From b9a5dc3c7002fb0eac37835a566b6e1d4ad6162e Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Tue, 9 Nov 2021 10:26:39 +0800 Subject: [PATCH 1/4] Remove use-zoom It's only needed for electron --- electron/menu/setupBarMenu.js | 33 ----------------------- ui/component/app/view.jsx | 6 ----- ui/effects/use-zoom.js | 51 ----------------------------------- ui/index.jsx | 5 ---- 4 files changed, 95 deletions(-) delete mode 100644 ui/effects/use-zoom.js diff --git a/electron/menu/setupBarMenu.js b/electron/menu/setupBarMenu.js index ba1e55bfe..1cd9315fe 100644 --- a/electron/menu/setupBarMenu.js +++ b/electron/menu/setupBarMenu.js @@ -1,5 +1,4 @@ import { app, Menu, shell } from 'electron'; -import { ZOOM } from 'util/zoomWindow'; export default () => { const template = [ @@ -23,38 +22,6 @@ 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' }], diff --git a/ui/component/app/view.jsx b/ui/component/app/view.jsx index 4dcb3dfce..3c84db9ea 100644 --- a/ui/component/app/view.jsx +++ b/ui/component/app/view.jsx @@ -22,7 +22,6 @@ import Spinner from 'component/spinner'; import LANGUAGES from 'constants/languages'; // @if TARGET='app' -import useZoom from 'effects/use-zoom'; import useHistoryNav from 'effects/use-history-nav'; // @endif // @if TARGET='web' @@ -236,11 +235,6 @@ 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); diff --git a/ui/effects/use-zoom.js b/ui/effects/use-zoom.js deleted file mode 100644 index c16f49ef2..000000000 --- a/ui/effects/use-zoom.js +++ /dev/null @@ -1,51 +0,0 @@ -import { useEffect } from 'react'; -import { changeZoomFactor, ZOOM } from 'util/zoomWindow'; - -export default function useHover(ref) { - useEffect(() => { - const handleKeyPress = e => { - if (e.ctrlKey && !e.shiftKey) { - switch (e.code) { - case 'NumpadAdd': - case 'Equal': - e.preventDefault(); - changeZoomFactor(ZOOM.INCREMENT); - break; - case 'NumpadSubtract': - case 'Minus': - e.preventDefault(); - changeZoomFactor(ZOOM.DECREMENT); - break; - case 'Numpad0': - case 'Digit0': - e.preventDefault(); - changeZoomFactor(ZOOM.RESET); - break; - default: - // Do nothing - break; - } - } - }; - window.addEventListener('keydown', handleKeyPress); - return () => window.removeEventListener('keydown', handleKeyPress); - }, []); - - useEffect(() => { - const handleWheel = e => { - if (e.ctrlKey && !e.shiftKey) { - if (e.deltaY < 0) { - changeZoomFactor(ZOOM.INCREMENT); - } else { - changeZoomFactor(ZOOM.DECREMENT); - } - } - }; - window.addEventListener('wheel', handleWheel); - return () => window.removeEventListener('wheel', handleWheel); - }, []); - - useEffect(() => { - changeZoomFactor(ZOOM.LOAD_FROM_LOCAL_STORAGE); - }, []); -} diff --git a/ui/index.jsx b/ui/index.jsx index d1cdf9915..64eff89c2 100644 --- a/ui/index.jsx +++ b/ui/index.jsx @@ -6,7 +6,6 @@ import SnackBar from 'component/snackBar'; // @if TARGET='app' import SplashScreen from 'component/splash'; import * as ACTIONS from 'constants/action_types'; -import { changeZoomFactor } from 'util/zoomWindow'; // @endif import { ipcRenderer, remote, shell } from 'electron'; import moment from 'moment'; @@ -179,10 +178,6 @@ ipcRenderer.on('open-menu', (event, uri) => { } }); -ipcRenderer.on('zoom-window', (event, action) => { - changeZoomFactor(action); -}); - const { dock } = remote.app; ipcRenderer.on('window-is-focused', () => { From d7fc5069be90cf2ca6fa831ccfc3feb6a97627d3 Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Tue, 9 Nov 2021 15:43:09 +0800 Subject: [PATCH 2/4] Remove .env.ody again Accidentally brought back in when porting over the Redux consolidation PR. --- web/.env.ody | 92 ---------------------------------------------------- 1 file changed, 92 deletions(-) delete mode 100644 web/.env.ody diff --git a/web/.env.ody b/web/.env.ody deleted file mode 100644 index 2d9e1313e..000000000 --- a/web/.env.ody +++ /dev/null @@ -1,92 +0,0 @@ -# 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 From 45ad08ec32c86d6da5d6f9ea057aaabdcae49b1b Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Tue, 9 Nov 2021 16:00:24 +0800 Subject: [PATCH 3/4] Remove use-history-nav.js For electron.js only --- ui/component/app/view.jsx | 8 -------- ui/effects/use-history-nav.js | 25 ------------------------- 2 files changed, 33 deletions(-) delete mode 100644 ui/effects/use-history-nav.js diff --git a/ui/component/app/view.jsx b/ui/component/app/view.jsx index 3c84db9ea..cd6c65c8a 100644 --- a/ui/component/app/view.jsx +++ b/ui/component/app/view.jsx @@ -21,9 +21,6 @@ import usePersistedState from 'effects/use-persisted-state'; import Spinner from 'component/spinner'; import LANGUAGES from 'constants/languages'; -// @if TARGET='app' -import useHistoryNav from 'effects/use-history-nav'; -// @endif // @if TARGET='web' import YoutubeWelcome from 'web/component/youtubeReferralWelcome'; import { @@ -235,11 +232,6 @@ function App(props: Props) { return () => window.removeEventListener('keydown', handleKeyPress); }, []); - // Enable 'Alt + Left/Right' for history navigation on Desktop. - // @if TARGET='app' - useHistoryNav(history); - // @endif - useEffect(() => { if (referredRewardAvailable && sanitizedReferrerParam && isRewardApproved) { setReferrer(sanitizedReferrerParam, true); diff --git a/ui/effects/use-history-nav.js b/ui/effects/use-history-nav.js deleted file mode 100644 index aa82b4077..000000000 --- a/ui/effects/use-history-nav.js +++ /dev/null @@ -1,25 +0,0 @@ -import { useEffect } from 'react'; - -export default function useHistoryNav(history) { - useEffect(() => { - const handleKeyPress = e => { - if ((e.metaKey || e.altKey) && !e.ctrlKey && !e.shiftKey) { - switch (e.code) { - case 'ArrowLeft': - e.preventDefault(); - history.goBack(); - break; - case 'ArrowRight': - e.preventDefault(); - history.goForward(); - break; - default: - // Do nothing - break; - } - } - }; - window.addEventListener('keydown', handleKeyPress); - return () => window.removeEventListener('keydown', handleKeyPress); - }, []); -} From 9fc417edfa047553f104308bf5a6924591d75c82 Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Tue, 9 Nov 2021 16:08:13 +0800 Subject: [PATCH 4/4] Remove 'web' preprocessor --- ui/component/app/view.jsx | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/ui/component/app/view.jsx b/ui/component/app/view.jsx index cd6c65c8a..147e275a9 100644 --- a/ui/component/app/view.jsx +++ b/ui/component/app/view.jsx @@ -20,8 +20,6 @@ import REWARDS from 'rewards'; import usePersistedState from 'effects/use-persisted-state'; import Spinner from 'component/spinner'; import LANGUAGES from 'constants/languages'; - -// @if TARGET='web' import YoutubeWelcome from 'web/component/youtubeReferralWelcome'; import { useDegradedPerformance, @@ -30,22 +28,17 @@ import { STATUS_FAILING, STATUS_DOWN, } from 'web/effects/use-degraded-performance'; -// @endif import LANGUAGE_MIGRATIONS from 'constants/language-migrations'; const FileDrop = lazyImport(() => import('component/fileDrop' /* webpackChunkName: "fileDrop" */)); const NagContinueFirstRun = lazyImport(() => import('component/nagContinueFirstRun' /* webpackChunkName: "nagCFR" */)); const OpenInAppLink = lazyImport(() => import('web/component/openInAppLink' /* webpackChunkName: "openInAppLink" */)); - -// @if TARGET='web' const NagDataCollection = lazyImport(() => import('web/component/nag-data-collection' /* webpackChunkName: "nagDC" */)); 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" */)); -// @endif - const SyncFatalError = lazyImport(() => import('component/syncFatalError' /* webpackChunkName: "syncFatalError" */)); // **************************************************************************** @@ -150,10 +143,10 @@ function App(props: Props) { const isRewardApproved = user && user.is_reward_approved; const previousHasVerifiedEmail = usePrevious(hasVerifiedEmail); const previousRewardApproved = usePrevious(isRewardApproved); - // @if TARGET='web' + const [showAnalyticsNag, setShowAnalyticsNag] = usePersistedState('analytics-nag', true); const [lbryTvApiStatus, setLbryTvApiStatus] = useState(STATUS_OK); - // @endif + const { pathname, hash, search } = props.location; const [upgradeNagClosed, setUpgradeNagClosed] = useState(false); const [resolvedSubscriptions, setResolvedSubscriptions] = useState(false); @@ -183,12 +176,10 @@ function App(props: Props) { uri = newpath + hash; } catch (e) {} - // @if TARGET='web' function handleAnalyticsDismiss() { setShowAnalyticsNag(false); } - // @endif useEffect(() => { if (userId) { analytics.setUser(userId); @@ -310,7 +301,6 @@ function App(props: Props) { }, [previousRewardApproved, isRewardApproved]); // Load IMA3 SDK for aniview - // @if TARGET='web' useEffect(() => { const script = document.createElement('script'); script.src = imaLibraryPath; @@ -322,7 +312,6 @@ function App(props: Props) { document.body.removeChild(script); }; }, []); - // @endif // @if TARGET='app' useEffect(() => { @@ -343,15 +332,11 @@ function App(props: Props) { if (readyForSync && hasVerifiedEmail) { // In case we are syncing. syncLoop(); - // @if TARGET='web' window.addEventListener('focus', syncLoopWithoutInterval); - // @endif } - // @if TARGET='web' return () => { window.removeEventListener('focus', syncLoopWithoutInterval); }; - // @endif }, [readyForSync, hasVerifiedEmail, syncLoop]); // We know someone is logging in or not when we get their user object @@ -389,11 +374,8 @@ function App(props: Props) { } }, [sidebarOpen, isPersonalized, resolvedSubscriptions, subscriptions, resolveUris, setResolvedSubscriptions]); - // @if TARGET='web' useDegradedPerformance(setLbryTvApiStatus, user); - // @endif - // @if TARGET='web' // 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 @@ -404,16 +386,11 @@ function App(props: Props) { ); } - // @endif if (syncFatalError) { return ( - + ); } @@ -455,7 +432,6 @@ function App(props: Props) { )} {/* @endif */} - {/* @if TARGET='web' */} {!SIMPLE_SITE && !shouldHideNag && } {!shouldHideNag && } @@ -469,7 +445,6 @@ function App(props: Props) { )} {user === null && } - {/* @endif */} {isReloadRequired && (