Commit graph

286 commits

Author SHA1 Message Date
infinite-persistence
426d1ea0c9 Factor out geo-restriction logic
No functional change.

Impetus is to make the logic re-usable for comment-blocking.
2022-05-24 12:53:40 -04:00
infinite-persistence
3719a73c81
Add announcement modal and open it after prefs sync'd.
- Don't want to show it in Incognito.
- Only show it in when entered from homepage, or in the Help page.
- Record the hash of the viewed announcement and update the wallet with it.
2022-05-20 00:04:06 +08:00
infinite-persistence
5e3effc94d
Wrapper for localStorage 2022-05-19 23:56:33 +08:00
Rafael
a4bb276608 Fix crash 2022-05-16 07:41:53 -04:00
Rafael
26d7e9a2b6 Add share buttons on channel page 2022-05-16 06:36:50 -04:00
Rafael
bf158ad696 Refactor
- some cleanups
- uri was being parsed the same way in different places, so do it only once for simplicity
2022-05-16 06:36:50 -04:00
infinite-persistence
de206162f9
getHtml/routes/rss: fetch streaming_url instead of generating it.
## Issues from the initial attempt
- There are 2 versions of `Lbry` and `buildURI` -- the app and web-server version.  There are subtle differences between them, and for the app case, importing the web-server version results in a query into an invalid URL.
- It changed the function from returning a string to returning a promise.

## Changes
- Since the new function (renamed to `fetchStreamUrl` for clarity) is currently only needed for web-server, I moved it into the `web` folder to avoid misuse in app.
- Await on the promise. Unfortunately, this also means the entire chain of function calls need to be adjusted to be `async`.
2022-05-13 20:23:17 +08:00
Thomas Zarebczan
6e9b07ec6f Revert "Replace generateStreamUrl for Lbry get call"
This reverts commit 4d44d81f59.
2022-05-12 18:16:03 -04:00
Thomas Zarebczan
4d44d81f59 Replace generateStreamUrl for Lbry get call
+ remove unused config
2022-05-12 15:24:58 -04:00
infinite-persistence
2698cc7001
Add 'dispatchToast' wrapper
Just to shorten code, and easier to know what the parameters are if it's a function call (instead of an object).
2022-05-06 13:41:47 +08:00
infinite-persistence
e3996f458f
Relay fund-transfer failure reason to user
## Issue
Was just getting a generic "Transaction failed" and had to check devTools to figure out what's wrong.
2022-05-05 16:42:23 +08:00
infinite-persistence
9b44b7eb91 Add a timeout on SDK calls to allow specific error messages.
## Issue 1263
Previously, we tried to inform the user that when an SDK call such as `support_create` and `publish` fails (specifically, timed out), the operation could be successful -- please check the transactions later.

However, we only covered the case of `fetch` actually getting a response that indicated a timeout, e.g. "status = 524". For our SDK case, the timeout scenario is an error that goes into the `catch` block. In the `catch` block, we can't differentiate whether it is a timeout because it only returns a generic "failed to fetch" message.

## New Approach
Since `fetch` does not support a timeout value, the usual solution is to wrap it with a `setTimeout`. This already exists in our code as `fetchWithTimeout` (yay).

By setting a timeout that is lower than the browser's default and also lower than the SDK operation (90s for most commands, 5m for `publish`), we would now have a way to detect a timeout and inform the user.

Firefox's 90s seems to be the lowest common denominator ... so 60s was chosen as the default (added some buffer).

For the case of 'publish', it is actually called in the backend, so wrap the xhr call with a timeout as well.
2022-05-04 08:10:17 -04:00
infinite-persistence
dcc66f211e Reject reaction if already done from another channel.
## Issue
1075, spam prevention.

## Approach
- When making a reaction, fetch reactions for all my channels for the particular comment id, and reject the reaction is any was found.
- Report the channel name in the toast so that user can at least know which channel to select in order to undo the reaction.
2022-05-02 16:03:53 -04:00
infinite-persistence
dc46af34ec Sort livestreams per viewCount, descending 2022-05-02 07:26:47 -04:00
infinite-persistence
7445063405 Use videojs::http-streaming for all except iPhones
## Ticket
31: "quality selector not available on safari browsers"

## Notes
The quality selector isn't populated in some Apple products -- a known issue with videojs as the platform doesn't relay the info.

But it seems like only iPhone is affected, so let's enable the override for all platforms except iPhone.
2022-04-25 09:14:24 -04:00
Thomas Zarebczan
a6106f7427 Remove old apis 2022-04-22 12:59:34 -04:00
infinite-persistence
e4a88a5e9b SearchInLanguage: honor user's setting before category's setting.
## Ticket
Part of 1368 ("if user overrides the category homepage language with a different language setting + use 'search this language' option, use that instead. It's not typical this will happen, but probably expected.")

## Change
- Refactored to move more logic into `resolveLangForClaimSearch`
- Replaced the ternary version to make it more readable (hopefully).
- Inverted the language filter precedence by honoring the user's setting first.
  - Note: for both User and Category, URLSearchParams will always take precedence.
2022-04-22 09:39:23 -04:00
Thomas Zarebczan
b832f56929
encode channel names 2022-04-20 16:40:03 -04:00
Thomas Zarebczan
8144a9bb87 livestream new api
Re-used lots of Anthony's code + made fixes to a few areas including the publish page.

a

new videojs

video.js@7.18.1 + http-streaming@2.14.2

remove console log
2022-04-20 15:53:28 -04:00
infinite-persistence
e64d661dcd
Support not_channel_ids through Category definition
Mainly only useful for Wild West, which doesn't use `channel_ids` (otherwise, the homepage maintainer could just exclude the id from `channel_ids` directly).
2022-04-20 22:56:16 +08:00
infinite-persistence
7b85d7a585
Allow Category definitions to specify language to search in.
This will be entirely up to the homepage maintainer, and will override the user's "Search only in the this language" setting.
2022-04-20 22:56:15 +08:00
infinite-persistence
f27b68587e
Restore original way to exclude categories in Homepage
It was previously done in `GetLinkData`, but accidentally removed in d854a992.
It is DRY-er to do it here rather than at the client side.

Also needed to filter in the homepage-sort dialog, so move the definition to a constant array.
2022-04-20 22:56:13 +08:00
Thomas Zarebczan
7622e7aaf2 Fix release time on category pages 2022-04-14 14:23:22 -04:00
infinite-persistence
49db1fe83b Replace IS_IOS and IS_ANDROID with platform 2022-04-14 10:29:01 -04:00
external
c4d11c6c48 Port navigatorJS - provides platform details 2022-04-14 10:29:01 -04:00
Thomas Zarebczan
17d5d5c73b partial new livestream api support 2022-04-13 11:52:00 -04:00
Raphael Wickihalder
14f3195a7f
Adjust tile grid 2022-04-07 19:36:45 +02:00
Rafael
65b9906086 Add dynamic player aspect ratio resizing 2022-04-07 11:44:25 -04:00
infinite-persistence
3e5290d8b0 Swap pinnedUrls vs. pinnedClaimIds precedence
pinnedUrls = resolve
pinnedClaimIds = claim_search

Make `pinnedClaimIds` take precedence for now, since the homepage is defining both to support Android.

For some reason, I previously made `pinnedUrls` the priority, thinking this should be the "correct" one to use when the SDK is fixed.
2022-04-01 11:35:29 -04:00
infinite-persistence
f5034f74ca Batch resolve pin urls in 2 ways
Expanded homepage pins to support 2 types of input (if both are passed in, pinnedUrls take precedence):
  (1) pinnedUrls     --> uses doResolveUris (resolve)
  (2) pinnedClaimIds --> uses doResolveClaimIds (claim_search)

Instead of injecting the pinned URLs directly, we inject from `resolvedPinUris`, which will be blank until the uris are resolved, thus preventing it from being resolved individually from the tiles.

There's additional complexity with the `claim_search` method, as the rest of the code deals with uris instead of IDs. Fortunately, it's all contained with `useResolvePins`, so removal would be easier when the batch `resolve` issue is fixed.
2022-03-31 15:58:10 -04:00
infinite-persistence
3b98f73a0f Fix livestream countdown i18n
Ticket: 1228

## Code changes
- Pass through `getTimeAgoStr` so that the value gets localized.
- Pass the simpler `number` around instead of the `moment` object for better memoization.

## Notable differences
Due to how `getTimeAgoStr` is written, we now get to see the time actually counting down, vs "in a few seconds" currently in production.  I think the counting-down behavior was the original intentional, since a 1s timer was used (otherwise, a 1-minute timer could be used) ... or maybe not since streams may not start on the dot.
2022-03-31 08:25:32 -04:00
Rave | 図書館猫
99d730d0e3
Design fallout patch 2 (#1245)
* patch 1
* patch 2
2022-03-30 17:53:05 +02:00
infinite-persistence
0d3f6c2f9e getImageProxyUrl: don't assume IMAGE_PROXY_URL is always defined
This allows us to disable it by not defining.
2022-03-29 10:16:52 -04:00
infinite-persistence
f1ea0b20dd
Fix i18n issues reported
- Changed to "Add a Card" to reuse existing string.
2022-03-24 15:36:09 +08:00
infinite-persistence
42451e14a8
Split toast wrappers into separate file 2022-03-24 15:19:50 +08:00
infinite-persistence
e0ddd94c01
Rename: [commentron-error.js] -> [api-message.js] 2022-03-24 15:18:13 +08:00
infinite-persistence
f53680ea63
Refactor ERR_MAP to be general purpose
- Remove the need for an object key. Just use an array. It gets hard to maintain as more messages come in, and so far there is no need to access the configs directly.

- Just focus on handling the message and not creating a toast object. Leave the latter to the client.
2022-03-24 15:16:47 +08:00
infinite-persistence
d854a99250 Inject ID into homepage data
This will be used to sorting.
2022-03-23 15:35:27 -04:00
Thomas Zarebczan
aeb475ec2e
temp: pass random param
There are some channels returning 304, and they can't stream without this param
2022-03-23 14:48:45 -04:00
Rafael
4cec3ee9b3 Update browser window title when notifications are received 2022-03-22 18:48:53 -04:00
Thomas Zarebczan
b5630f0ed6 Load gifs through proxy
Continuation of 1009 (2eae20f0)

It can probably be handled inside the existing getThumbnailCdnUrl to reduce 1 function, but since the functionality is somewhat different (the proxy doesn't compress), it's probably clearer to separate it.
2022-03-21 13:13:25 -04:00
Thomas Zarebczan
75478ad18f Thumbnail improvements
- always pass to optimizer, even for speech

- default channel thumb to optimized at 5
50px, original on channel page

- fix misc analytics bug
2022-03-21 13:13:25 -04:00
Rafael
b096aad70e Improve livestream claimLink embeds
- Remove embedPlayButton for fileRenderInitiator
- getThumbnailFromClaim from utils function instead of redux
- Improve playingUri
2022-03-16 16:36:50 -04:00
Rafael
6dea79819d livestream + old APIs 2022-03-16 16:36:50 -04:00
infinite-persistence
1e67a5cc7f
[on hold recsys work] Recommended For You (#782)
* Factor out lighthouse-result processing code for FYP re-use.

The FYP results will be in the same format as LH.

* Recsys: add ability to pass in specific uuid to use

For FYP, we want to pass the UUID as a param when searching for recommendations. The search comes before the recsys entry creation, so we need to generate the UUID first when searching, and then tell recsys to use that specific ID.

* Redux: fetch and store FYP

Note that the gid cannot be used as "hash" for the uri list -- it doesn't necessarily change when the list changes, so we can't use it to optimize redux.  For now, just always update/render when re-fetched.

* UI for FYP

* Mark rendered FYPs

* Pass the FYP ID down the same way as Collection ID

Not ideal, but at least it's in the same pattern as existing code for now. The whole prop-drilling problem with the claim components will be fixed together later.

* Include 'gid' and 'uuid' in recommendation search

* Allow users to mark recommendations that they dislike

* Pass auth-token to all FYP requests + remove beacon use

beacons are unreliable and often blocked

* Only show FYP for members

* FYP readme page

* small fixes

* fyp

Co-authored-by: Thomas Zarebczan <thomas.zarebczan@gmail.com>
2022-03-15 15:07:31 -04:00
infinite-persistence
76493d48ee
Missed remaining 'homepages' imports
This is a follow-up for #1016

Still doesn't affect anything at the moment, but this reduce the amount of work needed when we yank out the homepages from our bundle later.
2022-03-04 11:10:08 +08:00
Thomas Zarebczan
c4ae797add
Remove deprecated migration 2022-03-02 21:48:40 -05:00
infinite-persistence
5c91d55cbc Fix sub/view count not in compact form for some components
## Ticket
968 Truncate views/subs in other areas

## Changes
- Corrected logic for `minThresholdToApply`, which was ignoring the case of "no threshold", causing it to not be truncated in Channel Page. We want to always truncate there due to the smaller cards.

- Missed out handling `ClaimPreviewSubtitle`.
2022-02-26 10:27:25 -05:00
infinite-persistence
c6d8687cfa ClaimListDiscover: pull out 'claim_search' language code for re-use, so all clients are sending the same value. No functional change. 2022-02-25 16:53:45 -05:00
infinite-persistence
2e26064d2f
Replace commentron's min-age error message
Hopefully this is more concise, but it's meant more as a placeholder for others to edit easily.
2022-02-23 23:01:58 +08:00