Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a51d252a8 |
No files matched your search
+83
-88
@@ -2,120 +2,115 @@
|
||||
|
||||
# Copy this file to .env to make modifications
|
||||
|
||||
# --- Minimum Version (Format: YYYYMMDDNNN) ---
|
||||
# Bump this when we want to nudge the user to refresh.
|
||||
MINIMUM_VERSION=20220708001
|
||||
|
||||
# This is 'false' in the production instances:
|
||||
IGNORE_MINIMUM_VERSION=true
|
||||
|
||||
# --- Base config ---
|
||||
# Base config
|
||||
WEBPACK_WEB_PORT=9090
|
||||
WEBPACK_ELECTRON_PORT=9091
|
||||
WEB_SERVER_PORT=1337
|
||||
|
||||
# -- APIs ---
|
||||
## APIS
|
||||
LBRY_WEB_API=https://api.na-backend.odysee.com
|
||||
LBRY_WEB_PUBLISH_API=https://publish.na-backend.odysee.com/v1
|
||||
LBRY_WEB_PUBLISH_API_V2=https://publish.na-backend.odysee.com/api/v2/publish/
|
||||
LBRY_WEB_STREAMING_API=https://cdn.lbryplayer.xyz
|
||||
LBRY_WEB_BUFFER_API=https://collector-service.api.lbry.tv/api/v1/events/video
|
||||
LBRY_API_URL=https://api.odysee.com
|
||||
COMMENT_SERVER_API=https://comments.odysee.tv/api/v2
|
||||
SEARCH_SERVER_API_ALT=https://recsys.odysee.tv/search
|
||||
SEARCH_SERVER_API=https://lighthouse.odysee.tv/search
|
||||
SOCKETY_SERVER_API=wss://sockety.odysee.tv/ws
|
||||
RECSYS_ENDPOINT=https://recsys.odysee.tv/v1/lvv
|
||||
RECSYS_FYP_ENDPOINT=https://recsys.odysee.tv/v1/u
|
||||
# -Disable boost due to instability:
|
||||
# IMAGE_PROXY_URL=https://boost.vanwanet.com/index.php
|
||||
THUMBNAIL_CDN_URL=https://thumbnails.odycdn.com/optimize/
|
||||
THUMBNAIL_CARDS_CDN_URL=https://thumbnails.odycdn.com/card/s:1280:720/quality:85/plain/
|
||||
LOCALE_API=https://api.odysee.com/legal/requirements
|
||||
THUMBNAIL_HEIGHT=220
|
||||
THUMBNAIL_HEIGHT_POSTER=720
|
||||
THUMBNAIL_WIDTH=390
|
||||
THUMBNAIL_WIDTH_POSTER=1280
|
||||
THUMBNAIL_QUALITY=85
|
||||
THUMBNAIL_CDN_SIZE_LIMIT_BYTES=5242880
|
||||
PLAYER_SERVER=https://player.odycdn.com
|
||||
COMMENT_SERVER_API=https://comments.odysee.com/api/v2
|
||||
COMMENT_SERVER_NAME=Odysee
|
||||
SEARCH_SERVER_API=https://lighthouse.odysee.com/search
|
||||
SOCKETY_SERVER_API=wss://sockety.odysee.com/ws
|
||||
THUMBNAIL_CDN_URL=https://image-processor.vanwanet.com/optimize/
|
||||
WELCOME_VERSION=1.0
|
||||
|
||||
# --- Stripe ---
|
||||
# STRIPE
|
||||
# STRIPE_PUBLIC_KEY='pk_test_NoL1JWL7i1ipfhVId5KfDZgo'
|
||||
|
||||
# --- OG ---
|
||||
OG_TITLE_SUFFIX=| odysee.com
|
||||
OG_HOMEPAGE_TITLE=Odysee
|
||||
OG_IMAGE_URL=https://thumbnails.odycdn.com/optimize/s:1200:630/quality:85/plain/https://spee.ch/odysee-og:e.png
|
||||
SITE_CANONICAL_URL=odysee.com
|
||||
# Analytics
|
||||
MATOMO_URL=https://analytics.lbry.com/
|
||||
MATOMO_ID=4
|
||||
|
||||
# --- UI ---
|
||||
DOMAIN=odysee.com
|
||||
URL=https://odysee.com
|
||||
SITE_TITLE=Odysee
|
||||
SITE_NAME=Odysee
|
||||
SITE_DESCRIPTION=Explore a whole universe of videos on Odysee from regular people just like you!
|
||||
SITE_HELP_EMAIL=help@odysee.com
|
||||
LOGO_TITLE=odysee
|
||||
TWITTER_ACCOUNT=OdyseeTeam
|
||||
LOADING_BAR_COLOR=#e50054
|
||||
# OG
|
||||
OG_TITLE_SUFFIX=| lbry.tv
|
||||
OG_HOMEPAGE_TITLE=lbry.tv
|
||||
OG_IMAGE_URL=
|
||||
SITE_CANONICAL_URL=https://lbry.tv
|
||||
|
||||
# UI
|
||||
## Custom Site info
|
||||
DOMAIN=lbry.tv
|
||||
URL=https://lbry.tv
|
||||
SITE_TITLE=LBRY
|
||||
SITE_NAME=LBRY
|
||||
SITE_DESCRIPTION=Meet LBRY, an open, free, and community-controlled content wonderland.
|
||||
SITE_HELP_EMAIL=help@lbry.com
|
||||
LOGO_TITLE=LBRY
|
||||
CLOUD_CONNECT_SITE_NAME=Odysee
|
||||
## Social media
|
||||
TWITTER_ACCOUNT=LBRYcom
|
||||
BRANDED_SITE=odysee
|
||||
SIMPLE_SITE=false
|
||||
ENABLE_WILD_WEST=true
|
||||
CUSTOM_HOMEPAGE=false
|
||||
SHOW_ADS=true
|
||||
ENABLE_MATURE=false
|
||||
ENABLE_UI_NOTIFICATIONS=true
|
||||
#SHOW_TAGS_INTRO=false
|
||||
USE_LOCAL_HOMEPAGE_DATA=true
|
||||
|
||||
AUTO_FOLLOW_CHANNELS=lbry://@lbry#3fda836a92faaceedfe398225fb9b2ee2ed1f01a
|
||||
## IMAGE ASSETS
|
||||
YRBL_HAPPY_IMG_URL=https://cdn.lbryplayer.xyz/api/v3/streams/free/yrbl-happy/7aa50a7e5adaf48691935d55e45d697547392929/839d9a
|
||||
YRBL_SAD_IMG_URL=https://cdn.lbryplayer.xyz/api/v3/streams/free/yrbl-sad/c2d9649633d974e5ffb503925e1f17d951f1bd0f/f262dd
|
||||
#LOGIN_IMG_URL=https://cdn.lbryplayer.xyz/api/v3/streams/free/login/b671946e911c66c5fa7233afb35de2badd9eceb8/0e1d81
|
||||
#LOGO=https://cdn.lbryplayer.xyz/api/v3/streams/free/yrbl-sad/c2d9649633d974e5ffb503925e1f17d951f1bd0f/f262dd
|
||||
#LOGO_TEXT_LIGHT=https://cdn.lbryplayer.xyz/api/v3/streams/free/yrbl-sad/c2d9649633d974e5ffb503925e1f17d951f1bd0f/f262dd
|
||||
#LOGO_TEXT_DARK=https://cdn.lbryplayer.xyz/api/v3/streams/free/yrbl-sad/c2d9649633d974e5ffb503925e1f17d951f1bd0f/f262dd
|
||||
#AVATAR_DEFAULT=
|
||||
#MISSING_THUMB_DEFAULT=
|
||||
#FAVICON=
|
||||
|
||||
# --- Image Assets ---
|
||||
YRBL_HAPPY_IMG_URL=https://thumbnails.odycdn.com/optimize/s:300:300/quality:85/plain/https://spee.ch/spaceman-happy:a.png
|
||||
YRBL_SAD_IMG_URL=https://thumbnails.odycdn.com/optimize/s:300:300/quality:85/plain/https://spee.ch/spaceman-sad:d.png
|
||||
LOGIN_IMG_URL=https://thumbnails.odycdn.com/optimize/s:400:507/quality:85/plain/https://player.odycdn.com/speech/odysee-sign-up:d.png
|
||||
LOGO=https://thumbnails.odycdn.com/optimize/s:100:100/quality:85/plain/https://spee.ch/odysee-logo-png:3.png
|
||||
LOGO_WHITE_TEXT=https://thumbnails.odycdn.com/optimize/s:1000:300/quality:85/plain/https://spee.ch/odysee-white-png:f.png
|
||||
LOGO_DARK_TEXT=https://thumbnails.odycdn.com/optimize/s:1000:300/quality:85/plain/https://spee.ch/odysee-png:2.png
|
||||
AVATAR_DEFAULT=https://thumbnails.odycdn.com/optimize/s:160:160/quality:85/plain/https://spee.ch/spaceman-png:2.png
|
||||
MISSING_THUMB_DEFAULT=https://thumbnails.odycdn.com/optimize/s:390:220/quality:85/plain/https://spee.ch/missing-thumb-png
|
||||
FAVICON=https://odysee.com/public/favicon-spaceman.png
|
||||
|
||||
# --- Locale ---
|
||||
# LOCALE
|
||||
DEFAULT_LANGUAGE=en
|
||||
|
||||
# --- Custom Settings ---
|
||||
## CUSTOM SETTINGS
|
||||
# Additional settings for below are found in ui/constants/settings and are for
|
||||
# preventing user settings from applying to custom sites without overwriting them.
|
||||
# UNSYNCED_SETTINGS='theme dark_mode_times automatic_dark_mode_enabled'
|
||||
|
||||
# --- Linked Content Whitelist ---
|
||||
KNOWN_APP_DOMAINS=open.lbry.com,lbry.tv,lbry.lat,odysee.com
|
||||
## LINKED CONTENT WHITELIST
|
||||
KNOWN_APP_DOMAINS=lbry.tv,lbry.lat,odysee.com
|
||||
|
||||
## CUSTOM CONTENT
|
||||
# If the following is true, copy custom/homepage.example.js to custom/homepage.js and modify
|
||||
CUSTOM_HOMEPAGE=false
|
||||
|
||||
# Add channels to auto-follow on first run
|
||||
AUTO_FOLLOW_CHANNELS=lbry://@lbry#3fda836a92faaceedfe398225fb9b2ee2ed1f01a
|
||||
|
||||
## FEATURES AND LIMITS
|
||||
SIMPLE_SITE=false
|
||||
#BRANDED_SITE
|
||||
|
||||
# --- Features & Limits ---
|
||||
CHANNEL_CREATION_LIMIT=5
|
||||
CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS=4
|
||||
ENABLE_COMMENT_REACTIONS=true
|
||||
ENABLE_CREATOR_REACTIONS=true
|
||||
ENABLE_FILE_REACTIONS=true
|
||||
ENABLE_NO_SOURCE_CLAIMS=true
|
||||
ENABLE_PREROLL_ADS=true
|
||||
LIGHTHOUSE_DEFAULT_TYPES=audio,video
|
||||
ENABLE_CREATOR_REACTIONS=false
|
||||
ENABLE_NO_SOURCE_CLAIMS=false
|
||||
ENABLE_PREROLL_ADS=false
|
||||
CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS=4
|
||||
CHANNEL_STAKED_LEVEL_LIVESTREAM=5
|
||||
WEB_PUBLISH_SIZE_LIMIT_GB=4
|
||||
LOADING_BAR_COLOR=#2bbb90
|
||||
LIGHTHOUSE_DEFAULT_TYPES=audio,video,text,image,application
|
||||
|
||||
SHOW_ADS=false
|
||||
|
||||
## SIMPLE_SITE REPLACEMENTS
|
||||
ENABLE_MATURE=true
|
||||
ENABLE_UI_NOTIFICATIONS=false
|
||||
|
||||
#ENABLE_LINK_TO_APP=true
|
||||
#FORCE_ANALYTICS=true
|
||||
#ENABLE_ADVANCED_FILTER=true
|
||||
#ENABLE_PAID_CONTENT=true
|
||||
#USE_FOOTER=true
|
||||
#USE_DISCOVER_WHITELIST=false
|
||||
#ENABLE_WILD_WEST=false
|
||||
#FULL_SIDE_LINKS=true
|
||||
#SHOW_TAGS_INTRO=false
|
||||
|
||||
# --- Firebase ---
|
||||
FIREBASE_API_KEY=AIzaSyAgc-4QORyglpYZ3qH9E5pDauEDOJXgM3A
|
||||
FIREBASE_AUTH_DOMAIN=lbry-mobile.firebaseapp.com
|
||||
FIREBASE_PROJECT_ID=lbry-mobile
|
||||
FIREBASE_STORAGE_BUCKET=lbry-mobile.appspot.com
|
||||
FIREBASE_MESSAGING_SENDER_ID=638894153788
|
||||
FIREBASE_APP_ID=1:638894153788:web:35b295b15297201bd2e339
|
||||
FIREBASE_MEASUREMENT_ID=G-2MPJGFEEXC
|
||||
FIREBASE_VAPID_KEY=BFayEBpwMTU9GQQpXgitIJkfx-SD8-ltrFb3wLTZWgA27MfBhG4948pe0eERl432NzPrMKsbkXnA7ap_vLPgLYk
|
||||
# SEARCH TYPES
|
||||
#VIDEO_ENABLED=true
|
||||
#AUDIO_ENABLED=true
|
||||
#POSTS_ENABLED=true
|
||||
#IMAGES_ENABLED=true
|
||||
#FILES_ENABLED=true
|
||||
#MODELS_ENABLED=true
|
||||
|
||||
# --- Development ---
|
||||
REPORT_NEW_STRINGS=false
|
||||
BRANDED_SITE=odysee
|
||||
@@ -0,0 +1,92 @@
|
||||
# Copy this file to .env to make modifications
|
||||
|
||||
# Base config
|
||||
|
||||
WEBPACK_WEB_PORT=9090
|
||||
WEBPACK_ELECTRON_PORT=9091
|
||||
WEB_SERVER_PORT=1337
|
||||
|
||||
WELCOME_VERSION=1.0
|
||||
|
||||
# Custom Site info
|
||||
DOMAIN=lbry.tv
|
||||
URL=https://lbry.tv
|
||||
|
||||
# UI
|
||||
SITE_TITLE=lbry.tv
|
||||
SITE_NAME=local.lbry.tv
|
||||
SITE_DESCRIPTION=Meet LBRY, an open, free, and community-controlled content wonderland.
|
||||
LOGO_TITLE=local.lbry.tv
|
||||
|
||||
##### ODYSEE SETTINGS #######
|
||||
|
||||
MATOMO_URL=https://analytics.lbry.com/
|
||||
MATOMO_ID=4
|
||||
|
||||
# Base config
|
||||
WEBPACK_WEB_PORT=9090
|
||||
WEBPACK_ELECTRON_PORT=9091
|
||||
WEB_SERVER_PORT=1337
|
||||
|
||||
## APIS
|
||||
LBRY_API_URL=https://api.odysee.com
|
||||
#LBRY_WEB_API=https://api.na-backend.odysee.com
|
||||
#LBRY_WEB_STREAMING_API=https://cdn.lbryplayer.xyz
|
||||
# deprecated:
|
||||
#LBRY_WEB_BUFFER_API=https://collector-service.api.lbry.tv/api/v1/events/video
|
||||
#COMMENT_SERVER_API=https://comments.lbry.com/api/v2
|
||||
WELCOME_VERSION=1.0
|
||||
|
||||
# STRIPE
|
||||
STRIPE_PUBLIC_KEY='pk_live_e8M4dRNnCCbmpZzduEUZBgJO'
|
||||
|
||||
## UI
|
||||
|
||||
LOADING_BAR_COLOR=#e50054
|
||||
|
||||
# IMAGE ASSETS
|
||||
YRBL_HAPPY_IMG_URL=https://spee.ch/spaceman-happy:a.png
|
||||
YRBL_SAD_IMG_URL=https://spee.ch/spaceman-sad:d.png
|
||||
LOGIN_IMG_URL=https://spee.ch/login:b.png
|
||||
LOGO=https://spee.ch/odysee-logo-png:3.png
|
||||
LOGO_TEXT_LIGHT=https://spee.ch/odysee-white-png:f.png
|
||||
LOGO_TEXT_DARK=https://spee.ch/odysee-png:2.png
|
||||
AVATAR_DEFAULT=https://spee.ch/spaceman-png:2.png
|
||||
FAVICON=https://spee.ch/favicon-png:c.png
|
||||
|
||||
# LOCALE
|
||||
DEFAULT_LANGUAGE=en
|
||||
|
||||
## LINKED CONTENT WHITELIST
|
||||
KNOWN_APP_DOMAINS=open.lbry.com,lbry.tv,lbry.lat,odysee.com
|
||||
|
||||
## CUSTOM CONTENT
|
||||
# If the following is true, copy custom/homepage.example.js to custom/homepage.js and modify
|
||||
CUSTOM_HOMEPAGE=true
|
||||
|
||||
# Add channels to auto-follow on firstrun (space delimited)
|
||||
AUTO_FOLLOW_CHANNELS=lbry://@Odysee#80d2590ad04e36fb1d077a9b9e3a8bba76defdf8 lbry://@OdyseeHelp#b58dfaeab6c70754d792cdd9b56ff59b90aea334
|
||||
|
||||
## FEATURES AND LIMITS
|
||||
SIMPLE_SITE=true
|
||||
BRANDED_SITE=odysee
|
||||
# SIMPLE_SITE REPLACEMENTS
|
||||
ENABLE_MATURE=false
|
||||
ENABLE_UI_NOTIFICATIONS=true
|
||||
ENABLE_WILD_WEST=true
|
||||
SHOW_TAGS_INTRO=false
|
||||
|
||||
# CENTRALIZED FEATURES
|
||||
ENABLE_COMMENT_REACTIONS=true
|
||||
ENABLE_FILE_REACTIONS=true
|
||||
ENABLE_CREATOR_REACTIONS=true
|
||||
ENABLE_NO_SOURCE_CLAIMS=true
|
||||
ENABLE_PREROLL_ADS=false
|
||||
SHOW_ADS=true
|
||||
|
||||
CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS=4
|
||||
CHANNEL_STAKED_LEVEL_LIVESTREAM=3
|
||||
WEB_PUBLISH_SIZE_LIMIT_GB=4
|
||||
|
||||
#SEARCH TYPES - comma-delimited
|
||||
LIGHTHOUSE_DEFAULT_TYPES=audio,video
|
||||
@@ -2,6 +2,3 @@ node_modules/*
|
||||
./node_modules/**
|
||||
**/node_modules/**
|
||||
web/dist/**
|
||||
**/plugins/inline-attachment/**
|
||||
|
||||
ui/component/viewers/videoViewer/internal/plugins/canAutoplay.js
|
||||
@@ -2,9 +2,6 @@
|
||||
"parser": "babel-eslint",
|
||||
"extends": ["standard", "standard-jsx", "plugin:react/recommended", "plugin:flowtype/recommended"],
|
||||
"plugins": ["flowtype", "import", "react-hooks"],
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2020
|
||||
},
|
||||
"env": {
|
||||
"browser": true,
|
||||
"node": true
|
||||
@@ -25,13 +22,7 @@
|
||||
"rules": {
|
||||
"brace-style": 0,
|
||||
"camelcase": 0,
|
||||
"comma-dangle": ["error", {
|
||||
"arrays": "always-multiline",
|
||||
"objects": "always-multiline",
|
||||
"imports": "always-multiline",
|
||||
"exports": "always-multiline",
|
||||
"functions": "never"
|
||||
}],
|
||||
"comma-dangle": ["error", "always-multiline"],
|
||||
"handle-callback-err": 0,
|
||||
"indent": 0,
|
||||
"jsx-quotes": ["error", "prefer-double"],
|
||||
|
||||
+1
-8
@@ -2,9 +2,7 @@
|
||||
.*\.typeface\.json
|
||||
.*/node_modules/findup/.*
|
||||
.*/node_modules/react-plastic/.*
|
||||
.*/node_modules/raf-schd/.*
|
||||
.*/node_modules/react-beautiful-dnd/.*
|
||||
.*/node_modules/@emotion/.*
|
||||
|
||||
|
||||
[include]
|
||||
|
||||
@@ -15,9 +13,7 @@
|
||||
[options]
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowIgnore
|
||||
module.name_mapper='^constants\(.*\)$' -> '<PROJECT_ROOT>/ui/constants\1'
|
||||
module.name_mapper='^contexts\(.*\)$' -> '<PROJECT_ROOT>/ui/contexts\1'
|
||||
module.name_mapper='^util\(.*\)$' -> '<PROJECT_ROOT>/ui/util\1'
|
||||
module.name_mapper='^redux\(.*\)$' -> '<PROJECT_ROOT>/ui/redux\1'
|
||||
module.name_mapper='^types\(.*\)$' -> '<PROJECT_ROOT>/ui/types\1'
|
||||
@@ -33,15 +29,12 @@ module.name_mapper='^rewards\(.*\)$' -> '<PROJECT_ROOT>/ui/rewards\1'
|
||||
module.name_mapper='^i18n\(.*\)$' -> '<PROJECT_ROOT>/ui/i18n\1'
|
||||
module.name_mapper='^effects\(.*\)$' -> '<PROJECT_ROOT>/ui/effects\1'
|
||||
module.name_mapper='^comments\(.*\)$' -> '<PROJECT_ROOT>/ui/comments\1'
|
||||
module.name_mapper='^locale\(.*\)$' -> '<PROJECT_ROOT>/ui/locale\1'
|
||||
module.name_mapper='^config\(.*\)$' -> '<PROJECT_ROOT>/config\1'
|
||||
module.name_mapper='^web\/component\(.*\)$' -> '<PROJECT_ROOT>/web/component\1'
|
||||
module.name_mapper='^web\/effects\(.*\)$' -> '<PROJECT_ROOT>/web/effects\1'
|
||||
module.name_mapper='^web\/page\(.*\)$' -> '<PROJECT_ROOT>/web/page\1'
|
||||
module.name_mapper='^homepage\(.*\)$' -> '<PROJECT_ROOT>/ui/util/homepage\1'
|
||||
module.name_mapper='^scss\/component\(.*\)$' -> '<PROJECT_ROOT>/ui/scss/component/\1'
|
||||
module.name_mapper='^\$web\(.*\)$' -> '<PROJECT_ROOT>/web\1'
|
||||
module.name_mapper='^\$ui\(.*\)$' -> '<PROJECT_ROOT>/ui\1'
|
||||
|
||||
esproposal.optional_chaining=enable
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ about: "Something isn't working \U0001F915"
|
||||
title: ''
|
||||
labels: 'type: bug'
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
@@ -15,7 +16,7 @@ Before reporting any issues, please make sure that you're using the latest versi
|
||||
- App releases: https://github.com/lbryio/lbry-desktop/releases
|
||||
- Standalone daemon: https://github.com/lbryio/lbry/releases
|
||||
|
||||
We are also available on live chat at https://chat.odysee.com
|
||||
We are also available on live chat at https://chat.lbry.com
|
||||
-->
|
||||
|
||||
**Bug**
|
||||
@@ -23,7 +24,6 @@ A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
@@ -49,5 +49,6 @@ If applicable, add screenshots to help explain your problem.
|
||||
- LBRY Installation ID:
|
||||
- Operating system:
|
||||
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
@@ -1,22 +1,22 @@
|
||||
---
|
||||
name: "❤️Say thank you"
|
||||
about: If you enjoy using Odysee's website, let us know!
|
||||
title: Odysee rocks!
|
||||
about: If you enjoy using the LBRY app, let us know!
|
||||
title: LBRY rocks!
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
If you are using the Odysee's website - please let us know. We'd love to hear from you!
|
||||
If you are using the LBRY app - please let us know. We'd love to hear from you!
|
||||
|
||||
If you would like to help Nock - any of the following is greatly appreciated.
|
||||
|
||||
- Give the repository a star ⭐️
|
||||
- Help out with issues
|
||||
- Blog about Odysee
|
||||
- Blog about LBRY
|
||||
- Make tutorials
|
||||
- Give talks
|
||||
- Convince other people to use Odysee
|
||||
- Convince other people to use LBRY
|
||||
- Anything your heart desires
|
||||
|
||||
Thank you! 💐
|
||||
@@ -34,6 +34,7 @@ What kind of change does this PR introduce?
|
||||
Please check all that apply to this PR using "x":
|
||||
|
||||
- [ ] I have checked that this PR is not a duplicate of an existing PR (open, closed or merged)
|
||||
- [ ] I added a line describing my change to CHANGELOG.md
|
||||
- [ ] I have checked that this PR does not introduce a breaking change
|
||||
- [ ] This PR introduces breaking changes and I have provided a detailed explanation below
|
||||
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
name: Node.js CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: Borales/actions-yarn@v2.3.0
|
||||
- run: yarn lint
|
||||
|
||||
build:
|
||||
needs: ['lint']
|
||||
name: 'build'
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [14.x]
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- macos-latest
|
||||
- windows-latest
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2-beta
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- uses: maxim-lobanov/setup-xcode@v1
|
||||
if: startsWith(runner.os, 'mac')
|
||||
with:
|
||||
xcode-version: '12.4.0'
|
||||
|
||||
- name: Download blockchain headers
|
||||
run: |
|
||||
mkdir -p ./static/daemon
|
||||
curl -o ./static/daemon/headers https://headers.lbry.io/blockchain_headers_latest
|
||||
ls ./static/daemon
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
yarn global add cross-env
|
||||
yarn
|
||||
yarn build
|
||||
node ./build/afterSignHook.js
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
NOTARIZATION_USERNAME: ${{ secrets.NOTARIZATION_USERNAME }}
|
||||
NOTARIZATION_PASSWORD: ${{ secrets.NOTARIZATION_PASSWORD }}
|
||||
WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }}
|
||||
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
|
||||
WIN_CSC_LINK: https://raw.githubusercontent.com/lbryio/lbry-desktop/master/build/win-csc-2021-2022-08.p12
|
||||
CSC_LINK: https://s3.amazonaws.com/files.lbry.io/cert/osx-csc-2021-2022.p12
|
||||
|
||||
# UI
|
||||
MATOMO_URL: https://analytics.lbry.com/
|
||||
MATOMO_ID: 4
|
||||
WELCOME_VERSION: 1.0
|
||||
DOMAIN: lbry.tv
|
||||
URL: https://lbry.tv
|
||||
SHARE_DOMAIN_URL: https://open.lbry.com
|
||||
SITE_TITLE: lbry.tv
|
||||
SITE_NAME: lbry.tv
|
||||
SHOW_ADS: false
|
||||
YRBL_HAPPY_IMG_URL: https://cdn.lbryplayer.xyz/api/v3/streams/free/yrbl-happy/7aa50a7e5adaf48691935d55e45d697547392929/839d9a
|
||||
YRBL_SAD_IMG_URL: https://cdn.lbryplayer.xyz/api/v3/streams/free/yrbl-sad/c2d9649633d974e5ffb503925e1f17d951f1bd0f/f262dd
|
||||
ENABLE_COMMENT_REACTIONS: true
|
||||
ENABLE_NO_SOURCE_CLAIMS: false
|
||||
|
||||
DEFAULT_LANGUAGE: en
|
||||
KNOWN_APP_DOMAINS: lbry.tv,lbry.lat,odysee.com
|
||||
CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS: 0
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: |
|
||||
startsWith(runner.os, 'linux')
|
||||
with:
|
||||
name: Linux
|
||||
path: ./dist/electron/*.*
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: |
|
||||
startsWith(runner.os, 'mac')
|
||||
with:
|
||||
name: macOS
|
||||
path: ./dist/electron/*.*
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: |
|
||||
github.event.pull_request.head.repo.full_name == github.repository
|
||||
with:
|
||||
name: Windows
|
||||
path: ./dist/electron/*.*
|
||||
@@ -1,57 +0,0 @@
|
||||
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
||||
|
||||
name: Node.js CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: Borales/actions-yarn@v3.0.0
|
||||
- run: yarn lint
|
||||
|
||||
build:
|
||||
needs: ['lint']
|
||||
name: 'build'
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [14.x]
|
||||
os:
|
||||
- ubuntu-latest
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2-beta
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
yarn global add cross-env
|
||||
yarn
|
||||
yarn compile:web
|
||||
env:
|
||||
# UI
|
||||
WELCOME_VERSION: 1.0
|
||||
DOMAIN: odysee.com
|
||||
URL: https://odysee.com
|
||||
SHARE_DOMAIN_URL: https://odysee.com
|
||||
SITE_TITLE: Odysee
|
||||
SITE_NAME: Odysee
|
||||
SHOW_ADS: false
|
||||
YRBL_HAPPY_IMG_URL: https://player.odycdn.com/api/v3/streams/free/yrbl-happy/7aa50a7e5adaf48691935d55e45d697547392929/839d9a
|
||||
YRBL_SAD_IMG_URL: https://player.odycdn.com/api/v3/streams/free/yrbl-sad/c2d9649633d974e5ffb503925e1f17d951f1bd0f/f262dd
|
||||
ENABLE_COMMENT_REACTIONS: true
|
||||
ENABLE_NO_SOURCE_CLAIMS: true
|
||||
DEFAULT_LANGUAGE: en
|
||||
KNOWN_APP_DOMAINS: lbry.tv,lbry.lat,odysee.com
|
||||
CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS: 4
|
||||
+1
-3
@@ -12,7 +12,6 @@ yarn-error.log
|
||||
package-lock.json
|
||||
.transifexrc
|
||||
.idea/
|
||||
.vscode/
|
||||
/build/daemon*
|
||||
/lbrytv/dist/
|
||||
/lbrytv/node_modules
|
||||
@@ -34,7 +33,6 @@ package-lock.json
|
||||
!/custom/robots.disallowall
|
||||
!/custom/robots.allowall
|
||||
.env
|
||||
.env.ody
|
||||
!.env.ody
|
||||
.env.desktop
|
||||
.env.lbrytv
|
||||
analyzeResults*.html
|
||||
+2
-6
@@ -1,11 +1,7 @@
|
||||
{
|
||||
"linters": {
|
||||
"ui/**/*.{js,jsx,scss,json}": ["prettier --write", "git add"],
|
||||
"extras/**/*.{js,jsx,scss,json}": ["prettier --write", "git add"],
|
||||
"web/**/*.{js,jsx,scss,json}": ["prettier --write", "git add"],
|
||||
"ui/**/*.{js,jsx}": ["eslint", "flow focus-check --color always", "git add"],
|
||||
"extras/**/*.{js,jsx}": ["eslint", "flow focus-check --color always", "git add"],
|
||||
"web/**/*.{js,jsx}": ["eslint", "git add"]
|
||||
"ui/**/*.{js,jsx}": ["eslint", "flow focus-check --color always", "git add"]
|
||||
},
|
||||
"ignore": ["node_modules", "web/dist/**/*", "dist/**/*", "package-lock.json"]
|
||||
"ignore": ["node_modules", "dist/**/*", "package-lock.json"]
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
**/plugins/inline-attachment/**
|
||||
**/plugins/videojs-http-streaming--override/playlist-selectors.js
|
||||
**/ui/constants/errors.js
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
[defaults]
|
||||
url = https://sentry.odysee.tv/
|
||||
org = odysee
|
||||
project = odysee-web
|
||||
url = https://sentry.lbry.tech/
|
||||
org = lbry
|
||||
project = lbry-desktop-web
|
||||
+1969
File diff suppressed because it is too large.
Load diff
+54
-34
@@ -1,4 +1,4 @@
|
||||
# Contribute to Odysee
|
||||
# Contribute to LBRY
|
||||
|
||||
**First:** if you're unsure or afraid of anything, just ask or submit the issue or pull request anyways. You won't be yelled at for giving your best effort. The worst that can happen is that you'll be politely asked to change something. We appreciate any sort of contributions, and don't want a wall of rules to get in the way of that.
|
||||
|
||||
@@ -6,52 +6,55 @@ However, for those individuals who want a bit more guidance on the best way to c
|
||||
|
||||
## TL;DR?
|
||||
|
||||
- [Here](https://github.com/OdyseeTeam/odysee-frontend/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+no%3Aassignee)
|
||||
- [Here](https://github.com/lbryio/lbry-desktop/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+no%3Aassignee)
|
||||
is a list of help wanted issues.
|
||||
- Comment on an issue to let us know if you are going to work on it, don't take an issue that someone reserved less than 3 days ago.
|
||||
- Submit a pull request and get paid in Credits.
|
||||
- Submit a pull request and get paid in LBC.
|
||||
- Don't hesitate to contact us with any questions or comments.
|
||||
|
||||
## Contents
|
||||
|
||||
- [Choose an Issue](#choose-an-issue)
|
||||
- [Code Overview](#code-overview)
|
||||
- [Libraries](#libraries)
|
||||
- [Flow](#flow)
|
||||
- [Lint](#lint)
|
||||
- [Code Formatting](#code-formatting)
|
||||
- [Debug](#debug)
|
||||
- [Submit a Pull Request](#submit-a-pull-request)
|
||||
- [Tom's "Voice of the User" Wishlist](#toms-voice-of-the-user-wishlist)
|
||||
- [Get in Touch](#get-in-touch)
|
||||
- [More Information](#more-information)
|
||||
|
||||
## Choose an Issue
|
||||
|
||||
Odysee is an open source project and therefore is developed out in the open for everyone to see. What
|
||||
LBRY is an open source project and therefore is developed out in the open for everyone to see. What
|
||||
you see here are the latest source code changes and issues.
|
||||
|
||||
Since Odysee is based on a decentralized community, we believe that the app will be stronger if it
|
||||
Since LBRY is based on a decentralized community, we believe that the app will be stronger if it
|
||||
receives contributions from individuals outside the core team -- such as yourself!
|
||||
|
||||
To make contributing as easy and rewarding as possible, we have instituted the following system:
|
||||
|
||||
- Anyone can view all issues in the system by clicking on the
|
||||
[Issues](https://github.com/OdyseeTeam/odysee-frontend/issues) button at the top of the page. Feel free to
|
||||
add an issue if you think we have missed something (and you might earn some Credits in the process
|
||||
[Issues](https://github.com/lbryio/lbry-desktop/issues) button at the top of the page. Feel free to
|
||||
add an issue if you think we have missed something (and you might earn some LBC in the process
|
||||
because we do tip people for reporting bugs).
|
||||
- Once on the [Issues](https://github.com/OdyseeTeam/odysee-frontend/issues) page, a potential contributor can
|
||||
- Once on the [Issues](https://github.com/lbryio/lbry-desktop/issues) page, a potential contributor can
|
||||
filter issues by the
|
||||
[Help Wanted (in progress)](https://github.com/OdyseeTeam/odysee-frontend/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+no%3Aassignee)
|
||||
[Help Wanted](https://github.com/lbryio/lbry-desktop/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+no%3Aassignee)
|
||||
label to see a curated list of suggested issues with which community members can help.
|
||||
- Every
|
||||
[Help Wanted](https://github.com/OdyseeTeam/odysee-frontend/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+no%3Aassignee)
|
||||
issue is ranked on a scale from zero to four (in progress)
|
||||
[Help Wanted](https://github.com/lbryio/lbry-desktop/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+no%3Aassignee)
|
||||
issue is ranked on a scale from zero to four.
|
||||
|
||||
| Level (in progress) | Description |
|
||||
| ----------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
|
||||
| [**level 0**](https://github.com/OdyseeTeam/odysee-frontend/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+label%3A%22level%3A+0%22+no%3Aassignee) | Typos and text edits -- a tech-savvy non-programmer can fix these. |
|
||||
| [**level 1**](https://github.com/OdyseeTeam/odysee-frontend/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+label%3A%22level%3A+1%22+no%3Aassignee) | Programming issues that require little knowledge of how the Odysee app works. |
|
||||
| [**level 2**](https://github.com/OdyseeTeam/odysee-frontend/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+label%3A%22level%3A+2%22+no%3Aassignee) | Issues of average difficulty that require the developer to dig into how the app works a little bit. |
|
||||
| [**level 3**](https://github.com/OdyseeTeam/odysee-frontend/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+label%3A%22level%3A+3%22+no%3Aassignee) | Issues that are likely too tricky to be level 2 or require more thinking outside of the box. |
|
||||
| [**level 4**](https://github.com/OdyseeTeam/odysee-frontend/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+label%3A%22level%3A+4%22+no%3Aassignee) | Big features or really hard issues. |
|
||||
| Level | Description |
|
||||
| ---------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
|
||||
| [**level 0**](https://github.com/lbryio/lbry-desktop/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+label%3A%22level%3A+0%22+no%3Aassignee) | Typos and text edits -- a tech-savvy non-programmer can fix these. |
|
||||
| [**level 1**](https://github.com/lbryio/lbry-desktop/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+label%3A%22level%3A+1%22+no%3Aassignee) | Programming issues that require little knowledge of how the LBRY app works. |
|
||||
| [**level 2**](https://github.com/lbryio/lbry-desktop/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+label%3A%22level%3A+2%22+no%3Aassignee) | Issues of average difficulty that require the developer to dig into how the app works a little bit. |
|
||||
| [**level 3**](https://github.com/lbryio/lbry-desktop/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+label%3A%22level%3A+3%22+no%3Aassignee) | Issues that are likely too tricky to be level 2 or require more thinking outside of the box. |
|
||||
| [**level 4**](https://github.com/lbryio/lbry-desktop/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+label%3A%22level%3A+4%22+no%3Aassignee) | Big features or really hard issues. |
|
||||
|
||||
The process of ranking issues is highly subjective. The purpose of sorting issues like this is to
|
||||
give contributors a general idea about the type of issues they are looking at. For instance, it could very well be
|
||||
@@ -59,19 +62,24 @@ the case that a level 1 issue is more difficult than a level 2 issue. This syste
|
||||
to help you find relevant issues, not to prevent you from working on issues that you otherwise
|
||||
would. If these rankings don't work for you, feel free to ignore them.
|
||||
|
||||
Although all contributions should have good UX, the [UX label, when applied in conjunction with Help Wanted](https://github.com/OdyseeTeam/odysee-frontend/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+label%3Aux+no%3Aassignee), indicates that the contributor ought to implement the feature in a creative way that specifically focuses on providing a good user experience. These issues often have no set instruction for how the experience should be and leave it to the contributor to figure out. This may be challenging for people who do not like UX, but also more fun and rewarding for those who do.
|
||||
Although all contributions should have good UX, the [UX label, when applied in conjunction with Help Wanted](https://github.com/lbryio/lbry-desktop/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+label%3Aux+no%3Aassignee), indicates that the contributor ought to implement the feature in a creative way that specifically focuses on providing a good user experience. These issues often have no set instruction for how the experience should be and leave it to the contributor to figure out. This may be challenging for people who do not like UX, but also more fun and rewarding for those who do.
|
||||
|
||||
## Code Overview
|
||||
|
||||
This application is primarily written in JavaScript, utilizing [React](https://reactjs.org) and [Redux](https://redux.js.org) for UI and
|
||||
The entry point for this application is [`electron/index.js`](https://github.com/lbryio/lbry-desktop/blob/master/electron/index.js).
|
||||
|
||||
This application is primarily written in JavaScript and is built on [Electron](https://electronjs.org)
|
||||
while utilizing [React](https://reactjs.org) and [Redux](https://redux.js.org) for UI and
|
||||
application state.
|
||||
|
||||
The project comes with diverse tools for simplifying the development process and for providing
|
||||
better code quality. It's recommended to make use of them thoroughly during ongoing development.
|
||||
|
||||
We follow the well-known [Airbnb JavaScript Style Guide](https://airbnb.io/javascript/) for defining
|
||||
better code quality. It's recommended to make use of them thoroughly during ongoing development. We follow the well-known [Airbnb JavaScript Style Guide](https://airbnb.io/javascript/) for defining
|
||||
our styling rules and code best practices.
|
||||
|
||||
### Libraries
|
||||
|
||||
This project uses [lbry-redux](https://github.com/lbryio/lbry-redux) and [lbryionc](https://github.com/lbryio/lbryinc) to share Redux and LBRY API specific code with other LBRY apps. Over time, more Redux code that is suitable to be shared will be moved into lbry-redux. If modifying Redux code, you may be asked to make some of your changes in lbry-redux rather than lbry-desktop. The steps to work with lbry-redux locally can be found [here](https://github.com/lbryio/lbry-redux#local-development).
|
||||
|
||||
### Flow
|
||||
|
||||
[Flow](https://flow.org/) is a static type checker for JavaScript. Flow checks your code for
|
||||
@@ -132,6 +140,7 @@ There are a few tools integrated to the project that will ease the process of de
|
||||
|
||||
- [Chrome DevTools](https://developer.chrome.com/devtools)
|
||||
- Also available for the main process as a [remote target](chrome://inspect/#devices).
|
||||
- [Electron Devtron](https://electronjs.org/devtron)
|
||||
- [React DevTools](https://github.com/facebook/react-devtools)
|
||||
- [Redux DevTools](https://github.com/gaearon/redux-devtools)
|
||||
|
||||
@@ -140,17 +149,19 @@ There are a few tools integrated to the project that will ease the process of de
|
||||
- After deciding what to work on, a potential contributor can
|
||||
[fork](https://help.github.com/articles/fork-a-repo/) this repository, make his or her changes,
|
||||
and submit a
|
||||
[pull request](https://help.github.com/articles/creating-a-pull-request-from-a-fork/).
|
||||
- A contributor wanting to reserve an issue in advance can leave a comment saying that he or she is
|
||||
[pull request](https://help.github.com/articles/creating-a-pull-request-from-a-fork/). A
|
||||
contributor wanting to reserve an issue in advance can leave a comment saying that he or she is
|
||||
working on it. Contributors should respect other people's efforts to complete issues in a timely
|
||||
manner and, therefore, not begin working on anything reserved (or updated) within the last 3 days.
|
||||
If someone has been officially assigned an issue via GitHub's assignment system, it is also not
|
||||
available. Contributors are encouraged to ask if they have any questions about issue availability.
|
||||
- Once the pull request is visible in the Odysee repo, a Odysee team member will review it and make sure
|
||||
- The [changelog](https://github.com/lbryio/lbry-desktop/blob/master/CHANGELOG.md) should be updated to
|
||||
include a reference to the fix/change/addition. See previous entries for format.
|
||||
- Once the pull request is visible in the LBRY repo, a LBRY team member will review it and make sure
|
||||
it is up to our standards. At this point, the contributor may have to change his or her code based
|
||||
on our suggestions and comments.
|
||||
- Then, upon a satisfactory review of the code, we will merge it and send the contributor a tip (in
|
||||
Credits or Cash) for the contribution.
|
||||
LBC) for the contribution.
|
||||
|
||||
We are dedicated to being fair and friendly in this process. In **general**, level 4 issues will be
|
||||
paid more than level 3 issues which will be paid more than level 2, and so on. However, this is not
|
||||
@@ -162,20 +173,29 @@ Also, we are here to enable you. We want you to succeed, so do not hesitate to a
|
||||
need some information or assistance in completing an issue, please let us know! That is what we are
|
||||
here for-- pushing development forward.
|
||||
|
||||
Lastly, don't feel limited by this list. Should Odysee have built-in Tor support? Add it! It's not in
|
||||
Lastly, don't feel limited by this list. Should LBRY have built-in Tor support? Add it! It's not in
|
||||
the issue tracker, but maybe it's a good idea. Do you think the search layout is unintuitive? Change
|
||||
it! We welcome all feedback and suggestions. That said, it may be the case that we do not wish to
|
||||
incorporate your change if you don't check with us first (also, please check with us especially if
|
||||
you are planning on adding Tor support :P). If you want to add a feature that is not listed in the
|
||||
issue tracker, go ahead and [create an issue](https://github.com/OdyseeTeam/odysee-frontend/issues/new), and
|
||||
issue tracker, go ahead and [create an issue](https://github.com/lbryio/lbry-desktop/issues/new), and
|
||||
say in the description that you would like to try to implement it yourself. This way we can tell you
|
||||
in advance if we will accept your changes and we can point you in the right direction.
|
||||
|
||||
# Tom's "Voice of the User" Wishlist
|
||||
|
||||
[Anything marked with **both** "Help Wanted" and "Tom's 'Voice of the User' Wishlist"](https://github.com/lbryio/lbry-desktop/issues?q=is%3Aopen+is%3Aissue+label%3A%22Tom%27s+%5C%22Voice+of+the+User%5C%22+Wishlist%22+label%3A%22help+wanted%22+no%3Aassignee)
|
||||
will earn you an extra 50 LBC on top of what we would otherwise tip you.
|
||||
|
||||
# Get in Touch
|
||||
|
||||
| Name | Role | Discord | Email |
|
||||
| ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | --------------------------- |
|
||||
| [Tom](https://github.com/tzarebczan) | Community manager. He knows more than anyone about the app and all of its flaws. Reach out to him with any questions about how the app works, if a bug has been reported, or if a feature should be requested. | jiggytom | tom@Odysee.com |
|
||||
| [Anthony](https://github.com/mayeaux) | The primary engineer working on the app. Feel free to ask any questions about the code. | Anthony | anthony.mayfield@odysee.com |
|
||||
| Name | Role | Discord | Email |
|
||||
| -------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------- |
|
||||
| [Tom](https://github.com/tzarebczan) | Community manager. He knows more than anyone about the app and all of its flaws. Reach out to him with any questions about how the app works, if a bug has been reported, or if a feature should be requested. | jiggytom | tom@lbry.com |
|
||||
| [Sean](https://github.com/seanyesmunt) | The primary engineer working on the app. Feel free to ask any questions about the code. | sean | sean@lbry.com |
|
||||
|
||||
Join our Discord [here](https://chat.odysee.com/).
|
||||
Join our Discord [here](https://chat.lbry.com/).
|
||||
|
||||
# More Information
|
||||
|
||||
More information about contributing to LBRY [here](https://lbry.tech/contribute).
|
||||
@@ -1,61 +1,135 @@
|
||||
# Odysee Frontend - Odysee.com
|
||||
<img width="40%" src="https://miro.medium.com/max/5198/1*bTVuL2THG_0mpwmE-n7Ezg.png" />
|
||||
|
||||
This repo contains the UI and front end code that powers Odysee.com.
|
||||
# LBRY App - https://lbry.tv
|
||||
|
||||
<a href="https://github.com/OdyseeTeam/odysee-frontend/blob/master/LICENSE" title="MIT licensed">
|
||||
This repo contains the UI code that powers the official LBRY desktop app, as well as lbry.tv. The LBRY app is a graphical browser for the decentralized content marketplace provided by the
|
||||
[LBRY](https://lbry.com) protocol. It is essentially the
|
||||
[lbry daemon](https://github.com/lbryio/lbry) bundled with a UI using
|
||||
[Electron](https://electron.atom.io/).
|
||||
|
||||
<a href="https://github.com/lbryio/lbry-desktop/blob/master/LICENSE" title="MIT licensed">
|
||||
<img alt="npm" src="https://img.shields.io/dub/l/vibe-d.svg?style=flat">
|
||||
</a>
|
||||
<a href="https://chat.odysee.com">
|
||||
<img src="https://img.shields.io/discord/362322208485277697.svg?logo=discord" alt="chat on Discord">
|
||||
<a href="https://GitHub.com/lbryio/lbry-desktop/releases/" title="GitHub release">
|
||||
<img src="https://img.shields.io/github/release/lbryio/lbry-desktop.svg"/>
|
||||
</a>
|
||||
<a href="https://travis-ci.org/lbryio/lbry-desktop">
|
||||
<img src="https://travis-ci.org/lbryio/lbry-desktop.svg?branch=master" alt="Build Status" />
|
||||
</a>
|
||||
<a href="https://chat.lbry.com">
|
||||
<img alt="GitHub contributors" src="https://img.shields.io/discord/362322208485277697.svg?logo=discord" alt="chat on Discord">
|
||||
</a>
|
||||
|
||||
<h2>
|
||||
<a href="https://forthebadge.com" title="forthebadge">
|
||||
<img alt="forthebadge" src="https://forthebadge.com/images/badges/60-percent-of-the-time-works-every-time.svg">
|
||||
</a>
|
||||
<a href="https://forthebadge.com" title="forthebadge">
|
||||
<img alt="forthebadge" src="https://forthebadge.com/images/badges/approved-by-veridian-dynamics.svg">
|
||||
</a>
|
||||
</h2>
|
||||
|
||||

|
||||
|
||||
## Table of Contents
|
||||
|
||||
1. [Usage](#usage)
|
||||
2. [Running from Source](#running-from-source)
|
||||
3. [Contributing](#contributing)
|
||||
4. [License](#license)
|
||||
5. [Security](#security)
|
||||
6. [Contact](#contact)
|
||||
1. [Install](#install)
|
||||
2. [Usage](#usage)
|
||||
3. [Running from Source](#running-from-source)
|
||||
4. [Contributing](#contributing)
|
||||
5. [License](#license)
|
||||
6. [Security](#security)
|
||||
7. [Contact](#contact)
|
||||
|
||||
## Install
|
||||
|
||||
[](https://lbry.com/get/lbry.exe)
|
||||
[](https://lbry.com/get/lbry.deb)
|
||||
[](https://lbry.com/get/lbry.dmg)
|
||||
|
||||
We provide installers for Windows, macOS (v10.12.4, Sierra, or greater), and Debian-based Linux. See community maintained builds section for alternative Linux installations.
|
||||
|
||||
| | Windows | macOS | Linux |
|
||||
| --------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- |
|
||||
| Latest Stable Release | [Download](https://lbry.com/get/lbry.exe) | [Download](https://lbry.com/get/lbry.dmg) | [Download](https://lbry.com/get/lbry.deb) |
|
||||
| Latest Pre-release | [Download](https://lbry.com/get/lbry.pre.exe) | [Download](https://lbry.com/get/lbry.pre.dmg) | [Download](https://lbry.com/get/lbry.pre.deb) |
|
||||
|
||||
Our [releases page](https://github.com/lbryio/lbry-desktop/releases) also contains the latest
|
||||
release, pre-releases, and past builds.
|
||||
_Note: If the deb fails to install using the Ubuntu Software Center, install manually via `sudo dpkg -i <path to deb>`. You'll need to run `sudo apt-get install -f` if this is the first time installing it to install dependencies_
|
||||
|
||||
To install from source or make changes to the application, continue to the next section below.
|
||||
|
||||
**Community maintained** builds for Arch Linux and Flatpak are available, see below. These installs will need to be updated manually as the in-app update process only supports Debian installs at this time.
|
||||
_Note: If coming from a deb install, the directory structure is different and you'll need to [migrate data](https://lbry.com/faq/backup-data)._
|
||||
|
||||
| | Flatpak | Arch | Nixpkgs | ARM/ARM64 |
|
||||
| -------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ------------------------------------------- |
|
||||
| Latest Release | [FlatHub Page](https://flathub.org/apps/details/io.lbry.lbry-app) | [AUR Package](https://aur.archlinux.org/packages/lbry-app-bin/) | [Nixpkgs](https://search.nixos.org/packages?channel=unstable&show=lbry&query=lbry) | [Build Guide](https://lbry.tv/@LBRYarm:5) |
|
||||
| Maintainers | [@kcSeb](https://keybase.io/kcseb) | [@kcSeb](https://keybase.io/kcseb) | [@Enderger](https://github.com/enderger) | [@Madiator2011](https://github.com/kodxana) |
|
||||
|
||||
## Usage
|
||||
|
||||
Go to the website to interact on this frontend.
|
||||
Double click the installed application to interact with the LBRY network.
|
||||
|
||||
## Running from Source
|
||||
|
||||
You can run the web version (lbry.tv), the electron app, or both at the same time.
|
||||
|
||||
#### Prerequisites
|
||||
|
||||
- [Git](https://git-scm.com/downloads)
|
||||
- [Node.js](https://nodejs.org/en/download/) (v14 required)
|
||||
- [Yarn](https://yarnpkg.com/en/docs/install)
|
||||
|
||||
1. Clone (or [fork](https://help.github.com/articles/fork-a-repo/)) this repository: `git clone https://github.com/OdyseeTeam/odysee-frontend`
|
||||
2. Change directory into the cloned repository: `cd odysee-frontend`
|
||||
1. Clone (or [fork](https://help.github.com/articles/fork-a-repo/)) this repository: `git clone https://github.com/lbryio/lbry-desktop`
|
||||
2. Change directory into the cloned repository: `cd lbry-desktop`
|
||||
3. Install the dependencies: `yarn`
|
||||
|
||||
#### Run the electron app
|
||||
|
||||
`yarn dev`
|
||||
|
||||
- If you want to build and launch the production app you can run `yarn build`. This will give you an executable inside the `/dist` folder. We use [electron-builder](https://github.com/electron-userland/electron-builder) to create distributable packages.
|
||||
|
||||
#### Run the web app for development
|
||||
|
||||
`yarn dev:web`
|
||||
|
||||
- This uses `webpack-dev-server` and includes hot-reloading. If you want to debug the [web server we use in production](https://github.com/OdyseeTeam/odysee-frontend/blob/master/web/index.js) you can run `yarn dev:web-server`. This starts a server at `localhost:1337` and does not include hot reloading.
|
||||
- This uses webpack-dev-server and includes hot-reloading. If you want to debug the [web server we use in production](https://github.com/lbryio/lbry-desktop/blob/master/web/index.js) you can run `yarn dev:web-server`. This starts a server at `localhost:1337` and does not include hot reloading.
|
||||
|
||||
#### Customize the web app
|
||||
|
||||
- In root directory, duplicate the `.env.default` file as `.env` and make customizations there.
|
||||
```
|
||||
cp .env.defaults .env
|
||||
nano .env
|
||||
```
|
||||
- To specify your own OG-IMAGE:
|
||||
- Either place a png named `v2-og.png` in the `/custom` folder or specify the `OG_IMAGE_URL` in .env file.
|
||||
- To specify your own channels to be followed on first run:
|
||||
- `AUTO_FOLLOW_URLS=lbry://@chan#123...a lbry://@chan2#456...a`
|
||||
- To customize the homepage content:
|
||||
1. Add `CUSTOM_HOMEPAGE=true` to the .env file.
|
||||
2. Copy `/custom/homepage.example.js` to `/custom/homepage.js` and make desired changes to `homepage.js`.
|
||||
- Finally, run `NODE_ENV=production yarn compile:web` to rebuild.
|
||||
- _Note: You do not need to edit the `.env` file in the `/web` folder - that is copied during compilation._
|
||||
- In root directory, duplicate the .env.default file and rename it to .env then copy the code below and paste it anywhere in the .env file.
|
||||
|
||||
```
|
||||
cp .env.defaults .env
|
||||
nano .env
|
||||
```
|
||||
|
||||
- To specify your own OG-IMAGE
|
||||
You can either place a png named v2-og.png in the /custom folder or specify the OG_IMAGE_URL in .env
|
||||
|
||||
- To specify your own channels to be followed on first run
|
||||
`AUTO_FOLLOW_URLS=lbry://@chan#123...a lbry://@chan2#456...a`
|
||||
|
||||
- If you want to customize the homepage content
|
||||
|
||||
1. add `CUSTOM_HOMEPAGE=true` to the '.env' file
|
||||
2. copy `/custom/homepage.example.js` to `/custom/homepage.js` and make desired changes to `homepage.js`
|
||||
|
||||
- If you want up to two custom sidebar links
|
||||
|
||||
```
|
||||
PINNED_URI_1=@someurl#2/someclaim#4
|
||||
PINNED_LABEL_1=Linktext
|
||||
|
||||
PINNED_URI_2=$/discover?t=tag&[queryparams]
|
||||
PINNED_LABEL_2=OtherLinkText
|
||||
```
|
||||
|
||||
- Finally `NODE_ENV=production yarn compile:web` to rebuild
|
||||
_Note: You don't need to edit the .env file in the /web folder - that is copied during compile._
|
||||
|
||||
#### Deploy the web app (_experimental_)
|
||||
|
||||
@@ -67,6 +141,17 @@ Go to the website to interact on this frontend.
|
||||
6. Run `NODE_ENV=production yarn compile:web` to build
|
||||
7. Set up pm2 to start ./web/index.js
|
||||
|
||||
#### Run both at the same time
|
||||
|
||||
Run the two commands above in separate terminal windows
|
||||
|
||||
```
|
||||
yarn dev
|
||||
|
||||
// in another terminal window
|
||||
yarn dev:web
|
||||
```
|
||||
|
||||
#### Resetting your Packages
|
||||
|
||||
If the app isn't building, or `yarn xxx` commands aren't working you may need to just reset your `node_modules`. To do so you can run: `rm -r node_modules && yarn` or `del /s /q node_modules && yarn` on Windows.
|
||||
@@ -75,9 +160,9 @@ If you _really_ think something might have gone wrong, you can force your repo t
|
||||
|
||||
## Contributing
|
||||
|
||||
We :heart: contributions from everyone and contributions to this project are encouraged, and compensated. We welcome [bug reports](https://github.com/OdyseeTeam/odysee-frontend/issues/), [bug fixes](https://github.com/OdyseeTeam/odysee-frontend/pulls) and feedback is always appreciated. For more details, see [CONTRIBUTING.md](CONTRIBUTING.md).
|
||||
We :heart: contributions from everyone and contributions to this project are encouraged, and compensated. We welcome [bug reports](https://github.com/lbryio/lbry-desktop/issues/), [bug fixes](https://github.com/lbryio/lbry-desktop/pulls) and feedback is always appreciated. For more details, see [CONTRIBUTING.md](CONTRIBUTING.md).
|
||||
|
||||
## [](https://github.com/OdyseeTeam/odysee-frontend/issues) [](https://GitHub.com/OdyseeTeam/odysee-frontend/graphs/contributors/)
|
||||
## [](https://github.com/lbryio/lbry-desktop/issues) [](https://GitHub.com/lbryio/lbry-desktop/graphs/contributors/)
|
||||
|
||||
## License
|
||||
|
||||
@@ -85,4 +170,9 @@ This project is MIT licensed. For the full license, see [LICENSE](LICENSE).
|
||||
|
||||
## Security
|
||||
|
||||
For security issues, please reach out to security@odysee.com
|
||||
We take security seriously. Please contact security@lbry.com regarding any security issues. Our PGP key is [here](https://lbry.com/faq/pgp-key) if you need it. Previous versions up to v0.50.2 were signed by [Sean Yesmunt](https://keybase.io/seanyesmunt/key.asc).
|
||||
New Releases are signed by [Jessop Breth](https://keybase.io/jessopb/key.asc).
|
||||
|
||||
## Contact
|
||||
|
||||
The primary contact for this project is [@jessopb](https://github.com/jessopb).
|
||||
Binary file not shown.
@@ -3,37 +3,26 @@
|
||||
require('dotenv-defaults').config({ silent: false });
|
||||
|
||||
const config = {
|
||||
MINIMUM_VERSION: process.env.MINIMUM_VERSION,
|
||||
IGNORE_MINIMUM_VERSION: process.env.IGNORE_MINIMUM_VERSION,
|
||||
MATOMO_URL: process.env.MATOMO_URL,
|
||||
MATOMO_ID: process.env.MATOMO_ID,
|
||||
WEBPACK_WEB_PORT: process.env.WEBPACK_WEB_PORT,
|
||||
WEBPACK_ELECTRON_PORT: process.env.WEBPACK_ELECTRON_PORT,
|
||||
WEB_SERVER_PORT: process.env.WEB_SERVER_PORT,
|
||||
LBRY_WEB_API: process.env.LBRY_WEB_API, // api.na-backend.odysee.com',
|
||||
LBRY_WEB_API: process.env.LBRY_WEB_API, //api.na-backend.odysee.com',
|
||||
LBRY_WEB_PUBLISH_API: process.env.LBRY_WEB_PUBLISH_API,
|
||||
LBRY_WEB_PUBLISH_API_V2: process.env.LBRY_WEB_PUBLISH_API_V2,
|
||||
LBRY_API_URL: process.env.LBRY_API_URL, // api.odysee.com',
|
||||
LBRY_API_URL: process.env.LBRY_API_URL, //api.lbry.com',
|
||||
LBRY_WEB_STREAMING_API: process.env.LBRY_WEB_STREAMING_API, //cdn.lbryplayer.xyz',
|
||||
LBRY_WEB_BUFFER_API: process.env.LBRY_WEB_BUFFER_API,
|
||||
SEARCH_SERVER_API: process.env.SEARCH_SERVER_API,
|
||||
SEARCH_SERVER_API_ALT: process.env.SEARCH_SERVER_API_ALT,
|
||||
CLOUD_CONNECT_SITE_NAME: process.env.CLOUD_CONNECT_SITE_NAME,
|
||||
COMMENT_SERVER_API: process.env.COMMENT_SERVER_API,
|
||||
COMMENT_SERVER_NAME: process.env.COMMENT_SERVER_NAME,
|
||||
SOCKETY_SERVER_API: process.env.SOCKETY_SERVER_API,
|
||||
LOCALE_API: process.env.LOCALE_API,
|
||||
WELCOME_VERSION: process.env.WELCOME_VERSION,
|
||||
DOMAIN: process.env.DOMAIN,
|
||||
SHARE_DOMAIN_URL: process.env.SHARE_DOMAIN_URL,
|
||||
URL: process.env.URL,
|
||||
RECSYS_ENDPOINT: process.env.RECSYS_ENDPOINT,
|
||||
RECSYS_FYP_ENDPOINT: process.env.RECSYS_FYP_ENDPOINT,
|
||||
IMAGE_PROXY_URL: process.env.IMAGE_PROXY_URL,
|
||||
THUMBNAIL_CDN_URL: process.env.THUMBNAIL_CDN_URL,
|
||||
THUMBNAIL_CARDS_CDN_URL: process.env.THUMBNAIL_CARDS_CDN_URL,
|
||||
THUMBNAIL_HEIGHT: process.env.THUMBNAIL_HEIGHT,
|
||||
THUMBNAIL_HEIGHT_POSTER: process.env.THUMBNAIL_HEIGHT_POSTER,
|
||||
THUMBNAIL_WIDTH: process.env.THUMBNAIL_WIDTH,
|
||||
THUMBNAIL_WIDTH_POSTER: process.env.THUMBNAIL_WIDTH_POSTER,
|
||||
THUMBNAIL_QUALITY: process.env.THUMBNAIL_QUALITY,
|
||||
THUMBNAIL_CDN_SIZE_LIMIT_BYTES: process.env.THUMBNAIL_CDN_SIZE_LIMIT_BYTES,
|
||||
PLAYER_SERVER: process.env.PLAYER_SERVER,
|
||||
SITE_TITLE: process.env.SITE_TITLE,
|
||||
SITE_NAME: process.env.SITE_NAME,
|
||||
SITE_DESCRIPTION: process.env.SITE_DESCRIPTION,
|
||||
@@ -42,9 +31,10 @@ const config = {
|
||||
TWITTER_ACCOUNT: process.env.TWITTER_ACCOUNT,
|
||||
// LOGO
|
||||
LOGO_TITLE: process.env.LOGO_TITLE,
|
||||
FAVICON: process.env.FAVICON,
|
||||
LOGO: process.env.LOGO,
|
||||
LOGO_WHITE_TEXT: process.env.LOGO_WHITE_TEXT,
|
||||
LOGO_DARK_TEXT: process.env.LOGO_DARK_TEXT,
|
||||
LOGO_TEXT_LIGHT: process.env.LOGO_TEXT_LIGHT,
|
||||
LOGO_TEXT_DARK: process.env.LOGO_TEXT_DARK,
|
||||
AVATAR_DEFAULT: process.env.AVATAR_DEFAULT,
|
||||
MISSING_THUMB_DEFAULT: process.env.MISSING_THUMB_DEFAULT,
|
||||
// OG
|
||||
@@ -67,11 +57,15 @@ const config = {
|
||||
ENABLE_NO_SOURCE_CLAIMS: process.env.ENABLE_NO_SOURCE_CLAIMS === 'true',
|
||||
ENABLE_PREROLL_ADS: process.env.ENABLE_PREROLL_ADS === 'true',
|
||||
CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS: process.env.CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS,
|
||||
CHANNEL_CREATION_LIMIT: process.env.CHANNEL_CREATION_LIMIT,
|
||||
CHANNEL_STAKED_LEVEL_LIVESTREAM: process.env.CHANNEL_STAKED_LEVEL_LIVESTREAM,
|
||||
WEB_PUBLISH_SIZE_LIMIT_GB: process.env.WEB_PUBLISH_SIZE_LIMIT_GB,
|
||||
LOADING_BAR_COLOR: process.env.LOADING_BAR_COLOR,
|
||||
SIMPLE_SITE: process.env.SIMPLE_SITE === 'true',
|
||||
SHOW_ADS: process.env.SHOW_ADS === 'true',
|
||||
PINNED_URI_1: process.env.PINNED_URI_1,
|
||||
PINNED_LABEL_1: process.env.PINNED_LABEL_1,
|
||||
PINNED_URI_2: process.env.PINNED_URI_2,
|
||||
PINNED_LABEL_2: process.env.PINNED_LABEL_2,
|
||||
KNOWN_APP_DOMAINS: process.env.KNOWN_APP_DOMAINS ? process.env.KNOWN_APP_DOMAINS.split(',') : [],
|
||||
STRIPE_PUBLIC_KEY: process.env.STRIPE_PUBLIC_KEY,
|
||||
ENABLE_UI_NOTIFICATIONS: process.env.ENABLE_UI_NOTIFICATIONS === 'true',
|
||||
@@ -80,30 +74,9 @@ const config = {
|
||||
SHOW_TAGS_INTRO: process.env.SHOW_TAGS_INTRO === 'true',
|
||||
LIGHTHOUSE_DEFAULT_TYPES: process.env.LIGHTHOUSE_DEFAULT_TYPES,
|
||||
BRANDED_SITE: process.env.BRANDED_SITE,
|
||||
|
||||
// FIREBASE SDK
|
||||
FIREBASE_API_KEY: process.env.FIREBASE_API_KEY,
|
||||
FIREBASE_AUTH_DOMAIN: process.env.FIREBASE_AUTH_DOMAIN,
|
||||
FIREBASE_PROJECT_ID: process.env.FIREBASE_PROJECT_ID,
|
||||
FIREBASE_STORAGE_BUCKET: process.env.FIREBASE_STORAGE_BUCKET,
|
||||
FIREBASE_MESSAGING_SENDER_ID: process.env.FIREBASE_MESSAGING_SENDER_ID,
|
||||
FIREBASE_APP_ID: process.env.FIREBASE_APP_ID,
|
||||
FIREBASE_MEASUREMENT_ID: process.env.FIREBASE_MEASUREMENT_ID,
|
||||
FIREBASE_VAPID_KEY: process.env.FIREBASE_VAPID_KEY,
|
||||
|
||||
AD_KEYWORD_BLOCKLIST: process.env.AD_KEYWORD_BLOCKLIST,
|
||||
AD_KEYWORD_BLOCKLIST_CHECK_DESCRIPTION: process.env.AD_KEYWORD_BLOCKLIST_CHECK_DESCRIPTION,
|
||||
|
||||
// FROM COMMAND LINE
|
||||
COMMIT_ID: process.env.COMMIT_ID,
|
||||
NODE_ENV: process.env.NODE_ENV,
|
||||
};
|
||||
|
||||
config.SDK_API_PATH = `${config.LBRY_WEB_API}/api/v1`;
|
||||
config.PROXY_URL = `${config.SDK_API_PATH}/proxy`;
|
||||
|
||||
config.URL_DEV = `http://localhost:${config.WEBPACK_WEB_PORT}`;
|
||||
config.URL_LOCAL = `http://localhost:${config.WEB_SERVER_PORT}`;
|
||||
config.FAVICON = `/public/favicon-spaceman.png`;
|
||||
|
||||
module.exports = config;
|
||||
@@ -1,4 +1,5 @@
|
||||
import { app, Menu, shell } from 'electron';
|
||||
import { ZOOM } from 'util/zoomWindow';
|
||||
|
||||
export default () => {
|
||||
const template = [
|
||||
@@ -22,6 +23,38 @@ export default () => {
|
||||
label: 'View',
|
||||
submenu: [
|
||||
{ role: 'reload' },
|
||||
{
|
||||
label: 'Zoom',
|
||||
submenu: [
|
||||
{
|
||||
label: 'Zoom In',
|
||||
accelerator: 'CmdOrCtrl+=',
|
||||
click: (menuItem, browserWindow) => {
|
||||
if (browserWindow) {
|
||||
browserWindow.webContents.send('zoom-window', ZOOM.INCREMENT);
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'Zoom Out',
|
||||
accelerator: 'CmdOrCtrl+-',
|
||||
click: (menuItem, browserWindow) => {
|
||||
if (browserWindow) {
|
||||
browserWindow.webContents.send('zoom-window', ZOOM.DECREMENT);
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'Reset Zoom',
|
||||
accelerator: 'CmdOrCtrl+0',
|
||||
click: (menuItem, browserWindow) => {
|
||||
if (browserWindow) {
|
||||
browserWindow.webContents.send('zoom-window', ZOOM.RESET);
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'Developer',
|
||||
submenu: [{ role: 'forcereload' }, { role: 'toggledevtools' }],
|
||||
|
||||
@@ -17,6 +17,9 @@ export const FETCH_CHANNEL_LIST_STARTED = 'FETCH_CHANNEL_LIST_STARTED';
|
||||
export const FETCH_CHANNEL_LIST_COMPLETED = 'FETCH_CHANNEL_LIST_COMPLETED';
|
||||
export const CREATE_CHANNEL_STARTED = 'CREATE_CHANNEL_STARTED';
|
||||
export const CREATE_CHANNEL_COMPLETED = 'CREATE_CHANNEL_COMPLETED';
|
||||
export const PUBLISH_STARTED = 'PUBLISH_STARTED';
|
||||
export const PUBLISH_COMPLETED = 'PUBLISH_COMPLETED';
|
||||
export const PUBLISH_FAILED = 'PUBLISH_FAILED';
|
||||
export const SET_PLAYING_URI = 'SET_PLAYING_URI';
|
||||
export const SET_CONTENT_POSITION = 'SET_CONTENT_POSITION';
|
||||
export const SET_CONTENT_LAST_VIEWED = 'SET_CONTENT_LAST_VIEWED';
|
||||
@@ -26,8 +29,10 @@ export const CLEAR_CONTENT_HISTORY_ALL = 'CLEAR_CONTENT_HISTORY_ALL';
|
||||
// Subscriptions
|
||||
export const CHANNEL_SUBSCRIBE = 'CHANNEL_SUBSCRIBE';
|
||||
export const CHANNEL_UNSUBSCRIBE = 'CHANNEL_UNSUBSCRIBE';
|
||||
export const CHANNEL_SUBSCRIPTION_ENABLE_NOTIFICATIONS = 'CHANNEL_SUBSCRIPTION_ENABLE_NOTIFICATIONS';
|
||||
export const CHANNEL_SUBSCRIPTION_DISABLE_NOTIFICATIONS = 'CHANNEL_SUBSCRIPTION_DISABLE_NOTIFICATIONS';
|
||||
export const CHANNEL_SUBSCRIPTION_ENABLE_NOTIFICATIONS =
|
||||
'CHANNEL_SUBSCRIPTION_ENABLE_NOTIFICATIONS';
|
||||
export const CHANNEL_SUBSCRIPTION_DISABLE_NOTIFICATIONS =
|
||||
'CHANNEL_SUBSCRIPTION_DISABLE_NOTIFICATIONS';
|
||||
export const HAS_FETCHED_SUBSCRIPTIONS = 'HAS_FETCHED_SUBSCRIPTIONS';
|
||||
export const SET_SUBSCRIPTION_LATEST = 'SET_SUBSCRIPTION_LATEST';
|
||||
export const UPDATE_SUBSCRIPTION_UNREADS = 'UPDATE_SUBSCRIPTION_UNREADS';
|
||||
@@ -83,6 +88,9 @@ export const SYNC_APPLY_FAILED = 'SYNC_APPLY_FAILED';
|
||||
export const SYNC_APPLY_BAD_PASSWORD = 'SYNC_APPLY_BAD_PASSWORD';
|
||||
export const SYNC_RESET = 'SYNC_RESET';
|
||||
|
||||
// Lbry.tv
|
||||
export const UPDATE_UPLOAD_PROGRESS = 'UPDATE_UPLOAD_PROGRESS';
|
||||
|
||||
// User
|
||||
export const GENERATE_AUTH_TOKEN_FAILURE = 'GENERATE_AUTH_TOKEN_FAILURE';
|
||||
export const GENERATE_AUTH_TOKEN_STARTED = 'GENERATE_AUTH_TOKEN_STARTED';
|
||||
|
||||
+11
-13
@@ -16,7 +16,6 @@ export { doGenerateAuthToken } from './redux/actions/auth';
|
||||
export { doFetchCostInfoForUri } from './redux/actions/cost_info';
|
||||
export { doBlackListedOutpointsSubscribe } from './redux/actions/blacklist';
|
||||
export { doFilteredOutpointsSubscribe } from './redux/actions/filtered';
|
||||
// export { doFetchFeaturedUris, doFetchTrendingUris } from './redux/actions/homepage';
|
||||
export { doFetchViewCount, doFetchSubCount } from './redux/actions/stats';
|
||||
export {
|
||||
doCheckSync,
|
||||
@@ -33,28 +32,27 @@ export { authReducer } from './redux/reducers/auth';
|
||||
export { costInfoReducer } from './redux/reducers/cost_info';
|
||||
export { blacklistReducer } from './redux/reducers/blacklist';
|
||||
export { filteredReducer } from './redux/reducers/filtered';
|
||||
// export { homepageReducer } from './redux/reducers/homepage';
|
||||
export { statsReducer } from './redux/reducers/stats';
|
||||
export { syncReducer } from './redux/reducers/sync';
|
||||
|
||||
// selectors
|
||||
export { selectAuthToken, selectIsAuthenticating } from './redux/selectors/auth';
|
||||
export {
|
||||
selectFetchingCostInfoForUri,
|
||||
selectCostInfoForUri,
|
||||
makeSelectFetchingCostInfoForUri,
|
||||
makeSelectCostInfoForUri,
|
||||
selectAllCostInfoByUri,
|
||||
selectFetchingCostInfo,
|
||||
} from './redux/selectors/cost_info';
|
||||
export { selectBlackListedOutpoints, selectBlacklistedOutpointMap } from './redux/selectors/blacklist';
|
||||
export {
|
||||
selectBlackListedOutpoints,
|
||||
selectBlacklistedOutpointMap,
|
||||
} from './redux/selectors/blacklist';
|
||||
export { selectFilteredOutpoints, selectFilteredOutpointMap } from './redux/selectors/filtered';
|
||||
// export {
|
||||
// selectFeaturedUris,
|
||||
// selectFetchingFeaturedUris,
|
||||
// selectTrendingUris,
|
||||
// selectFetchingTrendingUris,
|
||||
// } from './redux/selectors/homepage';
|
||||
export { selectViewCount, selectViewCountForUri, selectSubCountForUri } from './redux/selectors/stats';
|
||||
export { selectBanStateForUri } from './redux/selectors/ban';
|
||||
export {
|
||||
selectViewCount,
|
||||
makeSelectViewCountForUri,
|
||||
makeSelectSubCountForUri,
|
||||
} from './redux/selectors/stats';
|
||||
export {
|
||||
selectHasSyncedWallet,
|
||||
selectSyncData,
|
||||
|
||||
+21
-42
@@ -1,7 +1,6 @@
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
import Lbry from 'lbry';
|
||||
import querystring from 'querystring';
|
||||
import analytics from 'analytics';
|
||||
|
||||
const Lbryio = {
|
||||
enabled: true,
|
||||
@@ -15,7 +14,7 @@ const EXCHANGE_RATE_TIMEOUT = 20 * 60 * 1000;
|
||||
const INTERNAL_APIS_DOWN = 'internal_apis_down';
|
||||
|
||||
// We can't use env's because they aren't passed into node_modules
|
||||
Lbryio.setLocalApi = (endpoint) => {
|
||||
Lbryio.setLocalApi = endpoint => {
|
||||
Lbryio.CONNECTION_STRING = endpoint.replace(/\/*$/, '/'); // exactly one slash at the end;
|
||||
};
|
||||
|
||||
@@ -37,8 +36,8 @@ Lbryio.call = (resource, action, params = {}, method = 'get') => {
|
||||
return Promise.reject(INTERNAL_APIS_DOWN);
|
||||
}
|
||||
|
||||
if (response) {
|
||||
return response.json().then((json) => {
|
||||
if (response)
|
||||
return response.json().then(json => {
|
||||
let error;
|
||||
if (json.error) {
|
||||
error = new Error(json.error);
|
||||
@@ -48,16 +47,15 @@ Lbryio.call = (resource, action, params = {}, method = 'get') => {
|
||||
error.response = response; // This is primarily a hack used in actions/user.js
|
||||
return Promise.reject(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function makeRequest(url, options) {
|
||||
return fetch(url, options).then(checkAndParse);
|
||||
}
|
||||
|
||||
return Lbryio.getAuthToken().then((token) => {
|
||||
return Lbryio.getAuthToken().then(token => {
|
||||
const fullParams = { auth_token: token, ...params };
|
||||
Object.keys(fullParams).forEach((key) => {
|
||||
Object.keys(fullParams).forEach(key => {
|
||||
const value = fullParams[key];
|
||||
if (typeof value === 'object') {
|
||||
fullParams[key] = JSON.stringify(value);
|
||||
@@ -82,21 +80,18 @@ Lbryio.call = (resource, action, params = {}, method = 'get') => {
|
||||
url = `${Lbryio.CONNECTION_STRING}${resource}/${action}`;
|
||||
}
|
||||
|
||||
return makeRequest(url, options).then((response) => {
|
||||
sendCallAnalytics(resource, action, params);
|
||||
return response.data;
|
||||
});
|
||||
return makeRequest(url, options).then(response => response.data);
|
||||
});
|
||||
};
|
||||
|
||||
Lbryio.authToken = null;
|
||||
|
||||
Lbryio.getAuthToken = () =>
|
||||
new Promise((resolve) => {
|
||||
new Promise(resolve => {
|
||||
if (Lbryio.authToken) {
|
||||
resolve(Lbryio.authToken);
|
||||
} else if (Lbryio.overrides.getAuthToken) {
|
||||
Lbryio.overrides.getAuthToken().then((token) => {
|
||||
Lbryio.overrides.getAuthToken().then(token => {
|
||||
resolve(token);
|
||||
});
|
||||
} else if (typeof window !== 'undefined') {
|
||||
@@ -127,7 +122,7 @@ Lbryio.authenticate = (domain, language) => {
|
||||
language: language || 'en',
|
||||
};
|
||||
|
||||
return new Promise((resolve) => {
|
||||
return new Promise(resolve => {
|
||||
resolve(params);
|
||||
});
|
||||
}
|
||||
@@ -135,15 +130,15 @@ Lbryio.authenticate = (domain, language) => {
|
||||
if (Lbryio.authenticationPromise === null) {
|
||||
Lbryio.authenticationPromise = new Promise((resolve, reject) => {
|
||||
Lbryio.getAuthToken()
|
||||
.then((token) => {
|
||||
.then(token => {
|
||||
if (!token || token.length > 60) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// check that token works
|
||||
return Lbryio.getCurrentUser()
|
||||
.then((user) => user)
|
||||
.catch((error) => {
|
||||
.then(user => user)
|
||||
.catch(error => {
|
||||
if (error === INTERNAL_APIS_DOWN) {
|
||||
throw new Error('Internal APIS down');
|
||||
}
|
||||
@@ -151,14 +146,14 @@ Lbryio.authenticate = (domain, language) => {
|
||||
return false;
|
||||
});
|
||||
})
|
||||
.then((user) => {
|
||||
.then(user => {
|
||||
if (user) {
|
||||
return user;
|
||||
}
|
||||
|
||||
return Lbry.status()
|
||||
.then(
|
||||
(status) =>
|
||||
status =>
|
||||
new Promise((res, rej) => {
|
||||
const appId =
|
||||
domain && domain !== 'lbry.tv'
|
||||
@@ -174,7 +169,7 @@ Lbryio.authenticate = (domain, language) => {
|
||||
},
|
||||
'post'
|
||||
)
|
||||
.then((response) => {
|
||||
.then(response => {
|
||||
if (!response.auth_token) {
|
||||
throw new Error('auth_token was not set in the response');
|
||||
}
|
||||
@@ -193,10 +188,10 @@ Lbryio.authenticate = (domain, language) => {
|
||||
Lbryio.authToken = response.auth_token;
|
||||
return res(response);
|
||||
})
|
||||
.catch((error) => rej(error));
|
||||
.catch(error => rej(error));
|
||||
})
|
||||
)
|
||||
.then((newUser) => {
|
||||
.then(newUser => {
|
||||
if (!newUser) {
|
||||
return Lbryio.getCurrentUser();
|
||||
}
|
||||
@@ -216,7 +211,10 @@ Lbryio.getStripeToken = () =>
|
||||
: 'pk_live_e8M4dRNnCCbmpZzduEUZBgJO';
|
||||
|
||||
Lbryio.getExchangeRates = () => {
|
||||
if (!Lbryio.exchangeLastFetched || Date.now() - Lbryio.exchangeLastFetched > EXCHANGE_RATE_TIMEOUT) {
|
||||
if (
|
||||
!Lbryio.exchangeLastFetched ||
|
||||
Date.now() - Lbryio.exchangeLastFetched > EXCHANGE_RATE_TIMEOUT
|
||||
) {
|
||||
Lbryio.exchangePromise = new Promise((resolve, reject) => {
|
||||
Lbryio.call('lbc', 'exchange_rate', {}, 'get', true)
|
||||
.then(({ lbc_usd: LBC_USD, lbc_btc: LBC_BTC, btc_usd: BTC_USD }) => {
|
||||
@@ -237,23 +235,4 @@ Lbryio.setOverride = (methodName, newMethod) => {
|
||||
Lbryio.overrides[methodName] = newMethod;
|
||||
};
|
||||
|
||||
function sendCallAnalytics(resource, action, params) {
|
||||
switch (resource) {
|
||||
case 'customer':
|
||||
if (action === 'tip') {
|
||||
analytics.reportEvent('spend_virtual_currency', {
|
||||
// https://developers.google.com/analytics/devguides/collection/ga4/reference/events#spend_virtual_currency
|
||||
value: params.amount,
|
||||
virtual_currency_name: params.currency.toLowerCase(),
|
||||
item_name: 'tip',
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Do nothing
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
export default Lbryio;
|
||||
@@ -1,37 +1,35 @@
|
||||
// @flow
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
import { Lbryio } from 'lbryinc';
|
||||
import { selectClaimForUri } from 'redux/selectors/claims';
|
||||
import { selectClaimsByUri } from 'redux/selectors/claims';
|
||||
|
||||
// eslint-disable-next-line import/prefer-default-export
|
||||
export function doFetchCostInfoForUri(uri: string) {
|
||||
return async (dispatch: Dispatch, getState: GetState) => {
|
||||
export function doFetchCostInfoForUri(uri) {
|
||||
return (dispatch, getState) => {
|
||||
const state = getState();
|
||||
const claim = selectClaimForUri(state, uri);
|
||||
const claim = selectClaimsByUri(state)[uri];
|
||||
|
||||
if (!claim) return;
|
||||
|
||||
const fee = claim.value ? claim.value.fee : undefined;
|
||||
|
||||
let costInfo;
|
||||
if (fee === undefined) {
|
||||
costInfo = { cost: 0, includesData: true };
|
||||
} else if (fee.currency === 'LBC') {
|
||||
costInfo = { cost: fee.amount, includesData: true };
|
||||
} else {
|
||||
await Lbryio.getExchangeRates().then(({ LBC_USD }) => {
|
||||
costInfo = { cost: fee.amount / LBC_USD, includesData: true };
|
||||
function resolve(costInfo) {
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_COST_INFO_COMPLETED,
|
||||
data: {
|
||||
uri,
|
||||
costInfo,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_COST_INFO_COMPLETED,
|
||||
data: {
|
||||
uri,
|
||||
costInfo,
|
||||
},
|
||||
});
|
||||
const fee = claim.value ? claim.value.fee : undefined;
|
||||
|
||||
return costInfo;
|
||||
if (fee === undefined) {
|
||||
resolve({ cost: 0, includesData: true });
|
||||
} else if (fee.currency === 'LBC') {
|
||||
resolve({ cost: fee.amount, includesData: true });
|
||||
} else {
|
||||
Lbryio.getExchangeRates().then(({ LBC_USD }) => {
|
||||
resolve({ cost: fee.amount / LBC_USD, includesData: true });
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
import { Lbryio } from 'lbryinc';
|
||||
import { batchActions } from 'util/batch-actions';
|
||||
import { doResolveUris } from 'util/lbryURI';
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
|
||||
export function doFetchFeaturedUris(offloadResolve = false) {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_FEATURED_CONTENT_STARTED,
|
||||
});
|
||||
|
||||
const success = ({ Uris }) => {
|
||||
let urisToResolve = [];
|
||||
Object.keys(Uris).forEach(category => {
|
||||
urisToResolve = [...urisToResolve, ...Uris[category]];
|
||||
});
|
||||
|
||||
const actions = [
|
||||
{
|
||||
type: ACTIONS.FETCH_FEATURED_CONTENT_COMPLETED,
|
||||
data: {
|
||||
uris: Uris,
|
||||
success: true,
|
||||
},
|
||||
},
|
||||
];
|
||||
if (urisToResolve.length && !offloadResolve) {
|
||||
actions.push(doResolveUris(urisToResolve));
|
||||
}
|
||||
|
||||
dispatch(batchActions(...actions));
|
||||
};
|
||||
|
||||
const failure = () => {
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_FEATURED_CONTENT_COMPLETED,
|
||||
data: {
|
||||
uris: {},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
Lbryio.call('file', 'list_homepage').then(success, failure);
|
||||
};
|
||||
}
|
||||
|
||||
export function doFetchTrendingUris() {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_TRENDING_CONTENT_STARTED,
|
||||
});
|
||||
|
||||
const success = data => {
|
||||
const urisToResolve = data.map(uri => uri.url);
|
||||
const actions = [
|
||||
doResolveUris(urisToResolve),
|
||||
{
|
||||
type: ACTIONS.FETCH_TRENDING_CONTENT_COMPLETED,
|
||||
data: {
|
||||
uris: data,
|
||||
success: true,
|
||||
},
|
||||
},
|
||||
];
|
||||
dispatch(batchActions(...actions));
|
||||
};
|
||||
|
||||
const failure = () => {
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_TRENDING_CONTENT_COMPLETED,
|
||||
data: {
|
||||
uris: [],
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
Lbryio.call('file', 'list_trending').then(success, failure);
|
||||
};
|
||||
}
|
||||
@@ -2,9 +2,6 @@
|
||||
import { Lbryio } from 'lbryinc';
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
|
||||
const FETCH_SUB_COUNT_MIN_INTERVAL_MS = 5 * 60 * 1000;
|
||||
const FETCH_SUB_COUNT_IDLE_FIRE_MS = 100;
|
||||
|
||||
export const doFetchViewCount = (claimIdCsv: string) => (dispatch: Dispatch) => {
|
||||
dispatch({ type: ACTIONS.FETCH_VIEW_COUNT_STARTED });
|
||||
|
||||
@@ -13,56 +10,23 @@ export const doFetchViewCount = (claimIdCsv: string) => (dispatch: Dispatch) =>
|
||||
const viewCounts = result;
|
||||
dispatch({ type: ACTIONS.FETCH_VIEW_COUNT_COMPLETED, data: { claimIdCsv, viewCounts } });
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch(error => {
|
||||
dispatch({ type: ACTIONS.FETCH_VIEW_COUNT_FAILED, data: error });
|
||||
});
|
||||
};
|
||||
|
||||
const executeFetchSubCount = (claimIdCsv: string) => (dispatch: Dispatch, getState: GetState) => {
|
||||
const state = getState();
|
||||
const subCountLastFetchedById = state.stats.subCountLastFetchedById;
|
||||
const now = Date.now();
|
||||
|
||||
const claimIds = claimIdCsv.split(',').filter((id) => {
|
||||
const prev = subCountLastFetchedById[id];
|
||||
return !prev || now - prev > FETCH_SUB_COUNT_MIN_INTERVAL_MS;
|
||||
});
|
||||
|
||||
if (claimIds.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
export const doFetchSubCount = (claimId: string) => (dispatch: Dispatch) => {
|
||||
dispatch({ type: ACTIONS.FETCH_SUB_COUNT_STARTED });
|
||||
|
||||
return Lbryio.call('subscription', 'sub_count', { claim_id: claimIds.join(',') })
|
||||
return Lbryio.call('subscription', 'sub_count', { claim_id: claimId })
|
||||
.then((result: Array<number>) => {
|
||||
const subCounts = result;
|
||||
const subCount = result[0];
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_SUB_COUNT_COMPLETED,
|
||||
data: { claimIds, subCounts, fetchDate: now },
|
||||
data: { claimId, subCount },
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch(error => {
|
||||
dispatch({ type: ACTIONS.FETCH_SUB_COUNT_FAILED, data: error });
|
||||
});
|
||||
};
|
||||
|
||||
let fetchSubCountTimer;
|
||||
let fetchSubCountQueue = '';
|
||||
|
||||
export const doFetchSubCount = (claimIdCsv: string) => (dispatch: Dispatch) => {
|
||||
if (fetchSubCountTimer) {
|
||||
clearTimeout(fetchSubCountTimer);
|
||||
}
|
||||
|
||||
if (fetchSubCountQueue && !fetchSubCountQueue.endsWith(',')) {
|
||||
fetchSubCountQueue += ',';
|
||||
}
|
||||
|
||||
fetchSubCountQueue += claimIdCsv;
|
||||
|
||||
fetchSubCountTimer = setTimeout(() => {
|
||||
dispatch(executeFetchSubCount(fetchSubCountQueue));
|
||||
fetchSubCountQueue = '';
|
||||
}, FETCH_SUB_COUNT_IDLE_FIRE_MS);
|
||||
};
|
||||
@@ -1,48 +0,0 @@
|
||||
import { handleActions } from 'util/redux-utils';
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
|
||||
const defaultState = {
|
||||
fetchingFeaturedContent: false,
|
||||
fetchingFeaturedContentFailed: false,
|
||||
featuredUris: undefined,
|
||||
fetchingTrendingContent: false,
|
||||
fetchingTrendingContentFailed: false,
|
||||
trendingUris: undefined,
|
||||
};
|
||||
|
||||
export const homepageReducer = handleActions(
|
||||
{
|
||||
[ACTIONS.FETCH_FEATURED_CONTENT_STARTED]: state => ({
|
||||
...state,
|
||||
fetchingFeaturedContent: true,
|
||||
}),
|
||||
|
||||
[ACTIONS.FETCH_FEATURED_CONTENT_COMPLETED]: (state, action) => {
|
||||
const { uris, success } = action.data;
|
||||
|
||||
return {
|
||||
...state,
|
||||
fetchingFeaturedContent: false,
|
||||
fetchingFeaturedContentFailed: !success,
|
||||
featuredUris: uris,
|
||||
};
|
||||
},
|
||||
|
||||
[ACTIONS.FETCH_TRENDING_CONTENT_STARTED]: state => ({
|
||||
...state,
|
||||
fetchingTrendingContent: true,
|
||||
}),
|
||||
|
||||
[ACTIONS.FETCH_TRENDING_CONTENT_COMPLETED]: (state, action) => {
|
||||
const { uris, success } = action.data;
|
||||
|
||||
return {
|
||||
...state,
|
||||
fetchingTrendingContent: false,
|
||||
fetchingTrendingContentFailed: !success,
|
||||
trendingUris: uris,
|
||||
};
|
||||
},
|
||||
},
|
||||
defaultState
|
||||
);
|
||||
@@ -8,18 +8,15 @@ const defaultState = {
|
||||
fetchingSubCount: false,
|
||||
subCountError: undefined,
|
||||
subCountById: {},
|
||||
subCountLastFetchedById: {},
|
||||
};
|
||||
|
||||
export const statsReducer = handleActions(
|
||||
{
|
||||
[ACTIONS.FETCH_VIEW_COUNT_STARTED]: (state) => ({ ...state, fetchingViewCount: true }),
|
||||
|
||||
[ACTIONS.FETCH_VIEW_COUNT_STARTED]: state => ({ ...state, fetchingViewCount: true }),
|
||||
[ACTIONS.FETCH_VIEW_COUNT_FAILED]: (state, action) => ({
|
||||
...state,
|
||||
viewCountError: action.data,
|
||||
}),
|
||||
|
||||
[ACTIONS.FETCH_VIEW_COUNT_COMPLETED]: (state, action) => {
|
||||
const { claimIdCsv, viewCounts } = action.data;
|
||||
|
||||
@@ -38,42 +35,20 @@ export const statsReducer = handleActions(
|
||||
viewCountById,
|
||||
};
|
||||
},
|
||||
|
||||
[ACTIONS.FETCH_SUB_COUNT_STARTED]: (state) => ({ ...state, fetchingSubCount: true }),
|
||||
|
||||
[ACTIONS.FETCH_SUB_COUNT_STARTED]: state => ({ ...state, fetchingSubCount: true }),
|
||||
[ACTIONS.FETCH_SUB_COUNT_FAILED]: (state, action) => ({
|
||||
...state,
|
||||
subCountError: action.data,
|
||||
}),
|
||||
|
||||
[ACTIONS.FETCH_SUB_COUNT_COMPLETED]: (state, action) => {
|
||||
const { claimIds, subCounts, fetchDate } = action.data;
|
||||
const { claimId, subCount } = action.data;
|
||||
|
||||
const subCountById = Object.assign({}, state.subCountById);
|
||||
const subCountLastFetchedById = Object.assign({}, state.subCountLastFetchedById);
|
||||
let dataChanged = false;
|
||||
|
||||
if (claimIds.length === subCounts.length) {
|
||||
claimIds.forEach((claimId, index) => {
|
||||
if (subCountById[claimId] !== subCounts[index]) {
|
||||
subCountById[claimId] = subCounts[index];
|
||||
dataChanged = true;
|
||||
}
|
||||
subCountLastFetchedById[claimId] = fetchDate;
|
||||
});
|
||||
}
|
||||
|
||||
const newState = {
|
||||
const subCountById = { ...state.subCountById, [claimId]: subCount };
|
||||
return {
|
||||
...state,
|
||||
fetchingSubCount: false,
|
||||
subCountLastFetchedById,
|
||||
subCountById,
|
||||
};
|
||||
|
||||
if (dataChanged) {
|
||||
newState.subCountById = subCountById;
|
||||
}
|
||||
|
||||
return newState;
|
||||
},
|
||||
},
|
||||
defaultState
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
const selectState = (state) => state.auth || {};
|
||||
import { createSelector } from 'reselect';
|
||||
|
||||
export const selectAuthToken = (state) => selectState(state).authToken;
|
||||
export const selectIsAuthenticating = (state) => selectState(state).authenticating;
|
||||
const selectState = state => state.auth || {};
|
||||
|
||||
export const selectAuthToken = createSelector(selectState, state => state.authToken);
|
||||
|
||||
export const selectIsAuthenticating = createSelector(selectState, state => state.authenticating);
|
||||
@@ -1,68 +0,0 @@
|
||||
// @flow
|
||||
|
||||
// TODO: This should be in 'redux/selectors/claim.js'. Temporarily putting it
|
||||
// here to get past importing issues with 'lbryinc', which the real fix might
|
||||
// involve moving it from 'extras' to 'ui' (big change).
|
||||
|
||||
import { createCachedSelector } from 're-reselect';
|
||||
import { selectClaimForUri } from 'redux/selectors/claims';
|
||||
import { selectMutedChannels } from 'redux/selectors/blocked';
|
||||
import { selectModerationBlockList } from 'redux/selectors/comments';
|
||||
import { selectBlacklistedOutpointMap, selectFilteredOutpointMap } from 'lbryinc';
|
||||
import { getChannelFromClaim } from 'util/claim';
|
||||
import { isURIEqual } from 'util/lbryURI';
|
||||
|
||||
export const selectBanStateForUri = createCachedSelector(
|
||||
selectClaimForUri,
|
||||
selectBlacklistedOutpointMap,
|
||||
selectFilteredOutpointMap,
|
||||
selectMutedChannels,
|
||||
selectModerationBlockList,
|
||||
(claim, blackListedOutpointMap, filteredOutpointMap, mutedChannelUris, personalBlocklist) => {
|
||||
const banState = {};
|
||||
|
||||
if (!claim) {
|
||||
return banState;
|
||||
}
|
||||
|
||||
const channelClaim = getChannelFromClaim(claim);
|
||||
|
||||
// This will be replaced once blocking is done at the wallet server level.
|
||||
if (blackListedOutpointMap) {
|
||||
if (
|
||||
(channelClaim && blackListedOutpointMap[`${channelClaim.txid}:${channelClaim.nout}`]) ||
|
||||
blackListedOutpointMap[`${claim.txid}:${claim.nout}`]
|
||||
) {
|
||||
banState['blacklisted'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// We're checking to see if the stream outpoint or signing channel outpoint
|
||||
// is in the filter list.
|
||||
if (filteredOutpointMap) {
|
||||
if (
|
||||
(channelClaim && filteredOutpointMap[`${channelClaim.txid}:${channelClaim.nout}`]) ||
|
||||
filteredOutpointMap[`${claim.txid}:${claim.nout}`]
|
||||
) {
|
||||
banState['filtered'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// block stream claims
|
||||
// block channel claims if we can't control for them in claim search
|
||||
if (mutedChannelUris.length && channelClaim) {
|
||||
if (mutedChannelUris.some((blockedUri) => isURIEqual(blockedUri, channelClaim.permanent_url))) {
|
||||
banState['muted'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Commentron blocklist
|
||||
if (personalBlocklist.length && channelClaim) {
|
||||
if (personalBlocklist.some((blockedUri) => isURIEqual(blockedUri, channelClaim.permanent_url))) {
|
||||
banState['blocked'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
return banState;
|
||||
}
|
||||
)((state, uri) => String(uri));
|
||||
@@ -1,15 +1,20 @@
|
||||
import { createSelector } from 'reselect';
|
||||
|
||||
export const selectState = (state) => state.blacklist || {};
|
||||
export const selectState = state => state.blacklist || {};
|
||||
|
||||
export const selectBlackListedOutpoints = (state) => selectState(state).blackListedOutpoints;
|
||||
export const selectBlackListedOutpoints = createSelector(
|
||||
selectState,
|
||||
state => state.blackListedOutpoints
|
||||
);
|
||||
|
||||
export const selectBlacklistedOutpointMap = createSelector(selectBlackListedOutpoints, (outpoints) =>
|
||||
outpoints
|
||||
? outpoints.reduce((acc, val) => {
|
||||
const outpoint = `${val.txid}:${val.nout}`;
|
||||
acc[outpoint] = 1;
|
||||
return acc;
|
||||
}, {})
|
||||
: {}
|
||||
export const selectBlacklistedOutpointMap = createSelector(
|
||||
selectBlackListedOutpoints,
|
||||
outpoints =>
|
||||
outpoints
|
||||
? outpoints.reduce((acc, val) => {
|
||||
const outpoint = `${val.txid}:${val.nout}`;
|
||||
acc[outpoint] = 1;
|
||||
return acc;
|
||||
}, {})
|
||||
: {}
|
||||
);
|
||||
@@ -1,16 +1,13 @@
|
||||
// @flow
|
||||
type State = { costInfo: any };
|
||||
import { createSelector } from 'reselect';
|
||||
|
||||
export const selectState = (state: State) => state.costInfo || {};
|
||||
export const selectAllCostInfoByUri = (state: State) => selectState(state).byUri;
|
||||
export const selectFetchingCostInfo = (state: State) => selectState(state).fetching;
|
||||
export const selectState = state => state.costInfo || {};
|
||||
|
||||
export const selectCostInfoForUri = (state: State, uri: string) => {
|
||||
const costInfos = selectAllCostInfoByUri(state);
|
||||
return costInfos && costInfos[uri];
|
||||
};
|
||||
export const selectAllCostInfoByUri = createSelector(selectState, state => state.byUri || {});
|
||||
|
||||
export const selectFetchingCostInfoForUri = (state: State, uri: string) => {
|
||||
const fetchingByUri = selectFetchingCostInfo(state);
|
||||
return fetchingByUri && fetchingByUri[uri];
|
||||
};
|
||||
export const makeSelectCostInfoForUri = uri =>
|
||||
createSelector(selectAllCostInfoByUri, costInfos => costInfos && costInfos[uri]);
|
||||
|
||||
export const selectFetchingCostInfo = createSelector(selectState, state => state.fetching || {});
|
||||
|
||||
export const makeSelectFetchingCostInfoForUri = uri =>
|
||||
createSelector(selectFetchingCostInfo, fetchingByUri => fetchingByUri && fetchingByUri[uri]);
|
||||
@@ -1,15 +1,20 @@
|
||||
import { createSelector } from 'reselect';
|
||||
|
||||
export const selectState = (state) => state.filtered || {};
|
||||
export const selectState = state => state.filtered || {};
|
||||
|
||||
export const selectFilteredOutpoints = (state) => selectState(state).filteredOutpoints;
|
||||
export const selectFilteredOutpoints = createSelector(
|
||||
selectState,
|
||||
state => state.filteredOutpoints
|
||||
);
|
||||
|
||||
export const selectFilteredOutpointMap = createSelector(selectFilteredOutpoints, (outpoints) =>
|
||||
outpoints
|
||||
? outpoints.reduce((acc, val) => {
|
||||
const outpoint = `${val.txid}:${val.nout}`;
|
||||
acc[outpoint] = 1;
|
||||
return acc;
|
||||
}, {})
|
||||
: {}
|
||||
export const selectFilteredOutpointMap = createSelector(
|
||||
selectFilteredOutpoints,
|
||||
outpoints =>
|
||||
outpoints
|
||||
? outpoints.reduce((acc, val) => {
|
||||
const outpoint = `${val.txid}:${val.nout}`;
|
||||
acc[outpoint] = 1;
|
||||
return acc;
|
||||
}, {})
|
||||
: {}
|
||||
);
|
||||
@@ -1,6 +0,0 @@
|
||||
const selectState = (state) => state.homepage || {};
|
||||
|
||||
export const selectFeaturedUris = (state) => selectState(state).featuredUris;
|
||||
export const selectFetchingFeaturedUris = (state) => selectState(state).fetchingFeaturedContent;
|
||||
export const selectTrendingUris = (state) => selectState(state).trendingUris;
|
||||
export const selectFetchingTrendingUris = (state) => selectState(state).fetchingTrendingContent;
|
||||
@@ -1,20 +1,20 @@
|
||||
// @flow
|
||||
import { selectClaimIdForUri } from 'redux/selectors/claims';
|
||||
import { createSelector } from 'reselect';
|
||||
import { makeSelectClaimForUri } from 'redux/selectors/claims';
|
||||
|
||||
type State = { claims: any, stats: any, user: UserState };
|
||||
const selectState = state => state.stats || {};
|
||||
export const selectViewCount = createSelector(selectState, state => state.viewCountById);
|
||||
export const selectSubCount = createSelector(selectState, state => state.subCountById);
|
||||
|
||||
const selectState = (state: State) => state.stats || {};
|
||||
export const selectViewCount = (state: State) => selectState(state).viewCountById;
|
||||
export const selectSubCount = (state: State) => selectState(state).subCountById;
|
||||
export const makeSelectViewCountForUri = uri =>
|
||||
createSelector(
|
||||
makeSelectClaimForUri(uri),
|
||||
selectViewCount,
|
||||
(claim, viewCountById) => (claim ? viewCountById[claim.claim_id] || 0 : 0)
|
||||
);
|
||||
|
||||
export const selectViewCountForUri = (state: State, uri: string) => {
|
||||
const claimId = selectClaimIdForUri(state, uri);
|
||||
const viewCountById = selectViewCount(state);
|
||||
return claimId ? viewCountById[claimId] || 0 : 0;
|
||||
};
|
||||
|
||||
export const selectSubCountForUri = (state: State, uri: string) => {
|
||||
const claimId = selectClaimIdForUri(state, uri);
|
||||
const subCountById = selectSubCount(state);
|
||||
return claimId ? subCountById[claimId] || 0 : 0;
|
||||
};
|
||||
export const makeSelectSubCountForUri = uri =>
|
||||
createSelector(
|
||||
makeSelectClaimForUri(uri),
|
||||
selectSubCount,
|
||||
(claim, subCountById) => (claim ? subCountById[claim.claim_id] || 0 : 0)
|
||||
);
|
||||
@@ -1,13 +1,40 @@
|
||||
const selectState = (state) => state.sync || {};
|
||||
import { createSelector } from 'reselect';
|
||||
|
||||
export const selectHasSyncedWallet = (state) => selectState(state).hasSyncedWallet;
|
||||
export const selectSyncHash = (state) => selectState(state).syncHash;
|
||||
export const selectSyncData = (state) => selectState(state).syncData;
|
||||
export const selectSetSyncErrorMessage = (state) => selectState(state).setSyncErrorMessage;
|
||||
export const selectGetSyncErrorMessage = (state) => selectState(state).getSyncErrorMessage;
|
||||
export const selectGetSyncIsPending = (state) => selectState(state).getSyncIsPending;
|
||||
export const selectSetSyncIsPending = (state) => selectState(state).setSyncIsPending;
|
||||
export const selectHashChanged = (state) => selectState(state).hashChanged;
|
||||
export const selectSyncApplyIsPending = (state) => selectState(state).syncApplyIsPending;
|
||||
export const selectSyncApplyErrorMessage = (state) => selectState(state).syncApplyErrorMessage;
|
||||
export const selectSyncApplyPasswordError = (state) => selectState(state).syncApplyPasswordError;
|
||||
const selectState = state => state.sync || {};
|
||||
|
||||
export const selectHasSyncedWallet = createSelector(selectState, state => state.hasSyncedWallet);
|
||||
|
||||
export const selectSyncHash = createSelector(selectState, state => state.syncHash);
|
||||
|
||||
export const selectSyncData = createSelector(selectState, state => state.syncData);
|
||||
|
||||
export const selectSetSyncErrorMessage = createSelector(
|
||||
selectState,
|
||||
state => state.setSyncErrorMessage
|
||||
);
|
||||
|
||||
export const selectGetSyncErrorMessage = createSelector(
|
||||
selectState,
|
||||
state => state.getSyncErrorMessage
|
||||
);
|
||||
|
||||
export const selectGetSyncIsPending = createSelector(selectState, state => state.getSyncIsPending);
|
||||
|
||||
export const selectSetSyncIsPending = createSelector(selectState, state => state.setSyncIsPending);
|
||||
|
||||
export const selectHashChanged = createSelector(selectState, state => state.hashChanged);
|
||||
|
||||
export const selectSyncApplyIsPending = createSelector(
|
||||
selectState,
|
||||
state => state.syncApplyIsPending
|
||||
);
|
||||
|
||||
export const selectSyncApplyErrorMessage = createSelector(
|
||||
selectState,
|
||||
state => state.syncApplyErrorMessage
|
||||
);
|
||||
|
||||
export const selectSyncApplyPasswordError = createSelector(
|
||||
selectState,
|
||||
state => state.syncApplyPasswordError
|
||||
);
|
||||
+75
-150
@@ -1,21 +1,15 @@
|
||||
// @flow
|
||||
import { RECSYS_ENDPOINT } from 'config';
|
||||
import { selectUser } from 'redux/selectors/user';
|
||||
import { selectRecommendedMetaForClaimId } from 'redux/selectors/search';
|
||||
import { makeSelectRecommendedRecsysIdForClaimId } from 'redux/selectors/search';
|
||||
import { v4 as Uuidv4 } from 'uuid';
|
||||
import { parseURI } from 'util/lbryURI';
|
||||
import { getAuthToken } from 'util/saved-passwords';
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
import * as SETTINGS from 'constants/settings';
|
||||
import { X_LBRY_AUTH_TOKEN } from 'constants/token';
|
||||
import { makeSelectClaimForUri } from 'redux/selectors/claims';
|
||||
import { selectPlayingUri, selectPrimaryUri } from 'redux/selectors/content';
|
||||
import { selectClientSetting, selectDaemonSettings } from 'redux/selectors/settings';
|
||||
import { selectIsSubscribedForClaimId } from 'redux/selectors/subscriptions';
|
||||
// $FlowFixMe: cannot resolve..
|
||||
import { makeSelectClientSetting, selectDaemonSettings } from 'redux/selectors/settings';
|
||||
import { history } from 'ui/store';
|
||||
|
||||
const recsysEndpoint = RECSYS_ENDPOINT;
|
||||
const DEFAULT_RECSYS_ID = 'lighthouse-v0';
|
||||
const recsysEndpoint = 'https://clickstream.odysee.com/log/video/view';
|
||||
const recsysId = 'lighthouse-v0';
|
||||
|
||||
const getClaimIdsFromUris = (uris) => {
|
||||
return uris
|
||||
@@ -30,30 +24,30 @@ const getClaimIdsFromUris = (uris) => {
|
||||
: [];
|
||||
};
|
||||
|
||||
const recsys: Recsys = {
|
||||
const recsys = {
|
||||
entries: {},
|
||||
debug: false,
|
||||
|
||||
/**
|
||||
* Provides for creating, updating, and sending Clickstream data object Entries.
|
||||
* Entries are Created either when recommendedContent loads, or when recommendedContent is clicked.
|
||||
* If recommended content is clicked, An Entry with parentUuid is created.
|
||||
* On page load, find an empty entry with your claimId, or create a new entry and record to it.
|
||||
* The entry will be populated with the following:
|
||||
* - parentUuid // optional
|
||||
* - Uuid
|
||||
* - claimId
|
||||
* - recommendedClaims [] // optionally empty
|
||||
* - playerEvents [] // optionally empty
|
||||
* - recommendedClaimsIndexClicked [] // optionally empty
|
||||
* - UserId
|
||||
* - pageLoadedAt
|
||||
* - isEmbed
|
||||
* - pageExitedAt
|
||||
* - recsysId // optional
|
||||
*/
|
||||
|
||||
/**
|
||||
* Saves existing entries to persistence storage (in this case, Redux).
|
||||
*/
|
||||
saveEntries: function () {
|
||||
if (window && window.store) {
|
||||
window.store.dispatch({
|
||||
type: ACTIONS.SET_RECSYS_ENTRIES,
|
||||
data: recsys.entries,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Function: onClickedRecommended()
|
||||
* Called when RecommendedContent was clicked.
|
||||
* Adds index of clicked recommendation to parent entry
|
||||
* Adds new Entry with parentUuid for destination page
|
||||
@@ -62,52 +56,31 @@ const recsys: Recsys = {
|
||||
*/
|
||||
onClickedRecommended: function (parentClaimId, newClaimId) {
|
||||
const parentEntry = recsys.entries[parentClaimId] ? recsys.entries[parentClaimId] : null;
|
||||
const parentUuid = parentEntry ? parentEntry['uuid'] : '';
|
||||
const parentRecommendedClaims = parentEntry ? parentEntry['recClaimIds'] : [];
|
||||
const parentClickedIndexes = parentEntry ? parentEntry['recClickedVideoIdx'] : [];
|
||||
const parentUuid = parentEntry['uuid'];
|
||||
const parentRecommendedClaims = parentEntry['recClaimIds'] || [];
|
||||
const parentClickedIndexes = parentEntry['recClickedVideoIdx'] || [];
|
||||
const indexClicked = parentRecommendedClaims.indexOf(newClaimId);
|
||||
|
||||
if (parentUuid) {
|
||||
recsys.createRecsysEntry(newClaimId, parentUuid);
|
||||
}
|
||||
|
||||
parentClickedIndexes.push(indexClicked);
|
||||
// recsys.log('onClickedRecommended', { parentClaimId, newClaimId });
|
||||
recsys.log('onClickedRecommended', newClaimId);
|
||||
recsys.log('onClickedRecommended', { parentClaimId, newClaimId });
|
||||
},
|
||||
|
||||
/**
|
||||
* Page was loaded. Get or Create entry and populate it with default data,
|
||||
* plus recommended content, recsysId, etc.
|
||||
* Page was loaded. Get or Create entry and populate it with default data, plus recommended content, recsysId, etc.
|
||||
* Called from recommendedContent component
|
||||
*
|
||||
* @param claimId The ID of the content the recommendations are for.
|
||||
* @param uris The recommended uris for `claimId`.
|
||||
* @param uuid Specific uuid to use (e.g. for FYP); uses the recommendation's
|
||||
* uuid otherwise.
|
||||
*/
|
||||
onRecsLoaded: function (claimId, uris, uuid = '') {
|
||||
if (window && window.store) {
|
||||
onRecsLoaded: function (claimId, uris) {
|
||||
if (window.store) {
|
||||
const state = window.store.getState();
|
||||
const recommendedMeta = selectRecommendedMetaForClaimId(state, claimId);
|
||||
|
||||
if (!recsys.entries[claimId]) {
|
||||
recsys.createRecsysEntry(claimId, null, uuid || recommendedMeta.uuid);
|
||||
} else if (!recsys.entries[claimId].uuid) {
|
||||
// Stubs might not have the uuid ready at the time. Refill now.
|
||||
recsys.entries[claimId].uuid = uuid || recommendedMeta.uuid;
|
||||
recsys.createRecsysEntry(claimId);
|
||||
}
|
||||
|
||||
const claimIds = getClaimIdsFromUris(uris);
|
||||
recsys.entries[claimId]['recsysId'] = recommendedMeta.poweredBy || DEFAULT_RECSYS_ID;
|
||||
recsys.entries[claimId]['recsysId'] = makeSelectRecommendedRecsysIdForClaimId(claimId)(state) || recsysId;
|
||||
recsys.entries[claimId]['pageLoadedAt'] = Date.now();
|
||||
|
||||
// It is possible that `claimIds` include `null | undefined` entries
|
||||
// instead of all being strings. I don't know if we should filter it,
|
||||
// or change the `recClaimIds` definition. Leaving as is for now since
|
||||
// any changes could affect existing recsys data set.
|
||||
// -----------
|
||||
// $FlowFixMe:
|
||||
recsys.entries[claimId]['recClaimIds'] = claimIds;
|
||||
}
|
||||
recsys.log('onRecsLoaded', claimId);
|
||||
@@ -117,119 +90,67 @@ const recsys: Recsys = {
|
||||
* Creates an Entry with optional parentUuid
|
||||
* @param: claimId: string
|
||||
* @param: parentUuid: string (optional)
|
||||
* @param uuid Specific uuid to use (e.g. for FYP); uses the recommendation's
|
||||
* uuid otherwise.
|
||||
*/
|
||||
createRecsysEntry: function (claimId, parentUuid, uuid = '') {
|
||||
if (window && window.store && claimId) {
|
||||
createRecsysEntry: function (claimId, parentUuid) {
|
||||
if (window.store && claimId) {
|
||||
const state = window.store.getState();
|
||||
const recommendedMeta = selectRecommendedMetaForClaimId(state, claimId);
|
||||
const user = selectUser(state);
|
||||
const userId = user ? user.id : null;
|
||||
|
||||
// Make a stub entry that will be filled out on page load
|
||||
// $FlowIgnore: not everything is defined since this is a stub
|
||||
recsys.entries[claimId] = {
|
||||
uuid: uuid || recommendedMeta.uuid,
|
||||
claimId: claimId,
|
||||
recClickedVideoIdx: [],
|
||||
pageLoadedAt: Date.now(),
|
||||
events: [],
|
||||
incognito: !(user && user.has_verified_email),
|
||||
isFollowing: selectIsSubscribedForClaimId(state, claimId),
|
||||
};
|
||||
|
||||
const { id: userId } = selectUser(state);
|
||||
if (parentUuid) {
|
||||
// $FlowFixMe: 'uid' should be a number, not null.
|
||||
recsys.entries[claimId].uid = userId || null;
|
||||
recsys.entries[claimId].parentUuid = parentUuid;
|
||||
// Make a stub entry that will be filled out on page load
|
||||
recsys.entries[claimId] = {
|
||||
uuid: Uuidv4(),
|
||||
parentUuid: parentUuid,
|
||||
uid: userId || null, // selectUser
|
||||
claimId: claimId,
|
||||
recClickedVideoIdx: [],
|
||||
pageLoadedAt: Date.now(),
|
||||
events: [],
|
||||
};
|
||||
} else {
|
||||
// $FlowFixMe: 'uid' should be a number, not null.
|
||||
recsys.entries[claimId].uid = userId;
|
||||
// $FlowFixMe: 'recsysId' should be a number, not null.
|
||||
recsys.entries[claimId].recsysId = null;
|
||||
recsys.entries[claimId].recClaimIds = [];
|
||||
recsys.entries[claimId] = {
|
||||
uuid: Uuidv4(),
|
||||
uid: userId, // selectUser
|
||||
claimId: claimId,
|
||||
pageLoadedAt: Date.now(),
|
||||
recsysId: null,
|
||||
recClaimIds: [],
|
||||
recClickedVideoIdx: [],
|
||||
events: [],
|
||||
};
|
||||
}
|
||||
|
||||
recsys.saveEntries();
|
||||
}
|
||||
recsys.log('createRecsysEntry', claimId);
|
||||
},
|
||||
|
||||
updateRecsysEntry: function (claimId, key, value) {
|
||||
const entry = recsys.entries[claimId];
|
||||
if (entry) {
|
||||
entry[key] = value;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Send event for claimId
|
||||
* @param claimId
|
||||
* @param isTentative Visibility change rather than tab closed.
|
||||
* @param isTentative
|
||||
*/
|
||||
sendRecsysEntry: function (claimId, isTentative) {
|
||||
const shareTelemetry =
|
||||
IS_WEB || (window && window.store && selectDaemonSettings(window.store.getState()).share_usage_data);
|
||||
|
||||
if (recsys.entries[claimId] && shareTelemetry) {
|
||||
// Exclude `events` in the submission https://github.com/OdyseeTeam/odysee-frontend/issues/1317
|
||||
const { events, ...entryData } = recsys.entries[claimId];
|
||||
const data = JSON.stringify(entryData);
|
||||
|
||||
return fetch(recsysEndpoint, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
[X_LBRY_AUTH_TOKEN]: getAuthToken(),
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: data,
|
||||
})
|
||||
.then(() => {
|
||||
if (!isTentative) {
|
||||
delete recsys.entries[claimId];
|
||||
recsys.saveEntries();
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log('RECSYS: failed to send entry', err);
|
||||
});
|
||||
const data = JSON.stringify(recsys.entries[claimId]);
|
||||
try {
|
||||
navigator.sendBeacon(recsysEndpoint, data);
|
||||
if (!isTentative) {
|
||||
delete recsys.entries[claimId];
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('no beacon for you', error);
|
||||
}
|
||||
}
|
||||
recsys.log('sendRecsysEntry', claimId);
|
||||
},
|
||||
|
||||
sendEntries: function (entries, isResumedSend) {
|
||||
if (entries) {
|
||||
if (Object.keys(recsys.entries).length !== 0) {
|
||||
// Typically called on startup only.
|
||||
console.warn('RECSYS: sendEntries() called on non-empty state. Data will be overwritten.');
|
||||
}
|
||||
|
||||
recsys.entries = entries;
|
||||
}
|
||||
|
||||
Object.keys(recsys.entries).forEach((claimId) => {
|
||||
recsys.entries[claimId].isResumedSend = isResumedSend;
|
||||
recsys.sendRecsysEntry(claimId, false); // Send and delete.
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* A player event fired. Get the Entry for the claimId, and add the events
|
||||
* @param claimId
|
||||
* @param event
|
||||
*/
|
||||
onRecsysPlayerEvent: function (claimId, event, isEmbedded) {
|
||||
const state = window.store.getState();
|
||||
const autoPlayNext = state && selectClientSetting(state, SETTINGS.AUTOPLAY_NEXT);
|
||||
// Check if played through (4 = onEnded) and handle multiple events at end
|
||||
if (recsys.entries[claimId] && !recsys.entries[claimId]['autoplay'] === true) {
|
||||
if (autoPlayNext && event.event === 4) {
|
||||
recsys.entries[claimId]['autoplay'] = true;
|
||||
} else {
|
||||
recsys.entries[claimId]['autoplay'] = false;
|
||||
}
|
||||
}
|
||||
if (!recsys.entries[claimId]) {
|
||||
recsys.createRecsysEntry(claimId);
|
||||
// do something to show it's floating or autoplay
|
||||
@@ -240,7 +161,6 @@ const recsys: Recsys = {
|
||||
recsys.entries[claimId].events.push(event);
|
||||
recsys.log('onRecsysPlayerEvent', claimId);
|
||||
},
|
||||
|
||||
log: function (callName, claimId) {
|
||||
if (recsys.debug) {
|
||||
console.log(`Call: ***${callName}***, ClaimId: ${claimId}, Recsys Entries`, Object.assign({}, recsys.entries));
|
||||
@@ -251,8 +171,8 @@ const recsys: Recsys = {
|
||||
* Player closed. Check to see if primaryUri = playingUri
|
||||
* if so, send the Entry.
|
||||
*/
|
||||
onPlayerDispose: function (claimId, isEmbedded, totalPlayingTime) {
|
||||
if (window && window.store) {
|
||||
onPlayerDispose: function (claimId, isEmbedded) {
|
||||
if (window.store) {
|
||||
const state = window.store.getState();
|
||||
const playingUri = selectPlayingUri(state);
|
||||
const primaryUri = selectPrimaryUri(state);
|
||||
@@ -261,7 +181,6 @@ const recsys: Recsys = {
|
||||
if (isEmbedded) {
|
||||
recsys.entries[claimId]['isEmbed'] = true;
|
||||
}
|
||||
recsys.entries[claimId]['totalPlayTime'] = totalPlayingTime;
|
||||
recsys.sendRecsysEntry(claimId);
|
||||
}
|
||||
}
|
||||
@@ -276,7 +195,7 @@ const recsys: Recsys = {
|
||||
// * more events until player is disposed. Don't send unless floatingPlayer playingUri
|
||||
// */
|
||||
// onLeaveFilePage: function (primaryUri) {
|
||||
// if (window && window.store) {
|
||||
// if (window.store) {
|
||||
// const state = window.store.getState();
|
||||
// const claim = makeSelectClaimForUri(primaryUri)(state);
|
||||
// const claimId = claim ? claim.claim_id : null;
|
||||
@@ -302,27 +221,33 @@ const recsys: Recsys = {
|
||||
* Send all claimIds that aren't currently playing.
|
||||
*/
|
||||
onNavigate: function () {
|
||||
if (window && window.store) {
|
||||
if (window.store) {
|
||||
const state = window.store.getState();
|
||||
const playingUri = selectPlayingUri(state);
|
||||
const actualPlayingUri = playingUri && playingUri.uri;
|
||||
const claim = makeSelectClaimForUri(actualPlayingUri || '')(state);
|
||||
const claim = makeSelectClaimForUri(actualPlayingUri)(state);
|
||||
const playingClaimId = claim ? claim.claim_id : null;
|
||||
// const primaryUri = selectPrimaryUri(state);
|
||||
const floatingPlayer = selectClientSetting(state, SETTINGS.FLOATING_PLAYER);
|
||||
const floatingPlayer = makeSelectClientSetting(SETTINGS.FLOATING_PLAYER)(state);
|
||||
// When leaving page, if floating player is enabled, play will continue.
|
||||
Object.keys(recsys.entries).forEach((claimId) => {
|
||||
const shouldSkip = recsys.entries[claimId].parentUuid && !recsys.entries[claimId].recClaimIds;
|
||||
if (!shouldSkip && ((claimId !== playingClaimId && floatingPlayer) || !floatingPlayer)) {
|
||||
recsys.entries[claimId]['pageExitedAt'] = Date.now();
|
||||
recsys.saveEntries();
|
||||
// recsys.sendRecsysEntry(claimId); breaks pop out = off, not helping with browser close.
|
||||
recsys.sendRecsysEntry(claimId);
|
||||
}
|
||||
recsys.log('OnNavigate', claimId);
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
// @if TARGET='web'
|
||||
document.addEventListener('visibilitychange', function logData() {
|
||||
if (document.visibilityState === 'hidden') {
|
||||
Object.keys(recsys.entries).map((claimId) => recsys.sendRecsysEntry(claimId, true));
|
||||
}
|
||||
});
|
||||
// @endif
|
||||
|
||||
history.listen(() => {
|
||||
recsys.onNavigate();
|
||||
|
||||
Vendored
+1
-29
@@ -1,6 +1,5 @@
|
||||
declare type BlocklistState = {
|
||||
blockedChannels: Array<string>,
|
||||
geoBlockedList: ?GBL,
|
||||
blockedChannels: Array<string>
|
||||
};
|
||||
|
||||
declare type BlocklistAction = {
|
||||
@@ -9,30 +8,3 @@ declare type BlocklistAction = {
|
||||
uri: string,
|
||||
},
|
||||
};
|
||||
|
||||
// ****************************************************************************
|
||||
// Geo-blocked list (GBL)
|
||||
// ****************************************************************************
|
||||
|
||||
declare type GeoChannelId = string;
|
||||
|
||||
declare type GeoRestriction = {
|
||||
id: string,
|
||||
trigger?: string,
|
||||
reason?: string,
|
||||
message?: string,
|
||||
};
|
||||
|
||||
declare type GeoConfig = {
|
||||
countries?: Array<GeoRestriction>,
|
||||
continents?: Array<GeoRestriction>,
|
||||
specials?: Array<GeoRestriction>,
|
||||
};
|
||||
|
||||
declare type GBL = {
|
||||
livestreams?: { [GeoChannelId]: GeoConfig },
|
||||
videos?: { [GeoChannelId]: GeoConfig }
|
||||
};
|
||||
|
||||
// ****************************************************************************
|
||||
// ****************************************************************************
|
||||
Vendored
-2
@@ -58,8 +58,6 @@ declare type GenericClaim = {
|
||||
},
|
||||
};
|
||||
|
||||
declare type ClaimId = string;
|
||||
|
||||
declare type GenericMetadata = {
|
||||
title?: string,
|
||||
description?: string,
|
||||
|
||||
Vendored
+4
-33
@@ -2,16 +2,9 @@ declare type Collection = {
|
||||
id: string,
|
||||
items: Array<?string>,
|
||||
name: string,
|
||||
description?: string,
|
||||
thumbnail?: {
|
||||
url?: string,
|
||||
},
|
||||
type: string,
|
||||
createdAt?: ?number,
|
||||
updatedAt: number,
|
||||
totalItems?: number,
|
||||
itemCount?: number,
|
||||
editsCleared?: boolean,
|
||||
sourceId?: string, // if copied, claimId of original collection
|
||||
};
|
||||
|
||||
@@ -24,40 +17,18 @@ declare type CollectionState = {
|
||||
saved: Array<string>,
|
||||
isResolvingCollectionById: { [string]: boolean },
|
||||
error?: string | null,
|
||||
queue: Collection,
|
||||
};
|
||||
|
||||
declare type CollectionGroup = {
|
||||
[string]: Collection,
|
||||
};
|
||||
|
||||
declare type CollectionList = Array<Collection>;
|
||||
|
||||
declare type CollectionCreateParams = {
|
||||
name: string,
|
||||
description?: string,
|
||||
thumbnail?: {
|
||||
url?: string,
|
||||
},
|
||||
items: ?Array<string>,
|
||||
type: string,
|
||||
sourceId?: string, // if copied, claimId of original collection
|
||||
};
|
||||
}
|
||||
|
||||
declare type CollectionEditParams = {
|
||||
uris?: Array<string>,
|
||||
claims?: Array<Claim>,
|
||||
remove?: boolean,
|
||||
claimIds?: Array<string>,
|
||||
replace?: boolean,
|
||||
order?: { from: number, to: number },
|
||||
type?: string,
|
||||
name?: string,
|
||||
description?: string,
|
||||
thumbnail?: {
|
||||
url?: string,
|
||||
},
|
||||
};
|
||||
|
||||
declare type CollectionFetchParams = {
|
||||
collectionId: string,
|
||||
pageSize?: number,
|
||||
};
|
||||
}
|
||||
Vendored
+44
-76
@@ -18,17 +18,6 @@ declare type Comment = {
|
||||
is_creator: boolean,
|
||||
is_global_mod: boolean,
|
||||
is_fiat?: boolean,
|
||||
removed?: boolean,
|
||||
};
|
||||
|
||||
declare type CommentSubmitParams = {
|
||||
comment: string,
|
||||
claim_id: string,
|
||||
parent_id?: string,
|
||||
txid?: ?string,
|
||||
payment_intent_id?: ?string,
|
||||
environment?: ?string,
|
||||
sticker: boolean,
|
||||
};
|
||||
|
||||
declare type PerChannelSettings = {
|
||||
@@ -37,12 +26,11 @@ declare type PerChannelSettings = {
|
||||
min_tip_amount_comment?: number,
|
||||
min_tip_amount_super_chat?: number,
|
||||
slow_mode_min_gap?: number,
|
||||
time_since_first_comment?: number,
|
||||
};
|
||||
|
||||
// todo: relate individual comments to their commentId
|
||||
declare type CommentsState = {
|
||||
commentsByUri: { [string]: string }, // URI -> claimId (TODO: remove)
|
||||
commentsByUri: { [string]: string },
|
||||
superChatsByUri: { [string]: { totalAmount: number, comments: Array<Comment> } },
|
||||
byId: { [string]: Array<string> }, // ClaimID -> list of fetched comment IDs.
|
||||
totalCommentsById: {}, // ClaimId -> ultimate total (including replies) in commentron.
|
||||
@@ -51,13 +39,12 @@ declare type CommentsState = {
|
||||
topLevelCommentsById: { [string]: Array<string> }, // ClaimID -> list of fetched top level comments.
|
||||
topLevelTotalPagesById: { [string]: number }, // ClaimID -> total number of top-level pages in commentron. Based on COMMENT_PAGE_SIZE_TOP_LEVEL.
|
||||
topLevelTotalCommentsById: { [string]: number }, // ClaimID -> total top level comments in commentron.
|
||||
commentById: { [string]: Comment }, // commentId -> Comment
|
||||
fetchedCommentAncestors: { [string]: Array<string> }, // {"fetchedCommentId": ["parentId", "grandParentId", ...]}
|
||||
commentById: { [string]: Comment },
|
||||
linkedCommentAncestors: { [string]: Array<string> }, // {"linkedCommentId": ["parentId", "grandParentId", ...]}
|
||||
pinnedCommentsById: {}, // ClaimId -> array of pinned comment IDs
|
||||
isLoading: boolean,
|
||||
isLoadingById: boolean,
|
||||
isLoadingByParentId: { [string]: boolean },
|
||||
isCommenting: boolean,
|
||||
myComments: ?Set<string>,
|
||||
isFetchingReacts: boolean,
|
||||
myReactsByCommentId: ?{ [string]: Array<string> }, // {"CommentId:MyChannelId": ["like", "dislike", ...]}
|
||||
@@ -66,42 +53,21 @@ declare type CommentsState = {
|
||||
moderationBlockList: ?Array<string>, // @KP rename to "personalBlockList"?
|
||||
adminBlockList: ?Array<string>,
|
||||
moderatorBlockList: ?Array<string>,
|
||||
moderatorBlockListDelegatorsMap: { [string]: Array<string> }, // {"blockedUri": ["delegatorUri1", ""delegatorUri2", ...]}
|
||||
moderatorBlockListDelegatorsMap: {[string]: Array<string>}, // {"blockedUri": ["delegatorUri1", ""delegatorUri2", ...]}
|
||||
fetchingModerationBlockList: boolean,
|
||||
moderationDelegatesById: { [string]: Array<{ channelId: string, channelName: string }> },
|
||||
fetchingModerationDelegates: boolean,
|
||||
moderationDelegatorsById: { [string]: { global: boolean, delegators: { name: string, claimId: string } } },
|
||||
moderationDelegatorsById: { [string]: { global: boolean, delegators: { name: string, claimId: string } }},
|
||||
fetchingModerationDelegators: boolean,
|
||||
blockingByUri: {},
|
||||
unBlockingByUri: {},
|
||||
personalTimeoutMap: { [uri: string]: { blockedAt: string, bannedFor: number, banRemaining: number } },
|
||||
adminTimeoutMap: { [uri: string]: { blockedAt: string, bannedFor: number, banRemaining: number } },
|
||||
moderatorTimeoutMap: { [uri: string]: { blockedAt: string, bannedFor: number, banRemaining: number } },
|
||||
togglingForDelegatorMap: { [string]: Array<string> }, // {"blockedUri": ["delegatorUri1", ""delegatorUri2", ...]}
|
||||
togglingForDelegatorMap: {[string]: Array<string>}, // {"blockedUri": ["delegatorUri1", ""delegatorUri2", ...]}
|
||||
settingsByChannelId: { [string]: PerChannelSettings }, // ChannelID -> settings
|
||||
fetchingSettings: boolean,
|
||||
fetchingBlockedWords: boolean,
|
||||
myCommentedChannelIdsById: { [string]: Array<string> }, // [content-claim-id] -> array of own channels IDs that have commented before.
|
||||
};
|
||||
|
||||
// Authorization parameters for calls requiring user authentication
|
||||
declare type Authorization = {
|
||||
channel_name: string,
|
||||
channel_id: string,
|
||||
signature: string,
|
||||
signing_ts: string,
|
||||
};
|
||||
|
||||
// ModAuthorization parameters for calls requiring creator/moderator authentication
|
||||
declare type ModAuthorization = {
|
||||
// Publisher, Moderator or Commentron Admin
|
||||
mod_channel_id: string,
|
||||
mod_channel_name: string,
|
||||
// Creator that Moderator is delegated from. Used for delegated moderation
|
||||
creator_channel_id: string,
|
||||
creator_channel_name: string,
|
||||
signature: string,
|
||||
signing_ts: string,
|
||||
};
|
||||
|
||||
declare type CommentReactParams = {
|
||||
@@ -125,7 +91,7 @@ declare type ReactionReactParams = {
|
||||
};
|
||||
|
||||
declare type ReactionReactResponse = {
|
||||
Reactions: { [string]: { [string]: number } },
|
||||
Reactions: { [string]: { [string]: number} },
|
||||
};
|
||||
|
||||
declare type ReactionListParams = {
|
||||
@@ -143,23 +109,23 @@ declare type ReactionListResponse = {
|
||||
};
|
||||
|
||||
declare type CommentListParams = {
|
||||
page: number, // pagination: which page of results
|
||||
page_size: number, // pagination: nr of comments to show in a page (max 200)
|
||||
claim_id?: string, // claim id of claim being commented on
|
||||
channel_name?: string, // signing channel name of claim (enables 'commentsEnabled' check)
|
||||
channel_id?: string, // signing channel claim id of claim (enables 'commentsEnabled' check)
|
||||
page: number, // pagination: which page of results
|
||||
page_size: number, // pagination: nr of comments to show in a page (max 200)
|
||||
claim_id?: string, // claim id of claim being commented on
|
||||
channel_name?: string, // signing channel name of claim (enables 'commentsEnabled' check)
|
||||
channel_id?: string, // signing channel claim id of claim (enables 'commentsEnabled' check)
|
||||
author_claim_id?: string, // filters comments to just this author
|
||||
parent_id?: ?string, // filters comments to those under this thread
|
||||
top_level?: boolean, // filters to only top level comments
|
||||
hidden?: boolean, // if true, will show hidden comments as well
|
||||
sort_by?: ?number, // @see: ui/constants/comments.js::SORT_BY
|
||||
parent_id?: string, // filters comments to those under this thread
|
||||
top_level?: boolean, // filters to only top level comments
|
||||
hidden?: boolean, // if true, will show hidden comments as well
|
||||
sort_by?: number, // @see: ui/constants/comments.js::SORT_BY
|
||||
};
|
||||
|
||||
declare type CommentListResponse = {
|
||||
items: Array<Comment>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items: number, // Grand total for the claim being commented on.
|
||||
total_items: number, // Grand total for the claim being commented on.
|
||||
total_filtered_items: number, // Total for filtered queries (e.g. top_level=true, parent_id=xxx, etc.).
|
||||
total_pages: number,
|
||||
has_hidden_comments: boolean,
|
||||
@@ -168,13 +134,13 @@ declare type CommentListResponse = {
|
||||
declare type CommentByIdParams = {
|
||||
comment_id: string,
|
||||
with_ancestors: boolean,
|
||||
};
|
||||
}
|
||||
|
||||
declare type CommentByIdResponse = {
|
||||
item: Comment,
|
||||
items: Comment,
|
||||
ancestors: Array<Comment>,
|
||||
};
|
||||
}
|
||||
|
||||
declare type CommentPinParams = {
|
||||
comment_id: string,
|
||||
@@ -183,34 +149,27 @@ declare type CommentPinParams = {
|
||||
remove?: boolean,
|
||||
signature: string,
|
||||
signing_ts: string,
|
||||
};
|
||||
}
|
||||
|
||||
declare type CommentPinResponse = {
|
||||
items: Comment, // "items" is an inherited typo to match SDK. Will be "item" in a new version.
|
||||
};
|
||||
}
|
||||
|
||||
declare type CommentEditParams = {
|
||||
comment: string,
|
||||
comment_id: string,
|
||||
signature: string,
|
||||
signing_ts: string,
|
||||
};
|
||||
}
|
||||
|
||||
declare type CommentEditResponse = Comment;
|
||||
declare type CommentEditResponse = Comment
|
||||
|
||||
declare type CommentAbandonParams = {
|
||||
comment_id: string,
|
||||
creator_channel_id?: string,
|
||||
creator_channel_name?: string,
|
||||
signature?: string,
|
||||
signing_ts?: string,
|
||||
mod_channel_id?: string,
|
||||
mod_channel_name?: string,
|
||||
};
|
||||
|
||||
declare type MentionedChannel = {
|
||||
channel_name: string,
|
||||
channel_id: string,
|
||||
channel_id?: string,
|
||||
hexdata?: string,
|
||||
};
|
||||
|
||||
declare type CommentCreateParams = {
|
||||
@@ -220,7 +179,6 @@ declare type CommentCreateParams = {
|
||||
signature: string,
|
||||
signing_ts: string,
|
||||
support_tx_id?: string,
|
||||
mentioned_channels?: Array<MentionedChannel>,
|
||||
};
|
||||
|
||||
declare type SuperListParams = {};
|
||||
@@ -245,11 +203,9 @@ declare type ModerationBlockParams = {
|
||||
// Creator that Moderator is delegated from. Used for delegated moderation
|
||||
creator_channel_id?: string,
|
||||
creator_channel_name?: string,
|
||||
// ID of comment to remove as part of this block
|
||||
offending_comment_id?: string,
|
||||
// Blocks identity from comment universally, requires Admin rights on commentron instance
|
||||
block_all?: boolean,
|
||||
time_out?: ?number,
|
||||
time_out?: number,
|
||||
// If true will delete all comments of the offender, requires Admin rights on commentron for universal delete
|
||||
delete_all?: boolean,
|
||||
// The usual signature stuff
|
||||
@@ -275,23 +231,36 @@ declare type BlockedListArgs = {
|
||||
signing_ts: string,
|
||||
};
|
||||
|
||||
declare type ModerationAddDelegateParams = Authorization & {
|
||||
declare type ModerationAddDelegateParams = {
|
||||
mod_channel_id: string,
|
||||
mod_channel_name: string,
|
||||
creator_channel_id: string,
|
||||
creator_channel_name: string,
|
||||
signature: string,
|
||||
signing_ts: string,
|
||||
};
|
||||
|
||||
declare type ModerationRemoveDelegateParams = Authorization & {
|
||||
declare type ModerationRemoveDelegateParams = {
|
||||
mod_channel_id: string,
|
||||
mod_channel_name: string,
|
||||
creator_channel_id: string,
|
||||
creator_channel_name: string,
|
||||
signature: string,
|
||||
signing_ts: string,
|
||||
};
|
||||
|
||||
declare type ModerationListDelegatesParams = Authorization;
|
||||
declare type ModerationListDelegatesParams = {
|
||||
creator_channel_id: string,
|
||||
creator_channel_name: string,
|
||||
signature: string,
|
||||
signing_ts: string,
|
||||
};
|
||||
|
||||
declare type ModerationAmIParams = {
|
||||
channel_name: string,
|
||||
channel_id: string,
|
||||
signature: string,
|
||||
signing_ts: string,
|
||||
signing_ts: string
|
||||
};
|
||||
|
||||
declare type SettingsParams = {
|
||||
@@ -320,8 +289,7 @@ declare type UpdateSettingsParams = {
|
||||
min_tip_amount_comment?: number,
|
||||
min_tip_amount_super_chat?: number,
|
||||
slow_mode_min_gap?: number,
|
||||
time_since_first_comment?: number,
|
||||
};
|
||||
}
|
||||
|
||||
declare type BlockWordParams = {
|
||||
channel_name: string,
|
||||
|
||||
Vendored
+2
-3
@@ -101,8 +101,8 @@ declare type ClaimSearchResponse = {
|
||||
items: Array<Claim>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items?: number,
|
||||
total_pages?: number,
|
||||
total_items: number,
|
||||
total_pages: number,
|
||||
};
|
||||
|
||||
declare type ClaimListResponse = {
|
||||
@@ -155,7 +155,6 @@ declare type CommentPinResponse = {
|
||||
declare type CommentAbandonResponse = {
|
||||
// keyed by the CommentId given
|
||||
abandoned: boolean,
|
||||
claim_id: string,
|
||||
};
|
||||
|
||||
declare type ChannelListResponse = {
|
||||
|
||||
Vendored
+93
@@ -0,0 +1,93 @@
|
||||
// @flow
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
|
||||
/*
|
||||
Toasts:
|
||||
- First-in, first-out queue
|
||||
- Simple messages that are shown in response to user interactions
|
||||
- Never saved
|
||||
- If they are the result of errors, use the isError flag when creating
|
||||
- For errors that should interrupt user behavior, use Error
|
||||
*/
|
||||
declare type ToastParams = {
|
||||
message: string,
|
||||
title?: string,
|
||||
linkText?: string,
|
||||
linkTarget?: string,
|
||||
isError?: boolean,
|
||||
};
|
||||
|
||||
declare type Toast = {
|
||||
id: string,
|
||||
params: ToastParams,
|
||||
};
|
||||
|
||||
declare type DoToast = {
|
||||
type: ACTIONS.CREATE_TOAST,
|
||||
data: Toast,
|
||||
};
|
||||
|
||||
/*
|
||||
Notifications:
|
||||
- List of notifications based on user interactions/app notifications
|
||||
- Always saved, but can be manually deleted
|
||||
- Can happen in the background, or because of user interaction (ex: publish confirmed)
|
||||
*/
|
||||
declare type Notification = {
|
||||
id: string, // Unique id
|
||||
dateCreated: number,
|
||||
isRead: boolean, // Used to display "new" notifications that a user hasn't seen yet
|
||||
source?: string, // The type/area an notification is from. Used for sorting (ex: publishes, transactions)
|
||||
// We may want to use priority/isDismissed in the future to specify how urgent a notification is
|
||||
// and if the user should see it immediately
|
||||
// isDissmied: boolean,
|
||||
// priority?: number
|
||||
};
|
||||
|
||||
declare type DoNotification = {
|
||||
type: ACTIONS.CREATE_NOTIFICATION,
|
||||
data: Notification,
|
||||
};
|
||||
|
||||
declare type DoEditNotification = {
|
||||
type: ACTIONS.EDIT_NOTIFICATION,
|
||||
data: {
|
||||
notification: Notification,
|
||||
},
|
||||
};
|
||||
|
||||
declare type DoDeleteNotification = {
|
||||
type: ACTIONS.DELETE_NOTIFICATION,
|
||||
data: {
|
||||
id: string, // The id to delete
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
Errors:
|
||||
- First-in, first-out queue
|
||||
- Errors that should interupt user behavior
|
||||
- For errors that can be shown without interrupting a user, use Toast with the isError flag
|
||||
*/
|
||||
declare type ErrorNotification = {
|
||||
title: string,
|
||||
text: string,
|
||||
};
|
||||
|
||||
declare type DoError = {
|
||||
type: ACTIONS.CREATE_ERROR,
|
||||
data: ErrorNotification,
|
||||
};
|
||||
|
||||
declare type DoDismissError = {
|
||||
type: ACTIONS.DISMISS_ERROR,
|
||||
};
|
||||
|
||||
/*
|
||||
NotificationState
|
||||
*/
|
||||
declare type NotificationState = {
|
||||
notifications: Array<Notification>,
|
||||
errors: Array<ErrorNotification>,
|
||||
toasts: Array<Toast>,
|
||||
};
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
// @flow
|
||||
|
||||
declare type UpdatePublishFormData = {
|
||||
filePath?: string,
|
||||
contentIsFree?: boolean,
|
||||
fee?: {
|
||||
amount: string,
|
||||
currency: string,
|
||||
},
|
||||
title?: string,
|
||||
thumbnail_url?: string,
|
||||
uploadThumbnailStatus?: string,
|
||||
thumbnailPath?: string,
|
||||
description?: string,
|
||||
language?: string,
|
||||
channel?: string,
|
||||
channelId?: string,
|
||||
name?: string,
|
||||
nameError?: string,
|
||||
bid?: string,
|
||||
bidError?: string,
|
||||
otherLicenseDescription?: string,
|
||||
licenseUrl?: string,
|
||||
licenseType?: string,
|
||||
uri?: string,
|
||||
nsfw: boolean,
|
||||
};
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
// @flow
|
||||
/* eslint-disable no-use-before-define */
|
||||
declare type GetState = () => any;
|
||||
declare type ThunkAction = (dispatch: Dispatch, getState: GetState) => any;
|
||||
declare type Dispatch = (action: {} | Promise<*> | Array<{}> | ThunkAction) => any; // Need to refer to ThunkAction
|
||||
/* eslint-enable */
|
||||
Vendored
+3
-31
@@ -1,37 +1,9 @@
|
||||
// @flow
|
||||
|
||||
declare type ContentState = {
|
||||
primaryUri: ?string,
|
||||
playingUri: {
|
||||
uri?: string,
|
||||
collection: PlayingCollection,
|
||||
},
|
||||
positions: { [string]: { [string]: number } }, // claimId: { outpoint: position }
|
||||
history: Array<WatchHistory>,
|
||||
recommendationId: { [string]: string }, // claimId: recommendationId
|
||||
recommendationParentId: { [string]: string }, // claimId: referrerId
|
||||
recommendationUrls: { [string]: Array<string> }, // claimId: [lbryUrls...]
|
||||
recommendationClicks: { [string]: Array<number> }, // "claimId": [clicked indices...]
|
||||
lastViewedAnnouncement: ?string, // undefined = not seen in wallet.
|
||||
recsysEntries: { [ClaimId]: RecsysEntry }, // Persistent shadow copy. The main one resides in RecSys.
|
||||
};
|
||||
|
||||
declare type WatchHistory = {
|
||||
uri: string,
|
||||
lastViewed: number,
|
||||
};
|
||||
|
||||
declare type PlayingUri = {
|
||||
uri?: ?string,
|
||||
primaryUri?: string,
|
||||
pathname?: string,
|
||||
uri: string,
|
||||
primaryUri: string,
|
||||
pathname: string,
|
||||
commentId?: string,
|
||||
collection: PlayingCollection,
|
||||
source?: string,
|
||||
};
|
||||
|
||||
declare type PlayingCollection = {
|
||||
collectionId?: ?string,
|
||||
loop?: ?boolean,
|
||||
shuffle?: ?{ newUrls: Array<string> },
|
||||
};
|
||||
Vendored
-5
@@ -1,5 +0,0 @@
|
||||
|
||||
declare type ListInjectedItem = {
|
||||
node: Node | (index: number, lastVisibleIndex: ?number, pageSize: ?number) => Node,
|
||||
index?: number,
|
||||
};
|
||||
Vendored
+1
-7
@@ -8,26 +8,20 @@ declare type HomepageObject = {
|
||||
|
||||
declare type HomepageData = {
|
||||
[string]: HomepageObject,
|
||||
default: (any) => any,
|
||||
default: any => any,
|
||||
};
|
||||
|
||||
declare type RowDataItem = {
|
||||
id: string,
|
||||
title: any,
|
||||
link?: string,
|
||||
help?: any,
|
||||
icon?: string,
|
||||
extra?: any,
|
||||
pinnedUrls?: Array<string>,
|
||||
pinnedClaimIds?: Array<string>, // takes precedence over pinnedUrls
|
||||
hideByDefault?: boolean,
|
||||
options?: {
|
||||
channelIds?: Array<string>,
|
||||
excludedChannelIds?: Array<string>,
|
||||
limitClaimsPerChannel?: number,
|
||||
pageSize?: number,
|
||||
releaseTime?: string,
|
||||
searchLanguages?: Array<string>,
|
||||
},
|
||||
route?: string,
|
||||
hideForUnauth?: boolean,
|
||||
|
||||
Vendored
-2
@@ -13,8 +13,6 @@ declare type LbryUrlObj = {
|
||||
primaryBidPosition?: number,
|
||||
secondaryBidPosition?: number,
|
||||
startTime?: number,
|
||||
queryString?: string,
|
||||
pathHash?: string,
|
||||
|
||||
// Below are considered deprecated and should not be used due to unreliableness with claim.canonical_url
|
||||
claimName?: string,
|
||||
|
||||
Vendored
+7
-10
@@ -18,27 +18,24 @@ declare type LivestreamReplayItem = {
|
||||
uploadedAt: string, // Date?
|
||||
},
|
||||
id: string,
|
||||
};
|
||||
}
|
||||
declare type LivestreamReplayData = Array<LivestreamReplayItem>;
|
||||
|
||||
declare type LivestreamState = {
|
||||
fetchingById: {},
|
||||
viewersById: {},
|
||||
fetchingActiveLivestreams: boolean | string,
|
||||
fetchingActiveLivestreams: boolean,
|
||||
activeLivestreams: ?LivestreamInfo,
|
||||
activeLivestreamsLastFetchedDate: number,
|
||||
activeLivestreamsLastFetchedOptions: {},
|
||||
activeLivestreamsLastFetchedFailCount: number,
|
||||
activeLivestreamInitialized: boolean,
|
||||
socketConnectionById: { [id: string]: { connected: ?boolean, sub_category: ?string } },
|
||||
};
|
||||
}
|
||||
|
||||
declare type LivestreamInfo = {
|
||||
[/* creatorId */ string]: {
|
||||
live: boolean,
|
||||
viewCount: number,
|
||||
creatorId: string,
|
||||
claimId: string,
|
||||
claimUri: string,
|
||||
},
|
||||
};
|
||||
latestClaimId: string,
|
||||
latestClaimUri: string,
|
||||
}
|
||||
}
|
||||
Vendored
+1
-53
@@ -11,16 +11,10 @@ import * as ACTIONS from 'constants/action_types';
|
||||
*/
|
||||
declare type ToastParams = {
|
||||
message: string,
|
||||
subMessage?: string,
|
||||
// title?: string,
|
||||
title?: string,
|
||||
linkText?: string,
|
||||
linkTarget?: string,
|
||||
isError?: boolean,
|
||||
duration?: 'default' | 'long',
|
||||
actionText?: string,
|
||||
action?: () => void,
|
||||
secondaryActionText?: string,
|
||||
secondaryAction?: () => void,
|
||||
};
|
||||
|
||||
declare type Toast = {
|
||||
@@ -97,49 +91,3 @@ declare type NotificationState = {
|
||||
errors: Array<ErrorNotification>,
|
||||
toasts: Array<Toast>,
|
||||
};
|
||||
|
||||
declare type WebNotification = {
|
||||
active_at: string,
|
||||
created_at: string,
|
||||
id: number,
|
||||
is_app_readable: boolean,
|
||||
is_device_notified: boolean,
|
||||
is_emailed: boolean,
|
||||
is_read: boolean,
|
||||
is_seen: boolean,
|
||||
notification_parameters: {
|
||||
device: {
|
||||
analytics_label: string,
|
||||
image_url: string,
|
||||
is_data_only: boolean,
|
||||
name: string,
|
||||
placeholders: ?string,
|
||||
target: string,
|
||||
text: string,
|
||||
title: string,
|
||||
type: string,
|
||||
},
|
||||
dynamic: {
|
||||
comment_author: string,
|
||||
comment_author_thumbnail?: string,
|
||||
reply_author: string,
|
||||
hash: string,
|
||||
claim_title: string,
|
||||
claim_thumbnail?: string,
|
||||
comment?: string,
|
||||
channel_url: string,
|
||||
channel_thumbnail?: string,
|
||||
},
|
||||
email: {},
|
||||
},
|
||||
notification_rule: string,
|
||||
type: string,
|
||||
updated_at: string,
|
||||
user_id: number,
|
||||
group_count?: number,
|
||||
};
|
||||
|
||||
declare type NotificationCategory = {
|
||||
name: string,
|
||||
types: ?Array<string>,
|
||||
};
|
||||
Vendored
-28
@@ -14,9 +14,6 @@ declare type UpdatePublishFormData = {
|
||||
thumbnailError?: boolean,
|
||||
description?: string,
|
||||
language?: string,
|
||||
releaseTime?: number,
|
||||
releaseTimeEdited?: number,
|
||||
releaseTimeError?: string,
|
||||
channel?: string,
|
||||
channelId?: string,
|
||||
name?: string,
|
||||
@@ -55,28 +52,3 @@ declare type PublishParams = {
|
||||
nsfw: boolean,
|
||||
tags: Array<Tag>,
|
||||
};
|
||||
|
||||
declare type TusUploader = any;
|
||||
|
||||
declare type FileUploadSdkParams = {
|
||||
file_path: string | File,
|
||||
claim_id: ?string,
|
||||
name: ?string,
|
||||
preview?: boolean,
|
||||
remote_url?: string,
|
||||
thumbnail_url?: string,
|
||||
title?: string,
|
||||
// Temporary values; remove when passing to SDK
|
||||
guid: string,
|
||||
uploadUrl?: string,
|
||||
};
|
||||
|
||||
declare type FileUploadItem = {
|
||||
params: FileUploadSdkParams,
|
||||
file: File,
|
||||
fileFingerprint: string,
|
||||
progress: string,
|
||||
status?: string,
|
||||
uploader?: TusUploader | XMLHttpRequest,
|
||||
resumable: boolean,
|
||||
};
|
||||
Vendored
-49
@@ -1,49 +0,0 @@
|
||||
declare type Recsys = {
|
||||
entries: { [ClaimId]: RecsysEntry },
|
||||
debug: boolean,
|
||||
|
||||
saveEntries: () => void,
|
||||
onClickedRecommended: (parentClaimId: ClaimId, newClaimId: ClaimId) => void,
|
||||
onRecsLoaded: (claimId: ClaimId, uris: Array<string>, uuid: string) => void,
|
||||
createRecsysEntry: (claimId: ClaimId, parentUuid?: ?string, uuid?: string) => void,
|
||||
updateRecsysEntry: (claimId: ClaimId, key: string, value: string) => void,
|
||||
sendRecsysEntry: (claimId: ClaimId, isTentative?: boolean) => ?Promise<?Response>,
|
||||
sendEntries: (entries: ?{ [ClaimId]: RecsysEntry }, isResumedSend: boolean) => void,
|
||||
onRecsysPlayerEvent: (claimId: ClaimId, event: RecsysPlaybackEvent, isEmbedded: boolean) => void,
|
||||
log: (callName: string, claimId: ClaimId) => void,
|
||||
onPlayerDispose: (claimId: ClaimId, isEmbedded: boolean, totalPlayingTime: number) => void,
|
||||
onNavigate: () => void,
|
||||
};
|
||||
|
||||
declare type RecsysEntry = {
|
||||
uuid: string,
|
||||
parentUuid?: string,
|
||||
claimId: string,
|
||||
uid?: number,
|
||||
deviceId?: number,
|
||||
pageLoadedAt: number, // UNIX timestamp (in UTC)
|
||||
pageExitedAt: number, // UNIX timestamp (in UTC)
|
||||
events: Array<RecsysPlaybackEvent>,
|
||||
recsysId: string, // Recommender that produced recs
|
||||
recClaimIds: Array<string>, // Recommendations
|
||||
recClickedVideoIdx: Array<number>, // Video clicked index
|
||||
isEmbed: boolean,
|
||||
remoteIp: any, // [bytes] Caller IP address
|
||||
tentative: boolean, // Visibility change rather than tab close
|
||||
autoplay: boolean, // Was the last human action before this?
|
||||
commentPulls: number, // How many comment pull calls did the user request?
|
||||
recorded_at: number,
|
||||
user_agent: string,
|
||||
accept_lang: string,
|
||||
tokenVerified: boolean,
|
||||
totalPlayTime: number,
|
||||
finalPlayPosition: number,
|
||||
incognito: number, // User not logged in.
|
||||
isResumedSend: boolean, // Data sent after browser is re-opened.
|
||||
};
|
||||
|
||||
declare type RecsysPlaybackEvent = {
|
||||
event: number, // 0 = start, 1 = stop, 2 = scrub, 3 = speed, 4 = end_of_play
|
||||
offset: number, // Where playback was at time of event
|
||||
arg: number,
|
||||
};
|
||||
Vendored
+2
-2
@@ -1,6 +1,6 @@
|
||||
// @flow
|
||||
|
||||
/* eslint-disable no-use-before-define */
|
||||
declare type GetState = () => any;
|
||||
declare type Dispatch = any;
|
||||
declare type ThunkAction = (dispatch: Dispatch, getState: GetState) => any;
|
||||
declare type Dispatch = (action: {} | Promise<*> | Array<{}> | ThunkAction) => any; // Need to refer to ThunkAction
|
||||
/* eslint-enable */
|
||||
Vendored
+3
-18
@@ -15,7 +15,7 @@ declare type SearchOptions = {
|
||||
MEDIA_IMAGE: string,
|
||||
MEDIA_APPLICATION: string,
|
||||
SORT: string,
|
||||
SORT_ASCENDING: string,
|
||||
SORT_ACCENDING: string,
|
||||
SORT_DESCENDING: string,
|
||||
EXACT: string,
|
||||
TIME_FILTER: string,
|
||||
@@ -28,18 +28,9 @@ declare type SearchOptions = {
|
||||
|
||||
declare type SearchState = {
|
||||
options: SearchOptions,
|
||||
resultsByQuery: { [string]: { uris: Array<string>, recsys: string, uuid: string } },
|
||||
results: Array<string>,
|
||||
resultsByQuery: {},
|
||||
hasReachedMaxResultsLength: {},
|
||||
searching: boolean,
|
||||
mentionQuery: string,
|
||||
personalRecommendations: { gid: string, uris: Array<string>, fetched: boolean },
|
||||
};
|
||||
|
||||
declare type SearchResults = {
|
||||
body: Array<{ name: string, claimId: string}>,
|
||||
poweredBy: string,
|
||||
uuid: string,
|
||||
};
|
||||
|
||||
declare type SearchSuccess = {
|
||||
@@ -49,8 +40,7 @@ declare type SearchSuccess = {
|
||||
from: number,
|
||||
size: number,
|
||||
uris: Array<string>,
|
||||
poweredBy: string,
|
||||
uuid: string,
|
||||
recsys: string,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -58,8 +48,3 @@ declare type UpdateSearchOptions = {
|
||||
type: ACTIONS.UPDATE_SEARCH_OPTIONS,
|
||||
data: SearchOptions,
|
||||
};
|
||||
|
||||
declare type FypParam = {
|
||||
gid: string,
|
||||
uuid: string,
|
||||
};
|
||||
Vendored
-1
@@ -13,7 +13,6 @@ declare type Following = {
|
||||
|
||||
declare type SubscriptionState = {
|
||||
subscriptions: Array<Subscription>,
|
||||
lastActiveSubscriptions: ?Array<Subscription>,
|
||||
following: Array<Following>,
|
||||
loading: boolean,
|
||||
firstRunCompleted: boolean,
|
||||
|
||||
Vendored
-17
@@ -1,17 +0,0 @@
|
||||
declare type SyncState = {
|
||||
hasSyncedWallet: boolean,
|
||||
syncHash: ?string,
|
||||
syncData: ?string,
|
||||
setSyncErrorMessage: ?string,
|
||||
getSyncErrorMessage: ?string,
|
||||
syncApplyErrorMessage: string,
|
||||
syncApplyIsPending: boolean,
|
||||
syncApplyPasswordError: boolean,
|
||||
getSyncIsPending: boolean,
|
||||
setSyncIsPending: boolean,
|
||||
prefsReady: boolean,
|
||||
syncLocked: boolean,
|
||||
sharedStateSyncId: number,
|
||||
hashChanged: boolean,
|
||||
fatalError: boolean,
|
||||
};
|
||||
Vendored
-42
@@ -32,46 +32,4 @@ declare type User = {
|
||||
odysee_live_enabled: boolean,
|
||||
odysee_live_disabled: boolean,
|
||||
global_mod: boolean,
|
||||
publish_id: ?number,
|
||||
is_odysee_user: boolean,
|
||||
location: ?string,
|
||||
};
|
||||
|
||||
declare type UserState ={
|
||||
authenticationIsPending: boolean,
|
||||
userIsPending: boolean,
|
||||
emailNewIsPending: boolean,
|
||||
emailNewErrorMessage: string,
|
||||
emailToVerify: string,
|
||||
emailAlreadyExists: boolean,
|
||||
emailDoesNotExist: boolean,
|
||||
resendingVerificationEmail: boolean,
|
||||
passwordResetPending: boolean,
|
||||
passwordResetSuccess: boolean,
|
||||
passwordResetError: ?string,
|
||||
passwordSetPending: boolean,
|
||||
passwordSetSuccess: boolean,
|
||||
passwordSetError: ?string,
|
||||
inviteNewErrorMessage: string,
|
||||
inviteNewIsPending: boolean,
|
||||
inviteStatusIsPending: boolean,
|
||||
invitesRemaining: ?number,
|
||||
invitees: ?Array<string>,
|
||||
referralLink: ?string,
|
||||
referralCode: ?string,
|
||||
user: ?User,
|
||||
youtubeChannelImportPending: boolean,
|
||||
youtubeChannelImportErrorMessage: string,
|
||||
referrerSetIsPending: boolean,
|
||||
referrerSetError: string,
|
||||
odyseeMembershipName: ?string, // undefined: not fetched, '': no membership
|
||||
odyseeMembershipsPerClaimIds: ?{ [string]: string },
|
||||
locale: ?LocaleInfo,
|
||||
};
|
||||
|
||||
declare type LocaleInfo = {
|
||||
continent: string,
|
||||
country: string,
|
||||
gdpr_required: boolean,
|
||||
is_eu_member: boolean,
|
||||
};
|
||||
+27
-51
@@ -1,60 +1,51 @@
|
||||
{
|
||||
"name": "odysee.com",
|
||||
"version": "0.0.0",
|
||||
"description": "Explore a whole universe of videos on Odysee from regular people just like you!",
|
||||
"name": "lbry",
|
||||
"version": "0.52.0-rc.5",
|
||||
"description": "A browser for the LBRY network, a digital marketplace controlled by its users.",
|
||||
"keywords": [
|
||||
"odysee"
|
||||
"lbry"
|
||||
],
|
||||
"license": "MIT",
|
||||
"homepage": "https://odysee.com",
|
||||
"homepage": "https://lbry.com/",
|
||||
"bugs": {
|
||||
"url": "https://github.com/OdyseeTeam/odysee-frontend/issues"
|
||||
"url": "https://github.com/lbryio/lbry-desktop/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/OdyseeTeam/odysee-frontend"
|
||||
"url": "https://github.com/lbryio/lbry-desktop"
|
||||
},
|
||||
"author": {
|
||||
"name": "Odysee Inc.",
|
||||
"email": "hello@odysee.com"
|
||||
"name": "LBRY Inc.",
|
||||
"email": "hello@lbry.com"
|
||||
},
|
||||
"main": "./dist/electron/main.js",
|
||||
"scripts": {
|
||||
"analyze": "source-map-explorer --only-mapped dist/electron/webpack/ui*.js --html dist/sourceMap.html",
|
||||
"compile:electron": "node --max_old_space_size=4096 ./node_modules/webpack/bin/webpack.js --config webpack.electron.config.js",
|
||||
"compile:web": "yarn copyenv && cd web && node --max_old_space_size=4096 ./node_modules/webpack/bin/webpack.js --config webpack.config.js",
|
||||
"compile": "cross-env NODE_ENV=production yarn compile:electron && cross-env NODE_ENV=production yarn compile:web",
|
||||
"compile": "cross-env NODE_ENV=production yarn compile:electron",
|
||||
"copyenv": "copyfiles ./.env* web/",
|
||||
"dev": "yarn dev:electron",
|
||||
"dev:electron": "cross-env NODE_ENV=development node ./electron/devServer.js",
|
||||
"dev:web": "yarn copyenv && cd web && yarn dev",
|
||||
"dev:web-server": "cross-env NODE_ENV=development yarn compile:web && concurrently \"cross-env NODE_ENV=development yarn compile:web --watch\" \"cd web && yarn dev:server\"",
|
||||
"dev:internal-apis": "LBRY_API_URL='http://localhost:8080' yarn dev:electron",
|
||||
"dev:iatv": "LBRY_API_URL='http://localhost:15400' SDK_API_URL='http://localhost:15100' yarn dev:web",
|
||||
"run:web-server": "cross-env NODE_ENV=production yarn compile:web && cd web && yarn dev:server",
|
||||
"pack": "electron-builder --dir",
|
||||
"dist": "electron-builder",
|
||||
"build": "cross-env NODE_ENV=production yarn compile:electron && electron-builder build",
|
||||
"build:dir": "yarn build -- --dir -c.compression=store -c.mac.identity=null",
|
||||
"crossenv": "./node_modules/cross-env/dist/bin/cross-env",
|
||||
"flow": "flow",
|
||||
"lint": "eslint 'ui/**/*.{js,jsx}' && eslint 'extras/**/*.{js,jsx}' && eslint 'web/**/*.{js,jsx}' && eslint 'electron/**/*.js' && flow",
|
||||
"lint-fix": "eslint --fix --quiet 'ui/**/*.{js,jsx}' && eslint --fix --quiet 'extras/**/*.{js,jsx}' && eslint --fix --quiet 'web/**/*.{js,jsx}' && eslint --fix --quiet 'electron/**/*.js'",
|
||||
"lint": "eslint 'ui/**/*.{js,jsx}' && eslint 'electron/**/*.js' && flow",
|
||||
"lint-fix": "eslint --fix --quiet 'ui/**/*.{js,jsx}' && eslint --fix --quiet 'electron/**/*.js'",
|
||||
"format": "prettier 'src/**/*.{js,jsx,scss,json}' --write",
|
||||
"flow-defs": "flow-typed install",
|
||||
"preinstall": "",
|
||||
"postinstall": "cd web && yarn && cd .. && if-env NODE_ENV=production && yarn postinstall:warning || if-env APP_ENV=web && echo 'Done installing deps' || yarn postinstall:electron",
|
||||
"postinstall:electron": "electron-builder install-app-deps && node ./build/downloadDaemon.js && node ./build/downloadLBRYFirst.js",
|
||||
"precommit": "lint-staged",
|
||||
"preinstall": "yarn cache clean lbry-redux && yarn cache clean lbryinc",
|
||||
"postinstall": "electron-builder install-app-deps && node ./build/downloadDaemon.js",
|
||||
"postinstall:warning": "echo '\n\nWARNING\n\nNot all node modules were installed because NODE_ENV is set to \"production\".\nThis should only be set after installing dependencies with \"yarn\". The app will not work.\n\n'"
|
||||
},
|
||||
"dependencies": {
|
||||
"@emotion/react": "^11.6.0",
|
||||
"@emotion/styled": "^11.6.0",
|
||||
"@mui/material": "^5.6.2",
|
||||
"@silvermine/videojs-airplay": "^1.1.0",
|
||||
"@silvermine/videojs-chromecast": "^1.3.3",
|
||||
"@ungap/from-entries": "^0.2.1",
|
||||
"auto-launch": "^5.0.5",
|
||||
"core-js-pure": "^3.19.3",
|
||||
"electron-dl": "^1.11.0",
|
||||
"electron-log": "^2.2.12",
|
||||
"electron-notarize": "^1.0.0",
|
||||
@@ -64,24 +55,17 @@
|
||||
"if-env": "^1.0.4",
|
||||
"match-sorter": "^6.3.0",
|
||||
"parse-duration": "^1.0.0",
|
||||
"player.js": "^0.1.0",
|
||||
"proxy-polyfill": "0.1.6",
|
||||
"re-reselect": "^4.0.0",
|
||||
"react-beautiful-dnd": "^13.1.0",
|
||||
"react-color": "^2.19.3",
|
||||
"react-datetime-picker": "^3.4.3",
|
||||
"react-datetime-picker": "^3.2.1",
|
||||
"react-plastic": "^1.1.1",
|
||||
"react-top-loading-bar": "^2.0.1",
|
||||
"remove-markdown": "^0.3.0",
|
||||
"rss": "^1.2.2",
|
||||
"source-map-explorer": "^2.5.2",
|
||||
"tempy": "^0.6.0",
|
||||
"tus-js-client": "^2.3.0",
|
||||
"videojs-contrib-ads": "^6.9.0",
|
||||
"videojs-ima": "^1.11.0",
|
||||
"videojs-ima-player": "^0.5.6",
|
||||
"videojs-logo": "^2.1.4",
|
||||
"videojs-vtt-thumbnails": "https://github.com/OdyseeTeam/videojs-vtt-thumbnails"
|
||||
"videojs-logo": "^2.1.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.0.0",
|
||||
@@ -97,12 +81,13 @@
|
||||
"@babel/preset-flow": "^7.12.1",
|
||||
"@babel/preset-react": "^7.0.0",
|
||||
"@babel/register": "^7.0.0",
|
||||
"@datapunt/matomo-tracker-js": "^0.1.4",
|
||||
"@exponent/electron-cookies": "^2.0.0",
|
||||
"@hot-loader/react-dom": "^16.13",
|
||||
"@reach/auto-id": "^0.13.0",
|
||||
"@reach/combobox": "^0.12.1",
|
||||
"@reach/menu-button": "0.8.6",
|
||||
"@reach/rect": "^0.16.0",
|
||||
"@reach/menu-button": "0.7.4",
|
||||
"@reach/rect": "^0.13.0",
|
||||
"@reach/tabs": "^0.1.5",
|
||||
"@reach/tooltip": "^0.12.1",
|
||||
"@reach/utils": "^0.12.1",
|
||||
@@ -145,7 +130,7 @@
|
||||
"electron-webpack": "^2.8.2",
|
||||
"electron-window-state": "^4.1.1",
|
||||
"emoji-dictionary": "^1.0.11",
|
||||
"eslint": "^7.5",
|
||||
"eslint": "^5.15.2",
|
||||
"eslint-config-prettier": "^2.9.0",
|
||||
"eslint-config-standard": "^12.0.0",
|
||||
"eslint-config-standard-jsx": "^6.0.2",
|
||||
@@ -179,7 +164,7 @@
|
||||
"node-libs-browser": "^2.1.0",
|
||||
"node-loader": "^0.6.0",
|
||||
"node-wget": "^0.4.3",
|
||||
"nodemon": "^2.0.15",
|
||||
"nodemon": "^1.19.1",
|
||||
"postcss-import": "^12.0.1",
|
||||
"postcss-loader": "^3.0.0",
|
||||
"postcss-rtl": "^1.7.3",
|
||||
@@ -193,7 +178,7 @@
|
||||
"react-awesome-lightbox": "^1.7.3",
|
||||
"react-confetti": "^4.0.1",
|
||||
"react-dom": "^16.8.2",
|
||||
"react-draggable": "^4.4.4",
|
||||
"react-draggable": "^3.3.0",
|
||||
"react-google-recaptcha": "^2.0.1",
|
||||
"react-hot-loader": "^4.11.1",
|
||||
"react-modal": "^3.1.7",
|
||||
@@ -230,7 +215,7 @@
|
||||
"unist-util-visit": "^2.0.3",
|
||||
"uuid": "^8.3.2",
|
||||
"vast-client": "^3.1.1",
|
||||
"video.js": "^7.19.2",
|
||||
"video.js": "^7.13.3",
|
||||
"videojs-contrib-quality-levels": "^2.0.9",
|
||||
"videojs-event-tracking": "^1.0.1",
|
||||
"villain-react": "^1.0.9",
|
||||
@@ -251,19 +236,10 @@
|
||||
"node": ">=7",
|
||||
"yarn": "^1.3"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged"
|
||||
}
|
||||
},
|
||||
"lbrySettings": {
|
||||
"lbrynetDaemonVersion": "0.99.0",
|
||||
"lbrynetDaemonVersion": "0.103.0",
|
||||
"lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-OSNAME.zip",
|
||||
"lbrynetDaemonDir": "static/daemon",
|
||||
"lbrynetDaemonFileName": "lbrynet",
|
||||
"LBRYFirstVersion": "0.0.20",
|
||||
"LBRYFirstUrlTemplate": "https://github.com/lbryio/lbry-first/releases/download/vLBRYFIRSTVER/lbry-first_OSNAME_amd64.zip",
|
||||
"LBRYFirstDir": "static/lbry-first",
|
||||
"LBRYFirstFileName": "lbry-first"
|
||||
"lbrynetDaemonFileName": "lbrynet"
|
||||
}
|
||||
}
|
||||
+393
-515
File diff suppressed because it is too large.
Load diff
@@ -1,71 +0,0 @@
|
||||
<svg width="134" height="147" viewBox="0 0 134 147" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0_401_2)">
|
||||
<path d="M127.05 60.42C126.14 54.65 124.11 51.79 121.68 51.79C120.45 51.79 120.61 52.98 120.23 54.37C120.17 54.59 120.14 54.81 120.15 55.04C120.15 55.18 120.43 67.99 112.02 75.37C111.26 74.74 110.28 74.21 109.11 74.21C108.14 74.21 106.74 74.57 105.55 76.31C105.21 76.81 105.04 77.35 104.94 77.86C100.48 69.38 88.3499 47.04 77.7799 34.03C76.1199 31.99 73.9599 30.84 72.2199 29.91C71.1399 29.34 70.1299 28.8 69.5999 28.23C67.4899 25.96 65.3299 23.35 63.0399 20.57C56.4199 12.54 48.3099 1.12002 33.3099 0.0500204C28.6199 -0.27998 16.8299 0.91002 9.0899 8.84002C-0.830095 19.01 -7.0101 32.15 14.4299 59.13C13.9299 61.8 13.7299 66.85 14.4499 71.99C14.6599 73.49 14.9399 74.96 15.2799 76.37C15.6699 78 16.1499 79.58 16.7099 81.06C18.2199 85.07 20.3199 88.52 22.9599 91.3C28.2399 96.87 35.5599 99.77 44.7399 99.93C45.0099 99.93 45.7299 99.93 45.7299 99.93C46.5399 99.93 47.3299 99.91 48.0999 99.9C48.5699 102.37 48.3799 104.48 48.1899 106.52C48.0899 107.56 47.9999 108.64 47.9999 109.67C47.9699 110.22 47.4499 113.1 46.9399 115.89C44.1099 131.51 43.5199 136.58 44.2999 138.47C44.3299 138.54 44.3599 138.61 44.3999 138.68C47.3499 144.13 55.4299 146.08 62.0099 146.08C66.3199 146.08 70.4399 145.28 73.5899 143.82C80.4699 140.65 82.5499 122.48 83.1599 110.09C83.6199 112.15 83.8899 114.35 83.9899 116.73C84.1099 119.58 83.9799 122.38 83.8599 124.88C83.6199 129.97 83.4199 133.99 85.4699 136.54C87.9199 139.61 98.1199 139.7 99.2799 139.7C103.56 139.7 109.3 139.15 112.37 136.52C117.03 132.53 119.99 118.17 116.67 106.34C115.12 100.81 113.37 95.8 111.21 90.77C111.6 90.61 111.97 90.45 112.33 90.28C121.35 86.05 129.4 75.17 127.06 60.4L127.05 60.42Z" fill="#4C150C"/>
|
||||
<path style="mix-blend-mode:color-dodge" d="M84.6699 50.5801C84.6699 60.5301 76.5999 68.6001 66.6499 68.6001C56.6999 68.6001 48.6299 60.5301 48.6299 50.5801C48.6299 40.6301 56.6999 32.5601 66.6499 32.5601C76.5999 32.5601 84.6699 40.6301 84.6699 50.5801Z" fill="url(#paint0_radial_401_2)"/>
|
||||
<path d="M46.0398 137.11C49.5898 143.66 64.2098 145.01 72.2998 141.27C81.0098 137.25 80.8098 99.02 80.8098 99.02C84.5198 104.7 85.6698 110.63 85.8998 116.13C86.0298 119.08 85.8998 121.89 85.7698 124.44C85.5498 129.01 85.3698 132.73 86.8798 134.62C88.7598 136.97 105.67 138.48 110.55 134.3C114.21 131.16 117.38 117.99 114.15 106.43C112.32 99.9 110.35 94.7 108.47 90.42C102.06 91.06 98.0898 91.01 97.9798 90.75C97.8798 90.53 103.34 90.29 107.84 89.01C107.27 87.76 106.72 86.59 106.19 85.48C105.58 84.21 104.99 83.04 104.44 81.93C102.13 77.31 87.6598 49.66 75.6798 34.91C73.2598 31.94 69.4098 31.17 67.5998 29.23C59.1798 20.21 52.3698 6.63001 39.1798 2.42001C34.8098 1.06001 19.6598 0.170009 10.3498 9.90001C1.03983 19.63 -10.7302 34.81 36.5098 79.19C53.9098 95.54 49.9098 102.76 49.9098 109.23C49.9098 110.96 44.9398 134.48 46.0398 137.12V137.11Z" fill="white"/>
|
||||
<path opacity="0.15" d="M31.1498 6.08997C31.1498 6.08997 5.84982 8.86997 13.2998 34.34C17.7198 49.45 29.3598 51.12 37.0998 47.28C44.1698 43.77 54.4298 37.34 55.8198 28.33C56.5698 23.43 49.8198 35.03 41.0298 30.7C32.8798 26.68 31.1498 6.08997 31.1498 6.08997V6.08997Z" fill="#B98353"/>
|
||||
<path d="M39.0699 6.70002C48.2699 9.12002 55.5099 22.09 55.0099 26.75C54.5199 31.41 44.4799 40.74 37.5799 44.07C30.0399 47.71 22.4799 44.94 16.0999 31.46C10.3399 19.29 22.6199 9.98002 22.6199 9.98002C22.6199 9.98002 29.8699 4.27002 39.0599 6.70002H39.0699ZM36.8999 9.78002C35.9599 9.45002 34.9099 9.87002 34.3999 10.72C34.3299 10.83 34.2699 10.96 34.2199 11.09C33.8099 12.19 34.3399 13.38 35.4099 13.75C37.5699 14.5 38.5399 15.23 39.9199 17.11C40.5799 18.03 41.8799 18.19 42.8099 17.48C43.7399 16.78 43.9599 15.45 43.2899 14.54C41.4399 11.99 39.8299 10.79 36.8899 9.77002L36.8999 9.78002ZM50.6899 25.58C50.6199 25.22 50.3299 24.35 49.2899 22.47C48.7399 21.48 47.4699 21.16 46.4699 21.76C46.1499 21.95 45.8899 22.21 45.7099 22.51C45.3299 23.15 45.2799 23.96 45.6499 24.63C46.4699 26.1 46.6399 26.65 46.6499 26.68C46.9699 27.75 48.0799 28.37 49.1599 28.05C50.2499 27.73 50.9199 26.65 50.6899 25.57V25.58Z" fill="#4C150C"/>
|
||||
<path d="M121.28 39.69L120.57 39.77C116.14 40.28 115.28 38.32 113.72 34.74L113.26 33.69C113.02 33.15 112.45 32.84 111.87 32.92C111.86 32.92 111.19 33.04 111.09 33.05C109.49 33.29 108.18 33.03 107.2 32.3C104.94 30.59 104.42 26.55 104.19 24.83L104.13 24.36C104.06 23.8 103.64 23.35 103.08 23.25L102.62 23.16C100.17 22.69 98.0899 17.94 97.5599 16.32L97.4799 16.06C97.3699 15.73 97.1399 15.46 96.8299 15.3L94.6599 14.2C94.6599 14.2 94.5899 14.17 94.5599 14.15C93.0499 13.53 91.2299 12.87 89.1799 12.64C85.7699 12.25 82.2699 12.77 79.1799 13.23C78.4999 13.33 77.7999 13.46 77.0499 13.62C76.8499 13.64 76.6499 13.66 76.4499 13.69C75.5299 13.83 74.6399 14.09 73.8799 14.44C72.4499 14.88 71.0199 15.41 69.6199 16.01C67.0099 17.14 64.9199 18.86 62.9099 20.51C62.4499 20.89 61.9799 21.27 61.5099 21.65C60.3899 22.54 59.3999 23.38 58.4899 24.24L58.3799 24.34C57.9599 24.74 57.5399 25.14 57.1499 25.55L57.0799 25.63C56.6999 26.03 56.3199 26.45 55.9099 26.92L55.6799 27.19C55.2499 27.7 54.8999 28.13 54.5799 28.57C52.8099 30.96 51.8599 33.39 50.8399 36.02C50.6999 36.39 50.5499 36.77 50.3999 37.15C50.0399 38.06 49.5499 39 49.0299 39.99C47.9599 42.03 46.8599 44.14 46.5799 46.57C46.1499 50.3 46.5299 54.2 46.9199 56.81C47.3999 60.05 47.9499 63.22 49.2899 66.34C50.5899 69.35 52.3899 72.34 54.4999 74.99C55.9899 76.86 58.0399 78.02 60.0199 79.13L60.3399 79.31C61.2199 80.64 62.5799 81.73 64.2799 82.48L64.3599 82.52C64.4699 82.57 64.5899 82.6 64.7099 82.62H64.7699C64.7699 82.62 64.9399 82.65 65.1099 82.66C66.7899 84.02 68.5399 85.38 70.8099 86.28C71.1799 86.43 71.5599 86.57 71.9299 86.71C72.7499 87.02 73.4999 87.28 74.2399 87.52C75.5199 87.93 76.6999 88.25 77.8699 88.49C78.2899 88.58 78.6999 88.65 79.1199 88.72C79.5399 88.79 79.9699 88.85 80.3999 88.9C80.8099 88.95 81.7599 89.06 81.7599 89.06C83.6999 89.3 85.7099 89.54 87.7799 89.52C88.7299 89.51 89.5999 89.44 90.4499 89.32C91.2999 89.2 92.1599 89 93.0699 88.74C95.0399 88.17 96.8699 87.35 98.6599 86.56L98.7699 86.51C99.1699 86.33 99.5599 86.16 99.9499 85.99C100.36 85.81 100.78 85.6 101.2 85.37C101.58 85.15 101.96 84.92 102.36 84.65C103.02 84.21 103.68 83.7 104.45 83.05C104.77 82.78 105.09 82.5 105.42 82.22L106.06 81.65C106.75 81.04 107.41 80.45 108.07 79.93C108.36 79.7 108.64 79.49 108.93 79.28C109.43 78.92 109.93 78.59 110.44 78.24C111.2 77.73 111.99 77.2 112.76 76.61C113.94 75.7 114.83 74.81 115.57 73.81L115.7 73.63C117.92 70.61 119.52 67.83 120.59 65.14C121.57 62.66 121.78 60.27 122 57.69C122.06 56.98 122.12 56.26 122.21 55.53C122.3 54.72 122.44 53.84 122.58 52.99C122.98 50.49 123.4 47.9 123.01 45.29C122.97 45 122.9 44.71 122.84 44.43L122.82 44.34L122.77 44.17C122.75 43.54 122.73 42.73 122.7 41.69L122.68 40.97C122.68 40.6 122.51 40.26 122.23 40.02C121.95 39.78 121.59 39.67 121.22 39.71L121.28 39.69Z" fill="#4C150C"/>
|
||||
<path d="M110.68 16.95C111.29 16.86 111.88 16.61 112.44 16.2C113.61 15.34 115.33 13.35 114.35 11.31C113.46 9.44999 110.65 8.62999 108.56 8.93999C107.81 9.04999 107.17 9.29999 106.67 9.67999C105.61 10.48 105.38 12.1 106.09 13.81C106.84 15.6 108.55 17.26 110.68 16.94V16.95Z" fill="#4C150C"/>
|
||||
<path d="M132.72 16.57C131.81 14.97 130.25 14.17 128.54 14.42C127.75 14.54 126.98 14.87 126.26 15.42C124.97 16.39 124.59 18.33 125.34 20.12C126.1 21.93 127.73 22.94 129.49 22.68C130.05 22.6 130.59 22.39 131.19 22.02C132.85 20.9 133.91 18.67 132.72 16.57V16.57Z" fill="#4C150C"/>
|
||||
<path d="M119.08 22.25C119.47 22.19 119.86 22.05 120.26 21.8C120.31 21.77 120.38 21.72 120.42 21.68C120.78 21.37 121.16 20.76 121.15 20.02C121.15 19.52 120.96 18.79 120.14 18.09C120.12 18.06 120.11 18.03 120.09 18.01C119.85 17.59 119.21 16.46 117.87 16.66C117.5 16.72 117.15 16.87 116.79 17.14C115.88 17.83 115.61 19.19 116.14 20.46C116.68 21.74 117.83 22.45 119.07 22.26L119.08 22.25Z" fill="#4C150C"/>
|
||||
<path d="M120.75 25.38C120.08 25.48 119.44 25.75 118.87 26.19C117.06 27.55 116.33 30.79 117.3 33.11C118.16 35.17 120.18 36.18 122.68 35.81C122.83 35.79 122.99 35.76 123.16 35.73L123.3 35.7C123.48 35.66 123.65 35.59 123.8 35.48L123.92 35.4C125.41 34.31 127.6 31.77 126.36 29.17C125.41 27.18 123.38 25 120.76 25.39L120.75 25.38Z" fill="#4C150C"/>
|
||||
<path d="M111.53 14.82C111.53 14.82 113.65 13.27 112.96 11.83C112.27 10.4 108.94 9.74999 107.58 10.77C106.22 11.79 108.68 16.88 111.52 14.81L111.53 14.82Z" fill="#A15E20"/>
|
||||
<path d="M131.01 17.4C130.22 16.01 128.79 15.82 127.43 16.85C126.06 17.88 127.51 21.84 130.1 20.26C130.1 20.26 131.94 19.03 131.01 17.4Z" fill="#A15E20"/>
|
||||
<path d="M119.51 20.5C119.51 20.5 120.28 19.83 119.15 18.92C118.81 18.65 118.59 17.37 117.63 18.09C116.67 18.81 117.69 21.61 119.51 20.5V20.5Z" fill="#A15E20"/>
|
||||
<path d="M120.04 27.62C118.31 28.92 117.8 34.71 122.75 33.68C122.75 33.68 125.45 31.7 124.58 29.87C123.71 28.04 121.77 26.31 120.04 27.62V27.62Z" fill="#A15E20"/>
|
||||
<path d="M112.07 44.49C110.41 43.47 109.04 41.98 108.52 39.86C99.9899 41.05 95.9599 32.49 96.7799 28.14C91.0599 23.78 90.8199 18.31 91.8899 15.13C90.9399 14.82 89.9699 14.57 88.9699 14.46C86.1699 14.14 83.2399 14.49 80.3199 14.92C80.8299 15.09 81.2399 15.34 81.4999 15.69C82.7299 17.36 79.5699 19.83 79.5699 19.83C75.2199 22.59 72.7599 18.09 73.9999 16.34C72.7799 16.73 71.5799 17.19 70.4199 17.69C67.4899 18.96 65.1999 21.12 62.7499 23.07C62.1999 23.51 61.6699 23.95 61.1499 24.4H61.1599C60.7099 24.77 60.2799 25.16 59.8499 25.55C59.8099 25.58 59.7799 25.62 59.7399 25.65C59.3399 26.03 58.9499 26.41 58.5699 26.8C58.5499 26.82 58.5299 26.84 58.5099 26.86C58.1399 27.25 57.7699 27.65 57.4199 28.06C57.3499 28.15 57.2699 28.23 57.1999 28.32C56.8499 28.74 56.4999 29.16 56.1799 29.61C55.9499 29.93 55.7299 30.24 55.5199 30.56C55.1099 31.2 54.7499 31.85 54.4199 32.51C54.0899 33.17 53.7899 33.85 53.5099 34.53C53.0799 35.56 52.6799 36.63 52.2499 37.73C51.9599 38.46 51.6099 39.18 51.2399 39.9C51.0499 40.26 50.8599 40.63 50.6699 40.99C50.5699 41.17 50.4799 41.35 50.3899 41.54C50.0899 42.12 49.7999 42.71 49.5399 43.3C49.7399 43.13 49.9599 42.99 50.1999 42.89C50.8699 42.62 51.4399 42.77 51.9199 43.1C52.8899 43.76 53.4399 45.12 53.4399 45.12C54.0199 47.29 53.0299 48.75 51.7899 49.44C50.5499 50.12 49.0599 50.03 48.6199 49.09C48.5399 48.93 48.4799 48.75 48.4199 48.56C48.3099 51.11 48.5099 53.83 48.8899 56.38C49.0399 57.38 49.1999 58.37 49.3799 59.33V59.37L50.3399 61.07L52.3799 62.49L54.9699 63.37L57.0099 64.07L55.2699 63.99L53.1899 63.89L51.2199 63.57L50.1699 62.73C50.2199 62.91 50.2699 63.08 50.3199 63.26C50.5499 63.99 50.8099 64.71 51.1199 65.42C51.9099 67.25 52.8899 69.05 53.9799 70.73C54.3099 71.23 54.6499 71.73 54.9899 72.21C55.3399 72.69 55.6899 73.17 56.0599 73.62C56.2399 73.85 56.4399 74.07 56.6499 74.28C56.8599 74.49 57.0799 74.69 57.3099 74.89C57.6199 75.15 57.9399 75.39 58.2699 75.62C58.5999 75.85 58.9499 76.07 59.2999 76.29C59.8299 76.61 60.3699 76.92 60.9199 77.22C61.1999 77.38 61.4799 77.54 61.7699 77.7C60.4699 75.34 61.4699 72.79 63.1999 72.75C65.7099 72.69 69.1799 76.33 68.7699 78.65C68.4899 80.25 66.8499 80.54 65.8499 80.56C67.6299 82.01 69.3399 83.43 71.5599 84.3C74.4599 85.45 77.4799 86.43 80.6499 86.8C81.4199 86.89 82.1999 86.99 82.9899 87.08C83.7799 87.17 84.5799 87.26 85.3799 87.32C85.7799 87.35 86.1799 87.37 86.5799 87.39C87.7899 87.44 88.9999 87.4 90.1999 87.22C90.5999 87.16 90.9999 87.09 91.3899 87C91.7799 86.91 92.1699 86.81 92.5599 86.7C93.7199 86.36 94.8499 85.93 95.9499 85.46C97.0599 84.99 98.1399 84.5 99.1999 84.04C100.3 83.56 101.31 82.9 102.28 82.16C102.6 81.91 102.92 81.66 103.23 81.39C104.11 80.65 104.97 79.87 105.82 79.13C106.18 78.82 106.53 78.52 106.89 78.24C107.64 77.64 108.42 77.12 109.19 76.6C110.33 75.83 111.47 75.08 112.48 74.18C113.04 73.68 113.57 73.12 114.04 72.49C114.25 72.3 114.46 72.08 114.67 71.84L113.7 72.26L109.72 72.14L104.52 70.58L106.65 67.52L106.05 65.88L103.5 63.06C103.5 63.06 105.59 64.48 106.5 65.51C107.41 66.54 107.41 67.86 107.27 67.93C107.13 68 105.61 70.1 105.61 70.1L110.61 71.64H110.71C110.09 71.46 109.59 71.08 109.33 70.53C108.27 68.29 110.4 63.04 112.79 62.06C115.18 61.08 115.7 65.98 115.7 65.98C115.63 69.03 114.36 70.71 112.96 71.38L114.31 71.24L115.56 70.66C118.14 66.96 120.42 60.51 120.45 57.67C120.49 54.28 121.34 48.2 121.34 48.2L120.52 46.29C115.62 46.07 112.07 44.46 112.07 44.46V44.49ZM87.1799 23.52C87.9799 23.77 88.0599 24.32 88.0999 24.52C88.2399 25.25 88.5699 25.5 88.2799 25.93C87.6899 26.78 86.3699 25.91 86.3699 25.91C85.9099 25.61 85.6299 25.21 85.5399 24.87C85.1499 23.44 86.3999 23.27 87.1799 23.51V23.52ZM66.5799 58.76C66.5199 60.15 66.0599 60.72 65.3199 61.34C63.8299 62.59 61.8599 60.39 61.8599 60.39C61.1699 59.62 60.8599 58.76 60.8599 58.11C60.8299 55.33 63.5599 54.41 64.6499 55.5C65.3299 56.17 66.6499 57.38 66.5899 58.76H66.5799ZM69.9899 42.47C69.2199 43.43 68.5899 43.6 67.7299 43.66C65.9999 43.78 65.7399 41.16 65.7399 41.16C65.6499 40.25 65.8799 39.47 66.2199 39C67.6599 37 70.0999 37.76 70.3099 39.12C70.4399 39.96 70.7599 41.52 69.9899 42.48V42.47ZM68.0499 23.29L66.7199 25.77L62.2699 28.51L59.5099 32.12L56.2799 38.42L58.8199 31.82C58.8199 31.82 61.1099 28.1 61.5999 27.75C62.0899 27.41 66.0899 25.19 66.0899 25.19L67.7899 22.62L71.2599 21.04L68.0499 23.3V23.29ZM87.2499 79.46C87.1999 80.52 86.8599 80.95 86.2899 81.43C85.1599 82.39 83.6499 80.7 83.6499 80.7C83.1199 80.11 82.8899 79.46 82.8899 78.96C82.8699 76.84 84.3699 77.36 85.3599 77.98C86.3799 78.61 87.2999 78.4 87.2499 79.46ZM90.4399 62.33L86.2199 62.25L85.4899 61.92C85.1199 61.83 84.7499 61.65 84.3799 61.42L83.4499 60.99L81.8899 60.71L80.1699 59.7L77.1999 58.47L82.3499 60.04C82.3499 60.04 82.6399 60.11 83.0299 60.22C81.4599 58.42 80.4399 55.69 81.1599 54.08C82.2299 51.69 86.4299 52.69 86.4299 52.69C88.6599 53.2 89.6999 54.95 89.9399 56.3C90.3299 58.41 88.9399 60.55 87.4299 61.49C88.2399 61.71 88.9599 61.9 88.9599 61.9L92.7999 61.13L90.4399 62.34V62.33ZM94.9099 40.96C94.7599 42.34 92.0799 42.13 92.0Line truncated
|
||||
<path d="M119.89 46.6499C119.89 46.6499 116.68 46.8199 114.52 46.1299L112.35 45.4399C112.35 45.4399 114.52 47.3499 113.82 52.2899C113.12 57.2299 112.09 58.4399 111.39 58.7899C110.69 59.1399 108.96 61.9999 108.96 61.9999C108.96 61.9999 110.69 60.5299 112.77 61.0499C114.85 61.5699 117.88 64.8599 116.76 67.5499L115.63 70.2399C115.63 70.2399 119.18 63.6499 119.62 60.6199C120.06 57.5899 120.14 52.1299 120.49 50.9999C120.84 49.8699 120.75 47.0099 119.88 46.6699L119.89 46.6499Z" fill="#954A04"/>
|
||||
<path d="M75.1299 17.04C74.7699 18.45 75.4299 19.44 76.1399 19.64C76.1399 19.64 75.0999 17.2 76.8699 15.48C76.8699 15.48 75.4899 15.63 75.1299 17.04V17.04ZM67.3999 41.57C67.1199 40.52 67.2699 39.06 67.6899 38.34C67.6899 38.34 66.4899 39.25 66.6899 40.81C66.8899 42.37 67.3099 42.91 68.0899 43C68.8699 43.09 68.9599 42.83 68.9599 42.83C68.9599 42.83 67.6799 42.61 67.3999 41.56V41.57ZM85.2599 80.34C84.5399 79.76 83.8999 78.67 83.8299 77.96C83.8299 77.96 83.4599 79.2 84.3899 80.18C85.3199 81.16 85.8799 81.32 86.4699 80.98C87.0599 80.64 86.9899 80.43 86.9899 80.43C86.9899 80.43 85.9899 80.93 85.2699 80.34H85.2599ZM92.0399 40.9C91.5499 40.55 90.7299 39.72 91.3099 38.12C91.3099 38.12 90.4799 38.8 90.6399 39.88C90.7999 40.96 91.7899 41.37 92.4399 41.54C93.0899 41.71 92.5299 41.26 92.0399 40.91V40.9ZM85.2699 60.42C82.7499 56.43 84.3199 53.36 84.3199 53.36C84.3199 53.36 82.5199 52.65 82.2399 55.53C81.9599 58.41 85.2699 60.42 85.2699 60.42ZM62.5599 75.31C62.5599 75.31 63.1499 78.07 65.2699 78.64C67.3799 79.21 67.8799 78.64 67.8799 78.64C67.8799 78.64 66.4399 78.31 65.0999 77.55C64.0099 76.93 63.0499 75.95 62.5599 75.32V75.31ZM50.8399 43.35C50.8399 43.35 49.3999 43.94 49.2399 46.23C49.0699 48.52 50.4399 49.1 50.4399 49.1C50.4399 49.1 49.8899 47.47 50.0799 46.01C50.2799 44.42 50.8399 43.36 50.8399 43.36V43.35ZM65.3999 60.83C66.1699 60.39 66.0799 60.1 66.0799 60.1C66.0799 60.1 64.7699 60.75 63.8199 59.98C62.8799 59.21 62.0299 57.79 61.9399 56.85C61.9399 56.85 61.4499 58.47 62.6699 59.76C63.8899 61.05 64.6299 61.26 65.3999 60.82V60.83ZM112.85 62.47C112.85 62.47 110.89 63.66 110.07 66.44C109.25 69.22 109.91 70.43 110.65 70.62C111.39 70.81 111.03 70.38 110.85 69.92C110.67 69.46 110.43 66.32 111.68 64.71C112.94 63.1 113.68 62.81 112.84 62.48L112.85 62.47ZM121.31 41.37C115.12 42.09 113.87 38.42 112.19 34.61C104.48 35.96 103.23 28.26 102.78 24.74C98.5999 23.94 96.2199 16.58 96.2199 16.58L94.3499 15.62C93.2799 18.63 93.6099 23.59 99.3099 26.73C98.5699 30.87 100.16 39.47 110.33 37.76C111.63 44.67 119.77 44.88 121.4 44.43C121.38 43.75 121.31 42.12 121.31 41.37V41.37Z" fill="#64352C"/>
|
||||
<path d="M94.9099 17.86C94.9099 17.86 95.1499 22.86 97.8199 24.5L100.5 26.13C100.5 26.13 99.7199 31.27 102.09 34.11C105.92 38.72 110.35 36.44 110.35 36.44C110.35 36.44 110.35 39.79 113.52 42.06C116.69 44.33 120.91 44.01 120.91 44.01L120.65 42.93C120.65 42.93 114.6 42.51 113.01 39.3C111.42 36.09 111.14 35.62 111.14 35.62C111.14 35.62 105.66 35.62 103.7 33.38C101.74 31.13 102.02 25.51 102.02 25.51C102.02 25.51 96.9499 23.02 96.7699 19.09C96.6999 18.59 94.8999 17.88 94.8999 17.88L94.9099 17.86Z" fill="#844A04"/>
|
||||
<path d="M51.91 43.1C52.39 40.07 54.44 37.33 55.55 34.53C56.72 31.58 57.61 28.93 59.48 26.4C60.01 25.69 60.57 25.01 61.15 24.37C60.7 24.75 60.27 25.14 59.84 25.54C59.8 25.57 59.77 25.61 59.73 25.64C59.33 26.02 58.94 26.4 58.56 26.79C58.54 26.81 58.52 26.83 58.5 26.85C58.13 27.24 57.76 27.64 57.41 28.05C57.34 28.14 57.26 28.22 57.19 28.31C56.84 28.73 56.49 29.15 56.17 29.6C55.94 29.92 55.72 30.23 55.51 30.55C55.1 31.19 54.74 31.84 54.41 32.5C54.08 33.16 53.78 33.84 53.5 34.52C53.07 35.55 52.67 36.62 52.24 37.72C51.95 38.45 51.6 39.17 51.23 39.89C51.04 40.25 50.85 40.62 50.66 40.98C50.56 41.16 50.47 41.34 50.38 41.53C50.08 42.11 49.79 42.7 49.53 43.29C49.73 43.12 49.95 42.98 50.19 42.88C50.86 42.61 51.43 42.76 51.91 43.09V43.1Z" fill="#B98353"/>
|
||||
<path d="M52.3599 62.5001L54.9499 63.3801C54.7699 63.0001 54.5899 62.6101 54.4199 62.2301C53.1899 59.4001 52.6599 56.3901 52.1899 53.1901C52.0099 51.9701 51.8699 50.7101 51.7799 49.4401C50.5399 50.1201 49.0499 50.0301 48.6099 49.0901C48.5299 48.9301 48.4699 48.7501 48.4099 48.5601C48.2999 51.1101 48.4999 53.8301 48.8799 56.3801C49.0299 57.4001 49.1899 58.3901 49.3699 59.3701L50.3199 61.0701L52.3599 62.4901V62.5001Z" fill="#B98353"/>
|
||||
<path d="M110.2 75.05C107.76 76.99 105.44 79.58 102.51 80.85C101.33 81.36 100.11 81.92 98.8799 82.43C97.1599 83.14 95.3699 83.76 93.5099 84.04C90.3099 84.52 87.0299 83.96 83.9699 83.61C80.7999 83.25 77.7799 82.26 74.8799 81.11C71.9299 79.94 69.3499 75.61 66.8299 73.74C64.2999 71.87 61.3499 72.9 59.3799 70.43C57.8299 68.48 56.4199 66.29 55.2699 63.99L53.1899 63.89L51.2199 63.57L50.1699 62.73C50.2199 62.91 50.2699 63.08 50.3199 63.26C50.5499 63.99 50.8099 64.71 51.1199 65.42C51.9099 67.25 52.8899 69.05 53.9799 70.73C54.6399 71.74 55.3399 72.71 56.0599 73.63C56.4299 74.09 56.8499 74.51 57.3099 74.9C57.6199 75.16 57.9399 75.4 58.2699 75.63C58.5999 75.86 58.9499 76.08 59.2999 76.3C59.8299 76.62 60.3699 76.93 60.9199 77.23C61.1999 77.39 61.4799 77.55 61.7699 77.71C60.4699 75.35 61.4699 72.8 63.1999 72.76C65.7099 72.7 69.1799 76.34 68.7699 78.66C68.4899 80.26 66.8499 80.55 65.8499 80.57C67.6299 82.02 69.3399 83.44 71.5599 84.31C74.4599 85.46 77.4799 86.44 80.6499 86.81C81.4199 86.9 82.1999 87 82.9899 87.09C83.7799 87.18 84.5799 87.27 85.3799 87.33C85.7799 87.36 86.1799 87.38 86.5799 87.4C87.7899 87.45 88.9999 87.41 90.1999 87.23C90.5999 87.17 90.9999 87.1 91.3899 87.01C91.7799 86.92 92.1699 86.82 92.5599 86.71C93.7199 86.37 94.8499 85.94 95.9499 85.47C97.0599 85 98.1399 84.51 99.1999 84.05C100.3 83.57 101.31 82.91 102.28 82.17C102.6 81.92 102.92 81.67 103.23 81.4C104.11 80.66 104.97 79.88 105.82 79.14C106.18 78.83 106.53 78.53 106.89 78.25C107.64 77.65 108.42 77.13 109.19 76.61C110.33 75.84 111.47 75.09 112.48 74.19C113.04 73.69 113.57 73.13 114.04 72.5C114.11 72.4 114.18 72.3 114.25 72.21C113.79 72.54 113.32 72.86 112.84 73.18C111.96 73.77 111.07 74.37 110.21 75.06L110.2 75.05Z" fill="#B98353"/>
|
||||
<path d="M111.14 73.6901C111.14 73.6901 107.76 74.0401 101.17 72.4801C98.6698 71.8901 98.9998 70.7501 94.2398 71.2701C89.4798 71.7901 89.8698 84.2501 85.7498 82.8801C83.1598 82.0201 82.1898 79.6301 75.4398 80.8901C73.3098 81.2901 72.7498 80.6301 72.7498 80.6301L70.0598 81.6701C70.0598 81.6701 72.7498 85.0501 74.6498 84.1801C76.5498 83.3101 79.1598 87.3901 82.9698 87.5601C86.7798 87.7301 94.9298 86.9501 98.4798 85.2201C102.03 83.4901 109.23 76.2901 110.7 75.3401C112.17 74.3901 114.24 72.2101 114.24 72.2101L111.14 73.6901V73.6901Z" fill="#954A04"/>
|
||||
<path d="M68.77 30.9701C68.77 30.9701 69.4 31.3801 69.68 30.9701C69.82 30.7701 69.66 30.6401 69.6 30.3001C69.58 30.2001 69.54 29.9401 69.16 29.8201C68.79 29.7101 68.19 29.7901 68.38 30.4701C68.42 30.6301 68.55 30.8201 68.77 30.9601V30.9701Z" fill="#B98353"/>
|
||||
<path d="M92.93 29.88C93.29 30.02 93.89 29.98 93.76 29.29C93.73 29.13 93.61 28.93 93.4 28.77C93.4 28.77 92.8 28.31 92.49 28.7C92.33 28.89 92.49 29.03 92.52 29.37C92.53 29.47 92.55 29.73 92.92 29.88H92.93Z" fill="#B98353"/>
|
||||
<path d="M109.4 12.33C109.37 12.17 109.25 11.97 109.04 11.81C109.04 11.81 108.44 11.35 108.13 11.74C107.97 11.93 108.13 12.07 108.16 12.41C108.17 12.51 108.19 12.77 108.56 12.92C108.92 13.06 109.52 13.02 109.39 12.33H109.4Z" fill="#B98353"/>
|
||||
<path d="M120.26 30.3501C120.06 30.5001 120.18 30.6601 120.13 31.0101C120.12 31.1101 120.07 31.3701 120.4 31.6001C120.72 31.8201 121.31 31.9301 121.34 31.2301C121.34 31.0601 121.28 30.8401 121.12 30.6401C121.12 30.6401 120.65 30.0501 120.26 30.3501Z" fill="#B98353"/>
|
||||
<path d="M128.72 17.93C128.51 17.6 128.01 17.27 127.71 17.91C127.64 18.06 127.61 18.29 127.68 18.54C127.68 18.54 127.88 19.26 128.36 19.14C128.6 19.08 128.56 18.88 128.74 18.58C128.79 18.49 128.93 18.27 128.72 17.93V17.93Z" fill="#B98353"/>
|
||||
<path d="M117.63 18.87C117.59 18.94 117.58 19.08 117.62 19.27C117.62 19.27 117.73 19.79 117.99 19.86C118.12 19.9 118.18 19.81 118.27 19.67C118.3 19.63 118.29 19.48 118.17 19.2C118.06 18.92 117.79 18.56 117.63 18.87Z" fill="#B98353"/>
|
||||
<path d="M77.0599 41.5901C77.2399 41.5201 77.4399 41.3501 77.5799 41.0801C77.5799 41.0801 77.9799 40.3101 77.4799 40.0401C77.2299 39.9001 77.1099 40.1001 76.7199 40.2101C76.6099 40.2401 76.3099 40.3201 76.2199 40.7701C76.1299 41.2101 76.2999 41.8801 77.0499 41.5901H77.0599Z" fill="#B98353"/>
|
||||
<path d="M61.62 67.1C61.25 66.99 60.65 67.07 60.84 67.75C60.88 67.91 61.01 68.1 61.23 68.24C61.23 68.24 61.86 68.65 62.14 68.24C62.28 68.04 62.12 67.92 62.06 67.57C62.04 67.47 62 67.21 61.62 67.09V67.1Z" fill="#B98353"/>
|
||||
<path d="M59.6099 47.76C59.4799 47.87 59.3599 48.06 59.3199 48.32C59.3199 48.32 59.1999 49.06 59.6899 49.15C59.9299 49.2 59.9799 49 60.2699 48.8C60.3499 48.74 60.5699 48.6 60.5199 48.2C60.4699 47.81 60.1499 47.31 59.6099 47.76Z" fill="#B98353"/>
|
||||
<path d="M86.38 71.03C86.62 71.08 86.67 70.88 86.96 70.68C87.04 70.62 87.26 70.48 87.21 70.08C87.16 69.69 86.84 69.19 86.3 69.64C86.17 69.75 86.05 69.94 86.01 70.2C86.01 70.2 85.89 70.94 86.38 71.03V71.03Z" fill="#B98353"/>
|
||||
<path d="M84.0999 33.8C84.2199 33.82 84.2399 33.73 84.3899 33.62C84.4299 33.59 84.5399 33.52 84.5199 33.32C84.4899 33.13 84.3299 32.87 84.0599 33.1C83.9999 33.15 83.9399 33.25 83.9199 33.38C83.9199 33.38 83.8599 33.75 84.1099 33.8H84.0999Z" fill="#B98353"/>
|
||||
<path d="M86.2698 19.3C86.3898 19.32 86.4198 19.22 86.5598 19.12C86.5998 19.09 86.7098 19.02 86.6898 18.82C86.6598 18.63 86.4998 18.37 86.2298 18.6C86.1698 18.65 86.1098 18.75 86.0898 18.88C86.0898 18.88 86.0298 19.25 86.2798 19.3H86.2698Z" fill="#B98353"/>
|
||||
<path d="M101.78 76.52C101.78 76.52 102.39 76.62 102.35 76.18C102.33 75.96 102.15 75.97 101.91 75.77C101.84 75.71 101.67 75.56 101.34 75.69C101.02 75.82 100.66 76.22 101.17 76.58C101.29 76.66 101.54 76.55 101.78 76.52Z" fill="#B98353"/>
|
||||
<path d="M116.24 58.55C116.01 58.55 116.01 58.74 115.78 58.98C115.72 59.05 115.54 59.22 115.66 59.57C115.78 59.91 116.17 60.31 116.57 59.8C116.67 59.68 116.56 59.41 116.54 59.17C116.54 59.17 116.68 58.54 116.23 58.55H116.24Z" fill="#B98353"/>
|
||||
<path d="M96.6299 55.82C96.6299 55.82 97.4599 55.96 97.4199 55.36C97.3999 55.06 97.1499 55.07 96.8199 54.8C96.7199 54.72 96.4899 54.51 96.0399 54.69C95.5999 54.87 95.1099 55.41 95.8099 55.9C95.9799 56.02 96.3199 55.85 96.6399 55.82H96.6299Z" fill="#B98353"/>
|
||||
<path d="M118.99 48.36C118.89 48.28 118.66 48.07 118.21 48.25C117.77 48.43 117.28 48.97 117.98 49.46C118.15 49.58 118.49 49.41 118.81 49.38C118.81 49.38 119.64 49.52 119.6 48.92C119.58 48.62 119.33 48.63 119 48.36H118.99Z" fill="#B98353"/>
|
||||
<path d="M74.3298 71.46C74.4698 71.49 74.4998 71.37 74.6598 71.26C74.7098 71.23 74.8398 71.14 74.8098 70.91C74.7798 70.68 74.5898 70.39 74.2798 70.65C74.2098 70.71 74.1398 70.83 74.1098 70.98C74.1098 70.98 74.0398 71.41 74.3198 71.46H74.3298Z" fill="#B98353"/>
|
||||
<path d="M77.17 80.06C77.35 80.09 77.39 79.95 77.6 79.79C77.66 79.75 77.83 79.64 77.79 79.34C77.75 79.05 77.51 78.67 77.1 79.01C77 79.09 76.91 79.24 76.88 79.43C76.88 79.43 76.79 79.99 77.16 80.06H77.17Z" fill="#B98353"/>
|
||||
<path d="M101.35 49.3701C101.56 49.4101 101.61 49.2401 101.86 49.0601C101.93 49.0101 102.13 48.8801 102.08 48.5301C102.04 48.1901 101.75 47.7401 101.27 48.1401C101.16 48.2301 101.05 48.4101 101.02 48.6401C101.02 48.6401 100.92 49.3001 101.35 49.3701V49.3701Z" fill="#B98353"/>
|
||||
<path d="M77.8998 48.19C77.8198 48.26 77.7398 48.39 77.7098 48.56C77.7098 48.56 77.6298 49.05 77.9498 49.11C78.1098 49.14 78.1398 49.01 78.3298 48.88C78.3798 48.84 78.5298 48.75 78.4998 48.49C78.4698 48.23 78.2598 47.9 77.8998 48.2V48.19Z" fill="#B98353"/>
|
||||
<path d="M24.26 89.25C28.56 93.79 34.97 97.01 44.44 97.18C44.75 97.18 45.07 97.18 45.38 97.18C54.42 97.14 61.65 96.3 67.35 95.12C69.7 94.63 71.79 94.09 73.63 93.52C77.28 92.4 79.99 91.18 81.89 90.13C83.22 89.4 84.15 88.74 84.75 88.26C85.03 88.03 85.29 87.8 85.49 87.52C85.69 87.24 85.8 86.95 85.8 86.58C85.8 85.04 83.87 83.28 82.53 83.1C82.3 83.07 82.09 83.09 81.9 83.16C80.36 83.78 75.25 85.45 70.35 84.85C67.05 84.45 64.63 83.14 62.72 81.6C60.16 79.53 58.55 77.06 57.03 75.86C56.2 75.2 55.39 74.92 54.48 75.3C51.06 76.73 53.53 81.56 53.53 81.56C53.53 81.56 51.7 83.91 50.14 83.41L42.66 77.8C32.76 70.37 16.58 58.01 16.58 58.01C16.24 58.33 15.38 64.22 16.35 71.16C16.54 72.51 16.8 73.91 17.14 75.33C17.48 76.75 17.94 78.29 18.49 79.76C19.76 83.14 21.61 86.44 24.27 89.24L24.26 89.25Z" fill="white"/>
|
||||
<path opacity="0.15" d="M54.1999 99.11C52.9399 99.4 51.5499 99.55 50.0399 99.54C50.6499 103.38 49.8999 106.38 49.8999 109.23C49.8999 110.96 46.0199 133.02 46.5799 135.93C46.5799 139.75 56.9099 143.56 65.5799 142.83C65.3399 140.28 62.2499 137.92 58.0099 137.64C52.8099 137.29 50.0399 135.56 51.7699 123.08C52.7799 115.81 54.0799 105.29 54.1999 99.1V99.11Z" fill="#B98353"/>
|
||||
<path opacity="0.15" d="M63.1599 91.54C63.5699 91.61 64.2299 91.67 65.0499 91.72C84.9099 90.51 84.5799 87.04 84.5799 87.04C84.5799 87.04 68.5199 90.51 64.1299 89.12C56.4599 86.7 52.5799 77.91 52.5799 77.91L52.8099 79.87C52.8099 79.87 52.8099 82.64 54.8899 87.38C45.8799 91.25 37.9099 89.11 28.1999 83.91C21.2199 80.17 19.2399 67.55 19.9999 60.11C20.2999 57.2 22.9999 54.1 22.9999 54.1C22.9999 54.1 8.7899 41.51 6.7099 28.68C5.4999 21.2 6.54989 16.37 13.8699 6.98999C3.2499 15.27 -7.2501 28.76 16.1299 57.58C16.2999 57.8 16.5299 58.2 16.5299 58.2C16.1899 58.52 15.3699 64.22 16.3399 71.16C16.5299 72.51 16.7899 73.91 17.1299 75.33C17.4799 76.8 17.9299 78.29 18.4799 79.76C19.7499 83.14 21.5999 86.44 24.2599 89.24C28.5599 93.78 34.9599 97 44.4399 97.17C44.7499 97.17 45.0699 97.17 45.3899 97.17C46.7999 97.17 48.1399 97.13 49.4599 97.09C49.4599 97.09 58.6499 96.58 63.1699 91.53L63.1599 91.54Z" fill="#B98353"/>
|
||||
<path opacity="0.15" d="M105.85 132.79C101.34 132.79 94.4099 131.75 92.3299 131.75C90.2499 131.75 90.2499 127.94 90.5999 117.19C90.9499 106.44 88.1699 100.9 85.3999 97.09C82.6299 93.28 79.5099 93.28 78.4699 98.82C77.4299 104.37 78.8199 123.08 78.8199 123.08C78.8199 123.08 78.9299 123.5 79.1399 124.19C80.8899 112.42 80.8199 99.03 80.8199 99.03C84.5299 104.71 85.6799 110.64 85.9099 116.14C86.0399 119.09 85.9099 121.9 85.7799 124.45C85.5599 129.02 85.3799 132.74 86.8899 134.63C88.7699 136.98 105.68 138.49 110.56 134.31C110.98 133.95 111.38 133.45 111.78 132.85C110.03 132.6 107.71 132.78 105.86 132.78L105.85 132.79Z" fill="#B98353"/>
|
||||
<path d="M54.1999 99.11C60.6899 97.64 63.9299 93.08 63.9299 93.08C63.9299 93.08 75.6199 94.16 83.3099 89.39C78.8999 91.59 69.4699 91.94 65.0499 91.72C64.2199 91.68 63.5699 91.62 63.1599 91.54C58.6399 96.6 49.4499 97.1 49.4499 97.1C49.4499 97.1 45.3299 99.23 49.1699 99.54C49.4699 99.55 49.7599 99.54 50.0499 99.54C51.5499 99.54 52.9499 99.39 54.2099 99.11H54.1999Z" fill="#4C150C"/>
|
||||
<path d="M111.4 77.93C111.4 77.93 109.08 74.12 107.07 77.06C106.28 78.21 107.48 81.19 104.12 81.81C99.7999 82.61 89.9999 83.4 90.3299 87.59C90.6599 91.78 103.84 91.1 111.02 87.73C118.2 84.36 126.79 74.82 124.48 60.24C123.01 50.97 122.06 54.44 122.06 54.44C122.06 54.44 122.58 70.04 111.4 77.92V77.93Z" fill="white"/>
|
||||
<path opacity="0.15" d="M90.3198 87.6C90.3198 87.6 93.7398 91.06 98.2698 90.67C102.8 90.28 115.37 89.3 120.8 78.44C124.57 71.19 124.97 65.39 124.55 62.26L124.13 59.13C124.13 59.13 126.19 78.69 112.62 84.69C104.8 88.46 98.1898 90.56 90.3198 87.59V87.6Z" fill="#B98353"/>
|
||||
<path d="M81.89 83.16C81.89 83.16 71.19 86.34 64.83 82.41C59.17 78.13 56.74 75.48 56.74 75.48C56.74 75.48 60.55 83.45 67.02 84.95C73.49 86.45 79.39 85.87 82.51 83.1" fill="#4C150C"/>
|
||||
<path d="M105.51 81.4801C105.51 81.4801 92.9198 85.0601 90.9498 86.2201C88.9798 87.3801 90.4899 85.4101 90.4899 85.4101C90.4899 85.4101 95.7999 81.1301 105.51 81.4801V81.4801Z" fill="#4C150C"/>
|
||||
</g>
|
||||
<defs>
|
||||
<radialGradient id="paint0_radial_401_2" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(66.6499 50.5801) scale(18.02)">
|
||||
<stop stop-color="#E6E7E8"/>
|
||||
<stop offset="0.08" stop-color="#B8B9B9"/>
|
||||
<stop offset="0.19" stop-color="#878889"/>
|
||||
<stop offset="0.29" stop-color="#5E5E5E"/>
|
||||
<stop offset="0.4" stop-color="#3C3C3C"/>
|
||||
<stop offset="0.51" stop-color="#212121"/>
|
||||
<stop offset="0.62" stop-color="#0E0E0F"/>
|
||||
<stop offset="0.73" stop-color="#030303"/>
|
||||
<stop offset="0.85"/>
|
||||
</radialGradient>
|
||||
<clipPath id="clip0_401_2">
|
||||
<rect width="133.23" height="146.1" fill="white"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 30 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 78 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 79 KiB |
+2
-19
@@ -1,27 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html dir="ltr">
|
||||
<head>
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-BB8DNPB73F"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag() {
|
||||
dataLayer.push(arguments);
|
||||
}
|
||||
gtag('consent', 'default', {
|
||||
ad_storage: 'denied',
|
||||
analytics_storage: 'denied',
|
||||
});
|
||||
gtag('js', new Date());
|
||||
gtag('config', 'G-BB8DNPB73F');
|
||||
</script>
|
||||
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta http-equiv="Pragma" content="no-cache" />
|
||||
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
|
||||
<meta http-equiv="Expires" content="0" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||
|
||||
<link rel="preload" href="/public/font/v1/300.woff" as="font" type="font/woff" crossorigin />
|
||||
<link rel="preload" href="/public/font/v1/300i.woff" as="font" type="font/woff" crossorigin />
|
||||
@@ -30,7 +13,7 @@
|
||||
<link rel="preload" href="/public/font/v1/700.woff" as="font" type="font/woff" crossorigin />
|
||||
<link rel="preload" href="/public/font/v1/700i.woff" as="font" type="font/woff" crossorigin />
|
||||
|
||||
<link rel="shortcut icon" href="/public/favicon-spaceman.png" />
|
||||
<link rel="shortcut icon" href="/public/favicon-spaceman.png">
|
||||
|
||||
<style>
|
||||
@font-face {
|
||||
|
||||
+151
-173
@@ -1,38 +1,15 @@
|
||||
// @flow
|
||||
import { Lbryio } from 'lbryinc';
|
||||
import * as Sentry from '@sentry/browser';
|
||||
import * as RENDER_MODES from 'constants/file_render_modes';
|
||||
import { SDK_API_PATH } from 'config';
|
||||
|
||||
// --- GA ---
|
||||
// - Events: 500 max (cannot be deleted).
|
||||
// - Dimensions: 25 max (cannot be deleted, but can be "archived"). Usually
|
||||
// tied to an event parameter for reporting purposes.
|
||||
//
|
||||
// Given the limitations above, we need to plan ahead before adding new Events
|
||||
// and Parameters.
|
||||
//
|
||||
// Events:
|
||||
// - Find a Recommended Event that is closest to what you need.
|
||||
// https://support.google.com/analytics/answer/9267735?hl=en
|
||||
// - If doesn't exist, use a Custom Event.
|
||||
//
|
||||
// Parameters:
|
||||
// - Custom parameters don't appear in automated reports until they are tied to
|
||||
// a Dimension.
|
||||
// - Add your entry to GA_DIMENSIONS below -- tt allows us to keep track so that
|
||||
// we don't exceed the limit. Re-use existing parameters if possible.
|
||||
// - Register the Dimension in GA Console to make it visible in reports.
|
||||
|
||||
export const GA_DIMENSIONS = {
|
||||
TYPE: 'type',
|
||||
ACTION: 'action',
|
||||
VALUE: 'value',
|
||||
START_TIME_MS: 'start_time_ms',
|
||||
DURATION_MS: 'duration_ms',
|
||||
END_TIME_MS: 'end_time_ms',
|
||||
};
|
||||
|
||||
import MatomoTracker from '@datapunt/matomo-tracker-js';
|
||||
import { history } from './store';
|
||||
import { SDK_API_PATH } from './index';
|
||||
// @if TARGET='app'
|
||||
import Native from 'native';
|
||||
import ElectronCookies from '@exponent/electron-cookies';
|
||||
import { generateInitialUrl } from 'util/url';
|
||||
// @endif
|
||||
import { MATOMO_ID, MATOMO_URL } from 'config';
|
||||
// import getConnectionSpeed from 'util/detect-user-bandwidth';
|
||||
|
||||
// let userDownloadBandwidthInBitsPerSecond;
|
||||
@@ -46,22 +23,33 @@ export const GA_DIMENSIONS = {
|
||||
const isProduction = process.env.NODE_ENV === 'production';
|
||||
const devInternalApis = process.env.LBRY_API_URL && process.env.LBRY_API_URL.includes('dev');
|
||||
|
||||
export const SHARE_INTERNAL = 'shareInternal';
|
||||
const SHARE_THIRD_PARTY = 'shareThirdParty';
|
||||
|
||||
const WATCHMAN_BACKEND_ENDPOINT = 'https://watchman.na-backend.odysee.com/reports/playback';
|
||||
const SEND_DATA_TO_WATCHMAN_INTERVAL = 10; // in seconds
|
||||
|
||||
// @if TARGET='app'
|
||||
if (isProduction) {
|
||||
ElectronCookies.enable({
|
||||
origin: 'https://lbry.tv',
|
||||
});
|
||||
}
|
||||
// @endif
|
||||
|
||||
type Analytics = {
|
||||
appStartTime: number,
|
||||
eventStartTime: any,
|
||||
error: (string) => Promise<any>,
|
||||
sentryError: ({} | string, {}) => Promise<any>,
|
||||
pageView: (string, ?string) => void,
|
||||
setUser: (Object) => void,
|
||||
toggleInternal: (boolean, ?boolean) => void,
|
||||
apiLogView: (string, string, string, ?number, ?() => void) => Promise<any>,
|
||||
apiLogPublish: (ChannelClaim | StreamClaim) => void,
|
||||
apiSyncTags: ({}) => void,
|
||||
tagFollowEvent: (string, boolean, ?string) => void,
|
||||
playerLoadedEvent: (string, ?boolean) => void,
|
||||
playerVideoStartedEvent: (?boolean) => void,
|
||||
videoStartEvent: (?string, number, string, ?number, string, any, ?number, boolean) => void,
|
||||
playerLoadedEvent: (?boolean) => void,
|
||||
playerStartedEvent: (?boolean) => void,
|
||||
videoStartEvent: (string, number, string, number, string, any, number) => void,
|
||||
videoIsPlaying: (boolean, any) => void,
|
||||
videoBufferEvent: (
|
||||
StreamClaim,
|
||||
@@ -73,20 +61,18 @@ type Analytics = {
|
||||
userId: string,
|
||||
playerPoweredBy: string,
|
||||
readyState: number,
|
||||
isLivestream: boolean,
|
||||
}
|
||||
) => Promise<any>,
|
||||
adsFetchedEvent: () => void,
|
||||
adsReceivedEvent: (any) => void,
|
||||
adsErrorEvent: (any) => void,
|
||||
emailProvidedEvent: () => void,
|
||||
emailVerifiedEvent: () => void,
|
||||
rewardEligibleEvent: () => void,
|
||||
initAppStartTime: (startTime: number) => void,
|
||||
startupEvent: (time: number) => void,
|
||||
eventStarted: (name: string, time: number, id?: string) => void,
|
||||
eventCompleted: (name: string, time: number, id?: string) => void,
|
||||
startupEvent: () => void,
|
||||
purchaseEvent: (number) => void,
|
||||
readyEvent: (number) => void,
|
||||
openUrlEvent: (string) => void,
|
||||
reportEvent: (string, any) => void,
|
||||
};
|
||||
|
||||
type LogPublishParams = {
|
||||
@@ -98,8 +84,10 @@ type LogPublishParams = {
|
||||
|
||||
let internalAnalyticsEnabled: boolean = IS_WEB || false;
|
||||
// let thirdPartyAnalyticsEnabled: boolean = IS_WEB || false;
|
||||
|
||||
const isGaAllowed = internalAnalyticsEnabled && isProduction;
|
||||
// @if TARGET='app'
|
||||
if (window.localStorage.getItem(SHARE_INTERNAL) === 'true') internalAnalyticsEnabled = true;
|
||||
// if (window.localStorage.getItem(SHARE_THIRD_PARTY) === 'true') thirdPartyAnalyticsEnabled = true;
|
||||
// @endif
|
||||
|
||||
/**
|
||||
* Determine the mobile device type viewing the data
|
||||
@@ -132,7 +120,7 @@ function getDeviceType() {
|
||||
// variables initialized for watchman
|
||||
let amountOfBufferEvents = 0;
|
||||
let amountOfBufferTimeInMS = 0;
|
||||
let videoType, userId, claimUrl, playerPoweredBy, videoPlayer, bitrateAsBitsPerSecond, isLivestream;
|
||||
let videoType, userId, claimUrl, playerPoweredBy, videoPlayer, bitrateAsBitsPerSecond;
|
||||
let lastSentTime;
|
||||
|
||||
// calculate data for backend, send them, and reset buffer data for next interval
|
||||
@@ -149,27 +137,20 @@ async function sendAndResetWatchmanData() {
|
||||
lastSentTime = new Date();
|
||||
|
||||
let protocol;
|
||||
if (videoType === 'application/x-mpegURL' && !isLivestream) {
|
||||
if (videoType === 'application/x-mpegURL') {
|
||||
protocol = 'hls';
|
||||
// get bandwidth if it exists from the texttrack (so it's accurate if user changes quality)
|
||||
// $FlowFixMe
|
||||
bitrateAsBitsPerSecond = videoPlayer.tech(true).vhs?.playlists?.media?.().attributes?.BANDWIDTH;
|
||||
} else if (isLivestream) {
|
||||
protocol = 'lvs';
|
||||
// $FlowFixMe
|
||||
bitrateAsBitsPerSecond = videoPlayer.tech(true).vhs?.playlists?.media?.().attributes?.BANDWIDTH;
|
||||
bitrateAsBitsPerSecond = videoPlayer.textTracks?.().tracks_[0]?.activeCues[0]?.value?.bandwidth;
|
||||
} else {
|
||||
protocol = 'stb';
|
||||
}
|
||||
|
||||
// current position in video in MS
|
||||
const positionInVideo = isLivestream ? 0 : videoPlayer && Math.round(videoPlayer.currentTime()) * 1000;
|
||||
const positionInVideo = Math.round(videoPlayer.currentTime()) * 1000;
|
||||
|
||||
// get the duration marking the time in the video for relative position calculation
|
||||
const totalDurationInSeconds = isLivestream ? 0 : videoPlayer && Math.round(videoPlayer.duration());
|
||||
|
||||
// temp: if buffering over the interval, the duration doesn't reset since we don't get an event
|
||||
if (amountOfBufferTimeInMS > timeSinceLastIntervalSend) amountOfBufferTimeInMS = timeSinceLastIntervalSend;
|
||||
const totalDurationInSeconds = Math.round(videoPlayer.duration());
|
||||
|
||||
// build object for watchman backend
|
||||
const objectToSend = {
|
||||
@@ -181,8 +162,8 @@ async function sendAndResetWatchmanData() {
|
||||
protocol,
|
||||
player: playerPoweredBy,
|
||||
user_id: userId.toString(),
|
||||
position: isLivestream ? 0 : Math.round(positionInVideo),
|
||||
rel_position: isLivestream ? 0 : Math.round((positionInVideo / (totalDurationInSeconds * 1000)) * 100),
|
||||
position: Math.round(positionInVideo),
|
||||
rel_position: Math.round((positionInVideo / (totalDurationInSeconds * 1000)) * 100),
|
||||
bitrate: bitrateAsBitsPerSecond,
|
||||
bandwidth: undefined,
|
||||
// ...(userDownloadBandwidthInBitsPerSecond && {bandwidth: userDownloadBandwidthInBitsPerSecond}), // add bandwidth if populated
|
||||
@@ -227,14 +208,15 @@ async function sendWatchmanData(body) {
|
||||
},
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
|
||||
return response;
|
||||
} catch (err) {}
|
||||
} catch (err) {
|
||||
console.log('ERROR FROM WATCHMAN BACKEND');
|
||||
console.log(err);
|
||||
}
|
||||
}
|
||||
|
||||
const analytics: Analytics = {
|
||||
appStartTime: 0,
|
||||
eventStartTime: {},
|
||||
|
||||
// receive buffer events from tracking plugin and save buffer amounts and times for backend call
|
||||
videoBufferEvent: async (claim, data) => {
|
||||
amountOfBufferEvents = amountOfBufferEvents + 1;
|
||||
@@ -273,26 +255,18 @@ const analytics: Analytics = {
|
||||
startWatchmanIntervalIfNotRunning();
|
||||
}
|
||||
},
|
||||
videoStartEvent: (
|
||||
claimId,
|
||||
timeToStartVideo,
|
||||
poweredBy,
|
||||
passedUserId,
|
||||
canonicalUrl,
|
||||
passedPlayer,
|
||||
videoBitrate,
|
||||
isLivestreamClaim
|
||||
) => {
|
||||
videoStartEvent: (claimId, duration, poweredBy, passedUserId, canonicalUrl, passedPlayer, videoBitrate) => {
|
||||
// populate values for watchman when video starts
|
||||
userId = passedUserId;
|
||||
claimUrl = canonicalUrl;
|
||||
playerPoweredBy = poweredBy;
|
||||
isLivestream = isLivestreamClaim;
|
||||
|
||||
videoType = passedPlayer.currentSource().type;
|
||||
videoPlayer = passedPlayer;
|
||||
bitrateAsBitsPerSecond = videoBitrate;
|
||||
!isLivestreamClaim && sendPromMetric('time_to_start', timeToStartVideo, playerPoweredBy);
|
||||
|
||||
sendPromMetric('time_to_start', duration);
|
||||
sendMatomoEvent('Media', 'TimeToStart', claimId, duration);
|
||||
},
|
||||
error: (message) => {
|
||||
return new Promise((resolve) => {
|
||||
@@ -318,17 +292,45 @@ const analytics: Analytics = {
|
||||
}
|
||||
});
|
||||
},
|
||||
pageView: (path, search) => {
|
||||
if (internalAnalyticsEnabled) {
|
||||
const params: { href: string, customDimensions?: Array<{ id: number, value: ?string }> } = { href: `${path}` };
|
||||
const dimensions = [];
|
||||
const searchParams = search && new URLSearchParams(search);
|
||||
|
||||
if (searchParams && searchParams.get('src')) {
|
||||
dimensions.push({ id: 1, value: searchParams.get('src') });
|
||||
}
|
||||
if (dimensions.length) {
|
||||
params['customDimensions'] = dimensions;
|
||||
}
|
||||
MatomoInstance.trackPageView(params);
|
||||
}
|
||||
},
|
||||
setUser: (userId) => {
|
||||
if (isGaAllowed && userId && window.gtag) {
|
||||
window.gtag('set', { user_id: userId });
|
||||
if (internalAnalyticsEnabled && userId) {
|
||||
window._paq.push(['setUserId', String(userId)]);
|
||||
// @if TARGET='app'
|
||||
Native.getAppVersionInfo().then(({ localVersion }) => {
|
||||
sendMatomoEvent('Version', 'Desktop-Version', localVersion);
|
||||
});
|
||||
// @endif
|
||||
}
|
||||
},
|
||||
toggleInternal: (enabled: boolean): void => {
|
||||
// Always collect analytics on Odysee for now.
|
||||
// Always collect analytics on lbry.tv
|
||||
// @if TARGET='app'
|
||||
internalAnalyticsEnabled = enabled;
|
||||
window.localStorage.setItem(SHARE_INTERNAL, enabled);
|
||||
// @endif
|
||||
},
|
||||
|
||||
toggleThirdParty: (enabled: boolean): void => {
|
||||
// Always collect analytics on Odysee for now.
|
||||
// Always collect analytics on lbry.tv
|
||||
// @if TARGET='app'
|
||||
// thirdPartyAnalyticsEnabled = enabled;
|
||||
window.localStorage.setItem(SHARE_THIRD_PARTY, enabled);
|
||||
// @endif
|
||||
},
|
||||
|
||||
apiLogView: (uri, outpoint, claimId, timeToStart) => {
|
||||
@@ -345,6 +347,7 @@ const analytics: Analytics = {
|
||||
claim_id: claimId,
|
||||
};
|
||||
|
||||
// lbry.tv streams from AWS so we don't care about the time to start
|
||||
if (timeToStart && !IS_WEB) {
|
||||
params.time_to_start = timeToStart;
|
||||
}
|
||||
@@ -377,129 +380,104 @@ const analytics: Analytics = {
|
||||
Lbryio.call('event', 'publish', params);
|
||||
}
|
||||
},
|
||||
adsFetchedEvent: () => {
|
||||
sendGaEvent('ad_fetched');
|
||||
},
|
||||
playerLoadedEvent: (renderMode, embedded) => {
|
||||
const RENDER_MODE_TO_EVENT = (renderMode) => {
|
||||
switch (renderMode) {
|
||||
case RENDER_MODES.VIDEO:
|
||||
return 'loaded_video';
|
||||
case RENDER_MODES.AUDIO:
|
||||
return 'loaded_audio';
|
||||
case RENDER_MODES.MARKDOWN:
|
||||
return 'loaded_markdown';
|
||||
case RENDER_MODES.IMAGE:
|
||||
return 'loaded_image';
|
||||
case 'livestream':
|
||||
return 'loaded_livestream';
|
||||
default:
|
||||
return 'loaded_misc';
|
||||
}
|
||||
};
|
||||
|
||||
sendGaEvent('player', {
|
||||
[GA_DIMENSIONS.ACTION]: RENDER_MODE_TO_EVENT(renderMode),
|
||||
[GA_DIMENSIONS.TYPE]: embedded ? 'embedded' : 'onsite',
|
||||
});
|
||||
apiSyncTags: (params) => {
|
||||
if (internalAnalyticsEnabled && isProduction) {
|
||||
Lbryio.call('content_tags', 'sync', params);
|
||||
}
|
||||
},
|
||||
playerVideoStartedEvent: (embedded) => {
|
||||
sendGaEvent('player', {
|
||||
[GA_DIMENSIONS.ACTION]: 'started_video',
|
||||
[GA_DIMENSIONS.TYPE]: embedded ? 'embedded' : 'onsite',
|
||||
});
|
||||
adsFetchedEvent: () => {
|
||||
sendMatomoEvent('Media', 'AdsFetched');
|
||||
},
|
||||
adsReceivedEvent: (response) => {
|
||||
sendMatomoEvent('Media', 'AdsReceived', JSON.stringify(response));
|
||||
},
|
||||
adsErrorEvent: (response) => {
|
||||
sendMatomoEvent('Media', 'AdsError', JSON.stringify(response));
|
||||
},
|
||||
playerLoadedEvent: (embedded) => {
|
||||
sendMatomoEvent('Player', 'Loaded', embedded ? 'embedded' : 'onsite');
|
||||
},
|
||||
playerStartedEvent: (embedded) => {
|
||||
sendMatomoEvent('Player', 'Started', embedded ? 'embedded' : 'onsite');
|
||||
},
|
||||
tagFollowEvent: (tag, following) => {
|
||||
sendGaEvent('tags', {
|
||||
[GA_DIMENSIONS.ACTION]: following ? 'follow' : 'unfollow',
|
||||
[GA_DIMENSIONS.VALUE]: tag,
|
||||
});
|
||||
sendMatomoEvent('Tag', following ? 'Tag-Follow' : 'Tag-Unfollow', tag);
|
||||
},
|
||||
channelBlockEvent: (uri, blocked, location) => {
|
||||
sendMatomoEvent(blocked ? 'Channel-Hidden' : 'Channel-Unhidden', uri);
|
||||
},
|
||||
emailProvidedEvent: () => {
|
||||
sendGaEvent('engagement', {
|
||||
[GA_DIMENSIONS.TYPE]: 'email_provided',
|
||||
});
|
||||
sendMatomoEvent('Engagement', 'Email-Provided');
|
||||
},
|
||||
emailVerifiedEvent: () => {
|
||||
sendGaEvent('engagement', {
|
||||
[GA_DIMENSIONS.TYPE]: 'email_verified',
|
||||
});
|
||||
sendMatomoEvent('Engagement', 'Email-Verified');
|
||||
},
|
||||
rewardEligibleEvent: () => {
|
||||
sendGaEvent('engagement', {
|
||||
[GA_DIMENSIONS.TYPE]: 'reward_eligible',
|
||||
});
|
||||
sendMatomoEvent('Engagement', 'Reward-Eligible');
|
||||
},
|
||||
openUrlEvent: (url: string) => {
|
||||
sendGaEvent('engagement', {
|
||||
[GA_DIMENSIONS.TYPE]: 'open_url',
|
||||
url,
|
||||
});
|
||||
sendMatomoEvent('Engagement', 'Open-Url', url);
|
||||
},
|
||||
trendingAlgorithmEvent: (trendingAlgorithm: string) => {
|
||||
sendGaEvent('engagement', {
|
||||
[GA_DIMENSIONS.TYPE]: 'trending_algorithm',
|
||||
trending_algorithm: trendingAlgorithm,
|
||||
});
|
||||
sendMatomoEvent('Engagement', 'Trending-Algorithm', trendingAlgorithm);
|
||||
},
|
||||
initAppStartTime: (startTime: number) => {
|
||||
analytics.appStartTime = startTime;
|
||||
startupEvent: () => {
|
||||
sendMatomoEvent('Startup', 'Startup');
|
||||
},
|
||||
startupEvent: (time: number) => {
|
||||
if (analytics.appStartTime !== 0) {
|
||||
sendGaEvent('diag_app_ready', {
|
||||
[GA_DIMENSIONS.DURATION_MS]: time - analytics.appStartTime,
|
||||
});
|
||||
}
|
||||
},
|
||||
eventStarted: (name: string, time: number, id?: string) => {
|
||||
const key = id || name;
|
||||
analytics.eventStartTime[key] = time;
|
||||
},
|
||||
eventCompleted: (name: string, time: number, id?: string) => {
|
||||
const key = id || name;
|
||||
if (analytics.eventStartTime[key]) {
|
||||
sendGaEvent(name, {
|
||||
[GA_DIMENSIONS.START_TIME_MS]: analytics.eventStartTime[key] - analytics.appStartTime,
|
||||
[GA_DIMENSIONS.DURATION_MS]: time - analytics.eventStartTime[key],
|
||||
[GA_DIMENSIONS.END_TIME_MS]: time - analytics.appStartTime,
|
||||
});
|
||||
|
||||
delete analytics.eventStartTime[key];
|
||||
}
|
||||
readyEvent: (timeToReady: number) => {
|
||||
sendMatomoEvent('Startup', 'App-Ready', 'Time', timeToReady);
|
||||
},
|
||||
purchaseEvent: (purchaseInt: number) => {
|
||||
sendGaEvent('purchase', {
|
||||
// https://developers.google.com/analytics/devguides/collection/ga4/reference/events#purchase
|
||||
[GA_DIMENSIONS.VALUE]: purchaseInt,
|
||||
});
|
||||
},
|
||||
reportEvent: (event: string, params?: { [string]: string | number }) => {
|
||||
sendGaEvent(event, params);
|
||||
sendMatomoEvent('Purchase', 'Purchase-Complete', 'someLabel', purchaseInt);
|
||||
},
|
||||
};
|
||||
|
||||
function sendGaEvent(event: string, params?: { [string]: string | number }) {
|
||||
if (isGaAllowed && window.gtag) {
|
||||
window.gtag('event', event, params);
|
||||
function sendMatomoEvent(category, action, name, value) {
|
||||
if (internalAnalyticsEnabled) {
|
||||
const event = { category, action, name, value };
|
||||
MatomoInstance.trackEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
function sendPromMetric(name: string, value?: number, player: string) {
|
||||
function sendPromMetric(name: string, value?: number) {
|
||||
if (IS_WEB) {
|
||||
let url = new URL(SDK_API_PATH + '/metric/ui');
|
||||
const params = { name: name, value: value ? value.toString() : '', player: player };
|
||||
const params = { name: name, value: value ? value.toString() : '' };
|
||||
url.search = new URLSearchParams(params).toString();
|
||||
return fetch(url, { method: 'post' }).catch(function (error) {});
|
||||
return fetch(url, { method: 'post' });
|
||||
}
|
||||
}
|
||||
|
||||
// Activate
|
||||
if (isGaAllowed && window.gtag) {
|
||||
window.gtag('consent', 'update', {
|
||||
ad_storage: 'granted',
|
||||
analytics_storage: 'granted',
|
||||
});
|
||||
}
|
||||
const MatomoInstance = new MatomoTracker({
|
||||
urlBase: MATOMO_URL,
|
||||
siteId: MATOMO_ID, // optional, default value: `1`
|
||||
// heartBeat: { // optional, enabled by default
|
||||
// active: true, // optional, default value: true
|
||||
// seconds: 10 // optional, default value: `15
|
||||
// },
|
||||
// linkTracking: false // optional, default value: true
|
||||
});
|
||||
|
||||
// Manually call the first page view
|
||||
// React Router doesn't include this on `history.listen`
|
||||
// @if TARGET='web'
|
||||
analytics.pageView(window.location.pathname + window.location.search, window.location.search);
|
||||
// @endif
|
||||
|
||||
// @if TARGET='app'
|
||||
analytics.pageView(
|
||||
window.location.pathname.split('.html')[1] + window.location.search || generateInitialUrl(window.location.hash)
|
||||
);
|
||||
// @endif;
|
||||
|
||||
// Listen for url changes and report
|
||||
// This will include search queries
|
||||
history.listen((location) => {
|
||||
const { pathname, search } = location;
|
||||
|
||||
const page = `${pathname}${search}`;
|
||||
analytics.pageView(page, search);
|
||||
});
|
||||
|
||||
export default analytics;
|
||||
+14
-4
@@ -1,17 +1,25 @@
|
||||
// @flow
|
||||
import { COMMENT_SERVER_API } from 'config';
|
||||
|
||||
// prettier-ignore
|
||||
const Comments = {
|
||||
url: COMMENT_SERVER_API,
|
||||
enabled: Boolean(COMMENT_SERVER_API),
|
||||
isCustomServer: false,
|
||||
|
||||
setServerUrl: (customUrl: ?string) => {
|
||||
Comments.url = customUrl === undefined ? COMMENT_SERVER_API : customUrl;
|
||||
Comments.enabled = Boolean(Comments.url);
|
||||
Comments.isCustomServer = Comments.url !== COMMENT_SERVER_API;
|
||||
},
|
||||
|
||||
moderation_block: (params: ModerationBlockParams) => fetchCommentsApi('moderation.Block', params),
|
||||
moderation_unblock: (params: ModerationBlockParams) => fetchCommentsApi('moderation.UnBlock', params),
|
||||
moderation_block_list: (params: BlockedListArgs) => fetchCommentsApi('moderation.BlockedList', params),
|
||||
moderation_add_delegate: (params: ModerationAddDelegateParams) => fetchCommentsApi('moderation.AddDelegate', params),
|
||||
moderation_remove_delegate: (params: ModerationRemoveDelegateParams) => fetchCommentsApi('moderation.RemoveDelegate', params),
|
||||
moderation_list_delegates: (params: ModerationListDelegatesParams) => fetchCommentsApi('moderation.ListDelegates', params),
|
||||
moderation_remove_delegate: (params: ModerationRemoveDelegateParams) =>
|
||||
fetchCommentsApi('moderation.RemoveDelegate', params),
|
||||
moderation_list_delegates: (params: ModerationListDelegatesParams) =>
|
||||
fetchCommentsApi('moderation.ListDelegates', params),
|
||||
moderation_am_i: (params: ModerationAmIParams) => fetchCommentsApi('moderation.AmI', params),
|
||||
comment_list: (params: CommentListParams) => fetchCommentsApi('comment.List', params),
|
||||
comment_abandon: (params: CommentAbandonParams) => fetchCommentsApi('comment.Abandon', params),
|
||||
@@ -31,7 +39,9 @@ const Comments = {
|
||||
};
|
||||
|
||||
function fetchCommentsApi(method: string, params: {}) {
|
||||
if (!Comments.enabled) {
|
||||
if (!Comments.url) {
|
||||
return Promise.reject(new Error('Commenting server is not set.'));
|
||||
} else if (!Comments.enabled) {
|
||||
return Promise.reject('Comments are not currently enabled.'); // eslint-disable-line
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
import { connect } from 'react-redux';
|
||||
import IframeReact from './view';
|
||||
|
||||
export default IframeReact;
|
||||
const select = state => ({});
|
||||
|
||||
const perform = () => ({});
|
||||
|
||||
export default connect(select, perform)(IframeReact);
|
||||
@@ -1,3 +1,6 @@
|
||||
import { connect } from 'react-redux';
|
||||
import AbandonedChannelPreview from './view';
|
||||
|
||||
export default AbandonedChannelPreview;
|
||||
const select = (state, props) => ({});
|
||||
|
||||
export default connect(select)(AbandonedChannelPreview);
|
||||
+45
-38
@@ -1,65 +1,72 @@
|
||||
import { hot } from 'react-hot-loader/root';
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
selectGetSyncErrorMessage,
|
||||
selectPrefsReady,
|
||||
selectSyncFatalError,
|
||||
selectSyncIsLocked,
|
||||
} from 'redux/selectors/sync';
|
||||
import { doUserSetReferrer } from 'redux/actions/user';
|
||||
import { doSetLastViewedAnnouncement } from 'redux/actions/content';
|
||||
import { selectUser, selectUserLocale, selectUserVerifiedEmail, selectHomepageFetched } from 'redux/selectors/user';
|
||||
import { selectGetSyncErrorMessage, selectSyncFatalError } from 'redux/selectors/sync';
|
||||
import { doFetchAccessToken, doUserSetReferrer } from 'redux/actions/user';
|
||||
import { selectUser, selectAccessToken, selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
import { selectUnclaimedRewards } from 'redux/selectors/rewards';
|
||||
import { doFetchChannelListMine, doFetchCollectionListMine } from 'redux/actions/claims';
|
||||
import { selectMyChannelClaimIds } from 'redux/selectors/claims';
|
||||
import { doFetchChannelListMine, doFetchCollectionListMine, doResolveUris } from 'redux/actions/claims';
|
||||
import { selectMyChannelUrls } from 'redux/selectors/claims';
|
||||
import * as SETTINGS from 'constants/settings';
|
||||
import { selectSubscriptions } from 'redux/selectors/subscriptions';
|
||||
import {
|
||||
makeSelectClientSetting,
|
||||
selectLanguage,
|
||||
selectLoadedLanguages,
|
||||
selectThemePath,
|
||||
selectDefaultChannelClaim,
|
||||
} from 'redux/selectors/settings';
|
||||
import { selectModal, selectActiveChannelClaim, selectIsReloadRequired } from 'redux/selectors/app';
|
||||
import { selectUploadCount } from 'redux/selectors/publish';
|
||||
import { doOpenAnnouncements, doSetLanguage, doSetDefaultChannel } from 'redux/actions/settings';
|
||||
import {
|
||||
selectIsUpgradeAvailable,
|
||||
selectAutoUpdateDownloaded,
|
||||
selectModal,
|
||||
selectActiveChannelClaim,
|
||||
} from 'redux/selectors/app';
|
||||
import { doGetWalletSyncPreference, doSetLanguage } from 'redux/actions/settings';
|
||||
import { doSyncLoop } from 'redux/actions/sync';
|
||||
import { doSignIn, doSetIncognito } from 'redux/actions/app';
|
||||
import {
|
||||
doDownloadUpgradeRequested,
|
||||
doSignIn,
|
||||
doGetAndPopulatePreferences,
|
||||
doSetActiveChannel,
|
||||
doSetIncognito,
|
||||
} from 'redux/actions/app';
|
||||
import { doFetchModBlockedList, doFetchCommentModAmIList } from 'redux/actions/comments';
|
||||
import App from './view';
|
||||
|
||||
const select = (state) => ({
|
||||
user: selectUser(state),
|
||||
locale: selectUserLocale(state),
|
||||
accessToken: selectAccessToken(state),
|
||||
theme: selectThemePath(state),
|
||||
language: selectLanguage(state),
|
||||
syncEnabled: makeSelectClientSetting(SETTINGS.ENABLE_SYNC)(state),
|
||||
languages: selectLoadedLanguages(state),
|
||||
isReloadRequired: selectIsReloadRequired(state),
|
||||
prefsReady: selectPrefsReady(state),
|
||||
autoUpdateDownloaded: selectAutoUpdateDownloaded(state),
|
||||
isUpgradeAvailable: selectIsUpgradeAvailable(state),
|
||||
syncError: selectGetSyncErrorMessage(state),
|
||||
syncIsLocked: selectSyncIsLocked(state),
|
||||
uploadCount: selectUploadCount(state),
|
||||
rewards: selectUnclaimedRewards(state),
|
||||
isAuthenticated: selectUserVerifiedEmail(state),
|
||||
currentModal: selectModal(state),
|
||||
syncFatalError: selectSyncFatalError(state),
|
||||
activeChannelClaim: selectActiveChannelClaim(state),
|
||||
myChannelClaimIds: selectMyChannelClaimIds(state),
|
||||
homepageFetched: selectHomepageFetched(state),
|
||||
defaultChannelClaim: selectDefaultChannelClaim(state),
|
||||
myChannelUrls: selectMyChannelUrls(state),
|
||||
subscriptions: selectSubscriptions(state),
|
||||
});
|
||||
|
||||
const perform = {
|
||||
fetchChannelListMine: doFetchChannelListMine,
|
||||
fetchCollectionListMine: doFetchCollectionListMine,
|
||||
setLanguage: doSetLanguage,
|
||||
signIn: doSignIn,
|
||||
syncLoop: doSyncLoop,
|
||||
setReferrer: doUserSetReferrer,
|
||||
setIncognito: doSetIncognito,
|
||||
fetchModBlockedList: doFetchModBlockedList,
|
||||
fetchModAmIList: doFetchCommentModAmIList,
|
||||
doOpenAnnouncements,
|
||||
doSetLastViewedAnnouncement,
|
||||
doSetDefaultChannel,
|
||||
};
|
||||
const perform = (dispatch) => ({
|
||||
fetchAccessToken: () => dispatch(doFetchAccessToken()),
|
||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||
fetchCollectionListMine: () => dispatch(doFetchCollectionListMine()),
|
||||
setLanguage: (language) => dispatch(doSetLanguage(language)),
|
||||
signIn: () => dispatch(doSignIn()),
|
||||
requestDownloadUpgrade: () => dispatch(doDownloadUpgradeRequested()),
|
||||
updatePreferences: () => dispatch(doGetAndPopulatePreferences()),
|
||||
getWalletSyncPref: () => dispatch(doGetWalletSyncPreference()),
|
||||
syncLoop: (noInterval) => dispatch(doSyncLoop(noInterval)),
|
||||
setReferrer: (referrer, doClaim) => dispatch(doUserSetReferrer(referrer, doClaim)),
|
||||
setActiveChannelIfNotSet: () => dispatch(doSetActiveChannel()),
|
||||
setIncognito: () => dispatch(doSetIncognito()),
|
||||
fetchModBlockedList: () => dispatch(doFetchModBlockedList()),
|
||||
resolveUris: (uris) => dispatch(doResolveUris(uris)),
|
||||
fetchModAmIList: () => dispatch(doFetchCommentModAmIList()),
|
||||
});
|
||||
|
||||
export default hot(connect(select, perform)(App));
|
||||
+144
-355
@@ -1,297 +1,178 @@
|
||||
// @flow
|
||||
import * as PAGES from 'constants/pages';
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import { lazyImport } from 'util/lazyImport';
|
||||
import { tusUnlockAndNotify, tusHandleTabUpdates } from 'util/tus';
|
||||
import React, { useEffect, useRef, useState, useLayoutEffect } from 'react';
|
||||
import classnames from 'classnames';
|
||||
import analytics from 'analytics';
|
||||
import { setSearchUserId } from 'redux/actions/search';
|
||||
import { parseURI, buildURI } from 'util/lbryURI';
|
||||
import { generateGoogleCacheUrl } from 'util/url';
|
||||
import Router from 'component/router/index';
|
||||
import ModalRouter from 'modal/modalRouter';
|
||||
import ReactModal from 'react-modal';
|
||||
import { openContextMenu } from 'util/context-menu';
|
||||
import useKonamiListener from 'util/enhanced-layout';
|
||||
import Yrbl from 'component/yrbl';
|
||||
import FileRenderFloating from 'component/fileRenderFloating';
|
||||
import { withRouter } from 'react-router';
|
||||
import usePrevious from 'effects/use-previous';
|
||||
import Nag from 'component/common/nag';
|
||||
import REWARDS from 'rewards';
|
||||
import usePersistedState from 'effects/use-persisted-state';
|
||||
import useConnectionStatus from 'effects/use-connection-status';
|
||||
import Spinner from 'component/spinner';
|
||||
import LANGUAGES from 'constants/languages';
|
||||
import AdsSticky from 'web/component/adsSticky';
|
||||
import YoutubeWelcome from 'web/component/youtubeReferralWelcome';
|
||||
import {
|
||||
useDegradedPerformance,
|
||||
STATUS_OK,
|
||||
STATUS_DEGRADED,
|
||||
STATUS_FAILING,
|
||||
STATUS_DOWN,
|
||||
} from 'web/effects/use-degraded-performance';
|
||||
import useZoom from 'effects/use-zoom';
|
||||
import useHistoryNav from 'effects/use-history-nav';
|
||||
import LANGUAGE_MIGRATIONS from 'constants/language-migrations';
|
||||
import { useIsMobile } from 'effects/use-screensize';
|
||||
import getLanguagesForCountry from 'constants/country_languages';
|
||||
import SUPPORTED_LANGUAGES from 'constants/supported_languages';
|
||||
|
||||
const FileDrop = lazyImport(() => import('component/fileDrop' /* webpackChunkName: "fileDrop" */));
|
||||
const NagContinueFirstRun = lazyImport(() => import('component/nagContinueFirstRun' /* webpackChunkName: "nagCFR" */));
|
||||
const NagLocaleSwitch = lazyImport(() => import('component/nagLocaleSwitch' /* webpackChunkName: "nagLocaleSwitch" */));
|
||||
const NagDegradedPerformance = lazyImport(() =>
|
||||
import('web/component/nag-degraded-performance' /* webpackChunkName: "NagDegradedPerformance" */)
|
||||
);
|
||||
const NagNoUser = lazyImport(() => import('web/component/nag-no-user' /* webpackChunkName: "nag-no-user" */));
|
||||
const NagSunset = lazyImport(() => import('web/component/nag-sunset' /* webpackChunkName: "nag-sunset" */));
|
||||
const SyncFatalError = lazyImport(() => import('component/syncFatalError' /* webpackChunkName: "syncFatalError" */));
|
||||
import FileDrop from 'component/fileDrop';
|
||||
import ModalRouter from 'modal/modalRouter';
|
||||
import Nag from 'component/common/nag';
|
||||
|
||||
import SyncFatalError from 'component/syncFatalError';
|
||||
import Yrbl from 'component/yrbl';
|
||||
|
||||
// ****************************************************************************
|
||||
|
||||
export const MAIN_WRAPPER_CLASS = 'main-wrapper';
|
||||
export const IS_MAC = navigator.userAgent.indexOf('Mac OS X') !== -1;
|
||||
|
||||
// const imaLibraryPath = 'https://imasdk.googleapis.com/js/sdkloader/ima3.js';
|
||||
const oneTrustScriptSrc = 'https://cdn.cookielaw.org/scripttemplates/otSDKStub.js';
|
||||
|
||||
const LATEST_PATH = `/$/${PAGES.LATEST}/`;
|
||||
const LIVE_PATH = `/$/${PAGES.LIVE_NOW}/`;
|
||||
const EMBED_PATH = `/$/${PAGES.EMBED}/`;
|
||||
// button numbers pulled from https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
|
||||
const MOUSE_BACK_BTN = 3;
|
||||
const MOUSE_FORWARD_BTN = 4;
|
||||
|
||||
type Props = {
|
||||
language: string,
|
||||
languages: Array<string>,
|
||||
theme: string,
|
||||
user: ?{ id: string, has_verified_email: boolean, is_reward_approved: boolean },
|
||||
locale: ?LocaleInfo,
|
||||
location: { pathname: string, hash: string, search: string, hostname: string, reload: () => void },
|
||||
history: { push: (string) => void, location: { pathname: string }, replace: (string) => void },
|
||||
location: { pathname: string, hash: string, search: string },
|
||||
history: {
|
||||
goBack: () => void,
|
||||
goForward: () => void,
|
||||
index: number,
|
||||
length: number,
|
||||
push: (string) => void,
|
||||
},
|
||||
fetchAccessToken: () => void,
|
||||
fetchChannelListMine: () => void,
|
||||
fetchCollectionListMine: () => void,
|
||||
signIn: () => void,
|
||||
requestDownloadUpgrade: () => void,
|
||||
onSignedIn: () => void,
|
||||
setLanguage: (string) => void,
|
||||
isReloadRequired: boolean,
|
||||
isUpgradeAvailable: boolean,
|
||||
autoUpdateDownloaded: boolean,
|
||||
updatePreferences: () => Promise<any>,
|
||||
getWalletSyncPref: () => Promise<any>,
|
||||
uploadCount: number,
|
||||
balance: ?number,
|
||||
syncIsLocked: boolean,
|
||||
syncError: ?string,
|
||||
prefsReady: boolean,
|
||||
syncEnabled: boolean,
|
||||
rewards: Array<Reward>,
|
||||
setReferrer: (string, boolean) => void,
|
||||
isAuthenticated: boolean,
|
||||
socketConnect: () => void,
|
||||
syncLoop: (?boolean) => void,
|
||||
currentModal: any,
|
||||
syncFatalError: boolean,
|
||||
activeChannelClaim: ?ChannelClaim,
|
||||
myChannelClaimIds: ?Array<string>,
|
||||
myChannelUrls: ?Array<string>,
|
||||
subscriptions: Array<Subscription>,
|
||||
setActiveChannelIfNotSet: () => void,
|
||||
setIncognito: (boolean) => void,
|
||||
fetchModBlockedList: () => void,
|
||||
resolveUris: (Array<string>) => void,
|
||||
fetchModAmIList: () => void,
|
||||
homepageFetched: boolean,
|
||||
defaultChannelClaim: ?any,
|
||||
doOpenAnnouncements: () => void,
|
||||
doSetLastViewedAnnouncement: (hash: string) => void,
|
||||
doSetDefaultChannel: (claimId: string) => void,
|
||||
};
|
||||
|
||||
function App(props: Props) {
|
||||
const {
|
||||
theme,
|
||||
user,
|
||||
locale,
|
||||
location,
|
||||
fetchAccessToken,
|
||||
fetchChannelListMine,
|
||||
fetchCollectionListMine,
|
||||
signIn,
|
||||
isReloadRequired,
|
||||
autoUpdateDownloaded,
|
||||
isUpgradeAvailable,
|
||||
requestDownloadUpgrade,
|
||||
uploadCount,
|
||||
history,
|
||||
syncError,
|
||||
syncIsLocked,
|
||||
prefsReady,
|
||||
language,
|
||||
languages,
|
||||
setLanguage,
|
||||
updatePreferences,
|
||||
getWalletSyncPref,
|
||||
rewards,
|
||||
setReferrer,
|
||||
isAuthenticated,
|
||||
syncLoop,
|
||||
currentModal,
|
||||
syncFatalError,
|
||||
myChannelClaimIds,
|
||||
myChannelUrls,
|
||||
activeChannelClaim,
|
||||
setActiveChannelIfNotSet,
|
||||
setIncognito,
|
||||
fetchModBlockedList,
|
||||
resolveUris,
|
||||
subscriptions,
|
||||
fetchModAmIList,
|
||||
homepageFetched,
|
||||
defaultChannelClaim,
|
||||
doOpenAnnouncements,
|
||||
doSetLastViewedAnnouncement,
|
||||
doSetDefaultChannel,
|
||||
} = props;
|
||||
|
||||
const isMobile = useIsMobile();
|
||||
const appRef = useRef();
|
||||
const isEnhancedLayout = useKonamiListener();
|
||||
const [hasSignedIn, setHasSignedIn] = useState(false);
|
||||
const [readyForSync, setReadyForSync] = useState(false);
|
||||
const [readyForPrefs, setReadyForPrefs] = useState(false);
|
||||
const hasVerifiedEmail = user && Boolean(user.has_verified_email);
|
||||
const isRewardApproved = user && user.is_reward_approved;
|
||||
const previousHasVerifiedEmail = usePrevious(hasVerifiedEmail);
|
||||
const previousRewardApproved = usePrevious(isRewardApproved);
|
||||
|
||||
const [localeLangs, setLocaleLangs] = React.useState();
|
||||
const [localeSwitchDismissed] = usePersistedState('locale-switch-dismissed', false);
|
||||
const [lbryTvApiStatus, setLbryTvApiStatus] = useState(STATUS_OK);
|
||||
|
||||
const { pathname, hash, search, hostname } = location;
|
||||
const [retryingSync, setRetryingSync] = useState(false);
|
||||
const [langRenderKey, setLangRenderKey] = useState(0);
|
||||
const [seenSunsestMessage, setSeenSunsetMessage] = usePersistedState('lbrytv-sunset', false);
|
||||
const { pathname, search } = props.location;
|
||||
const [upgradeNagClosed, setUpgradeNagClosed] = useState(false);
|
||||
const [resolvedSubscriptions, setResolvedSubscriptions] = useState(false);
|
||||
const [sidebarOpen] = usePersistedState('sidebar', true);
|
||||
const showUpgradeButton =
|
||||
(autoUpdateDownloaded || (process.platform === 'linux' && isUpgradeAvailable)) && !upgradeNagClosed;
|
||||
// referral claiming
|
||||
const referredRewardAvailable = rewards && rewards.some((reward) => reward.reward_type === REWARDS.TYPE_REFEREE);
|
||||
const urlParams = new URLSearchParams(search);
|
||||
const rawReferrerParam = urlParams.get('r');
|
||||
const fromLbrytvParam = urlParams.get('sunset');
|
||||
const sanitizedReferrerParam = rawReferrerParam && rawReferrerParam.replace(':', '#');
|
||||
const embedPath = pathname.startsWith(EMBED_PATH);
|
||||
const shouldHideNag = embedPath || pathname.startsWith(`/$/${PAGES.AUTH_VERIFY}`);
|
||||
const userId = user && user.id;
|
||||
const hasMyChannels = myChannelClaimIds && myChannelClaimIds.length > 0;
|
||||
const hasNoChannels = myChannelClaimIds && myChannelClaimIds.length === 0;
|
||||
const useCustomScrollbar = !IS_MAC;
|
||||
const hasMyChannels = myChannelUrls && myChannelUrls.length > 0;
|
||||
const hasNoChannels = myChannelUrls && myChannelUrls.length === 0;
|
||||
const shouldMigrateLanguage = LANGUAGE_MIGRATIONS[language];
|
||||
const renderFiledrop = !isMobile && isAuthenticated;
|
||||
const connectionStatus = useConnectionStatus();
|
||||
|
||||
const urlPath = pathname + hash;
|
||||
const latestContentPath = urlPath.startsWith(LATEST_PATH);
|
||||
const liveContentPath = urlPath.startsWith(LIVE_PATH);
|
||||
const featureParam = urlParams.get('feature');
|
||||
const embedLatestPath = embedPath && (featureParam === PAGES.LATEST || featureParam === PAGES.LIVE_NOW);
|
||||
const isNewestPath = latestContentPath || liveContentPath || embedLatestPath;
|
||||
|
||||
let path;
|
||||
if (isNewestPath) {
|
||||
path = urlPath.replace(embedLatestPath ? EMBED_PATH : latestContentPath ? LATEST_PATH : LIVE_PATH, '');
|
||||
} else {
|
||||
// Remove the leading "/" added by the browser
|
||||
path = urlPath.slice(1);
|
||||
}
|
||||
path = path.replace(/:/g, '#');
|
||||
|
||||
if (isNewestPath && !path.startsWith('@')) {
|
||||
path = `@${path}`;
|
||||
}
|
||||
|
||||
if (search && search.startsWith('?q=cache:')) {
|
||||
generateGoogleCacheUrl(search, path);
|
||||
}
|
||||
|
||||
let uri;
|
||||
try {
|
||||
// here queryString and startTime are "removed" from the buildURI process
|
||||
// to build only the uri itself
|
||||
const { queryString, startTime, ...parsedUri } = parseURI(path);
|
||||
uri = buildURI({ ...parsedUri });
|
||||
} catch (e) {
|
||||
const match = path.match(/[#/:]/);
|
||||
|
||||
if (!path.startsWith('$/') && match && match.index) {
|
||||
uri = `lbry://${path.slice(0, match.index)}`;
|
||||
}
|
||||
}
|
||||
|
||||
function getStatusNag() {
|
||||
// Handle "offline" first. Everything else is meaningless if it's offline.
|
||||
if (!connectionStatus.online) {
|
||||
return <Nag type="helpful" message={__('You are offline. Check your internet connection.')} />;
|
||||
}
|
||||
|
||||
// Only 1 nag is possible, so show the most important:
|
||||
|
||||
if (user === null) {
|
||||
return <NagNoUser />;
|
||||
}
|
||||
|
||||
if (lbryTvApiStatus === STATUS_DEGRADED || lbryTvApiStatus === STATUS_FAILING) {
|
||||
if (!shouldHideNag) {
|
||||
return <NagDegradedPerformance onClose={() => setLbryTvApiStatus(STATUS_OK)} />;
|
||||
}
|
||||
}
|
||||
|
||||
if (syncFatalError) {
|
||||
if (!retryingSync) {
|
||||
return (
|
||||
<Nag
|
||||
type="error"
|
||||
message={__('Failed to synchronize settings. Wait a while before retrying.')}
|
||||
actionText={__('Retry')}
|
||||
onClick={() => {
|
||||
syncLoop(true);
|
||||
setRetryingSync(true);
|
||||
setTimeout(() => setRetryingSync(false), 4000);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
} else if (isReloadRequired) {
|
||||
return (
|
||||
<Nag
|
||||
message={__('A new version of Odysee is available.')}
|
||||
actionText={__('Refresh')}
|
||||
onClick={() => window.location.reload()}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (localeLangs && !embedPath && !localeSwitchDismissed && homepageFetched) {
|
||||
const noLanguageSet = language === 'en' && languages.length === 1;
|
||||
return <NagLocaleSwitch localeLangs={localeLangs} noLanguageSet={noLanguageSet} onFrontPage={pathname === '/'} />;
|
||||
}
|
||||
}
|
||||
const hasActiveChannelClaim = activeChannelClaim !== undefined;
|
||||
const isPersonalized = hasVerifiedEmail;
|
||||
const renderFiledrop = isAuthenticated;
|
||||
|
||||
useEffect(() => {
|
||||
if (userId) {
|
||||
analytics.setUser(userId);
|
||||
setSearchUserId(userId);
|
||||
}
|
||||
}, [userId]);
|
||||
|
||||
useEffect(() => {
|
||||
if (syncIsLocked) {
|
||||
const handleBeforeUnload = (event) => {
|
||||
event.preventDefault();
|
||||
event.returnValue = __('There are unsaved settings. Exit the Settings Page to finalize them.');
|
||||
};
|
||||
window.addEventListener('beforeunload', handleBeforeUnload);
|
||||
return () => window.removeEventListener('beforeunload', handleBeforeUnload);
|
||||
}
|
||||
}, [syncIsLocked]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!uploadCount) return;
|
||||
|
||||
const handleUnload = (event) => tusUnlockAndNotify();
|
||||
const handleBeforeUnload = (event) => {
|
||||
event.preventDefault();
|
||||
event.returnValue = __('There are pending uploads.'); // without setting this to something it doesn't work
|
||||
event.returnValue = 'magic'; // without setting this to something it doesn't work
|
||||
};
|
||||
|
||||
window.addEventListener('unload', handleUnload);
|
||||
window.addEventListener('beforeunload', handleBeforeUnload);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener('unload', handleUnload);
|
||||
window.removeEventListener('beforeunload', handleBeforeUnload);
|
||||
};
|
||||
return () => window.removeEventListener('beforeunload', handleBeforeUnload);
|
||||
}, [uploadCount]);
|
||||
|
||||
// allows user to navigate history using the forward and backward buttons on a mouse
|
||||
useEffect(() => {
|
||||
if (!uploadCount) return;
|
||||
|
||||
const onStorageUpdate = (e) => tusHandleTabUpdates(e.key);
|
||||
window.addEventListener('storage', onStorageUpdate);
|
||||
|
||||
return () => window.removeEventListener('storage', onStorageUpdate);
|
||||
}, [uploadCount]);
|
||||
const handleForwardAndBackButtons = (e) => {
|
||||
switch (e.button) {
|
||||
case MOUSE_BACK_BTN:
|
||||
history.index > 0 && history.goBack();
|
||||
break;
|
||||
case MOUSE_FORWARD_BTN:
|
||||
history.index < history.length - 1 && history.goForward();
|
||||
break;
|
||||
}
|
||||
};
|
||||
window.addEventListener('mouseup', handleForwardAndBackButtons);
|
||||
return () => window.removeEventListener('mouseup', handleForwardAndBackButtons);
|
||||
});
|
||||
|
||||
// allows user to pause miniplayer using the spacebar without the page scrolling down
|
||||
useEffect(() => {
|
||||
@@ -304,6 +185,16 @@ function App(props: Props) {
|
||||
return () => window.removeEventListener('keydown', handleKeyPress);
|
||||
}, []);
|
||||
|
||||
// Enable ctrl +/- zooming on Desktop.
|
||||
// @if TARGET='app'
|
||||
useZoom();
|
||||
// @endif
|
||||
|
||||
// Enable 'Alt + Left/Right' for history navigation on Desktop.
|
||||
// @if TARGET='app'
|
||||
useHistoryNav(history);
|
||||
// @endif
|
||||
|
||||
useEffect(() => {
|
||||
if (referredRewardAvailable && sanitizedReferrerParam && isRewardApproved) {
|
||||
setReferrer(sanitizedReferrerParam, true);
|
||||
@@ -319,11 +210,13 @@ function App(props: Props) {
|
||||
ReactModal.setAppElement(wrapperElement);
|
||||
}
|
||||
|
||||
fetchAccessToken();
|
||||
|
||||
// @if TARGET='app'
|
||||
fetchChannelListMine(); // This is fetched after a user is signed in on web
|
||||
fetchCollectionListMine();
|
||||
// @endif
|
||||
}, [appRef, fetchChannelListMine, fetchCollectionListMine]);
|
||||
}, [appRef, fetchAccessToken, fetchChannelListMine, fetchCollectionListMine]);
|
||||
|
||||
useEffect(() => {
|
||||
// $FlowFixMe
|
||||
@@ -331,12 +224,9 @@ function App(props: Props) {
|
||||
}, [theme]);
|
||||
|
||||
useEffect(() => {
|
||||
// $FlowFixMe
|
||||
document.body.style.overflowY = currentModal ? 'hidden' : '';
|
||||
}, [currentModal]);
|
||||
|
||||
useEffect(() => {
|
||||
if (hasNoChannels) {
|
||||
if (hasMyChannels && !hasActiveChannelClaim) {
|
||||
setActiveChannelIfNotSet();
|
||||
} else if (hasNoChannels) {
|
||||
setIncognito(true);
|
||||
}
|
||||
|
||||
@@ -344,14 +234,7 @@ function App(props: Props) {
|
||||
fetchModBlockedList();
|
||||
fetchModAmIList();
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [hasMyChannels, hasNoChannels, setIncognito]);
|
||||
|
||||
useEffect(() => {
|
||||
if (hasMyChannels && activeChannelClaim && !defaultChannelClaim && prefsReady) {
|
||||
doSetDefaultChannel(activeChannelClaim.claim_id);
|
||||
}
|
||||
}, [activeChannelClaim, defaultChannelClaim, doSetDefaultChannel, hasMyChannels, prefsReady]);
|
||||
}, [hasMyChannels, hasNoChannels, hasActiveChannelClaim, setActiveChannelIfNotSet, setIncognito]);
|
||||
|
||||
useEffect(() => {
|
||||
// $FlowFixMe
|
||||
@@ -389,97 +272,35 @@ function App(props: Props) {
|
||||
}
|
||||
}, [previousRewardApproved, isRewardApproved]);
|
||||
|
||||
// Load IMA3 SDK for aniview
|
||||
// useEffect(() => {
|
||||
// if (!isAuthenticated && SHOW_ADS) {
|
||||
// const script = document.createElement('script');
|
||||
// script.src = imaLibraryPath;
|
||||
// script.async = true;
|
||||
// // $FlowFixMe
|
||||
// document.body.appendChild(script);
|
||||
// return () => {
|
||||
// // $FlowFixMe
|
||||
// document.body.removeChild(script);
|
||||
// };
|
||||
// }
|
||||
// }, []);
|
||||
|
||||
// add OneTrust script
|
||||
// @if TARGET='app'
|
||||
useEffect(() => {
|
||||
// don't add script for embedded content
|
||||
function inIframe() {
|
||||
try {
|
||||
return window.self !== window.top;
|
||||
} catch (e) {
|
||||
return true;
|
||||
}
|
||||
if (updatePreferences && getWalletSyncPref && readyForPrefs) {
|
||||
getWalletSyncPref()
|
||||
.then(() => updatePreferences())
|
||||
.then(() => {
|
||||
setReadyForSync(true);
|
||||
});
|
||||
}
|
||||
|
||||
if (inIframe() || !locale || !locale.gdpr_required) {
|
||||
return;
|
||||
}
|
||||
|
||||
// $FlowFixMe
|
||||
const useProductionOneTrust = process.env.NODE_ENV === 'production' && hostname === 'odysee.com';
|
||||
|
||||
const script = document.createElement('script');
|
||||
script.src = oneTrustScriptSrc;
|
||||
script.setAttribute('charset', 'UTF-8');
|
||||
if (useProductionOneTrust) {
|
||||
script.setAttribute('data-domain-script', '8a792d84-50a5-4b69-b080-6954ad4d4606');
|
||||
} else {
|
||||
script.setAttribute('data-domain-script', '8a792d84-50a5-4b69-b080-6954ad4d4606-test');
|
||||
}
|
||||
|
||||
const secondScript = document.createElement('script');
|
||||
// OneTrust asks to add this
|
||||
secondScript.innerHTML = 'function OptanonWrapper() { }';
|
||||
|
||||
// $FlowFixMe
|
||||
document.head.appendChild(script);
|
||||
// $FlowFixMe
|
||||
document.head.appendChild(secondScript);
|
||||
|
||||
return () => {
|
||||
try {
|
||||
// $FlowFixMe
|
||||
document.head.removeChild(script);
|
||||
// $FlowFixMe
|
||||
document.head.removeChild(secondScript);
|
||||
} catch (err) {
|
||||
// eslint-disable-next-line no-console
|
||||
// console.log(err); <-- disabling this ... it's clogging up Sentry logs.
|
||||
}
|
||||
};
|
||||
// (one time after locale is fetched)
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [locale]);
|
||||
|
||||
useEffect(() => {
|
||||
if (locale) {
|
||||
const countryCode = locale.country;
|
||||
const langs = getLanguagesForCountry(countryCode) || [];
|
||||
const supportedLangs = langs.filter((lang) => lang !== 'en' && SUPPORTED_LANGUAGES[lang]);
|
||||
|
||||
if (supportedLangs.length > 0) {
|
||||
setLocaleLangs(supportedLangs);
|
||||
}
|
||||
}
|
||||
}, [locale]);
|
||||
}, [updatePreferences, getWalletSyncPref, setReadyForSync, readyForPrefs, hasVerifiedEmail]);
|
||||
// @endif
|
||||
|
||||
// ready for sync syncs, however after signin when hasVerifiedEmail, that syncs too.
|
||||
useEffect(() => {
|
||||
// signInSyncPref is cleared after sharedState loop.
|
||||
const syncLoopWithoutInterval = () => syncLoop(true);
|
||||
if (hasSignedIn && hasVerifiedEmail) {
|
||||
if (readyForSync && hasVerifiedEmail) {
|
||||
// In case we are syncing.
|
||||
syncLoop();
|
||||
window.addEventListener('focus', syncLoopWithoutInterval);
|
||||
}
|
||||
return () => {
|
||||
window.removeEventListener('focus', syncLoopWithoutInterval);
|
||||
};
|
||||
}, [hasSignedIn, hasVerifiedEmail, syncLoop]);
|
||||
}, [readyForSync, hasVerifiedEmail, syncLoop]);
|
||||
|
||||
// We know someone is logging in or not when we get their user object
|
||||
// We'll use this to determine when it's time to pull preferences
|
||||
// This will no longer work if desktop users no longer get a user object from lbryinc
|
||||
useEffect(() => {
|
||||
if (user) {
|
||||
setReadyForPrefs(true);
|
||||
}
|
||||
}, [user, setReadyForPrefs]);
|
||||
|
||||
useEffect(() => {
|
||||
if (syncError && isAuthenticated && !pathname.includes(PAGES.AUTH_WALLET_PASSWORD) && !currentModal) {
|
||||
@@ -488,83 +309,51 @@ function App(props: Props) {
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [syncError, pathname, isAuthenticated]);
|
||||
|
||||
useEffect(() => {
|
||||
if (prefsReady) {
|
||||
doOpenAnnouncements();
|
||||
}
|
||||
}, [prefsReady]);
|
||||
|
||||
useEffect(() => {
|
||||
window.clearLastViewedAnnouncement = () => {
|
||||
console.log('Clearing history. Please wait ...');
|
||||
doSetLastViewedAnnouncement('');
|
||||
};
|
||||
}, []);
|
||||
|
||||
// Keep this at the end to ensure initial setup effects are run first
|
||||
useEffect(() => {
|
||||
if (!hasSignedIn && hasVerifiedEmail) {
|
||||
signIn();
|
||||
setHasSignedIn(true);
|
||||
if (IS_WEB) setReadyForSync(true);
|
||||
}
|
||||
}, [hasVerifiedEmail, signIn, hasSignedIn]);
|
||||
|
||||
useDegradedPerformance(setLbryTvApiStatus, user);
|
||||
// batch resolve subscriptions to be used by the sideNavigation component.
|
||||
// add it here so that it only resolves the first time, despite route changes.
|
||||
// useLayoutEffect because it has to be executed before the sideNavigation component requests them
|
||||
useLayoutEffect(() => {
|
||||
if (sidebarOpen && isPersonalized && subscriptions && !resolvedSubscriptions) {
|
||||
setResolvedSubscriptions(true);
|
||||
resolveUris(subscriptions.map((sub) => sub.uri));
|
||||
}
|
||||
}, [sidebarOpen, isPersonalized, resolvedSubscriptions, subscriptions, resolveUris, setResolvedSubscriptions]);
|
||||
|
||||
useEffect(() => {
|
||||
// When language is changed or translations are fetched, we render.
|
||||
setLangRenderKey(Date.now());
|
||||
}, [language, languages]);
|
||||
|
||||
// Require an internal-api user on lbry.tv
|
||||
// This also prevents the site from loading in the un-authed state while we wait for internal-apis to return for the first time
|
||||
// It's not needed on desktop since there is no un-authed state
|
||||
if (user === undefined) {
|
||||
return (
|
||||
<div className="main--empty">
|
||||
<Spinner delayed />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (connectionStatus.online && lbryTvApiStatus === STATUS_DOWN) {
|
||||
// TODO: Rename `SyncFatalError` since it has nothing to do with syncing.
|
||||
return (
|
||||
<React.Suspense fallback={null}>
|
||||
<SyncFatalError lbryTvApiStatus={lbryTvApiStatus} />
|
||||
</React.Suspense>
|
||||
);
|
||||
if (syncFatalError) {
|
||||
return <SyncFatalError />;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={MAIN_WRAPPER_CLASS} ref={appRef} key={langRenderKey}>
|
||||
{lbryTvApiStatus === STATUS_DOWN ? (
|
||||
<Yrbl
|
||||
className="main--empty"
|
||||
title={__('odysee.com is currently down')}
|
||||
subtitle={__('My wheel broke, but the good news is that someone from LBRY is working on it.')}
|
||||
<div
|
||||
className={classnames(MAIN_WRAPPER_CLASS, {
|
||||
[`${MAIN_WRAPPER_CLASS}--mac`]: IS_MAC,
|
||||
[`${MAIN_WRAPPER_CLASS}--scrollbar`]: useCustomScrollbar,
|
||||
})}
|
||||
ref={appRef}
|
||||
onContextMenu={IS_WEB ? undefined : (e) => openContextMenu(e)}
|
||||
>
|
||||
<Router />
|
||||
<ModalRouter />
|
||||
{renderFiledrop && <FileDrop />}
|
||||
<FileRenderFloating />
|
||||
{isEnhancedLayout && <Yrbl className="yrbl--enhanced" />}
|
||||
|
||||
{showUpgradeButton && (
|
||||
<Nag
|
||||
message={__('An upgrade is available.')}
|
||||
actionText={__('Install Now')}
|
||||
onClick={requestDownloadUpgrade}
|
||||
onClose={() => setUpgradeNagClosed(true)}
|
||||
/>
|
||||
) : (
|
||||
<React.Fragment>
|
||||
<AdsSticky uri={uri} />
|
||||
<Router uri={uri} embedLatestPath={embedLatestPath} />
|
||||
<ModalRouter />
|
||||
|
||||
<React.Suspense fallback={null}>{renderFiledrop && <FileDrop />}</React.Suspense>
|
||||
|
||||
<FileRenderFloating />
|
||||
|
||||
<React.Suspense fallback={null}>
|
||||
{isEnhancedLayout && <Yrbl className="yrbl--enhanced" />}
|
||||
|
||||
<YoutubeWelcome />
|
||||
{!shouldHideNag && <NagContinueFirstRun />}
|
||||
{fromLbrytvParam && !seenSunsestMessage && !shouldHideNag && (
|
||||
<NagSunset email={hasVerifiedEmail} onClose={() => setSeenSunsetMessage(true)} />
|
||||
)}
|
||||
{getStatusNag()}
|
||||
</React.Suspense>
|
||||
</React.Fragment>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimForUri, selectClaimIsNsfwForUri } from 'redux/selectors/claims';
|
||||
import { makeSelectClaimForUri } from 'redux/selectors/claims';
|
||||
import { withRouter } from 'react-router';
|
||||
import AutoplayCountdown from './view';
|
||||
import { selectModal } from 'redux/selectors/app';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
|
||||
/*
|
||||
AutoplayCountdown does not fetch it's own next content to play, it relies on <RecommendedContent> being rendered.
|
||||
@@ -11,11 +11,6 @@ import { doOpenModal } from 'redux/actions/app';
|
||||
const select = (state, props) => ({
|
||||
nextRecommendedClaim: makeSelectClaimForUri(props.nextRecommendedUri)(state),
|
||||
modal: selectModal(state),
|
||||
isMature: selectClaimIsNsfwForUri(state, props.uri),
|
||||
});
|
||||
|
||||
const perform = {
|
||||
doOpenModal,
|
||||
};
|
||||
|
||||
export default connect(select, perform)(AutoplayCountdown);
|
||||
export default withRouter(connect(select, null)(AutoplayCountdown));
|
||||
@@ -6,40 +6,33 @@ import I18nMessage from 'component/i18nMessage';
|
||||
import { withRouter } from 'react-router';
|
||||
import debounce from 'util/debounce';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as MODALS from 'constants/modal_types';
|
||||
|
||||
const DEBOUNCE_SCROLL_HANDLER_MS = 150;
|
||||
const CLASSNAME_AUTOPLAY_COUNTDOWN = 'autoplay-countdown';
|
||||
|
||||
type Props = {
|
||||
uri?: string,
|
||||
history: { push: (string) => void },
|
||||
nextRecommendedClaim: ?StreamClaim,
|
||||
nextRecommendedUri: string,
|
||||
modal: { id: string, modalProps: {} },
|
||||
skipPaid: boolean,
|
||||
skipMature: boolean,
|
||||
isMature: boolean,
|
||||
doNavigate: () => void,
|
||||
doReplay: () => void,
|
||||
doPrevious: () => void,
|
||||
onCanceled: () => void,
|
||||
doOpenModal: (id: string, props: {}) => void,
|
||||
};
|
||||
|
||||
function AutoplayCountdown(props: Props) {
|
||||
const {
|
||||
uri,
|
||||
nextRecommendedUri,
|
||||
nextRecommendedClaim,
|
||||
history: { push },
|
||||
modal,
|
||||
skipPaid,
|
||||
skipMature,
|
||||
isMature,
|
||||
doNavigate,
|
||||
doReplay,
|
||||
doPrevious,
|
||||
onCanceled,
|
||||
doOpenModal,
|
||||
} = props;
|
||||
const nextTitle = nextRecommendedClaim && nextRecommendedClaim.value && nextRecommendedClaim.value.title;
|
||||
|
||||
@@ -51,25 +44,14 @@ function AutoplayCountdown(props: Props) {
|
||||
const [timerPaused, setTimerPaused] = React.useState(false);
|
||||
const anyModalPresent = modal !== undefined && modal !== null;
|
||||
const isTimerPaused = timerPaused || anyModalPresent;
|
||||
const shouldSkipMature = skipMature && isMature;
|
||||
const skipCurrentVideo = skipPaid || shouldSkipMature;
|
||||
|
||||
function isAnyInputFocused() {
|
||||
const activeElement = document.activeElement;
|
||||
const inputTypes = ['input', 'select', 'textarea'];
|
||||
return activeElement && inputTypes.includes(activeElement.tagName.toLowerCase());
|
||||
}
|
||||
|
||||
function shouldPauseAutoplay() {
|
||||
// TODO: use ref instead querySelector
|
||||
const elm = document.querySelector(`.${CLASSNAME_AUTOPLAY_COUNTDOWN}`);
|
||||
return isAnyInputFocused() || (elm && elm.getBoundingClientRect().top < 0);
|
||||
return elm && elm.getBoundingClientRect().top < 0;
|
||||
}
|
||||
|
||||
function getMsgPlayingNext() {
|
||||
if (shouldSkipMature) {
|
||||
return __('Skipping mature content in %seconds_left% seconds...', { seconds_left: timer });
|
||||
} else if (skipPaid) {
|
||||
if (skipPaid) {
|
||||
return __('Playing next free content in %seconds_left% seconds...', { seconds_left: timer });
|
||||
} else {
|
||||
return __('Playing in %seconds_left% seconds...', { seconds_left: timer });
|
||||
@@ -93,14 +75,14 @@ function AutoplayCountdown(props: Props) {
|
||||
React.useEffect(() => {
|
||||
let interval;
|
||||
if (!timerCanceled && nextRecommendedUri) {
|
||||
if (isTimerPaused || isAnyInputFocused()) {
|
||||
if (isTimerPaused) {
|
||||
clearInterval(interval);
|
||||
setTimer(countdownTime);
|
||||
} else {
|
||||
interval = setInterval(() => {
|
||||
const newTime = timer - 1;
|
||||
if (newTime === 0) {
|
||||
if (skipCurrentVideo) setTimer(countdownTime);
|
||||
if (skipPaid) setTimer(countdownTime);
|
||||
doNavigate();
|
||||
} else {
|
||||
setTimer(timer - 1);
|
||||
@@ -111,7 +93,7 @@ function AutoplayCountdown(props: Props) {
|
||||
return () => {
|
||||
clearInterval(interval);
|
||||
};
|
||||
}, [doNavigate, isTimerPaused, nextRecommendedUri, skipCurrentVideo, timer, timerCanceled]);
|
||||
}, [timer, doNavigate, push, timerCanceled, isTimerPaused, nextRecommendedUri, skipPaid]);
|
||||
|
||||
if (timerCanceled || !nextRecommendedUri) {
|
||||
return null;
|
||||
@@ -149,7 +131,7 @@ function AutoplayCountdown(props: Props) {
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{skipCurrentVideo && doPrevious && (
|
||||
{skipPaid && doPrevious && (
|
||||
<div>
|
||||
<Button
|
||||
label={__('Play Previous')}
|
||||
@@ -161,16 +143,12 @@ function AutoplayCountdown(props: Props) {
|
||||
)}
|
||||
<div>
|
||||
<Button
|
||||
label={shouldSkipMature ? undefined : skipPaid ? __('Purchase?') : __('Replay?')}
|
||||
label={skipPaid ? __('Purchase?') : __('Replay?')}
|
||||
button="link"
|
||||
icon={shouldSkipMature ? undefined : skipPaid ? ICONS.WALLET : ICONS.REPLAY}
|
||||
iconRight={skipPaid ? ICONS.WALLET : ICONS.REPLAY}
|
||||
onClick={() => {
|
||||
setTimerCanceled(true);
|
||||
if (skipPaid) {
|
||||
doOpenModal(MODALS.AFFIRM_PURCHASE, { uri, cancelCb: () => setTimerCanceled(false) });
|
||||
} else {
|
||||
doReplay();
|
||||
}
|
||||
doReplay();
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -118,7 +118,7 @@ export default function BlockList(props: Props) {
|
||||
return (
|
||||
<>
|
||||
<div className="help--notice">{help}</div>
|
||||
<div className="section" style={{ zIndex: '4' }}>
|
||||
<div className="section">
|
||||
<SearchList
|
||||
list={localList}
|
||||
placeholder={__('e.g. odysee')}
|
||||
|
||||
@@ -2,13 +2,11 @@ import Button from './view';
|
||||
import React, { forwardRef } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { selectUser, selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
import { selectHasChannels } from 'redux/selectors/claims';
|
||||
|
||||
const mapStateToProps = (state) => ({
|
||||
pathname: state.router.location.pathname,
|
||||
emailVerified: selectUserVerifiedEmail(state),
|
||||
user: selectUser(state),
|
||||
hasChannels: selectHasChannels(state),
|
||||
});
|
||||
|
||||
const ConnectedButton = connect(mapStateToProps)(Button);
|
||||
|
||||
@@ -19,7 +19,6 @@ type Props = {
|
||||
disabled: ?boolean,
|
||||
children: ?Node,
|
||||
navigate: ?string,
|
||||
navigateTarget?: string,
|
||||
className: ?string,
|
||||
description: ?string,
|
||||
type: string,
|
||||
@@ -36,8 +35,6 @@ type Props = {
|
||||
pathname: string,
|
||||
emailVerified: boolean,
|
||||
requiresAuth: ?boolean,
|
||||
requiresChannel: ?boolean,
|
||||
hasChannels: boolean,
|
||||
myref: any,
|
||||
dispatch: any,
|
||||
'aria-label'?: string,
|
||||
@@ -62,7 +59,6 @@ const Button = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
disabled,
|
||||
children,
|
||||
navigate,
|
||||
navigateTarget,
|
||||
className,
|
||||
description,
|
||||
button,
|
||||
@@ -71,8 +67,6 @@ const Button = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
activeClass,
|
||||
emailVerified,
|
||||
requiresAuth,
|
||||
requiresChannel,
|
||||
hasChannels,
|
||||
myref,
|
||||
dispatch, // <button> doesn't know what to do with dispatch
|
||||
pathname,
|
||||
@@ -145,25 +139,15 @@ const Button = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
)}
|
||||
|
||||
{children && children}
|
||||
{iconRight && <Icon icon={iconRight} iconColor={iconColor} size={iconSize || size} />}
|
||||
{iconRight && <Icon icon={iconRight} iconColor={iconColor} size={size} />}
|
||||
</span>
|
||||
);
|
||||
|
||||
// check if the link is for odysee.com
|
||||
function isAnOdyseeLink(urlString) {
|
||||
return (
|
||||
urlString && (urlString.indexOf('https://odysee.com') !== -1 || urlString.indexOf('http://odysee.com') !== -1)
|
||||
);
|
||||
}
|
||||
|
||||
// if it's an internal link we won't open a new tab
|
||||
const isAnInternalLink = (href || navigate) && (isAnOdyseeLink(href) || isAnOdyseeLink(navigate));
|
||||
|
||||
if (href || (navigate && navigate.startsWith('http'))) {
|
||||
// TODO: replace the below with an outbound link tracker for matomo
|
||||
return (
|
||||
<a
|
||||
target={navigateTarget || (isAnInternalLink ? '' : '_blank')}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
href={href || navigate}
|
||||
className={combinedClassName}
|
||||
@@ -199,12 +183,8 @@ const Button = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
}
|
||||
}
|
||||
|
||||
if ((requiresAuth && !emailVerified) || (requiresChannel && !hasChannels)) {
|
||||
// requiresChannel can be used for both requiresAuth and requiresChannel,
|
||||
// since if the button requiresChannel, it also implies it requiresAuth in order to proceed
|
||||
// so using requiresChannel means: unauth users are sent to signup, auth users to create channel
|
||||
const page = !emailVerified ? PAGES.AUTH : PAGES.CHANNEL_NEW;
|
||||
let redirectUrl = `/$/${page}?redirect=${pathname}`;
|
||||
if (requiresAuth && !emailVerified) {
|
||||
let redirectUrl = `/$/${PAGES.AUTH}?redirect=${pathname}`;
|
||||
|
||||
if (authSrc) {
|
||||
redirectUrl += `&src=${authSrc}`;
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doCollectionEdit } from 'redux/actions/collections';
|
||||
import { selectCollectionForIdHasClaimUrl, selectUrlsForCollectionId } from 'redux/selectors/collections';
|
||||
import { selectClaimForUri } from 'redux/selectors/claims';
|
||||
import * as COLLECTIONS_CONSTS from 'constants/collections';
|
||||
import ButtonAddToQueue from './view';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
import { doUriInitiatePlay, doSetPlayingUri } from 'redux/actions/content';
|
||||
import { selectPlayingUri } from 'redux/selectors/content';
|
||||
|
||||
const select = (state, props) => {
|
||||
const { uri } = props;
|
||||
|
||||
const playingUri = selectPlayingUri(state);
|
||||
const { collectionId } = playingUri.collection || {};
|
||||
const { permanent_url: playingUrl } = selectClaimForUri(state, playingUri.uri) || {};
|
||||
|
||||
return {
|
||||
playingUri,
|
||||
playingUrl,
|
||||
hasClaimInQueue: selectCollectionForIdHasClaimUrl(state, COLLECTIONS_CONSTS.QUEUE_ID, uri),
|
||||
hasPlayingUriInQueue: Boolean(
|
||||
playingUrl && selectCollectionForIdHasClaimUrl(state, COLLECTIONS_CONSTS.QUEUE_ID, playingUrl)
|
||||
),
|
||||
playingCollectionUrls:
|
||||
collectionId && collectionId !== COLLECTIONS_CONSTS.QUEUE_ID && selectUrlsForCollectionId(state, collectionId),
|
||||
};
|
||||
};
|
||||
|
||||
const perform = {
|
||||
doToast,
|
||||
doCollectionEdit,
|
||||
doUriInitiatePlay,
|
||||
doSetPlayingUri,
|
||||
};
|
||||
|
||||
export default connect(select, perform)(ButtonAddToQueue);
|
||||
@@ -1,97 +0,0 @@
|
||||
// @flow
|
||||
import * as ICONS from 'constants/icons';
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import * as COLLECTIONS_CONSTS from 'constants/collections';
|
||||
import { MenuItem } from '@reach/menu-button';
|
||||
import Icon from 'component/common/icon';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
focusable: boolean,
|
||||
menuItem?: boolean,
|
||||
// -- redux --
|
||||
hasClaimInQueue: boolean,
|
||||
hasPlayingUriInQueue: boolean,
|
||||
playingUri: PlayingUri,
|
||||
playingUrl: ?string,
|
||||
playingCollectionUrls: ?Array<string>,
|
||||
doToast: (props: { message: string }) => void,
|
||||
doCollectionEdit: (id: string, any) => void,
|
||||
doUriInitiatePlay: (playingOptions: PlayingUri, isPlayable?: boolean, isFloating?: boolean) => void,
|
||||
doSetPlayingUri: (props: any) => void,
|
||||
};
|
||||
|
||||
function ButtonAddToQueue(props: Props) {
|
||||
const {
|
||||
uri,
|
||||
focusable = true,
|
||||
menuItem,
|
||||
hasClaimInQueue,
|
||||
hasPlayingUriInQueue,
|
||||
playingUri,
|
||||
playingUrl,
|
||||
playingCollectionUrls,
|
||||
doToast,
|
||||
doCollectionEdit,
|
||||
doUriInitiatePlay,
|
||||
doSetPlayingUri,
|
||||
} = props;
|
||||
|
||||
function handleQueue(e) {
|
||||
if (e) e.preventDefault();
|
||||
|
||||
doToast({ message: hasClaimInQueue ? __('Item removed from Queue') : __('Item added to Queue') });
|
||||
|
||||
const itemsToAdd = playingCollectionUrls || [playingUrl];
|
||||
doCollectionEdit(COLLECTIONS_CONSTS.QUEUE_ID, {
|
||||
uris: playingUrl && playingUrl !== uri && !hasPlayingUriInQueue ? [...itemsToAdd, uri] : [uri],
|
||||
remove: hasClaimInQueue,
|
||||
type: 'playlist',
|
||||
});
|
||||
|
||||
if (!hasClaimInQueue) {
|
||||
const paramsToAdd = {
|
||||
collection: { collectionId: COLLECTIONS_CONSTS.QUEUE_ID },
|
||||
source: COLLECTIONS_CONSTS.QUEUE_ID,
|
||||
};
|
||||
|
||||
if (playingUrl) {
|
||||
// adds the queue collection id to the playingUri data so it can be used and updated by other components
|
||||
if (!hasPlayingUriInQueue) doSetPlayingUri({ ...playingUri, ...paramsToAdd });
|
||||
} else {
|
||||
// There is nothing playing and added a video to queue -> the first item will play on the floating player with the list open
|
||||
doUriInitiatePlay({ uri, ...paramsToAdd }, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// label that is shown after hover
|
||||
const label = !hasClaimInQueue ? __('Add to Queue') : __('In Queue');
|
||||
|
||||
if (menuItem) {
|
||||
return (
|
||||
<MenuItem className="comment__menu-option" onSelect={handleQueue}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={hasClaimInQueue ? ICONS.PLAYLIST_FILLED : ICONS.PLAYLIST} />
|
||||
{hasClaimInQueue ? __('In Queue') : __('Add to Queue')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="claim-preview__hover-actions third-item">
|
||||
<Button
|
||||
title={__('Queue Mode')}
|
||||
label={label}
|
||||
className="button--file-action"
|
||||
icon={hasClaimInQueue ? ICONS.PLAYLIST_FILLED : ICONS.PLAYLIST_ADD}
|
||||
onClick={(e) => handleQueue(e)}
|
||||
tabIndex={focusable ? 0 : -1}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default ButtonAddToQueue;
|
||||
@@ -1,6 +1,5 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectMetadataItemForUri, makeSelectClaimForUri } from 'redux/selectors/claims';
|
||||
import { selectUser } from 'redux/selectors/user';
|
||||
import ChannelAbout from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
@@ -9,7 +8,6 @@ const select = (state, props) => ({
|
||||
website: makeSelectMetadataItemForUri(props.uri, 'website_url')(state),
|
||||
email: makeSelectMetadataItemForUri(props.uri, 'email')(state),
|
||||
languages: makeSelectMetadataItemForUri(props.uri, 'languages')(state),
|
||||
user: selectUser(state),
|
||||
});
|
||||
|
||||
export default connect(select, null)(ChannelAbout);
|
||||
@@ -1,11 +1,8 @@
|
||||
// @flow
|
||||
import { SIMPLE_SITE } from 'config';
|
||||
import React, { Fragment } from 'react';
|
||||
import MarkdownPreview from 'component/common/markdown-preview';
|
||||
import ClaimTags from 'component/claimTags';
|
||||
import CreditAmount from 'component/common/credit-amount';
|
||||
import Button from 'component/button';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import DateTime from 'component/dateTime';
|
||||
import YoutubeBadge from 'component/youtubeBadge';
|
||||
import SUPPORTED_LANGUAGES from 'constants/supported_languages';
|
||||
@@ -17,7 +14,6 @@ type Props = {
|
||||
email: ?string,
|
||||
website: ?string,
|
||||
languages: Array<string>,
|
||||
user: ?User,
|
||||
};
|
||||
|
||||
const formatEmail = (email: string) => {
|
||||
@@ -30,9 +26,8 @@ const formatEmail = (email: string) => {
|
||||
};
|
||||
|
||||
function ChannelAbout(props: Props) {
|
||||
const { claim, uri, description, email, website, languages, user } = props;
|
||||
const { claim, uri, description, email, website, languages } = props;
|
||||
const claimId = claim && claim.claim_id;
|
||||
const canView = user && user.global_mod;
|
||||
|
||||
return (
|
||||
<div className="card">
|
||||
@@ -96,24 +91,16 @@ function ChannelAbout(props: Props) {
|
||||
<div className="media__info-text media__info-text--constrained">{claim.claim_id}</div>
|
||||
</div>
|
||||
|
||||
<label>{__('Staked Credits')}</label>
|
||||
<label>{__('Staked LBRY Credits')}</label>
|
||||
<div className="media__info-text">
|
||||
<CreditAmount
|
||||
badge={false}
|
||||
amount={parseFloat(claim.amount) + parseFloat(claim.meta.support_amount)}
|
||||
precision={8}
|
||||
/>{' '}
|
||||
{SIMPLE_SITE && (
|
||||
<Button
|
||||
button="link"
|
||||
label={__('view other claims at lbry://%name%', {
|
||||
name: claim.name,
|
||||
})}
|
||||
navigate={`/$/${PAGES.TOP}?name=${claim.name}`}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
{canView && <YoutubeBadge channelClaimId={claimId} />}
|
||||
|
||||
<YoutubeBadge channelClaimId={claimId} />
|
||||
</Fragment>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { selectClaimIdForUri } from 'redux/selectors/claims';
|
||||
import { makeSelectClaimIdForUri } from 'redux/selectors/claims';
|
||||
import {
|
||||
doCommentModUnBlock,
|
||||
doCommentModBlock,
|
||||
@@ -43,7 +43,7 @@ const select = (state, props) => {
|
||||
isBlocked,
|
||||
isToggling,
|
||||
isBlockingOrUnBlocking: makeSelectUriIsBlockingOrUnBlocking(props.uri)(state),
|
||||
creatorId: selectClaimIdForUri(state, props.creatorUri),
|
||||
creatorId: makeSelectClaimIdForUri(props.creatorUri)(state),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -11,11 +11,11 @@ type Props = {
|
||||
isBlockingOrUnBlocking: boolean,
|
||||
isToggling: boolean,
|
||||
doCommentModUnBlock: (string, boolean) => void,
|
||||
doCommentModBlock: (string, ?string, ?Number, boolean) => void,
|
||||
doCommentModBlock: (string, ?Number, boolean) => void,
|
||||
doCommentModUnBlockAsAdmin: (string, string) => void,
|
||||
doCommentModBlockAsAdmin: (string, ?string, ?string) => void,
|
||||
doCommentModBlockAsAdmin: (string, string) => void,
|
||||
doCommentModUnBlockAsModerator: (string, string, string) => void,
|
||||
doCommentModBlockAsModerator: (string, ?string, string, ?string) => void,
|
||||
doCommentModBlockAsModerator: (string, string, string) => void,
|
||||
};
|
||||
|
||||
function ChannelBlockButton(props: Props) {
|
||||
@@ -41,7 +41,7 @@ function ChannelBlockButton(props: Props) {
|
||||
if (isBlocked) {
|
||||
doCommentModUnBlock(uri, false);
|
||||
} else {
|
||||
doCommentModBlock(uri, undefined, undefined, false);
|
||||
doCommentModBlock(uri, undefined, false);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -50,7 +50,7 @@ function ChannelBlockButton(props: Props) {
|
||||
if (isBlocked) {
|
||||
doCommentModUnBlockAsModerator(uri, creatorUri, '');
|
||||
} else {
|
||||
doCommentModBlockAsModerator(uri, undefined, creatorUri, undefined);
|
||||
doCommentModBlockAsModerator(uri, creatorUri, '');
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -59,7 +59,7 @@ function ChannelBlockButton(props: Props) {
|
||||
if (isBlocked) {
|
||||
doCommentModUnBlockAsAdmin(uri, '');
|
||||
} else {
|
||||
doCommentModBlockAsAdmin(uri, undefined, undefined);
|
||||
doCommentModBlockAsAdmin(uri, '');
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3,48 +3,38 @@ import { PAGE_SIZE } from 'constants/claim';
|
||||
import {
|
||||
makeSelectClaimsInChannelForPage,
|
||||
makeSelectFetchingChannelClaims,
|
||||
selectClaimIsMine,
|
||||
makeSelectClaimIsMine,
|
||||
makeSelectTotalPagesInChannelSearch,
|
||||
selectClaimForUri,
|
||||
makeSelectClaimForUri,
|
||||
} from 'redux/selectors/claims';
|
||||
import { selectOdyseeMembershipIsPremiumPlus } from 'redux/selectors/user';
|
||||
import { doResolveUris } from 'redux/actions/claims';
|
||||
import * as SETTINGS from 'constants/settings';
|
||||
import { makeSelectChannelIsMuted } from 'redux/selectors/blocked';
|
||||
import { withRouter } from 'react-router';
|
||||
import { selectClientSetting, selectShowMatureContent } from 'redux/selectors/settings';
|
||||
import { selectAdBlockerFound } from 'redux/selectors/app';
|
||||
import { doFetchChannelLiveStatus } from 'redux/actions/livestream';
|
||||
import { selectActiveLivestreamForChannel, selectActiveLivestreamInitialized } from 'redux/selectors/livestream';
|
||||
import { getChannelIdFromClaim } from 'util/claim';
|
||||
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
import { makeSelectClientSetting, selectShowMatureContent } from 'redux/selectors/settings';
|
||||
|
||||
import ChannelContent from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
const { search } = props.location;
|
||||
const urlParams = new URLSearchParams(search);
|
||||
const page = urlParams.get('page') || 0;
|
||||
const claim = props.uri && selectClaimForUri(state, props.uri);
|
||||
const channelClaimId = getChannelIdFromClaim(claim);
|
||||
|
||||
return {
|
||||
pageOfClaimsInChannel: makeSelectClaimsInChannelForPage(props.uri, page)(state),
|
||||
fetching: makeSelectFetchingChannelClaims(props.uri)(state),
|
||||
totalPages: makeSelectTotalPagesInChannelSearch(props.uri, PAGE_SIZE)(state),
|
||||
channelIsMine: selectClaimIsMine(state, claim),
|
||||
channelIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
channelIsBlocked: makeSelectChannelIsMuted(props.uri)(state),
|
||||
claim,
|
||||
claim: props.uri && makeSelectClaimForUri(props.uri)(state),
|
||||
isAuthenticated: selectUserVerifiedEmail(state),
|
||||
showMature: selectShowMatureContent(state),
|
||||
tileLayout: selectClientSetting(state, SETTINGS.TILE_LAYOUT),
|
||||
activeLivestreamForChannel: selectActiveLivestreamForChannel(state, channelClaimId),
|
||||
activeLivestreamInitialized: selectActiveLivestreamInitialized(state),
|
||||
adBlockerFound: selectAdBlockerFound(state),
|
||||
hasPremiumPlus: selectOdyseeMembershipIsPremiumPlus(state),
|
||||
tileLayout: makeSelectClientSetting(SETTINGS.TILE_LAYOUT)(state),
|
||||
};
|
||||
};
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
doResolveUris: (uris, returnCachedUris) => dispatch(doResolveUris(uris, returnCachedUris)),
|
||||
doFetchChannelLiveStatus: (channelID) => dispatch(doFetchChannelLiveStatus(channelID)),
|
||||
});
|
||||
|
||||
export default withRouter(connect(select, perform)(ChannelContent));
|
||||
@@ -1,92 +0,0 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import ClaimList from 'component/claimList';
|
||||
import { DEBOUNCE_WAIT_DURATION_MS, SEARCH_PAGE_SIZE } from 'constants/search';
|
||||
import { lighthouse } from 'redux/actions/search';
|
||||
|
||||
type Props = {
|
||||
searchQuery: string,
|
||||
claimId: ?string,
|
||||
showMature: ?boolean,
|
||||
tileLayout: boolean,
|
||||
onResults?: (results: ?Array<string>) => void,
|
||||
doResolveUris: (Array<string>, boolean) => void,
|
||||
};
|
||||
|
||||
export function SearchResults(props: Props) {
|
||||
const { searchQuery, claimId, showMature, tileLayout, onResults, doResolveUris } = props;
|
||||
|
||||
const [page, setPage] = React.useState(1);
|
||||
const [searchResults, setSearchResults] = React.useState(undefined);
|
||||
const [isSearching, setIsSearching] = React.useState(false);
|
||||
const noMoreResults = React.useRef(false);
|
||||
|
||||
React.useEffect(() => {
|
||||
setPage(1);
|
||||
}, [searchQuery]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (onResults) {
|
||||
onResults(searchResults);
|
||||
}
|
||||
}, [searchResults, onResults]);
|
||||
|
||||
React.useEffect(() => {
|
||||
const timer = setTimeout(() => {
|
||||
if (searchQuery.trim().length < 3 || !claimId) {
|
||||
return setSearchResults(null);
|
||||
}
|
||||
|
||||
setIsSearching(true);
|
||||
|
||||
lighthouse
|
||||
.search(
|
||||
`from=${SEARCH_PAGE_SIZE * (page - 1)}` +
|
||||
`&s=${encodeURIComponent(searchQuery)}` +
|
||||
`&channel_id=${encodeURIComponent(claimId)}` +
|
||||
`&nsfw=${showMature ? 'true' : 'false'}` +
|
||||
`&size=${SEARCH_PAGE_SIZE}`
|
||||
)
|
||||
.then(({ body: results }) => {
|
||||
const urls = results.map(({ name, claimId }) => {
|
||||
return `lbry://${name}#${claimId}`;
|
||||
});
|
||||
|
||||
// Batch-resolve the urls before calling 'setSearchResults', as the
|
||||
// latter will immediately cause the tiles to resolve, ending up
|
||||
// calling doResolveUri one by one before the batched one.
|
||||
doResolveUris(urls, true);
|
||||
|
||||
// De-dup (LH will return some duplicates) and concat results
|
||||
setSearchResults((prev) => (page === 1 ? urls : Array.from(new Set((prev || []).concat(urls)))));
|
||||
noMoreResults.current = !urls || urls.length < SEARCH_PAGE_SIZE;
|
||||
})
|
||||
.catch(() => {
|
||||
setPage(1);
|
||||
setSearchResults(null);
|
||||
noMoreResults.current = false;
|
||||
})
|
||||
.finally(() => {
|
||||
setIsSearching(false);
|
||||
});
|
||||
}, DEBOUNCE_WAIT_DURATION_MS);
|
||||
|
||||
return () => clearTimeout(timer);
|
||||
}, [searchQuery, claimId, page, showMature, doResolveUris]);
|
||||
|
||||
if (!searchResults) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<ClaimList
|
||||
uris={searchResults}
|
||||
loading={isSearching}
|
||||
onScrollBottom={() => setPage((prev) => (noMoreResults.current ? prev : prev + 1))}
|
||||
page={page}
|
||||
pageSize={SEARCH_PAGE_SIZE}
|
||||
tileLayout={tileLayout}
|
||||
useLoadingSpinner
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -1,23 +1,15 @@
|
||||
// @flow
|
||||
import { SIMPLE_SITE } from 'config';
|
||||
import * as CS from 'constants/claim_search';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import React, { Fragment } from 'react';
|
||||
import GeoRestrictionInfo from 'component/geoRestictionInfo';
|
||||
import HiddenNsfwClaims from 'component/hiddenNsfwClaims';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import Button from 'component/button';
|
||||
import ClaimListDiscover from 'component/claimListDiscover';
|
||||
import Ads from 'web/component/ads';
|
||||
import Icon from 'component/common/icon';
|
||||
import LivestreamLink from 'component/livestreamLink';
|
||||
import { Form, FormField } from 'component/common/form';
|
||||
import ScheduledStreams from 'component/scheduledStreams';
|
||||
import { ClaimSearchFilterContext } from 'contexts/claimSearchFilterContext';
|
||||
import { SearchResults } from './internal/searchResults';
|
||||
import useFetchLiveStatus from 'effects/use-fetch-live';
|
||||
import { useIsLargeScreen } from 'effects/use-screensize';
|
||||
import usePersistedState from 'effects/use-persisted-state';
|
||||
import { DEBOUNCE_WAIT_DURATION_MS } from 'constants/search';
|
||||
import { lighthouse } from 'redux/actions/search';
|
||||
|
||||
const TYPES_TO_ALLOW_FILTER = ['stream', 'repost'];
|
||||
|
||||
@@ -41,10 +33,6 @@ type Props = {
|
||||
doResolveUris: (Array<string>, boolean) => void,
|
||||
claimType: string,
|
||||
empty?: string,
|
||||
doFetchChannelLiveStatus: (string) => void,
|
||||
activeLivestreamForChannel: any,
|
||||
activeLivestreamInitialized: boolean,
|
||||
hasPremiumPlus: boolean,
|
||||
};
|
||||
|
||||
function ChannelContent(props: Props) {
|
||||
@@ -63,42 +51,21 @@ function ChannelContent(props: Props) {
|
||||
doResolveUris,
|
||||
claimType,
|
||||
empty,
|
||||
doFetchChannelLiveStatus,
|
||||
activeLivestreamForChannel,
|
||||
activeLivestreamInitialized,
|
||||
hasPremiumPlus,
|
||||
} = props;
|
||||
// const claimsInChannel = (claim && claim.meta.claims_in_channel) || 0;
|
||||
|
||||
const claimsInChannel = 9999;
|
||||
const [searchQuery, setSearchQuery] = React.useState('');
|
||||
const [isSearching, setIsSearching] = React.useState(false);
|
||||
const [searchResults, setSearchResults] = React.useState(undefined);
|
||||
const {
|
||||
location: { pathname, search },
|
||||
} = useHistory();
|
||||
|
||||
// In Channel Page, ignore SETTINGS.HIDE_REPOSTS and show reposts by default:
|
||||
const [hideReposts, setHideReposts] = usePersistedState('hideRepostsChannelPage', false);
|
||||
|
||||
const claimSearchFilterCtx = {
|
||||
contentTypes: CS.CONTENT_TYPES,
|
||||
repost: { hideReposts, setHideReposts },
|
||||
};
|
||||
|
||||
const url = `${pathname}${search}`;
|
||||
const claimId = claim && claim.claim_id;
|
||||
const isChannelEmpty = !claim || !claim.meta;
|
||||
const showFilters =
|
||||
!claimType ||
|
||||
(Array.isArray(claimType)
|
||||
? claimType.every((ct) => TYPES_TO_ALLOW_FILTER.includes(ct))
|
||||
: TYPES_TO_ALLOW_FILTER.includes(claimType));
|
||||
const isLargeScreen = useIsLargeScreen();
|
||||
const dynamicPageSize = isLargeScreen ? Math.ceil(defaultPageSize * 3) : defaultPageSize;
|
||||
|
||||
const isInitialized = Boolean(activeLivestreamForChannel) || activeLivestreamInitialized;
|
||||
const isChannelBroadcasting = Boolean(activeLivestreamForChannel);
|
||||
const showScheduledLiveStreams = claimType !== 'collection'; // ie. not on the playlist page.
|
||||
|
||||
function handleInputChange(e) {
|
||||
const { value } = e.target;
|
||||
@@ -106,43 +73,56 @@ function ChannelContent(props: Props) {
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
setSearchQuery('');
|
||||
}, [url]);
|
||||
const timer = setTimeout(() => {
|
||||
if (searchQuery === '' || !claimId) {
|
||||
// In order to display original search results, search results must be set to null. A query of '' should display original results.
|
||||
return setSearchResults(null);
|
||||
} else {
|
||||
lighthouse
|
||||
.search(
|
||||
`s=${encodeURIComponent(searchQuery)}&channel_id=${encodeURIComponent(claimId)}${
|
||||
!showMature ? '&nsfw=false&size=50&from=0' : ''
|
||||
}`
|
||||
)
|
||||
.then(({ body: results }) => {
|
||||
const urls = results.map(({ name, claimId }) => {
|
||||
return `lbry://${name}#${claimId}`;
|
||||
});
|
||||
|
||||
useFetchLiveStatus(claimId, doFetchChannelLiveStatus, true);
|
||||
// Batch-resolve the urls before calling 'setSearchResults', as the
|
||||
// latter will immediately cause the tiles to resolve, ending up
|
||||
// calling doResolveUri one by one before the batched one.
|
||||
doResolveUris(urls, true);
|
||||
|
||||
setSearchResults(urls);
|
||||
})
|
||||
.catch(() => {
|
||||
setSearchResults(null);
|
||||
});
|
||||
}
|
||||
}, DEBOUNCE_WAIT_DURATION_MS);
|
||||
return () => clearTimeout(timer);
|
||||
}, [claimId, searchQuery, showMature]);
|
||||
|
||||
React.useEffect(() => {
|
||||
setSearchQuery('');
|
||||
setSearchResults(null);
|
||||
}, [url]);
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<GeoRestrictionInfo uri={uri} />
|
||||
|
||||
{!fetching && Boolean(claimsInChannel) && !channelIsBlocked && !channelIsBlackListed && (
|
||||
<HiddenNsfwClaims uri={uri} />
|
||||
)}
|
||||
|
||||
{!fetching && isInitialized && isChannelBroadcasting && !isChannelEmpty && (
|
||||
<LivestreamLink claimUri={activeLivestreamForChannel.claimUri} />
|
||||
)}
|
||||
|
||||
{!fetching && showScheduledLiveStreams && (
|
||||
<ScheduledStreams
|
||||
channelIds={[claimId]}
|
||||
tileLayout={tileLayout}
|
||||
liveUris={
|
||||
isChannelBroadcasting && activeLivestreamForChannel.claimUri ? [activeLivestreamForChannel.claimUri] : []
|
||||
}
|
||||
showHideSetting={false}
|
||||
/>
|
||||
)}
|
||||
|
||||
{!fetching && channelIsBlackListed && (
|
||||
<section className="card card--section">
|
||||
<p>
|
||||
{__(
|
||||
'In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this channel from our applications. Content may also be blocked due to DMCA Red Flag rules which are obvious copyright violations we come across, are discussed in public channels, or reported to us.'
|
||||
'In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this channel from our applications.'
|
||||
)}
|
||||
</p>
|
||||
<div className="section__actions">
|
||||
<Button button="link" href="https://odysee.com/@OdyseeHelp:b/copyright:f" label={__('Read More')} />
|
||||
<Button button="link" href="https://lbry.com/faq/dmca" label={__('Read More')} />
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
@@ -155,68 +135,40 @@ function ChannelContent(props: Props) {
|
||||
|
||||
{!channelIsMine && claimsInChannel > 0 && <HiddenNsfwClaims uri={uri} />}
|
||||
|
||||
{!fetching && (
|
||||
<ClaimSearchFilterContext.Provider value={claimSearchFilterCtx}>
|
||||
<ClaimListDiscover
|
||||
ignoreSearchInLanguage
|
||||
hasSource
|
||||
defaultFreshness={CS.FRESH_ALL}
|
||||
showHiddenByUser={viewHiddenChannels}
|
||||
hideRepostsOverride={hideReposts}
|
||||
fetchViewCount
|
||||
hideFilters={!showFilters}
|
||||
hideAdvancedFilter={!showFilters}
|
||||
tileLayout={tileLayout}
|
||||
uris={isSearching ? [] : null}
|
||||
streamType={SIMPLE_SITE ? CS.CONTENT_ALL : undefined}
|
||||
channelIds={[claimId]}
|
||||
claimType={claimType}
|
||||
feeAmount={undefined}
|
||||
defaultOrderBy={CS.ORDER_BY_NEW}
|
||||
pageSize={dynamicPageSize}
|
||||
infiniteScroll={defaultInfiniteScroll}
|
||||
injectedItem={
|
||||
!hasPremiumPlus && {
|
||||
node: (index, lastVisibleIndex, pageSize) => {
|
||||
if (pageSize && index < pageSize) {
|
||||
return index === lastVisibleIndex ? <Ads type="video" tileLayout={tileLayout} small /> : null;
|
||||
} else {
|
||||
return index % (pageSize * 2) === 0 ? <Ads type="video" tileLayout={tileLayout} small /> : null;
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
meta={
|
||||
showFilters && (
|
||||
<Form onSubmit={() => {}} className="wunderbar--inline">
|
||||
<Icon icon={ICONS.SEARCH} />
|
||||
<FormField
|
||||
name="channel_search"
|
||||
className="wunderbar__input--inline"
|
||||
value={searchQuery}
|
||||
onChange={handleInputChange}
|
||||
type="text"
|
||||
placeholder={__('Search')}
|
||||
/>
|
||||
</Form>
|
||||
)
|
||||
}
|
||||
subSection={
|
||||
<SearchResults
|
||||
searchQuery={searchQuery}
|
||||
claimId={claimId}
|
||||
showMature={showMature}
|
||||
tileLayout={tileLayout}
|
||||
onResults={(results) => setIsSearching(results !== null)}
|
||||
doResolveUris={doResolveUris}
|
||||
<ClaimListDiscover
|
||||
hasSource
|
||||
defaultFreshness={CS.FRESH_ALL}
|
||||
showHiddenByUser={viewHiddenChannels}
|
||||
forceShowReposts
|
||||
fetchViewCount
|
||||
hideFilters={!showFilters}
|
||||
hideAdvancedFilter={!showFilters}
|
||||
tileLayout={tileLayout}
|
||||
uris={searchResults}
|
||||
channelIds={[claimId]}
|
||||
claimType={claimType}
|
||||
feeAmount={CS.FEE_AMOUNT_ANY}
|
||||
defaultOrderBy={CS.ORDER_BY_NEW}
|
||||
pageSize={defaultPageSize}
|
||||
infiniteScroll={defaultInfiniteScroll}
|
||||
meta={
|
||||
showFilters && (
|
||||
<Form onSubmit={() => {}} className="wunderbar--inline">
|
||||
<Icon icon={ICONS.SEARCH} />
|
||||
<FormField
|
||||
className="wunderbar__input--inline"
|
||||
value={searchQuery}
|
||||
onChange={handleInputChange}
|
||||
type="text"
|
||||
placeholder={__('Search')}
|
||||
/>
|
||||
}
|
||||
isChannel
|
||||
channelIsMine={channelIsMine}
|
||||
empty={isSearching ? ' ' : empty}
|
||||
/>
|
||||
</ClaimSearchFilterContext.Provider>
|
||||
)}
|
||||
</Form>
|
||||
)
|
||||
}
|
||||
isChannel
|
||||
channelIsMine={channelIsMine}
|
||||
empty={empty}
|
||||
/>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,26 +1,16 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { withRouter } from 'react-router';
|
||||
import { DISABLE_COMMENTS_TAG } from 'constants/tags';
|
||||
import { LINKED_COMMENT_QUERY_PARAM, THREAD_COMMENT_QUERY_PARAM } from 'constants/comment';
|
||||
import ChannelDiscussion from './view';
|
||||
import { makeSelectTagInClaimOrChannelForUri, selectClaimForUri } from 'redux/selectors/claims';
|
||||
import { selectSettingsByChannelId } from 'redux/selectors/comments';
|
||||
import { getChannelIdFromClaim } from 'util/claim';
|
||||
import { makeSelectTagInClaimOrChannelForUri } from 'redux/selectors/claims';
|
||||
|
||||
const select = (state, props) => {
|
||||
const { search } = props.location;
|
||||
const urlParams = new URLSearchParams(search);
|
||||
|
||||
const claim = selectClaimForUri(state, props.uri);
|
||||
const channelId = getChannelIdFromClaim(claim);
|
||||
const settingsByChannelId = selectSettingsByChannelId(state);
|
||||
const channelSettings = channelId ? settingsByChannelId[channelId] : undefined;
|
||||
|
||||
return {
|
||||
linkedCommentId: urlParams.get(LINKED_COMMENT_QUERY_PARAM),
|
||||
threadCommentId: urlParams.get(THREAD_COMMENT_QUERY_PARAM),
|
||||
linkedCommentId: urlParams.get('lc'),
|
||||
commentsDisabled: makeSelectTagInClaimOrChannelForUri(props.uri, DISABLE_COMMENTS_TAG)(state),
|
||||
commentSettingDisabled: channelSettings && !channelSettings.comments_enabled,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -1,40 +1,23 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import CommentsList from 'component/commentsList';
|
||||
import Empty from 'component/common/empty';
|
||||
import { lazyImport } from 'util/lazyImport';
|
||||
|
||||
const CommentsList = lazyImport(() => import('component/commentsList' /* webpackChunkName: "comments" */));
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
linkedCommentId?: string,
|
||||
threadCommentId?: string,
|
||||
commentsDisabled: boolean,
|
||||
commentSettingDisabled?: boolean,
|
||||
};
|
||||
|
||||
function ChannelDiscussion(props: Props) {
|
||||
const { uri, linkedCommentId, threadCommentId, commentsDisabled, commentSettingDisabled } = props;
|
||||
const { uri, linkedCommentId, commentsDisabled } = props;
|
||||
|
||||
if (commentsDisabled) {
|
||||
return <Empty text={__('The creator of this content has disabled comments.')} />;
|
||||
}
|
||||
|
||||
if (commentSettingDisabled) {
|
||||
return <Empty text={__('This channel has disabled comments on their page.')} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="section">
|
||||
<React.Suspense fallback={null}>
|
||||
<CommentsList
|
||||
uri={uri}
|
||||
linkedCommentId={linkedCommentId}
|
||||
threadCommentId={threadCommentId}
|
||||
commentsAreExpanded
|
||||
notInDrawer
|
||||
/>
|
||||
</React.Suspense>
|
||||
<CommentsList uri={uri} linkedCommentId={linkedCommentId} commentsAreExpanded />
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
selectTitleForUri,
|
||||
selectThumbnailForUri,
|
||||
makeSelectTitleForUri,
|
||||
makeSelectThumbnailForUri,
|
||||
makeSelectCoverForUri,
|
||||
makeSelectMetadataItemForUri,
|
||||
makeSelectAmountForUri,
|
||||
@@ -21,8 +21,8 @@ import ChannelForm from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
title: selectTitleForUri(state, props.uri),
|
||||
thumbnailUrl: selectThumbnailForUri(state, props.uri),
|
||||
title: makeSelectTitleForUri(props.uri)(state),
|
||||
thumbnailUrl: makeSelectThumbnailForUri(props.uri)(state),
|
||||
coverUrl: makeSelectCoverForUri(props.uri)(state),
|
||||
description: makeSelectMetadataItemForUri(props.uri, 'description')(state),
|
||||
website: makeSelectMetadataItemForUri(props.uri, 'website_url')(state),
|
||||
|
||||
@@ -6,7 +6,6 @@ import classnames from 'classnames';
|
||||
import { FormField } from 'component/common/form';
|
||||
import Button from 'component/button';
|
||||
import TagsSearch from 'component/tagsSearch';
|
||||
import ColorPicker from 'component/colorPicker';
|
||||
import { FF_MAX_CHARS_IN_DESCRIPTION } from 'constants/form-field';
|
||||
import ErrorText from 'component/common/error-text';
|
||||
import ChannelThumbnail from 'component/channelThumbnail';
|
||||
@@ -17,17 +16,15 @@ import { MINIMUM_PUBLISH_BID, INVALID_NAME_ERROR, ESTIMATED_FEE } from 'constant
|
||||
import { Tabs, TabList, Tab, TabPanels, TabPanel } from 'component/common/tabs';
|
||||
import Card from 'component/common/card';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import * as PUBLISH from 'constants/publish';
|
||||
import analytics from 'analytics';
|
||||
import LbcSymbol from 'component/common/lbc-symbol';
|
||||
import SUPPORTED_LANGUAGES from 'constants/supported_languages';
|
||||
import WalletSpendableBalanceHelp from 'component/walletSpendableBalanceHelp';
|
||||
import { SIMPLE_SITE, THUMBNAIL_CDN_SIZE_LIMIT_BYTES } from 'config';
|
||||
import { sortLanguageMap } from 'util/default-languages';
|
||||
import ThumbnailBrokenImage from 'component/selectThumbnail/thumbnail-broken.png';
|
||||
import Gerbil from 'component/channelThumbnail/gerbil.png';
|
||||
|
||||
const NEKODEV = false; // Temporary flag to hide unfinished progress
|
||||
const LANG_NONE = 'none';
|
||||
|
||||
const MAX_TAG_SELECT = 5;
|
||||
|
||||
@@ -123,9 +120,6 @@ function ChannelForm(props: Props) {
|
||||
);
|
||||
}, [isClaimingInitialRewards, creatingChannel, updatingChannel, nameError, bidError, isNewChannel, params.name]);
|
||||
|
||||
// const channelColor = 'ff0000';
|
||||
const [overrideColor, toggleColorOverride] = React.useState(false);
|
||||
|
||||
function getChannelParams() {
|
||||
// fill this in with sdk data
|
||||
const channelParams: {
|
||||
@@ -188,14 +182,14 @@ function ChannelForm(props: Props) {
|
||||
function handleLanguageChange(index, code) {
|
||||
let langs = [...languageParam];
|
||||
if (index === 0) {
|
||||
if (code === PUBLISH.LANG_NONE) {
|
||||
if (code === LANG_NONE) {
|
||||
// clear all
|
||||
langs = [];
|
||||
} else {
|
||||
langs[0] = code;
|
||||
}
|
||||
} else {
|
||||
if (code === PUBLISH.LANG_NONE || code === langs[0]) {
|
||||
if (code === LANG_NONE || code === langs[0]) {
|
||||
langs.splice(1, 1);
|
||||
} else {
|
||||
langs[index] = code;
|
||||
@@ -218,7 +212,6 @@ function ChannelForm(props: Props) {
|
||||
|
||||
function handleSubmit() {
|
||||
if (uri) {
|
||||
console.log('Params A: ', params);
|
||||
updateChannel(params).then((success) => {
|
||||
if (success) {
|
||||
onDone();
|
||||
@@ -276,10 +269,9 @@ function ChannelForm(props: Props) {
|
||||
}
|
||||
|
||||
// TODO clear and bail after submit
|
||||
// <div className={classnames('main--contained', { 'card--disabled': disabled })}></div>
|
||||
return (
|
||||
<>
|
||||
<div className={classnames({ 'card--disabled': disabled })}>
|
||||
<div className={classnames('main--contained', { 'card--disabled': disabled })}>
|
||||
<header className="channel-cover">
|
||||
<div className="channel__quick-actions">
|
||||
<Button
|
||||
@@ -289,9 +281,7 @@ function ChannelForm(props: Props) {
|
||||
openModal(MODALS.IMAGE_UPLOAD, {
|
||||
onUpdate: (coverUrl, isUpload) => handleCoverChange(coverUrl, isUpload),
|
||||
title: __('Edit Cover Image'),
|
||||
helpText: __('(6.25:1 ratio, %max_size%MB max)', {
|
||||
max_size: THUMBNAIL_CDN_SIZE_LIMIT_BYTES / (1024 * 1024),
|
||||
}),
|
||||
helpText: __('(6.25:1)'),
|
||||
assetName: __('Cover Image'),
|
||||
currentValue: params.coverUrl,
|
||||
})
|
||||
@@ -303,7 +293,7 @@ function ChannelForm(props: Props) {
|
||||
{params.coverUrl &&
|
||||
(coverError && isUpload.cover ? (
|
||||
<div className="channel-cover__custom--waiting">
|
||||
<p>{__('Uploaded image will be visible in a few minutes after you submit this form.')}</p>
|
||||
<p>{__('Uploaded image will be visible in a few minutes.')}</p>
|
||||
</div>
|
||||
) : (
|
||||
<img className="channel-cover__custom" src={coverSrc} onError={() => setCoverError(true)} />
|
||||
@@ -317,9 +307,7 @@ function ChannelForm(props: Props) {
|
||||
openModal(MODALS.IMAGE_UPLOAD, {
|
||||
onUpdate: (thumbnailUrl, isUpload) => handleThumbnailChange(thumbnailUrl, isUpload),
|
||||
title: __('Edit Thumbnail Image'),
|
||||
helpText: __('(1:1 ratio, %max_size%MB max)', {
|
||||
max_size: THUMBNAIL_CDN_SIZE_LIMIT_BYTES / (1024 * 1024),
|
||||
}),
|
||||
helpText: __('(1:1)'),
|
||||
assetName: __('Thumbnail'),
|
||||
currentValue: params.thumbnailUrl,
|
||||
})
|
||||
@@ -333,6 +321,7 @@ function ChannelForm(props: Props) {
|
||||
uri={uri}
|
||||
thumbnailPreview={thumbnailPreview}
|
||||
allowGifs
|
||||
showDelayedMessage={isUpload.thumbnail}
|
||||
setThumbUploadError={setThumbError}
|
||||
thumbUploadError={thumbError}
|
||||
/>
|
||||
@@ -343,7 +332,7 @@ function ChannelForm(props: Props) {
|
||||
<div className="channel-cover__gradient" />
|
||||
</header>
|
||||
|
||||
<Tabs className="channelPage-wrapper">
|
||||
<Tabs>
|
||||
<TabList className="tabs__list--channel-page">
|
||||
<Tab>{__('General')}</Tab>
|
||||
<Tab>{__('Credit Details')}</Tab>
|
||||
@@ -355,15 +344,6 @@ function ChannelForm(props: Props) {
|
||||
<Card
|
||||
body={
|
||||
<>
|
||||
{isNewChannel && (
|
||||
<Button
|
||||
button="primary"
|
||||
label={__('Sync YouTube Channel')}
|
||||
icon={ICONS.YOUTUBE}
|
||||
navigate={`/$/${PAGES.YOUTUBE_SYNC}`}
|
||||
/>
|
||||
)}
|
||||
|
||||
<fieldset-group class="fieldset-group--smushed fieldset-group--disabled-prefix">
|
||||
<fieldset-section>
|
||||
<label htmlFor="channel_name">{__('Name')}</label>
|
||||
@@ -433,7 +413,7 @@ function ChannelForm(props: Props) {
|
||||
<Card
|
||||
body={
|
||||
<TagsSearch
|
||||
suggestMature={!SIMPLE_SITE}
|
||||
suggestMature
|
||||
disableAutoFocus
|
||||
disableControlTags
|
||||
limitSelect={MAX_TAG_SELECT}
|
||||
@@ -461,19 +441,6 @@ function ChannelForm(props: Props) {
|
||||
<Card
|
||||
body={
|
||||
<>
|
||||
{NEKODEV && (
|
||||
<fieldset-section class>
|
||||
<label htmlFor="channel-color">{__('Channel color')}</label>
|
||||
<FormField
|
||||
name="manual-channel-color"
|
||||
type="checkbox"
|
||||
label="Pick color manually"
|
||||
checked={overrideColor}
|
||||
onChange={() => toggleColorOverride(!overrideColor)}
|
||||
/>
|
||||
<ColorPicker disabled={!overrideColor} />
|
||||
</fieldset-section>
|
||||
)}
|
||||
<FormField
|
||||
type="text"
|
||||
name="channel_website2"
|
||||
@@ -500,7 +467,7 @@ function ChannelForm(props: Props) {
|
||||
value={primaryLanguage}
|
||||
helper={__('Your main content language')}
|
||||
>
|
||||
<option key={'pri-langNone'} value={PUBLISH.LANG_NONE}>
|
||||
<option key={'pri-langNone'} value={LANG_NONE}>
|
||||
{__('None selected')}
|
||||
</option>
|
||||
{sortLanguageMap(SUPPORTED_LANGUAGES).map(([langKey, langName]) => (
|
||||
@@ -518,7 +485,7 @@ function ChannelForm(props: Props) {
|
||||
disabled={!languageParam[0]}
|
||||
helper={__('Your other content language')}
|
||||
>
|
||||
<option key={'sec-langNone'} value={PUBLISH.LANG_NONE}>
|
||||
<option key={'sec-langNone'} value={LANG_NONE}>
|
||||
{__('None selected')}
|
||||
</option>
|
||||
{sortLanguageMap(SUPPORTED_LANGUAGES).map(([langKey, langName]) => (
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimForUri, makeSelectIsUriResolving } from 'redux/selectors/claims';
|
||||
import ChannelMentionSuggestion from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
|
||||
});
|
||||
|
||||
export default connect(select)(ChannelMentionSuggestion);
|
||||
@@ -0,0 +1,32 @@
|
||||
// @flow
|
||||
import { ComboboxOption } from '@reach/combobox';
|
||||
import ChannelThumbnail from 'component/channelThumbnail';
|
||||
import React from 'react';
|
||||
|
||||
type Props = {
|
||||
claim: ?Claim,
|
||||
uri?: string,
|
||||
isResolvingUri: boolean,
|
||||
};
|
||||
|
||||
export default function ChannelMentionSuggestion(props: Props) {
|
||||
const { claim, uri, isResolvingUri } = props;
|
||||
|
||||
return !claim ? null : (
|
||||
<ComboboxOption value={uri}>
|
||||
{isResolvingUri ? (
|
||||
<div className="channel-mention__suggestion">
|
||||
<div className="media__thumb media__thumb--resolving" />
|
||||
</div>
|
||||
) : (
|
||||
<div className="channel-mention__suggestion">
|
||||
<ChannelThumbnail xsmall uri={uri} />
|
||||
<span className="channel-mention__suggestion-label">
|
||||
<div className="channel-mention__suggestion-title">{(claim.value && claim.value.title) || claim.name}</div>
|
||||
<div className="channel-mention__suggestion-name">{claim.name}</div>
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</ComboboxOption>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { selectShowMatureContent } from 'redux/selectors/settings';
|
||||
import { selectSubscriptions } from 'redux/selectors/subscriptions';
|
||||
import { withRouter } from 'react-router';
|
||||
import { makeSelectClaimForUri } from 'redux/selectors/claims';
|
||||
import { doResolveUris } from 'redux/actions/claims';
|
||||
import { makeSelectTopLevelCommentsForUri } from 'redux/selectors/comments';
|
||||
import ChannelMentionSuggestions from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
const subscriptionUris = selectSubscriptions(state).map(({ uri }) => uri);
|
||||
const topLevelComments = makeSelectTopLevelCommentsForUri(props.uri)(state);
|
||||
|
||||
const commentorUris = [];
|
||||
// Avoid repeated commentors
|
||||
topLevelComments.map(({ channel_url }) => !commentorUris.includes(channel_url) && commentorUris.push(channel_url));
|
||||
|
||||
const getUnresolved = (uris) =>
|
||||
uris.map((uri) => !makeSelectClaimForUri(uri)(state) && uri).filter((uri) => uri !== false);
|
||||
const getCanonical = (uris) =>
|
||||
uris
|
||||
.map((uri) => makeSelectClaimForUri(uri)(state) && makeSelectClaimForUri(uri)(state).canonical_url)
|
||||
.filter((uri) => Boolean(uri));
|
||||
|
||||
return {
|
||||
commentorUris,
|
||||
subscriptionUris,
|
||||
unresolvedCommentors: getUnresolved(commentorUris),
|
||||
unresolvedSubscriptions: getUnresolved(subscriptionUris),
|
||||
canonicalCreator: getCanonical([props.creatorUri])[0],
|
||||
canonicalCommentors: getCanonical(commentorUris),
|
||||
canonicalSubscriptions: getCanonical(subscriptionUris),
|
||||
showMature: selectShowMatureContent(state),
|
||||
};
|
||||
};
|
||||
|
||||
export default withRouter(connect(select, { doResolveUris })(ChannelMentionSuggestions));
|
||||
@@ -0,0 +1,277 @@
|
||||
// @flow
|
||||
import { Combobox, ComboboxInput, ComboboxPopover, ComboboxList } from '@reach/combobox';
|
||||
import { Form } from 'component/common/form';
|
||||
import { parseURI, regexInvalidURI } from 'util/lbryURI';
|
||||
import { SEARCH_OPTIONS } from 'constants/search';
|
||||
import * as KEYCODES from 'constants/keycodes';
|
||||
import ChannelMentionSuggestion from 'component/channelMentionSuggestion';
|
||||
import ChannelMentionTopSuggestion from 'component/channelMentionTopSuggestion';
|
||||
import React from 'react';
|
||||
import Spinner from 'component/spinner';
|
||||
import type { ElementRef } from 'react';
|
||||
import useLighthouse from 'effects/use-lighthouse';
|
||||
|
||||
const INPUT_DEBOUNCE_MS = 1000;
|
||||
const LIGHTHOUSE_MIN_CHARACTERS = 3;
|
||||
|
||||
type Props = {
|
||||
inputRef: any,
|
||||
mentionTerm: string,
|
||||
noTopSuggestion?: boolean,
|
||||
showMature: boolean,
|
||||
creatorUri: string,
|
||||
commentorUris: Array<string>,
|
||||
subscriptionUris: Array<string>,
|
||||
unresolvedSubscriptions: Array<string>,
|
||||
canonicalCreator: string,
|
||||
canonicalCommentors: Array<string>,
|
||||
canonicalSubscriptions: Array<string>,
|
||||
doResolveUris: (Array<string>) => void,
|
||||
customSelectAction?: (string, number) => void,
|
||||
};
|
||||
|
||||
export default function ChannelMentionSuggestions(props: Props) {
|
||||
const {
|
||||
unresolvedSubscriptions,
|
||||
canonicalCreator,
|
||||
creatorUri,
|
||||
inputRef,
|
||||
showMature,
|
||||
noTopSuggestion,
|
||||
mentionTerm,
|
||||
doResolveUris,
|
||||
customSelectAction,
|
||||
} = props;
|
||||
const comboboxInputRef: ElementRef<any> = React.useRef();
|
||||
const comboboxListRef: ElementRef<any> = React.useRef();
|
||||
|
||||
const mainEl = document.querySelector('.channel-mention__suggestions');
|
||||
|
||||
const [debouncedTerm, setDebouncedTerm] = React.useState('');
|
||||
const [mostSupported, setMostSupported] = React.useState('');
|
||||
const [canonicalResults, setCanonicalResults] = React.useState([]);
|
||||
|
||||
const isRefFocused = (ref) => ref && ref.current === document.activeElement;
|
||||
|
||||
const subscriptionUris = props.subscriptionUris.filter((uri) => uri !== creatorUri);
|
||||
const canonicalSubscriptions = props.canonicalSubscriptions.filter((uri) => uri !== canonicalCreator);
|
||||
const commentorUris = props.commentorUris.filter((uri) => uri !== creatorUri && !subscriptionUris.includes(uri));
|
||||
const canonicalCommentors = props.canonicalCommentors.filter(
|
||||
(uri) => uri !== canonicalCreator && !canonicalSubscriptions.includes(uri)
|
||||
);
|
||||
|
||||
const termToMatch = mentionTerm && mentionTerm.replace('@', '').toLowerCase();
|
||||
const allShownUris = [creatorUri, ...subscriptionUris, ...commentorUris];
|
||||
const allShownCanonical = [canonicalCreator, ...canonicalSubscriptions, ...canonicalCommentors];
|
||||
const possibleMatches = allShownUris.filter((uri) => {
|
||||
try {
|
||||
// yuck a try catch in a filter?
|
||||
const { channelName } = parseURI(uri);
|
||||
return channelName && channelName.toLowerCase().includes(termToMatch);
|
||||
} catch (e) {}
|
||||
});
|
||||
|
||||
const searchSize = 5;
|
||||
const additionalOptions = { isBackgroundSearch: false, [SEARCH_OPTIONS.CLAIM_TYPE]: SEARCH_OPTIONS.INCLUDE_CHANNELS };
|
||||
const { results, loading } = useLighthouse(debouncedTerm, showMature, searchSize, additionalOptions, 0);
|
||||
const stringifiedResults = JSON.stringify(results);
|
||||
|
||||
const hasMinLength = mentionTerm && mentionTerm.length >= LIGHTHOUSE_MIN_CHARACTERS;
|
||||
const isTyping = debouncedTerm !== mentionTerm;
|
||||
const showPlaceholder = isTyping || loading;
|
||||
|
||||
const isUriFromTermValid = !regexInvalidURI.test(mentionTerm.substring(1));
|
||||
|
||||
const handleSelect = React.useCallback(
|
||||
(value, key) => {
|
||||
if (customSelectAction) {
|
||||
// Give them full results, as our resolved one might truncate the claimId.
|
||||
customSelectAction(value || (results && results.find((r) => r.startsWith(value))) || '', Number(key));
|
||||
}
|
||||
},
|
||||
[customSelectAction, results]
|
||||
);
|
||||
|
||||
React.useEffect(() => {
|
||||
const timer = setTimeout(() => {
|
||||
if (isTyping) setDebouncedTerm(!hasMinLength ? '' : mentionTerm);
|
||||
}, INPUT_DEBOUNCE_MS);
|
||||
|
||||
return () => clearTimeout(timer);
|
||||
}, [hasMinLength, isTyping, mentionTerm]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!mainEl) return;
|
||||
const header = document.querySelector('.header__navigation');
|
||||
|
||||
function handleReflow() {
|
||||
const boxAtTopOfPage = header && mainEl.getBoundingClientRect().top <= header.offsetHeight;
|
||||
const boxAtBottomOfPage = mainEl.getBoundingClientRect().bottom >= window.innerHeight;
|
||||
|
||||
if (boxAtTopOfPage) {
|
||||
mainEl.setAttribute('flow-bottom', '');
|
||||
}
|
||||
if (mainEl.getAttribute('flow-bottom') !== null && boxAtBottomOfPage) {
|
||||
mainEl.removeAttribute('flow-bottom');
|
||||
}
|
||||
}
|
||||
handleReflow();
|
||||
|
||||
window.addEventListener('scroll', handleReflow);
|
||||
return () => window.removeEventListener('scroll', handleReflow);
|
||||
}, [mainEl]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!inputRef || !comboboxInputRef || !mentionTerm) return;
|
||||
|
||||
function handleKeyDown(event) {
|
||||
const { keyCode } = event;
|
||||
const activeElement = document.activeElement;
|
||||
|
||||
if (keyCode === KEYCODES.UP || keyCode === KEYCODES.DOWN) {
|
||||
if (isRefFocused(comboboxInputRef)) {
|
||||
const selectedId = activeElement && activeElement.getAttribute('aria-activedescendant');
|
||||
const selectedItem = selectedId && document.querySelector(`li[id="${selectedId}"]`);
|
||||
if (selectedItem) selectedItem.scrollIntoView({ block: 'nearest', inline: 'nearest' });
|
||||
} else {
|
||||
// $FlowFixMe
|
||||
comboboxInputRef.current.focus();
|
||||
}
|
||||
} else {
|
||||
if ((isRefFocused(comboboxInputRef) || isRefFocused(inputRef)) && keyCode === KEYCODES.TAB) {
|
||||
event.preventDefault();
|
||||
const activeValue = activeElement && activeElement.getAttribute('value');
|
||||
|
||||
if (activeValue) {
|
||||
handleSelect(activeValue, keyCode);
|
||||
} else if (possibleMatches.length) {
|
||||
// $FlowFixMe
|
||||
const suggest = allShownCanonical.find((matchUri) => possibleMatches.find((uri) => uri.includes(matchUri)));
|
||||
if (suggest) handleSelect(suggest, keyCode);
|
||||
} else if (results) {
|
||||
handleSelect(mentionTerm, keyCode);
|
||||
}
|
||||
}
|
||||
if (isRefFocused(comboboxInputRef)) {
|
||||
// $FlowFixMe
|
||||
inputRef.current.focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('keydown', handleKeyDown);
|
||||
|
||||
return () => window.removeEventListener('keydown', handleKeyDown);
|
||||
}, [allShownCanonical, handleSelect, inputRef, mentionTerm, possibleMatches, results]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!stringifiedResults) return;
|
||||
|
||||
const arrayResults = JSON.parse(stringifiedResults);
|
||||
if (arrayResults && arrayResults.length > 0) {
|
||||
// $FlowFixMe
|
||||
doResolveUris(arrayResults).then((response) => {
|
||||
try {
|
||||
// $FlowFixMe
|
||||
const canonical_urls = Object.values(response).map(({ canonical_url }) => canonical_url);
|
||||
setCanonicalResults(canonical_urls);
|
||||
} catch (e) {}
|
||||
});
|
||||
}
|
||||
}, [doResolveUris, stringifiedResults]);
|
||||
|
||||
// Only resolve the subscriptions that match the mention term, instead of all
|
||||
React.useEffect(() => {
|
||||
if (isTyping) return;
|
||||
|
||||
const urisToResolve = [];
|
||||
subscriptionUris.map(
|
||||
(uri) =>
|
||||
hasMinLength &&
|
||||
possibleMatches.includes(uri) &&
|
||||
unresolvedSubscriptions.includes(uri) &&
|
||||
urisToResolve.push(uri)
|
||||
);
|
||||
|
||||
if (urisToResolve.length > 0) doResolveUris(urisToResolve);
|
||||
}, [doResolveUris, hasMinLength, isTyping, possibleMatches, subscriptionUris, unresolvedSubscriptions]);
|
||||
|
||||
const suggestionsRow = (
|
||||
label: string,
|
||||
suggestions: Array<string>,
|
||||
canonical: Array<string>,
|
||||
hasSuggestionsBelow: boolean
|
||||
) => {
|
||||
if (mentionTerm.length > 1 && suggestions !== results) {
|
||||
suggestions = suggestions.filter((uri) => possibleMatches.includes(uri));
|
||||
} else if (suggestions === results) {
|
||||
suggestions = suggestions.filter((uri) => !allShownUris.includes(uri));
|
||||
}
|
||||
// $FlowFixMe
|
||||
suggestions = suggestions
|
||||
.map((matchUri) => canonical.find((uri) => matchUri.includes(uri)))
|
||||
.filter((uri) => Boolean(uri));
|
||||
|
||||
if (canonical === canonicalResults) {
|
||||
suggestions = suggestions.filter((uri) => uri !== mostSupported);
|
||||
}
|
||||
|
||||
return !suggestions.length ? null : (
|
||||
<>
|
||||
<div className="channel-mention__label">{label}</div>
|
||||
{suggestions.map((uri) => (
|
||||
<ChannelMentionSuggestion key={uri} uri={uri} />
|
||||
))}
|
||||
{hasSuggestionsBelow && <hr className="channel-mention__top-separator" />}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
return isRefFocused(inputRef) || isRefFocused(comboboxInputRef) ? (
|
||||
<Form onSubmit={() => handleSelect(mentionTerm)}>
|
||||
<Combobox className="channel-mention" onSelect={handleSelect}>
|
||||
<ComboboxInput ref={comboboxInputRef} className="channel-mention__input--none" value={mentionTerm} />
|
||||
{mentionTerm && isUriFromTermValid && (
|
||||
<ComboboxPopover portal={false} className="channel-mention__suggestions">
|
||||
<ComboboxList ref={comboboxListRef}>
|
||||
{creatorUri &&
|
||||
suggestionsRow(
|
||||
__('Creator'),
|
||||
[creatorUri],
|
||||
[canonicalCreator],
|
||||
canonicalSubscriptions.length > 0 || commentorUris.length > 0 || !showPlaceholder
|
||||
)}
|
||||
{canonicalSubscriptions.length > 0 &&
|
||||
suggestionsRow(
|
||||
__('Following'),
|
||||
subscriptionUris,
|
||||
canonicalSubscriptions,
|
||||
commentorUris.length > 0 || !showPlaceholder
|
||||
)}
|
||||
{commentorUris.length > 0 &&
|
||||
suggestionsRow(__('From comments'), commentorUris, canonicalCommentors, !showPlaceholder)}
|
||||
|
||||
{hasMinLength &&
|
||||
(showPlaceholder ? (
|
||||
<Spinner type="small" />
|
||||
) : (
|
||||
results && (
|
||||
<>
|
||||
{!noTopSuggestion && (
|
||||
<ChannelMentionTopSuggestion
|
||||
query={debouncedTerm}
|
||||
shownUris={allShownCanonical}
|
||||
setMostSupported={(winningUri) => setMostSupported(winningUri)}
|
||||
/>
|
||||
)}
|
||||
{suggestionsRow(__('From search'), results, canonicalResults, false)}
|
||||
</>
|
||||
)
|
||||
))}
|
||||
</ComboboxList>
|
||||
</ComboboxPopover>
|
||||
)}
|
||||
</Combobox>
|
||||
</Form>
|
||||
) : null;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectIsUriResolving } from 'redux/selectors/claims';
|
||||
import { doResolveUri } from 'redux/actions/claims';
|
||||
import { makeSelectWinningUriForQuery } from 'redux/selectors/search';
|
||||
import ChannelMentionTopSuggestion from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
const uriFromQuery = `lbry://${props.query}`;
|
||||
return {
|
||||
uriFromQuery,
|
||||
isResolvingUri: makeSelectIsUriResolving(uriFromQuery)(state),
|
||||
winningUri: makeSelectWinningUriForQuery(props.query)(state),
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(select, { doResolveUri })(ChannelMentionTopSuggestion);
|
||||
@@ -0,0 +1,49 @@
|
||||
// @flow
|
||||
import ChannelMentionSuggestion from 'component/channelMentionSuggestion';
|
||||
import LbcSymbol from 'component/common/lbc-symbol';
|
||||
import React from 'react';
|
||||
|
||||
type Props = {
|
||||
uriFromQuery: string,
|
||||
winningUri: string,
|
||||
isResolvingUri: boolean,
|
||||
shownUris: Array<string>,
|
||||
setMostSupported: (string) => void,
|
||||
doResolveUri: (string) => void,
|
||||
};
|
||||
|
||||
export default function ChannelMentionTopSuggestion(props: Props) {
|
||||
const { uriFromQuery, winningUri, isResolvingUri, shownUris, setMostSupported, doResolveUri } = props;
|
||||
|
||||
React.useEffect(() => {
|
||||
if (uriFromQuery) doResolveUri(uriFromQuery);
|
||||
}, [doResolveUri, uriFromQuery]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (winningUri) setMostSupported(winningUri);
|
||||
}, [setMostSupported, winningUri]);
|
||||
|
||||
if (isResolvingUri) {
|
||||
return (
|
||||
<div className="channel-mention__winning-claim">
|
||||
<div className="channel-mention__label channel-mention__placeholder-label" />
|
||||
|
||||
<div className="channel-mention__suggestion channel-mention__placeholder-suggestion">
|
||||
<div className="channel-mention__placeholder-thumbnail" />
|
||||
<div className="channel-mention__placeholder-info" />
|
||||
</div>
|
||||
<hr className="channel-mention__top-separator" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return !winningUri || shownUris.includes(winningUri) ? null : (
|
||||
<>
|
||||
<div className="channel-mention__label">
|
||||
<LbcSymbol prefix={__('Most Supported')} />
|
||||
</div>
|
||||
<ChannelMentionSuggestion uri={winningUri} />
|
||||
<hr className="channel-mention__top-separator" />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,30 +1,16 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { selectMyChannelClaims, selectClaimsByUri } from 'redux/selectors/claims';
|
||||
import { selectMyChannelClaims } from 'redux/selectors/claims';
|
||||
import { selectActiveChannelClaim, selectIncognito } from 'redux/selectors/app';
|
||||
import { doSetActiveChannel, doSetIncognito } from 'redux/actions/app';
|
||||
import { doFetchUserMemberships } from 'redux/actions/user';
|
||||
import { doSetDefaultChannel } from 'redux/actions/settings';
|
||||
import { selectDefaultChannelClaim } from 'redux/selectors/settings';
|
||||
import ChannelSelector from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
const { storeSelection } = props;
|
||||
const activeChannelClaim = selectActiveChannelClaim(state);
|
||||
const defaultChannelClaim = selectDefaultChannelClaim(state);
|
||||
const select = (state) => ({
|
||||
channels: selectMyChannelClaims(state),
|
||||
activeChannelClaim: selectActiveChannelClaim(state),
|
||||
incognito: selectIncognito(state),
|
||||
});
|
||||
|
||||
return {
|
||||
channels: selectMyChannelClaims(state),
|
||||
activeChannelClaim: storeSelection ? defaultChannelClaim : activeChannelClaim,
|
||||
incognito: selectIncognito(state),
|
||||
claimsByUri: selectClaimsByUri(state),
|
||||
};
|
||||
};
|
||||
|
||||
const perform = {
|
||||
export default connect(select, {
|
||||
doSetActiveChannel,
|
||||
doSetIncognito,
|
||||
doFetchUserMemberships,
|
||||
doSetDefaultChannel,
|
||||
};
|
||||
|
||||
export default connect(select, perform)(ChannelSelector);
|
||||
})(ChannelSelector);
|
||||
@@ -8,186 +8,30 @@ import { Menu, MenuList, MenuButton, MenuItem } from '@reach/menu-button';
|
||||
import ChannelTitle from 'component/channelTitle';
|
||||
import Icon from 'component/common/icon';
|
||||
import { useHistory } from 'react-router';
|
||||
import useGetUserMemberships from 'effects/use-get-user-memberships';
|
||||
import PremiumBadge from 'component/premiumBadge';
|
||||
|
||||
type Props = {
|
||||
selectedChannelUrl: string, // currently selected channel
|
||||
channels: ?Array<ChannelClaim>,
|
||||
onChannelSelect?: (id: ?string) => void,
|
||||
onChannelSelect: (url: string) => void,
|
||||
hideAnon?: boolean,
|
||||
activeChannelClaim: ?ChannelClaim,
|
||||
doSetActiveChannel: (claimId: ?string, override?: boolean) => void,
|
||||
doSetActiveChannel: (string) => void,
|
||||
incognito: boolean,
|
||||
doSetIncognito: (boolean) => void,
|
||||
claimsByUri: { [string]: any },
|
||||
doFetchUserMemberships: (claimIdCsv: string) => void,
|
||||
odyseeMembershipByUri: (uri: string) => string,
|
||||
storeSelection?: boolean,
|
||||
doSetDefaultChannel: (claimId: string) => void,
|
||||
isHeaderMenu?: boolean,
|
||||
isPublishMenu?: boolean,
|
||||
isTabHeader?: boolean,
|
||||
autoSet?: boolean,
|
||||
channelToSet?: string,
|
||||
disabled?: boolean,
|
||||
};
|
||||
|
||||
export default function ChannelSelector(props: Props) {
|
||||
const {
|
||||
channels,
|
||||
activeChannelClaim,
|
||||
doSetActiveChannel,
|
||||
onChannelSelect,
|
||||
incognito,
|
||||
doSetIncognito,
|
||||
odyseeMembershipByUri,
|
||||
claimsByUri,
|
||||
doFetchUserMemberships,
|
||||
storeSelection,
|
||||
doSetDefaultChannel,
|
||||
isHeaderMenu,
|
||||
isPublishMenu,
|
||||
isTabHeader,
|
||||
autoSet,
|
||||
channelToSet,
|
||||
disabled,
|
||||
} = props;
|
||||
|
||||
const hideAnon = Boolean(props.hideAnon || storeSelection);
|
||||
|
||||
const {
|
||||
push,
|
||||
location: { pathname },
|
||||
} = useHistory();
|
||||
|
||||
const activeChannelUrl = activeChannelClaim && activeChannelClaim.permanent_url;
|
||||
|
||||
function handleChannelSelect(channelClaim) {
|
||||
const { claim_id: id } = channelClaim;
|
||||
|
||||
doSetIncognito(false);
|
||||
doSetActiveChannel(id);
|
||||
if (onChannelSelect) onChannelSelect(id);
|
||||
|
||||
if (storeSelection) {
|
||||
doSetDefaultChannel(id);
|
||||
}
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!autoSet) return;
|
||||
|
||||
if (channelToSet) {
|
||||
doSetActiveChannel(channelToSet);
|
||||
doSetIncognito(false);
|
||||
} else if (!channelToSet) {
|
||||
doSetIncognito(true);
|
||||
}
|
||||
|
||||
// on mount, if we get to autoSet a channel, set it.
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={classnames('channel__selector', {
|
||||
'channel__selector--publish': isPublishMenu,
|
||||
'channel__selector--tabHeader': isTabHeader,
|
||||
disabled: disabled,
|
||||
})}
|
||||
>
|
||||
<Menu>
|
||||
{isHeaderMenu ? (
|
||||
<MenuButton className="menu__link">
|
||||
<ChannelThumbnail uri={activeChannelUrl} hideStakedIndicator xxsmall noLazyLoad />
|
||||
{__('Change Default Channel')}
|
||||
<Icon icon={ICONS.DOWN} />
|
||||
</MenuButton>
|
||||
) : (
|
||||
<MenuButton>
|
||||
{(incognito && !hideAnon) || !activeChannelUrl ? (
|
||||
<IncognitoSelector isSelected />
|
||||
) : (
|
||||
<ChannelListItem
|
||||
odyseeMembershipByUri={odyseeMembershipByUri}
|
||||
uri={activeChannelUrl}
|
||||
isSelected
|
||||
claimsByUri={claimsByUri}
|
||||
doFetchUserMemberships={doFetchUserMemberships}
|
||||
isPublishMenu={isPublishMenu}
|
||||
isTabHeader={isTabHeader}
|
||||
/>
|
||||
)}
|
||||
</MenuButton>
|
||||
)}
|
||||
|
||||
<MenuList
|
||||
className={classnames('menu__list channel__list', {
|
||||
'channel__list--publish': isPublishMenu,
|
||||
'channel__list--tabHeader': isTabHeader,
|
||||
})}
|
||||
>
|
||||
{channels &&
|
||||
channels.map((channel) => (
|
||||
<MenuItem key={channel.permanent_url} onSelect={() => handleChannelSelect(channel)}>
|
||||
<ChannelListItem
|
||||
odyseeMembershipByUri={odyseeMembershipByUri}
|
||||
uri={channel.permanent_url}
|
||||
claimsByUri={claimsByUri}
|
||||
doFetchUserMemberships={doFetchUserMemberships}
|
||||
isPublishMenu={isPublishMenu}
|
||||
isTabHeader={isTabHeader}
|
||||
/>
|
||||
</MenuItem>
|
||||
))}
|
||||
{!hideAnon && (
|
||||
<MenuItem
|
||||
onSelect={() => {
|
||||
doSetIncognito(true);
|
||||
if (onChannelSelect) onChannelSelect(undefined);
|
||||
}}
|
||||
>
|
||||
<IncognitoSelector />
|
||||
</MenuItem>
|
||||
)}
|
||||
<MenuItem onSelect={() => push(`/$/${PAGES.CHANNEL_NEW}?redirect=${pathname}`)}>
|
||||
<div className="channel__list-item">
|
||||
<Icon sectionIcon icon={ICONS.CHANNEL} />
|
||||
<h2 className="channel__list-text">{__('Create a new channel')}</h2>
|
||||
</div>
|
||||
</MenuItem>
|
||||
</MenuList>
|
||||
</Menu>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
type ListItemProps = {
|
||||
uri: string,
|
||||
isSelected?: boolean,
|
||||
claimsByUri: { [string]: any },
|
||||
doFetchUserMemberships: (claimIdCsv: string) => void,
|
||||
odyseeMembershipByUri: (uri: string) => string,
|
||||
isPublishMenu?: boolean,
|
||||
isTabHeader?: boolean,
|
||||
};
|
||||
|
||||
function ChannelListItem(props: ListItemProps) {
|
||||
const { uri, isSelected = false, claimsByUri, doFetchUserMemberships } = props;
|
||||
|
||||
const shouldFetchUserMemberships = true;
|
||||
useGetUserMemberships(shouldFetchUserMemberships, [uri], claimsByUri, doFetchUserMemberships, [uri]);
|
||||
const { uri, isSelected = false } = props;
|
||||
|
||||
return (
|
||||
<div
|
||||
className={classnames('channel__list-item', {
|
||||
'channel__list-item--selected': isSelected,
|
||||
})}
|
||||
>
|
||||
<div className={classnames('channel__list-item', { 'channel__list-item--selected': isSelected })}>
|
||||
<ChannelThumbnail uri={uri} hideStakedIndicator xsmall noLazyLoad />
|
||||
<ChannelTitle uri={uri} />
|
||||
<PremiumBadge uri={uri} />
|
||||
{isSelected && <Icon icon={ICONS.DOWN} />}
|
||||
</div>
|
||||
);
|
||||
@@ -206,3 +50,52 @@ function IncognitoSelector(props: IncognitoSelectorProps) {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function ChannelSelector(props: Props) {
|
||||
const { channels, activeChannelClaim, doSetActiveChannel, hideAnon = false, incognito, doSetIncognito } = props;
|
||||
const {
|
||||
push,
|
||||
location: { pathname },
|
||||
} = useHistory();
|
||||
const activeChannelUrl = activeChannelClaim && activeChannelClaim.permanent_url;
|
||||
|
||||
function handleChannelSelect(channelClaim) {
|
||||
doSetIncognito(false);
|
||||
doSetActiveChannel(channelClaim.claim_id);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="channel__selector">
|
||||
<Menu>
|
||||
<MenuButton>
|
||||
{(incognito && !hideAnon) || !activeChannelUrl ? (
|
||||
<IncognitoSelector isSelected />
|
||||
) : (
|
||||
<ChannelListItem uri={activeChannelUrl} isSelected />
|
||||
)}
|
||||
</MenuButton>
|
||||
<MenuList className="menu__list channel__list">
|
||||
{channels &&
|
||||
channels.map((channel) => (
|
||||
<MenuItem key={channel.permanent_url} onSelect={() => handleChannelSelect(channel)}>
|
||||
<ChannelListItem uri={channel.permanent_url} />
|
||||
</MenuItem>
|
||||
))}
|
||||
{!hideAnon && (
|
||||
<MenuItem onSelect={() => doSetIncognito(true)}>
|
||||
<IncognitoSelector />
|
||||
</MenuItem>
|
||||
)}
|
||||
<MenuItem onSelect={() => push(`/$/${PAGES.CHANNEL_NEW}?redirect=${pathname}`)}>
|
||||
<div className="channel__list-item">
|
||||
<Icon sectionIcon icon={ICONS.CHANNEL} />
|
||||
<h2 className="channel__list-text">{__('Create a new channel')}</h2>
|
||||
</div>
|
||||
</MenuItem>
|
||||
</MenuList>
|
||||
</Menu>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default ChannelSelector;
|
||||
@@ -1,15 +1,15 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
selectClaimForUri,
|
||||
selectStakedLevelForChannelUri,
|
||||
selectTotalStakedAmountForChannelUri,
|
||||
makeSelectClaimForUri,
|
||||
makeSelectStakedLevelForChannelUri,
|
||||
makeSelectTotalStakedAmountForChannelUri,
|
||||
} from 'redux/selectors/claims';
|
||||
import ChannelStakedIndicator from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
channelClaim: selectClaimForUri(state, props.uri),
|
||||
amount: selectTotalStakedAmountForChannelUri(state, props.uri),
|
||||
level: selectStakedLevelForChannelUri(state, props.uri),
|
||||
channelClaim: makeSelectClaimForUri(props.uri)(state),
|
||||
amount: makeSelectTotalStakedAmountForChannelUri(props.uri)(state),
|
||||
level: makeSelectStakedLevelForChannelUri(props.uri)(state),
|
||||
});
|
||||
|
||||
export default connect(select)(ChannelStakedIndicator);
|
||||
@@ -14,7 +14,6 @@ type Props = {
|
||||
level: number,
|
||||
large?: boolean,
|
||||
inline?: boolean,
|
||||
hideTooltip?: Boolean,
|
||||
};
|
||||
|
||||
function getChannelIcon(level: number): string {
|
||||
@@ -29,20 +28,8 @@ function getChannelIcon(level: number): string {
|
||||
return icons[level] || ICONS.CHANNEL_LEVEL_1;
|
||||
}
|
||||
|
||||
function getChannelIconB(level: number): string {
|
||||
const icons = {
|
||||
'1': ICONS.CHANNEL_LEVEL_1_B,
|
||||
'2': ICONS.CHANNEL_LEVEL_2_B,
|
||||
'3': ICONS.CHANNEL_LEVEL_3_B,
|
||||
'4': ICONS.CHANNEL_LEVEL_4_B,
|
||||
'5': ICONS.CHANNEL_LEVEL_5_B,
|
||||
};
|
||||
|
||||
return icons[level] || ICONS.CHANNEL_LEVEL_1_B;
|
||||
}
|
||||
|
||||
function ChannelStakedIndicator(props: Props) {
|
||||
const { channelClaim, amount, level, large = false, inline = false, hideTooltip = false } = props;
|
||||
const { channelClaim, amount, level, large = false, inline = false } = props;
|
||||
|
||||
if (!channelClaim || !channelClaim.meta) {
|
||||
return null;
|
||||
@@ -50,41 +37,25 @@ function ChannelStakedIndicator(props: Props) {
|
||||
|
||||
const isControlling = channelClaim && channelClaim.meta.is_controlling;
|
||||
const icon = getChannelIcon(level);
|
||||
const icon_b = getChannelIconB(level);
|
||||
|
||||
if (!hideTooltip) {
|
||||
return (
|
||||
SIMPLE_SITE && (
|
||||
<Tooltip
|
||||
title={
|
||||
<div className="channel-staked__tooltip">
|
||||
<div className="channel-staked__tooltip-icons">
|
||||
<LevelIcon icon={icon_b} isControlling={isControlling} size={isControlling ? 14 : 10} />
|
||||
</div>
|
||||
return (
|
||||
SIMPLE_SITE && (
|
||||
<Tooltip
|
||||
label={
|
||||
<div className="channel-staked__tooltip">
|
||||
<div className="channel-staked__tooltip-icons">
|
||||
<LevelIcon icon={icon} isControlling={isControlling} size={isControlling ? 14 : 10} />
|
||||
</div>
|
||||
|
||||
<div className="channel-staked__tooltip-text">
|
||||
<span>{__('Level %current_level%', { current_level: level })}</span>
|
||||
<div className="channel-staked__amount">
|
||||
<LbcSymbol postfix={<CreditAmount amount={amount} showLBC={false} />} size={14} />
|
||||
</div>
|
||||
<div className="channel-staked__tooltip-text">
|
||||
<span>{__('Level %current_level%', { current_level: level })}</span>
|
||||
<div className="channel-staked__amount">
|
||||
<LbcSymbol postfix={<CreditAmount amount={amount} showLBC={false} />} size={14} />
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<div
|
||||
className={classnames('channel-staked__wrapper', {
|
||||
'channel-staked__wrapper--large': large,
|
||||
'channel-staked__wrapper--inline': inline,
|
||||
})}
|
||||
>
|
||||
<LevelIcon icon={icon} large={large} isControlling={isControlling} />
|
||||
</div>
|
||||
</Tooltip>
|
||||
)
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
SIMPLE_SITE && (
|
||||
}
|
||||
>
|
||||
<div
|
||||
className={classnames('channel-staked__wrapper', {
|
||||
'channel-staked__wrapper--large': large,
|
||||
@@ -93,9 +64,9 @@ function ChannelStakedIndicator(props: Props) {
|
||||
>
|
||||
<LevelIcon icon={icon} large={large} isControlling={isControlling} />
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
</Tooltip>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
type LevelIconProps = {
|
||||
|
||||
@@ -1,22 +1,14 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
selectThumbnailForUri,
|
||||
selectClaimForUri,
|
||||
selectIsUriResolving,
|
||||
selectClaimsByUri,
|
||||
} from 'redux/selectors/claims';
|
||||
import { makeSelectThumbnailForUri, makeSelectClaimForUri, makeSelectIsUriResolving } from 'redux/selectors/claims';
|
||||
import { doResolveUri } from 'redux/actions/claims';
|
||||
import { doFetchUserMemberships } from 'redux/actions/user';
|
||||
import ChannelThumbnail from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
thumbnail: selectThumbnailForUri(state, props.uri),
|
||||
claim: selectClaimForUri(state, props.uri),
|
||||
isResolving: selectIsUriResolving(state, props.uri),
|
||||
claimsByUri: selectClaimsByUri(state),
|
||||
thumbnail: makeSelectThumbnailForUri(props.uri)(state),
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
isResolving: makeSelectIsUriResolving(props.uri)(state),
|
||||
});
|
||||
|
||||
export default connect(select, {
|
||||
doResolveUri,
|
||||
doFetchUserMemberships,
|
||||
})(ChannelThumbnail);
|
||||
@@ -1,14 +1,12 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import { parseURI } from 'util/lbryURI';
|
||||
import { getImageProxyUrl } from 'util/thumbnail';
|
||||
import classnames from 'classnames';
|
||||
import Gerbil from './gerbil.png';
|
||||
import FreezeframeWrapper from 'component/common/freezeframe-wrapper';
|
||||
import FreezeframeWrapper from 'component/fileThumbnail/FreezeframeWrapper';
|
||||
import ChannelStakedIndicator from 'component/channelStakedIndicator';
|
||||
import OptimizedImage from 'component/optimizedImage';
|
||||
import { AVATAR_DEFAULT } from 'config';
|
||||
import useGetUserMemberships from 'effects/use-get-user-memberships';
|
||||
import PremiumBadge from 'component/premiumBadge';
|
||||
|
||||
type Props = {
|
||||
thumbnail: ?string,
|
||||
@@ -18,21 +16,17 @@ type Props = {
|
||||
obscure?: boolean,
|
||||
small?: boolean,
|
||||
xsmall?: boolean,
|
||||
xxsmall?: boolean,
|
||||
allowGifs?: boolean,
|
||||
claim: ?ChannelClaim,
|
||||
doResolveUri: (string) => void,
|
||||
isResolving: boolean,
|
||||
showDelayedMessage?: boolean,
|
||||
noLazyLoad?: boolean,
|
||||
hideStakedIndicator?: boolean,
|
||||
hideTooltip?: boolean,
|
||||
xsmall?: boolean,
|
||||
noOptimization?: boolean,
|
||||
setThumbUploadError: (boolean) => void,
|
||||
ThumbUploadError: boolean,
|
||||
claimsByUri: { [string]: any },
|
||||
doFetchUserMemberships: (claimIdCsv: string) => void,
|
||||
showMemberBadge?: boolean,
|
||||
isChannel?: boolean,
|
||||
checkMembership: boolean,
|
||||
};
|
||||
|
||||
function ChannelThumbnail(props: Props) {
|
||||
@@ -44,23 +38,18 @@ function ChannelThumbnail(props: Props) {
|
||||
obscure,
|
||||
small = false,
|
||||
xsmall = false,
|
||||
xxsmall,
|
||||
allowGifs = false,
|
||||
claim,
|
||||
doResolveUri,
|
||||
isResolving,
|
||||
showDelayedMessage = false,
|
||||
noLazyLoad,
|
||||
hideTooltip,
|
||||
hideStakedIndicator = false,
|
||||
setThumbUploadError,
|
||||
ThumbUploadError,
|
||||
claimsByUri,
|
||||
doFetchUserMemberships,
|
||||
showMemberBadge,
|
||||
isChannel,
|
||||
checkMembership = true,
|
||||
} = props;
|
||||
const [thumbLoadError, setThumbLoadError] = React.useState(ThumbUploadError);
|
||||
const shouldResolve = !isResolving && claim === undefined;
|
||||
const shouldResolve = claim === undefined;
|
||||
const thumbnail = rawThumbnail && rawThumbnail.trim().replace(/^http:\/\//i, 'https://');
|
||||
const thumbnailPreview = rawThumbnailPreview && rawThumbnailPreview.trim().replace(/^http:\/\//i, 'https://');
|
||||
const defaultAvatar = AVATAR_DEFAULT || Gerbil;
|
||||
@@ -68,16 +57,6 @@ function ChannelThumbnail(props: Props) {
|
||||
const isGif = channelThumbnail && channelThumbnail.endsWith('gif');
|
||||
const showThumb = (!obscure && !!thumbnail) || thumbnailPreview;
|
||||
|
||||
const badgeProps = {
|
||||
uri,
|
||||
linkPage: isChannel,
|
||||
placement: isChannel ? 'bottom' : undefined,
|
||||
hideTooltip,
|
||||
className: isChannel ? 'profile-badge__tooltip' : undefined,
|
||||
};
|
||||
|
||||
useGetUserMemberships(checkMembership, [uri], claimsByUri, doFetchUserMemberships, [uri]);
|
||||
|
||||
// Generate a random color class based on the first letter of the channel name
|
||||
const { channelName } = parseURI(uri);
|
||||
let initializer;
|
||||
@@ -96,21 +75,10 @@ function ChannelThumbnail(props: Props) {
|
||||
}, [doResolveUri, shouldResolve, uri]);
|
||||
|
||||
if (isGif && !allowGifs) {
|
||||
const url = getImageProxyUrl(channelThumbnail);
|
||||
return (
|
||||
url && (
|
||||
<FreezeframeWrapper
|
||||
src={url}
|
||||
className={classnames('channel-thumbnail', className, {
|
||||
'channel-thumbnail--small': small,
|
||||
'channel-thumbnail--xsmall': xsmall,
|
||||
'channel-thumbnail--xxsmall': xxsmall,
|
||||
'channel-thumbnail--resolving': isResolving,
|
||||
})}
|
||||
>
|
||||
{showMemberBadge ? <PremiumBadge {...badgeProps} /> : null}
|
||||
</FreezeframeWrapper>
|
||||
)
|
||||
<FreezeframeWrapper src={channelThumbnail} className={classnames('channel-thumbnail', className)}>
|
||||
{!hideStakedIndicator && <ChannelStakedIndicator uri={uri} claim={claim} />}
|
||||
</FreezeframeWrapper>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -120,26 +88,27 @@ function ChannelThumbnail(props: Props) {
|
||||
[colorClassName]: !showThumb,
|
||||
'channel-thumbnail--small': small,
|
||||
'channel-thumbnail--xsmall': xsmall,
|
||||
'channel-thumbnail--xxsmall': xxsmall,
|
||||
'channel-thumbnail--resolving': isResolving,
|
||||
})}
|
||||
>
|
||||
{/* width: use the same size for all 'small' variants so that caching works better */}
|
||||
<OptimizedImage
|
||||
className={!channelThumbnail ? 'channel-thumbnail__default' : 'channel-thumbnail__custom'}
|
||||
src={(!thumbLoadError && channelThumbnail) || defaultAvatar}
|
||||
width={xxsmall || xsmall || small ? 64 : 160}
|
||||
quality={95}
|
||||
loading={noLazyLoad ? undefined : 'lazy'}
|
||||
onError={() => {
|
||||
if (setThumbUploadError) {
|
||||
setThumbUploadError(true);
|
||||
} else {
|
||||
setThumbLoadError(true);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
{showMemberBadge && <PremiumBadge {...badgeProps} />}
|
||||
{showDelayedMessage ? (
|
||||
<div className="channel-thumbnail--waiting">{__('This will be visible in a few minutes.')}</div>
|
||||
) : (
|
||||
<OptimizedImage
|
||||
alt={__('Channel profile picture')}
|
||||
className={!channelThumbnail ? 'channel-thumbnail__default' : 'channel-thumbnail__custom'}
|
||||
src={(!thumbLoadError && channelThumbnail) || defaultAvatar}
|
||||
loading={noLazyLoad ? undefined : 'lazy'}
|
||||
onError={() => {
|
||||
if (setThumbUploadError) {
|
||||
setThumbUploadError(true);
|
||||
} else {
|
||||
setThumbLoadError(true);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{!hideStakedIndicator && <ChannelStakedIndicator uri={uri} claim={claim} />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Loaded 100 of 1111 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user