Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
adb272068b |
No files matched your search
+6
-7
@@ -16,7 +16,7 @@ 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.1
|
||||
WELCOME_VERSION=1.2
|
||||
|
||||
# STRIPE
|
||||
# STRIPE_PUBLIC_KEY='pk_test_NoL1JWL7i1ipfhVId5KfDZgo'
|
||||
@@ -26,16 +26,15 @@ MATOMO_URL=https://analytics.lbry.com/
|
||||
MATOMO_ID=4
|
||||
|
||||
# OG
|
||||
OG_TITLE_SUFFIX=| lbry.com
|
||||
OG_HOMEPAGE_TITLE=lbry.com
|
||||
OG_TITLE_SUFFIX=| lbry.tv
|
||||
OG_HOMEPAGE_TITLE=lbry.tv
|
||||
OG_IMAGE_URL=
|
||||
SITE_CANONICAL_URL=https://lbry.com
|
||||
SITE_CANONICAL_URL=https://lbry.tv
|
||||
|
||||
# UI
|
||||
## Custom Site info
|
||||
DOMAIN=lbry.com
|
||||
CLOUD_DOMAIN=odysee.com
|
||||
URL=https://lbry.com
|
||||
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.
|
||||
|
||||
Vendored
Whitespace-only changes.
Vendored
Whitespace-only changes.
Vendored
Whitespace-only changes.
Vendored
Whitespace-only changes.
Vendored
Whitespace-only changes.
Vendored
Whitespace-only changes.
Vendored
Whitespace-only changes.
Vendored
Whitespace-only changes.
Vendored
Whitespace-only changes.
Vendored
Whitespace-only changes.
Vendored
Whitespace-only changes.
@@ -3,6 +3,29 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
|
||||
## [0.53.4] - [2022-06-10]
|
||||
|
||||
## Added
|
||||
- Add top in language category for non-english on homepage ([#7585](https://github.com/lbryio/lbry-desktop/pull/7585))
|
||||
- Auto hosting in settings and hosting first run page ([#7598](https://github.com/lbryio/lbry-desktop/pull/7598))
|
||||
|
||||
### Changed
|
||||
- Updated lbry-sdk to [0.107.2](https://github.com/lbryio/lbry-sdk/releases/tag/v0.107.2)
|
||||
|
||||
## Fixed
|
||||
- Better handle empty collections ([#7571](https://github.com/lbryio/lbry-desktop/pull/7571))
|
||||
- Better handle thumbnails in uploads/collections ([#7574](https://github.com/lbryio/lbry-desktop/pull/7574))
|
||||
- Work towards supporting collections of any claim type ([#7578](https://github.com/lbryio/lbry-desktop/pull/7578))
|
||||
- Improve handling of downed custom servers on startup ([#7593](https://github.com/lbryio/lbry-desktop/pull/7593))
|
||||
- Hide watch progress in related if being played ([#7606](https://github.com/lbryio/lbry-desktop/pull/7606))
|
||||
- IPC disk space calls wait for daemon ready; refresh on vis. component load ([#7610](https://github.com/lbryio/lbry-desktop/pull/7610))
|
||||
|
||||
## [0.53.3] - [2022-04-27]
|
||||
|
||||
## Fixed
|
||||
- Reverted lbry.tv changes that broke production login ([#7569](https://github.com/lbryio/lbry-desktop/pull/7569))
|
||||
- Reverted lbry.tv changes that broke login ([#7570](https://github.com/lbryio/lbry-desktop/pull/7570))
|
||||
|
||||
## [0.53.2] - [2022-04-26]
|
||||
|
||||
### Changed
|
||||
|
||||
@@ -21,7 +21,6 @@ const config = {
|
||||
WELCOME_VERSION: process.env.WELCOME_VERSION,
|
||||
DOMAIN: process.env.DOMAIN,
|
||||
SHARE_DOMAIN_URL: process.env.SHARE_DOMAIN_URL,
|
||||
CLOUD_DOMAIN: process.env.CLOUD_DOMAIN,
|
||||
URL: process.env.URL,
|
||||
THUMBNAIL_CDN_URL: process.env.THUMBNAIL_CDN_URL,
|
||||
SITE_TITLE: process.env.SITE_TITLE,
|
||||
|
||||
@@ -29,6 +29,10 @@
|
||||
"from": "./static/font",
|
||||
"to": "static/font",
|
||||
"filter": ["**/*"]
|
||||
},
|
||||
{
|
||||
"from": "./static/app-update.yml",
|
||||
"to": "app-update.yml"
|
||||
}
|
||||
],
|
||||
"publish": [
|
||||
|
||||
+174
-100
@@ -22,6 +22,7 @@ import { diskSpaceLinux, diskSpaceWindows, diskSpaceMac } from '../ui/util/disks
|
||||
const { download } = require('electron-dl');
|
||||
const remote = require('@electron/remote/main');
|
||||
const os = require('os');
|
||||
const sudo = require('sudo-prompt');
|
||||
|
||||
remote.initialize();
|
||||
const filePath = path.join(process.resourcesPath, 'static', 'upgradeDisabled');
|
||||
@@ -33,29 +34,23 @@ try {
|
||||
upgradeDisabled = false;
|
||||
}
|
||||
autoUpdater.autoDownload = !upgradeDisabled;
|
||||
autoUpdater.allowPrerelease = false;
|
||||
|
||||
// This is set to true if an auto update has been downloaded through the Electron
|
||||
// auto-update system and is ready to install. If the user declined an update earlier,
|
||||
// it will still install on shutdown.
|
||||
let autoUpdateDownloaded = false;
|
||||
const UPDATE_STATE_INIT = 0;
|
||||
const UPDATE_STATE_CHECKING = 1;
|
||||
const UPDATE_STATE_UPDATES_FOUND = 2;
|
||||
const UPDATE_STATE_NO_UPDATES_FOUND = 3;
|
||||
const UPDATE_STATE_DOWNLOADING = 4;
|
||||
const UPDATE_STATE_DOWNLOADED = 5;
|
||||
let updateState = UPDATE_STATE_INIT;
|
||||
let updateDownloadItem;
|
||||
|
||||
const isAutoUpdateSupported = ['win32', 'darwin'].includes(process.platform) || !!process.env.APPIMAGE;
|
||||
|
||||
// This is used to keep track of whether we are showing the special dialog
|
||||
// that we show on Windows after you decline an upgrade and close the app later.
|
||||
let showingAutoUpdateCloseAlert = false;
|
||||
|
||||
// This is used to prevent downloading updates multiple times when
|
||||
// using the auto updater API.
|
||||
// As read in the documentation:
|
||||
// "Calling autoUpdater.checkForUpdates() twice will download the update two times."
|
||||
// https://www.electronjs.org/docs/latest/api/auto-updater#autoupdatercheckforupdates
|
||||
let keepCheckingForUpdates = true;
|
||||
|
||||
// Auto updater doesn't support Linux installations (only trough AppImages)
|
||||
// this is why, for that case, we download a full executable (.deb package)
|
||||
// as a fallback support. This variable will be used to prevent
|
||||
// multiple downloads when auto updater isn't supported.
|
||||
let downloadUpgradeInProgress = false;
|
||||
|
||||
// Keep a global reference, if you don't, they will be closed automatically when the JavaScript
|
||||
// object is garbage collected.
|
||||
let rendererWindow;
|
||||
@@ -243,7 +238,8 @@ app.on('activate', () => {
|
||||
app.on('will-quit', event => {
|
||||
if (
|
||||
process.platform === 'win32' &&
|
||||
autoUpdateDownloaded &&
|
||||
updateState === UPDATE_STATE_DOWNLOADED &&
|
||||
isAutoUpdateSupported &&
|
||||
!appState.autoUpdateAccepted &&
|
||||
!showingAutoUpdateCloseAlert
|
||||
) {
|
||||
@@ -323,91 +319,10 @@ ipcMain.on('get-disk-space', async (event) => {
|
||||
rendererWindow.webContents.send('send-disk-space', { diskSpace });
|
||||
} catch (e) {
|
||||
rendererWindow.webContents.send('send-disk-space', { error: e.message || e });
|
||||
console.log('Failed to start LbryFirst', e);
|
||||
console.log('Failed to get disk space', e);
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.on('download-upgrade', async (event, params) => {
|
||||
if (downloadUpgradeInProgress) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { url, options } = params;
|
||||
const dir = fs.mkdtempSync(app.getPath('temp') + path.sep);
|
||||
options.onProgress = function(p) {
|
||||
rendererWindow.webContents.send('download-progress-update', p);
|
||||
};
|
||||
options.directory = dir;
|
||||
options.onCompleted = function(c) {
|
||||
downloadUpgradeInProgress = false;
|
||||
rendererWindow.webContents.send('download-update-complete', c);
|
||||
};
|
||||
const win = BrowserWindow.getFocusedWindow();
|
||||
downloadUpgradeInProgress = true;
|
||||
await download(win, url, options).catch(e => console.log('e', e));
|
||||
});
|
||||
|
||||
ipcMain.on('upgrade', (event, installerPath) => {
|
||||
app.on('quit', () => {
|
||||
console.log('Launching upgrade installer at', installerPath);
|
||||
// This gets triggered called after *all* other quit-related events, so
|
||||
// we'll only get here if we're fully prepared and quitting for real.
|
||||
shell.openPath(installerPath);
|
||||
});
|
||||
// what to do if no shutdown in a long time?
|
||||
console.log('Update downloaded to', installerPath);
|
||||
console.log('The app will close and you will be prompted to install the latest version of LBRY.');
|
||||
console.log('After the install is complete, please reopen the app.');
|
||||
app.quit();
|
||||
});
|
||||
|
||||
ipcMain.on('check-for-updates', (event, autoDownload) => {
|
||||
// Prevent downloading the same update multiple times.
|
||||
if (!keepCheckingForUpdates) {
|
||||
return;
|
||||
}
|
||||
|
||||
keepCheckingForUpdates = false;
|
||||
autoUpdater.autoDownload = autoDownload;
|
||||
autoUpdater.checkForUpdates();
|
||||
});
|
||||
|
||||
autoUpdater.on('update-downloaded', () => {
|
||||
autoUpdateDownloaded = true;
|
||||
|
||||
// If this download was trigger by
|
||||
// autoUpdateAccepted it means, the user
|
||||
// wants to install the new update but
|
||||
// needed to downloaded the files first.
|
||||
if (appState.autoUpdateAccepted) {
|
||||
autoUpdater.quitAndInstall();
|
||||
}
|
||||
});
|
||||
|
||||
autoUpdater.on('update-not-available', () => {
|
||||
keepCheckingForUpdates = true;
|
||||
});
|
||||
|
||||
ipcMain.on('autoUpdateAccepted', () => {
|
||||
appState.autoUpdateAccepted = true;
|
||||
|
||||
// quitAndInstall can only be called if the
|
||||
// update has been downloaded. Since the user
|
||||
// can disable auto updates, we have to make
|
||||
// sure it has been downloaded first.
|
||||
if (autoUpdateDownloaded) {
|
||||
autoUpdater.quitAndInstall();
|
||||
return;
|
||||
}
|
||||
|
||||
// If the update hasn't been downloaded,
|
||||
// start downloading it. After it's done, the
|
||||
// event 'update-downloaded' will be triggered,
|
||||
// where we will be able to resume the
|
||||
// update installation.
|
||||
autoUpdater.downloadUpdate();
|
||||
});
|
||||
|
||||
ipcMain.on('version-info-requested', () => {
|
||||
function formatRc(ver) {
|
||||
// Adds dash if needed to make RC suffix SemVer friendly
|
||||
@@ -500,3 +415,162 @@ process.on('uncaughtException', error => {
|
||||
if (daemon) daemon.quit();
|
||||
app.exit(1);
|
||||
});
|
||||
|
||||
// Auto updater
|
||||
autoUpdater.on('download-progress', () => {
|
||||
updateState = UPDATE_STATE_DOWNLOADING;
|
||||
});
|
||||
|
||||
autoUpdater.on('update-downloaded', () => {
|
||||
updateState = UPDATE_STATE_DOWNLOADED;
|
||||
|
||||
// If this download was trigger by
|
||||
// autoUpdateAccepted it means, the user
|
||||
// wants to install the new update but
|
||||
// needed to downloaded the files first.
|
||||
if (appState.autoUpdateAccepted) {
|
||||
autoUpdater.quitAndInstall();
|
||||
}
|
||||
});
|
||||
|
||||
autoUpdater.on('update-available', () => {
|
||||
if (updateState === UPDATE_STATE_DOWNLOADING) {
|
||||
return;
|
||||
}
|
||||
updateState = UPDATE_STATE_UPDATES_FOUND;
|
||||
});
|
||||
|
||||
autoUpdater.on('update-not-available', () => {
|
||||
updateState = UPDATE_STATE_NO_UPDATES_FOUND;
|
||||
});
|
||||
|
||||
autoUpdater.on('error', () => {
|
||||
if (updateState === UPDATE_STATE_DOWNLOADING) {
|
||||
updateState = UPDATE_STATE_UPDATES_FOUND;
|
||||
return;
|
||||
}
|
||||
updateState = UPDATE_STATE_INIT;
|
||||
});
|
||||
|
||||
// Manual (.deb) update
|
||||
ipcMain.on('cancel-download-upgrade', () => {
|
||||
if (updateDownloadItem) {
|
||||
// Cancel the download and execute the onCancel
|
||||
// callback set in the options.
|
||||
updateDownloadItem.cancel();
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.on('download-upgrade', (event, params) => {
|
||||
if (updateState !== UPDATE_STATE_UPDATES_FOUND) {
|
||||
return;
|
||||
}
|
||||
if (isAutoUpdateSupported) {
|
||||
updateState = UPDATE_STATE_DOWNLOADING;
|
||||
autoUpdater.downloadUpdate();
|
||||
return;
|
||||
}
|
||||
|
||||
const { url, options } = params;
|
||||
const dir = fs.mkdtempSync(app.getPath('temp') + path.sep);
|
||||
|
||||
updateState = UPDATE_STATE_DOWNLOADING;
|
||||
|
||||
// Grab the download item's handler to allow
|
||||
// cancelling the operation if required.
|
||||
options.onStarted = function(downloadItem) {
|
||||
updateDownloadItem = downloadItem;
|
||||
};
|
||||
options.onCancel = function() {
|
||||
updateState = UPDATE_STATE_UPDATES_FOUND;
|
||||
updateDownloadItem = undefined;
|
||||
};
|
||||
options.onProgress = function(p) {
|
||||
rendererWindow.webContents.send('download-progress-update', p);
|
||||
};
|
||||
options.onCompleted = function(c) {
|
||||
updateState = UPDATE_STATE_DOWNLOADED;
|
||||
updateDownloadItem = undefined;
|
||||
rendererWindow.webContents.send('download-update-complete', c);
|
||||
};
|
||||
options.directory = dir;
|
||||
const win = BrowserWindow.getFocusedWindow();
|
||||
download(win, url, options).catch(e => {
|
||||
updateState = UPDATE_STATE_UPDATES_FOUND;
|
||||
console.log('e', e);
|
||||
});
|
||||
});
|
||||
|
||||
// Update behavior
|
||||
ipcMain.on('autoUpdateAccepted', () => {
|
||||
appState.autoUpdateAccepted = true;
|
||||
|
||||
// quitAndInstall can only be called if the
|
||||
// update has been downloaded. Since the user
|
||||
// can disable auto updates, we have to make
|
||||
// sure it has been downloaded first.
|
||||
if (updateState === UPDATE_STATE_DOWNLOADED) {
|
||||
autoUpdater.quitAndInstall();
|
||||
return;
|
||||
}
|
||||
|
||||
if (updateState !== UPDATE_STATE_UPDATES_FOUND) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the update hasn't been downloaded,
|
||||
// start downloading it. After it's done, the
|
||||
// event 'update-downloaded' will be triggered,
|
||||
// where we will be able to resume the
|
||||
// update installation.
|
||||
updateState = UPDATE_STATE_DOWNLOADING;
|
||||
autoUpdater.downloadUpdate();
|
||||
});
|
||||
|
||||
ipcMain.on('check-for-updates', (event, autoDownload) => {
|
||||
if (![UPDATE_STATE_INIT, UPDATE_STATE_NO_UPDATES_FOUND].includes(updateState)) {
|
||||
return;
|
||||
}
|
||||
|
||||
updateState = UPDATE_STATE_CHECKING;
|
||||
|
||||
// If autoDownload is true, checkForUpdates will begin the
|
||||
// download automatically.
|
||||
if (autoDownload) {
|
||||
updateState = UPDATE_STATE_DOWNLOADING;
|
||||
}
|
||||
|
||||
autoUpdater.autoDownload = autoDownload;
|
||||
autoUpdater.checkForUpdates();
|
||||
});
|
||||
|
||||
ipcMain.on('upgrade', (event, installerPath) => {
|
||||
// what to do if no shutdown in a long time?
|
||||
console.log('Update downloaded to', installerPath);
|
||||
console.log('The app will close and you will be prompted to install the latest version of LBRY.');
|
||||
console.log('After the install is complete, please reopen the app.');
|
||||
|
||||
// Prevent .deb package from opening with archive manager (Ubuntu >= 20)
|
||||
if (process.platform === 'linux' && !process.env.APPIMAGE) {
|
||||
sudo.exec(`dpkg -i ${installerPath}`, { name: app.name }, (err, stdout, stderr) => {
|
||||
if (err || stderr) {
|
||||
rendererWindow.webContents.send('upgrade-installing-error');
|
||||
return;
|
||||
}
|
||||
|
||||
// Re-launch the application when the installation finishes.
|
||||
app.relaunch();
|
||||
app.quit();
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
app.on('quit', () => {
|
||||
console.log('Launching upgrade installer at', installerPath);
|
||||
// This gets triggered called after *all* other quit-related events, so
|
||||
// we'll only get here if we're fully prepared and quitting for real.
|
||||
shell.openPath(installerPath);
|
||||
});
|
||||
app.quit();
|
||||
});
|
||||
@@ -155,7 +155,10 @@ Lbryio.authenticate = (domain, language) => {
|
||||
.then(
|
||||
status =>
|
||||
new Promise((res, rej) => {
|
||||
const appId = status.installation_id;
|
||||
const appId =
|
||||
domain && domain !== 'lbry.tv'
|
||||
? (domain.replace(/[.]/gi, '') + status.installation_id).slice(0, 66)
|
||||
: status.installation_id;
|
||||
Lbryio.call(
|
||||
'user',
|
||||
'new',
|
||||
|
||||
Vendored
-1
@@ -67,7 +67,6 @@ declare type GenericMetadata = {
|
||||
languages?: Array<string>,
|
||||
tags?: Array<string>,
|
||||
locations?: Array<Location>,
|
||||
release_time?: number, // this shouldn't be here, but... fixme?
|
||||
};
|
||||
|
||||
declare type ChannelMetadata = GenericMetadata & {
|
||||
|
||||
Vendored
+2
-2
@@ -8,6 +8,6 @@ declare type WalletServerDetails = {
|
||||
};
|
||||
|
||||
declare type DiskSpace = {
|
||||
total: string,
|
||||
free: string,
|
||||
total: number,
|
||||
free: number,
|
||||
};
|
||||
Vendored
+1
@@ -22,6 +22,7 @@ declare type RowDataItem = {
|
||||
channelIds?: Array<string>,
|
||||
limitClaimsPerChannel?: number,
|
||||
pageSize?: number,
|
||||
languages?: Array<string>,
|
||||
},
|
||||
route?: string,
|
||||
hideForUnauth?: boolean,
|
||||
|
||||
Vendored
-3
@@ -16,7 +16,4 @@ declare type SubscriptionState = {
|
||||
following: Array<Following>,
|
||||
loading: boolean,
|
||||
firstRunCompleted: boolean,
|
||||
downloadEnabledByUrl: any,
|
||||
downloadQueue: Array<string>,
|
||||
lastReleaseBySubUrl: any,
|
||||
};
|
||||
+5
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lbry",
|
||||
"version": "0.53.2",
|
||||
"version": "0.53.5-alpha.test7495a4",
|
||||
"description": "A browser for the LBRY network, a digital marketplace controlled by its users.",
|
||||
"keywords": [
|
||||
"lbry"
|
||||
@@ -67,6 +67,7 @@
|
||||
"remove-markdown": "^0.3.0",
|
||||
"rss": "^1.2.2",
|
||||
"source-map-explorer": "^2.5.2",
|
||||
"sudo-prompt": "^9.2.1",
|
||||
"tempy": "^0.6.0",
|
||||
"videojs-logo": "^2.1.4"
|
||||
},
|
||||
@@ -238,10 +239,11 @@
|
||||
"yarn": "^1.3"
|
||||
},
|
||||
"lbrySettings": {
|
||||
"lbrynetDaemonVersion": "0.107.1",
|
||||
"lbrynetDaemonVersion": "0.107.2",
|
||||
"lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-OSNAME.zip",
|
||||
"lbrynetDaemonDir": "static/daemon",
|
||||
"lbrynetDaemonFileName": "lbrynet"
|
||||
},
|
||||
"packageManager": "yarn@3.2.0"
|
||||
"packageManager": "yarn@3.2.0",
|
||||
"stableVersion": "0.53.4"
|
||||
}
|
||||
+27
-29
@@ -2206,13 +2206,6 @@
|
||||
"Enabling a minimum amount to comment will force all comments to have tips associated with them. This can help prevent spam.": "Enabling a minimum amount to comment will force all comments to have tips associated with them. This can help prevent spam.",
|
||||
"Comments containing these words will be blocked.": "Comments containing these words will be blocked.",
|
||||
"Enter the full channel name or URL to search.\n\nExamples:\n - @channel\n - @channel#3\n - https://odysee.com/@Odysee:8\n - lbry://@Odysee#8": "Enter the full channel name or URL to search.\n\nExamples:\n - @channel\n - @channel#3\n - https://odysee.com/@Odysee:8\n - lbry://@Odysee#8",
|
||||
"Disk Space": "Disk Space",
|
||||
"Data Hosting": "Data Hosting",
|
||||
"Limit": "Limit",
|
||||
"Limit Space Used": "Limit Space Used",
|
||||
"Apply": "Apply",
|
||||
"Limit in GB": "Limit in GB",
|
||||
"If you set a limit, playing videos may exceed your limit until cleanup runs every 30 minutes.": "If you set a limit, playing videos may exceed your limit until cleanup runs every 30 minutes.",
|
||||
"Enable Data Hosting": "Enable Data Hosting",
|
||||
"Data over the limit will be deleted within 30 minutes. This will make the Yrbl cry a little bit.": "Data over the limit will be deleted within 30 minutes. This will make the Yrbl cry a little bit.",
|
||||
"Choose %asset%": "Choose %asset%",
|
||||
@@ -2228,13 +2221,6 @@
|
||||
"Enable Prerelease Updates": "Enable Prerelease Updates",
|
||||
"Enable Upgrade to Test Builds": "Enable Upgrade to Test Builds",
|
||||
"Prereleases may break things and we may not be able to fix them for you.": "Prereleases may break things and we may not be able to fix them for you.",
|
||||
"Limit (GB)": "Limit (GB)",
|
||||
"Limit Hosting for Content you Use": "Limit Hosting for Content you Use",
|
||||
"Allow (GB)": "Allow (GB)",
|
||||
"Content Data Hosting helps to seed things that you watch and download.": "Content Data Hosting helps to seed things that you watch and download.",
|
||||
"Network Data Hosting allows the p2p network to store blobs unrelated to your browsing.": "Network Data Hosting allows the p2p network to store blobs unrelated to your browsing.",
|
||||
"Content: Limit (GB)": "Content: Limit (GB)",
|
||||
"Network: Allow (GB)": "Network: Allow (GB)",
|
||||
"A channel is required to repost on LBRY": "A channel is required to repost on LBRY",
|
||||
"Admin": "Admin",
|
||||
"Stickers": "Stickers",
|
||||
@@ -2256,19 +2242,6 @@
|
||||
"Move Up": "Move Up",
|
||||
"Move Down": "Move Down",
|
||||
"Trending for #Game": "Trending for #Game",
|
||||
"Help the P2P data network by hosting data.": "Help the P2P data network by hosting data.",
|
||||
"History hosting lets you choose how much storage to use helping content you've consumed.": "History hosting lets you choose how much storage to use helping content you've consumed.",
|
||||
"Automatic hosting lets you delegate some amount of storage for the network to automatically download ad host.": "Automatic hosting lets you delegate some amount of storage for the network to automatically download ad host.",
|
||||
"Playing videos may exceed your history hosting limit until cleanup runs every 30 minutes.": "Playing videos may exceed your history hosting limit until cleanup runs every 30 minutes.",
|
||||
"History: Limit (GB)": "History: Limit (GB)",
|
||||
"Automatic: Allow (GB)": "Automatic: Allow (GB)",
|
||||
"Automatic hosting lets you delegate some amount of storage for the network to automatically download and host.": "Automatic hosting lets you delegate some amount of storage for the network to automatically download and host.",
|
||||
"History Hosting": "History Hosting",
|
||||
"Automatic Hosting": "Automatic Hosting",
|
||||
"History Hosting lets you choose how much storage to use helping content you've consumed.": "History Hosting lets you choose how much storage to use helping content you've consumed.",
|
||||
"Automatic Hosting lets you delegate some amount of storage for the network to automatically download and host.": "Automatic Hosting lets you delegate some amount of storage for the network to automatically download and host.",
|
||||
"Help improve the P2P data network (and make LBRY happy) by hosting data.": "Help improve the P2P data network (and make LBRY happy) by hosting data.",
|
||||
"Limit Hosting of Content History": "Limit Hosting of Content History",
|
||||
"Remove custom comment server": "Remove custom comment server",
|
||||
"Use Https": "Use Https",
|
||||
"Server URL": "Server URL",
|
||||
@@ -2315,7 +2288,32 @@
|
||||
"Clear Views": "Clear Views",
|
||||
"Show Video View Progress": "Show Video View Progress",
|
||||
"Display view progress on thumbnail. This setting will not hide any blockchain activity or downloads.": "Display view progress on thumbnail. This setting will not hide any blockchain activity or downloads.",
|
||||
"%anonymous%": "%anonymous%",
|
||||
"Anon --[used in <%anonymous% Reposted>]--": "Anon",
|
||||
"Content Hosting": "Content Hosting",
|
||||
"Hosting": "Hosting",
|
||||
"Viewed Hosting": "Viewed Hosting",
|
||||
"Auto Hosting": "Auto Hosting",
|
||||
"Help creators and improve the P2P data network by hosting content.": "Help creators and improve the P2P data network by hosting content.",
|
||||
"I'm happy with my settings": "I'm happy with my settings",
|
||||
"We've noticed you already have some settings.": "We've noticed you already have some settings.",
|
||||
"You choose how much data to host.": "You choose how much data to host.",
|
||||
"Go back": "Go back",
|
||||
"Custom Hosting": "Custom Hosting",
|
||||
"Automatic Hosting (GB)": "Automatic Hosting (GB)",
|
||||
"* Note that as peer-to-peer software, your IP address and potentially other system information can be sent to other users, though this information is not stored permanently.": "* Note that as peer-to-peer software, your IP address and potentially other system information can be sent to other users, though this information is not stored permanently.",
|
||||
"Help improve the P2P data network (and make LBRY users happy) by hosting data.": "Help improve the P2P data network (and make LBRY users happy) by hosting data.",
|
||||
"View History Hosting lets you choose how much storage to use hosting content you've consumed.": "View History Hosting lets you choose how much storage to use hosting content you've consumed.",
|
||||
"Automatic Hosting downloads a small portion of content active on the network.": "Automatic Hosting downloads a small portion of content active on the network.",
|
||||
"Publishes --[legend, storage category]--": "Publishes",
|
||||
"Auto Hosting --[legend, storage category]--": "Auto Hosting",
|
||||
"View Hosting --[legend, storage category]--": "View Hosting",
|
||||
"%spaceUsed% of %limit% GB": "%spaceUsed% of %limit% GB",
|
||||
"%spaceUsed% of %limit% Free GB": "%spaceUsed% of %limit% Free GB",
|
||||
"Disabled": "Disabled",
|
||||
"Free --[legend, unused disk space]--": "Free",
|
||||
"Top content in %language%": "Top content in %language%",
|
||||
"Apply": "Apply",
|
||||
"Disable background": "Disable background",
|
||||
"Installing, please wait...": "Installing, please wait...",
|
||||
"There was an error during installation. Please, try again.": "There was an error during installation. Please, try again.",
|
||||
"--end--": "--end--"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
owner: lbryio
|
||||
repo: lbry-desktop
|
||||
provider: github
|
||||
+1
-1
@@ -19,7 +19,7 @@ const WATCHMAN_BACKEND_ENDPOINT = 'https://watchman.na-backend.odysee.com/report
|
||||
|
||||
if (isProduction) {
|
||||
ElectronCookies.enable({
|
||||
origin: 'https://lbry.com',
|
||||
origin: 'https://lbry.tv',
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -143,7 +143,6 @@ function App(props: Props) {
|
||||
const shouldMigrateLanguage = LANGUAGE_MIGRATIONS[language];
|
||||
const hasActiveChannelClaim = activeChannelId !== undefined;
|
||||
const isPersonalized = hasVerifiedEmail;
|
||||
const renderFiledrop = isAuthenticated;
|
||||
|
||||
useEffect(() => {
|
||||
if (userId) {
|
||||
@@ -349,7 +348,7 @@ function App(props: Props) {
|
||||
>
|
||||
<Router />
|
||||
<ModalRouter />
|
||||
{renderFiledrop && <FileDrop />}
|
||||
<FileDrop />
|
||||
<FileRenderFloating />
|
||||
{isEnhancedLayout && <Yrbl className="yrbl--enhanced" />}
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import { connect } from 'react-redux';
|
||||
import StorageViz from './view';
|
||||
import {
|
||||
selectViewBlobSpace,
|
||||
selectViewHostingLimit,
|
||||
selectAutoBlobSpace,
|
||||
selectPrivateBlobSpace,
|
||||
selectAutoHostingLimit,
|
||||
} from 'redux/selectors/settings';
|
||||
import { selectDiskSpace } from 'redux/selectors/app';
|
||||
|
||||
const select = (state) => ({
|
||||
diskSpace: selectDiskSpace(state),
|
||||
viewHostingLimit: selectViewHostingLimit(state),
|
||||
autoHostingLimit: selectAutoHostingLimit(state),
|
||||
viewBlobSpace: selectViewBlobSpace(state),
|
||||
autoBlobSpace: selectAutoBlobSpace(state),
|
||||
privateBlobSpace: selectPrivateBlobSpace(state),
|
||||
});
|
||||
|
||||
export default connect(select)(StorageViz);
|
||||
@@ -0,0 +1,130 @@
|
||||
// @flow
|
||||
import * as React from 'react';
|
||||
import I18nMessage from 'component/i18nMessage';
|
||||
import { ipcRenderer } from 'electron';
|
||||
|
||||
type Props = {
|
||||
// --- select ---
|
||||
diskSpace: DiskSpace, // KB
|
||||
viewHostingLimit: number, // MB
|
||||
autoHostingLimit: number,
|
||||
viewBlobSpace: number,
|
||||
autoBlobSpace: number,
|
||||
privateBlobSpace: number,
|
||||
};
|
||||
|
||||
function StorageViz(props: Props) {
|
||||
const { diskSpace, viewHostingLimit, autoHostingLimit, viewBlobSpace, autoBlobSpace, privateBlobSpace } = props;
|
||||
React.useEffect(() => {
|
||||
ipcRenderer.send('get-disk-space');
|
||||
}, []);
|
||||
|
||||
if (!diskSpace || !diskSpace.total) {
|
||||
return (
|
||||
<div className={'storage__wrapper'}>
|
||||
<div className={'storage__bar'}>
|
||||
<div className="help">{__('Cannot get disk space information.')}</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const totalMB = diskSpace && Math.floor(diskSpace.total / 1024);
|
||||
const freeMB = diskSpace && Math.floor(diskSpace.free / 1024);
|
||||
const otherMB = totalMB - (freeMB + viewBlobSpace + autoBlobSpace + privateBlobSpace);
|
||||
const autoFree = autoHostingLimit - autoBlobSpace;
|
||||
const viewFree = viewHostingLimit > 0 ? viewHostingLimit - viewBlobSpace : freeMB - autoFree;
|
||||
const unallocFree = freeMB - viewFree - autoFree;
|
||||
const viewLimit =
|
||||
viewHostingLimit === 0
|
||||
? freeMB - (autoHostingLimit - autoBlobSpace) + viewBlobSpace
|
||||
: viewHostingLimit + viewBlobSpace;
|
||||
|
||||
const getPercent = (val, lim = totalMB) => (val / lim) * 100;
|
||||
const getGB = (val) => (Number(val) / 1024).toFixed(2);
|
||||
|
||||
const otherPercent = getPercent(otherMB);
|
||||
const privatePercent = getPercent(privateBlobSpace);
|
||||
const autoLimitPercent = getPercent(autoHostingLimit);
|
||||
const viewLimitPercent = getPercent(viewLimit);
|
||||
const viewUsedPercentOfLimit = getPercent(viewBlobSpace, viewLimit);
|
||||
const autoUsedPercentOfLimit = getPercent(autoBlobSpace, autoHostingLimit);
|
||||
|
||||
return (
|
||||
<div className={'storage__wrapper'}>
|
||||
<div className={'storage__bar'}>
|
||||
<div className={'storage__other'} style={{ width: `${otherPercent}%` }} />
|
||||
<div className={'storage__private'} style={{ width: `${privatePercent}%` }} />
|
||||
<div className={'storage__auto'} style={{ width: `${autoLimitPercent}%` }}>
|
||||
<div className={'storage__auto--used'} style={{ width: `${autoUsedPercentOfLimit}%` }} />
|
||||
<div className={'storage__auto--free'} />
|
||||
</div>
|
||||
<div className={'storage__viewed'} style={{ width: `${viewLimitPercent}%` }}>
|
||||
<div className={'storage__viewed--used'} style={{ width: `${viewUsedPercentOfLimit}%` }} />
|
||||
<div className={'storage__viewed--free'} />
|
||||
</div>
|
||||
{viewHostingLimit !== 0 && <div style={{ 'background-color': 'unset' }} />}
|
||||
</div>
|
||||
<div className={'storage__legend-wrapper'}>
|
||||
<div className={'storage__legend-item'}>
|
||||
<div className={'storage__legend-item-swatch storage__legend-item-swatch--private'} />
|
||||
<div className={'storage__legend-item-label'}>
|
||||
<label>{__('Publishes --[legend, storage category]--')}</label>
|
||||
<div className={'help'}>{`${getGB(privateBlobSpace)} GB`}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className={'storage__legend-item'}>
|
||||
<div className={'storage__legend-item-swatch storage__legend-item-swatch--auto'} />
|
||||
<div className={'storage__legend-item-label'}>
|
||||
<label>{__('Auto Hosting --[legend, storage category]--')}</label>
|
||||
<div className={'help'}>
|
||||
{autoHostingLimit === 0 ? (
|
||||
__('Disabled')
|
||||
) : (
|
||||
<I18nMessage
|
||||
tokens={{
|
||||
spaceUsed: getGB(autoBlobSpace),
|
||||
limit: getGB(autoHostingLimit),
|
||||
}}
|
||||
>
|
||||
%spaceUsed% of %limit% GB
|
||||
</I18nMessage>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className={'storage__legend-item'}>
|
||||
<div className={'storage__legend-item-swatch storage__legend-item-swatch--viewed'} />
|
||||
<div className={'storage__legend-item-label'}>
|
||||
<label>{__('View Hosting --[legend, storage category]--')}</label>
|
||||
<div className={'help'}>
|
||||
{viewHostingLimit === 1 ? (
|
||||
__('Disabled')
|
||||
) : (
|
||||
<I18nMessage
|
||||
tokens={{
|
||||
spaceUsed: getGB(viewBlobSpace),
|
||||
limit: viewHostingLimit !== 0 ? getGB(viewHostingLimit) : getGB(viewFree),
|
||||
}}
|
||||
>
|
||||
%spaceUsed% of %limit% Free GB
|
||||
</I18nMessage>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{viewHostingLimit !== 0 && (
|
||||
<div className={'storage__legend-item'}>
|
||||
<div className={'storage__legend-item-swatch storage__legend-item-swatch--free'} />
|
||||
<div className={'storage__legend-item-label'}>
|
||||
<label>{__('Free --[legend, unused disk space]--')}</label>
|
||||
<div className={'help'}>{`${getGB(unallocFree)} GB`}</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default StorageViz;
|
||||
@@ -6,6 +6,7 @@ import CreditAmount from 'component/common/credit-amount';
|
||||
import DateTime from 'component/dateTime';
|
||||
import YoutubeBadge from 'component/youtubeBadge';
|
||||
import SUPPORTED_LANGUAGES from 'constants/supported_languages';
|
||||
import { formatNumber } from 'util/number';
|
||||
|
||||
type Props = {
|
||||
claim: ChannelClaim,
|
||||
@@ -74,7 +75,7 @@ function ChannelAbout(props: Props) {
|
||||
</div>
|
||||
|
||||
<label>{__('Total Uploads')}</label>
|
||||
<div className="media__info-text">{claim.meta.claims_in_channel}</div>
|
||||
<div className="media__info-text">{formatNumber(claim.meta.claims_in_channel || 0, 2, true)}</div>
|
||||
|
||||
<label>{__('Last Updated')}</label>
|
||||
<div className="media__info-text">
|
||||
|
||||
@@ -50,6 +50,7 @@ function ChannelThumbnail(props: Props) {
|
||||
setThumbUploadError,
|
||||
ThumbUploadError,
|
||||
} = props;
|
||||
const [retries, setRetries] = React.useState(3);
|
||||
const [thumbLoadError, setThumbLoadError] = React.useState(ThumbUploadError);
|
||||
const shouldResolve = !isResolving && claim === undefined;
|
||||
const thumbnail = rawThumbnail && rawThumbnail.trim().replace(/^http:\/\//i, 'https://');
|
||||
@@ -58,6 +59,15 @@ function ChannelThumbnail(props: Props) {
|
||||
const channelThumbnail = thumbnailPreview || thumbnail || defaultAvatar;
|
||||
const isGif = channelThumbnail && channelThumbnail.endsWith('gif');
|
||||
const showThumb = (!obscure && !!thumbnail) || thumbnailPreview;
|
||||
const avatarSrc = React.useMemo(() => {
|
||||
if (retries <= 0) {
|
||||
return defaultAvatar;
|
||||
}
|
||||
if (!thumbLoadError) {
|
||||
return channelThumbnail;
|
||||
}
|
||||
return defaultAvatar;
|
||||
}, [retries, thumbLoadError, channelThumbnail, defaultAvatar]);
|
||||
|
||||
// Generate a random color class based on the first letter of the channel name
|
||||
const { channelName } = parseURI(uri);
|
||||
@@ -100,9 +110,10 @@ function ChannelThumbnail(props: Props) {
|
||||
<OptimizedImage
|
||||
alt={__('Channel profile picture')}
|
||||
className={!channelThumbnail ? 'channel-thumbnail__default' : 'channel-thumbnail__custom'}
|
||||
src={(!thumbLoadError && channelThumbnail) || defaultAvatar}
|
||||
src={avatarSrc}
|
||||
loading={noLazyLoad ? undefined : 'lazy'}
|
||||
onError={() => {
|
||||
setRetries((retries) => retries - 1);
|
||||
if (setThumbUploadError) {
|
||||
setThumbUploadError(true);
|
||||
} else {
|
||||
|
||||
@@ -110,6 +110,11 @@ function ClaimMenuList(props: Props) {
|
||||
const [doShuffle, setDoShuffle] = React.useState(false);
|
||||
const incognitoClaim = contentChannelUri && !contentChannelUri.includes('@');
|
||||
const isChannel = !incognitoClaim && !contentSigningChannel;
|
||||
// $FlowFixMe
|
||||
const claimLength = claim && claim.value && claim.value.claims && claim.value.claims.length;
|
||||
// $FlowFixMe
|
||||
const claimCount = editedCollection ? editedCollection.items.length : claimLength;
|
||||
const isEmptyCollection = (Number(claimCount) || 0) <= 0;
|
||||
const { channelName } = parseURI(contentChannelUri);
|
||||
const showDelete = claimIsMine || (fileInfo && (fileInfo.written_bytes > 0 || fileInfo.blobs_completed > 0));
|
||||
const subscriptionLabel = repostedClaim
|
||||
@@ -297,18 +302,20 @@ function ClaimMenuList(props: Props) {
|
||||
{__('View List')}
|
||||
</a>
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
onSelect={() => {
|
||||
if (!resolvedList) fetchItems();
|
||||
setDoShuffle(true);
|
||||
}}
|
||||
>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.SHUFFLE} />
|
||||
{__('Shuffle Play')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
{!isEmptyCollection && (
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
onSelect={() => {
|
||||
if (!resolvedList) fetchItems();
|
||||
setDoShuffle(true);
|
||||
}}
|
||||
>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.SHUFFLE} />
|
||||
{__('Shuffle Play')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
)}
|
||||
{isMyCollection && (
|
||||
<>
|
||||
<MenuItem
|
||||
|
||||
@@ -9,7 +9,7 @@ import * as COLLECTIONS_CONSTS from 'constants/collections';
|
||||
import { isChannelClaim } from 'util/claim';
|
||||
import { formatLbryUrlForWeb } from 'util/url';
|
||||
import { formatClaimPreviewTitle } from 'util/formatAriaLabel';
|
||||
import { toCompactNotation } from 'util/string';
|
||||
import { formatNumber } from 'util/number';
|
||||
import Tooltip from 'component/common/tooltip';
|
||||
import FileThumbnail from 'component/fileThumbnail';
|
||||
import UriIndicator from 'component/uriIndicator';
|
||||
@@ -138,7 +138,6 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
indexInContainer,
|
||||
channelSubCount,
|
||||
swipeLayout = false,
|
||||
lang,
|
||||
showEdit,
|
||||
dragHandleProps,
|
||||
unavailableUris,
|
||||
@@ -162,8 +161,8 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
if (channelSubCount === undefined) {
|
||||
return <span />;
|
||||
}
|
||||
const formattedSubCount = toCompactNotation(channelSubCount, lang, 10000);
|
||||
const formattedSubCountLocale = Number(channelSubCount).toLocaleString();
|
||||
const formattedSubCount = formatNumber(channelSubCount, 2, true);
|
||||
const formattedSubCountLocale = formatNumber(channelSubCount, 2, false);
|
||||
return (
|
||||
<div className="media__subtitle">
|
||||
<Tooltip title={formattedSubCountLocale} followCursor placement="top">
|
||||
|
||||
@@ -5,6 +5,7 @@ import DateTime from 'component/dateTime';
|
||||
import Button from 'component/button';
|
||||
import FileViewCountInline from 'component/fileViewCountInline';
|
||||
import { parseURI } from 'util/lbryURI';
|
||||
import { formatNumber } from 'util/number';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
@@ -34,7 +35,7 @@ function ClaimPreviewSubtitle(props: Props) {
|
||||
<>
|
||||
{isChannel &&
|
||||
type !== 'inline' &&
|
||||
`${claimsInChannel} ${claimsInChannel === 1 ? __('upload') : __('uploads')}`}
|
||||
`${formatNumber(claimsInChannel, 2, true)} ${claimsInChannel === 1 ? __('upload') : __('uploads')}`}
|
||||
|
||||
{!isChannel && (
|
||||
<>
|
||||
|
||||
@@ -54,9 +54,13 @@ function CollectionActions(props: Props) {
|
||||
const isMobile = useIsMobile();
|
||||
const claimId = claim && claim.claim_id;
|
||||
const webShareable = true; // collections have cost?
|
||||
const isEmptyCollection = !firstItem;
|
||||
|
||||
const doPlay = React.useCallback(
|
||||
(playUri) => {
|
||||
if (!playUri) {
|
||||
return;
|
||||
}
|
||||
const navigateUrl = formatLbryUrlForWeb(playUri);
|
||||
push({
|
||||
pathname: navigateUrl,
|
||||
@@ -81,6 +85,7 @@ function CollectionActions(props: Props) {
|
||||
icon={ICONS.PLAY}
|
||||
label={__('Play')}
|
||||
title={__('Play')}
|
||||
disabled={isEmptyCollection}
|
||||
onClick={() => {
|
||||
doToggleShuffleList(collectionId, false);
|
||||
doPlay(firstItem);
|
||||
@@ -91,6 +96,7 @@ function CollectionActions(props: Props) {
|
||||
icon={ICONS.SHUFFLE}
|
||||
label={__('Shuffle Play')}
|
||||
title={__('Shuffle Play')}
|
||||
disabled={isEmptyCollection}
|
||||
onClick={() => {
|
||||
doToggleShuffleList(collectionId, true);
|
||||
setDoShuffle(true);
|
||||
|
||||
@@ -23,6 +23,7 @@ import CollectionForm from './view';
|
||||
import { selectActiveChannelClaim, selectIncognito } from 'redux/selectors/app';
|
||||
import { doSetActiveChannel, doSetIncognito } from 'redux/actions/app';
|
||||
import { doCollectionEdit } from 'redux/actions/collections';
|
||||
import { doResetThumbnailStatus } from 'redux/actions/publish';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
@@ -52,6 +53,7 @@ const perform = (dispatch, ownProps) => ({
|
||||
setActiveChannel: (claimId) => dispatch(doSetActiveChannel(claimId)),
|
||||
setIncognito: (incognito) => dispatch(doSetIncognito(incognito)),
|
||||
doCollectionEdit: (params) => dispatch(doCollectionEdit(ownProps.collectionId, params)),
|
||||
resetThumbnailStatus: () => dispatch(doResetThumbnailStatus()),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(CollectionForm);
|
||||
@@ -58,6 +58,7 @@ type Props = {
|
||||
setActiveChannel: (string) => void,
|
||||
setIncognito: (boolean) => void,
|
||||
doCollectionEdit: (CollectionEditParams) => void,
|
||||
resetThumbnailStatus: () => void,
|
||||
};
|
||||
|
||||
function CollectionForm(props: Props) {
|
||||
@@ -92,6 +93,7 @@ function CollectionForm(props: Props) {
|
||||
setIncognito,
|
||||
onDone,
|
||||
doCollectionEdit,
|
||||
resetThumbnailStatus,
|
||||
} = props;
|
||||
const activeChannelName = activeChannelClaim && activeChannelClaim.name;
|
||||
let prefix = 'lbry://';
|
||||
@@ -158,7 +160,7 @@ function CollectionForm(props: Props) {
|
||||
}
|
||||
|
||||
function handleUpdateThumbnail(update: { [string]: string }) {
|
||||
if (update.thumbnail_url) {
|
||||
if (update.thumbnail_url !== undefined) {
|
||||
setParam(update);
|
||||
} else if (update.thumbnail_status) {
|
||||
setThumbStatus(update.thumbnail_status);
|
||||
@@ -309,6 +311,10 @@ function CollectionForm(props: Props) {
|
||||
}
|
||||
}, [uri, hasClaim]);
|
||||
|
||||
React.useEffect(() => {
|
||||
resetThumbnailStatus();
|
||||
}, [resetThumbnailStatus]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={classnames('main--contained', { 'card--disabled': disabled })}>
|
||||
@@ -358,10 +364,11 @@ function CollectionForm(props: Props) {
|
||||
/>
|
||||
<fieldset-section>
|
||||
<SelectThumbnail
|
||||
thumbnailParam={params.thumbnail_url}
|
||||
thumbnailParamError={thumbError}
|
||||
thumbnail={params.thumbnail_url}
|
||||
thumbnailError={thumbError}
|
||||
thumbnailParamStatus={thumbStatus}
|
||||
updateThumbnailParams={handleUpdateThumbnail}
|
||||
usePublishFormMode
|
||||
/>
|
||||
</fieldset-section>
|
||||
<FormField
|
||||
|
||||
@@ -33,7 +33,7 @@ function CollectionPreviewOverlay(props: Props) {
|
||||
collectionItemUrls.map((item, index) => {
|
||||
if (index < 2) {
|
||||
return (
|
||||
<div className="collection-preview__overlay-grid-items">
|
||||
<div key={item} className="collection-preview__overlay-grid-items">
|
||||
<FileThumbnail uri={item} key={item} />
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -95,7 +95,7 @@ export default function CollectionsListMine(props: Props) {
|
||||
{builtin.map((list: Collection) => {
|
||||
const { items: itemUrls } = list;
|
||||
return (
|
||||
<>
|
||||
<React.Fragment key={list.name}>
|
||||
{Boolean(itemUrls && itemUrls.length) && (
|
||||
<div className="claim-grid__wrapper" key={list.name}>
|
||||
<h1 className="claim-grid__header">
|
||||
@@ -124,7 +124,7 @@ export default function CollectionsListMine(props: Props) {
|
||||
<ClaimList tileLayout key={list.name} uris={itemUrls.slice(0, 6)} collectionId={list.id} />
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
</React.Fragment>
|
||||
);
|
||||
})}
|
||||
<div className="claim-grid__wrapper">
|
||||
|
||||
@@ -8,6 +8,7 @@ import { FF_MAX_CHARS_IN_COMMENT } from 'constants/form-field';
|
||||
import { SITE_NAME, ENABLE_COMMENT_REACTIONS } from 'config';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { parseURI } from 'util/lbryURI';
|
||||
import { formatNumber } from 'util/number';
|
||||
import DateTime from 'component/dateTime';
|
||||
import Button from 'component/button';
|
||||
import Expandable from 'component/expandable';
|
||||
@@ -384,7 +385,7 @@ function CommentView(props: Props) {
|
||||
label={
|
||||
numDirectReplies < 2
|
||||
? __('Show reply')
|
||||
: __('Show %count% replies', { count: numDirectReplies })
|
||||
: __('Show %count% replies', { count: formatNumber(numDirectReplies, 2, true) })
|
||||
}
|
||||
button="link"
|
||||
onClick={() => {
|
||||
|
||||
@@ -9,6 +9,7 @@ import Button from 'component/button';
|
||||
import ChannelThumbnail from 'component/channelThumbnail';
|
||||
import { useHistory } from 'react-router';
|
||||
import { useIsMobile } from 'effects/use-screensize';
|
||||
import { formatNumber } from 'util/number';
|
||||
|
||||
type Props = {
|
||||
myReacts: Array<string>,
|
||||
@@ -109,7 +110,11 @@ export default function CommentReactions(props: Props) {
|
||||
'comment__action--active': myReacts && myReacts.includes(REACTION_TYPES.LIKE),
|
||||
})}
|
||||
onClick={handleCommentLike}
|
||||
label={<span className="comment__reaction-count">{getCountForReact(REACTION_TYPES.LIKE)}</span>}
|
||||
label={
|
||||
<span className="comment__reaction-count">
|
||||
{formatNumber(getCountForReact(REACTION_TYPES.LIKE), 2, true)}
|
||||
</span>
|
||||
}
|
||||
/>
|
||||
<Button
|
||||
title={__('Downvote')}
|
||||
@@ -119,7 +124,11 @@ export default function CommentReactions(props: Props) {
|
||||
'comment__action--active': myReacts && myReacts.includes(REACTION_TYPES.DISLIKE),
|
||||
})}
|
||||
onClick={handleCommentDislike}
|
||||
label={<span className="comment__reaction-count">{getCountForReact(REACTION_TYPES.DISLIKE)}</span>}
|
||||
label={
|
||||
<span className="comment__reaction-count">
|
||||
{formatNumber(getCountForReact(REACTION_TYPES.DISLIKE), 2, true)}
|
||||
</span>
|
||||
}
|
||||
/>
|
||||
|
||||
{!shouldHide && ENABLE_CREATOR_REACTIONS && (canCreatorReact || creatorLiked) && (
|
||||
|
||||
@@ -47,7 +47,24 @@ class FileSelector extends React.PureComponent<Props> {
|
||||
};
|
||||
|
||||
handleDirectoryInputSelection = () => {
|
||||
remote.dialog.showOpenDialog({ properties: ['openDirectory'] }).then((result) => {
|
||||
let defaultPath;
|
||||
let properties;
|
||||
let isWin = process.platform === 'win32';
|
||||
let type = this.props.type;
|
||||
|
||||
if (isWin === true) {
|
||||
defaultPath = process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE;
|
||||
}
|
||||
|
||||
if (type === 'openFile') {
|
||||
properties = ['openFile'];
|
||||
}
|
||||
|
||||
if (type === 'openDirectory') {
|
||||
properties = ['openDirectory'];
|
||||
}
|
||||
|
||||
remote.dialog.showOpenDialog({ properties, defaultPath }).then((result) => {
|
||||
const path = result && result.filePaths[0];
|
||||
if (path) {
|
||||
// $FlowFixMe
|
||||
@@ -82,7 +99,11 @@ class FileSelector extends React.PureComponent<Props> {
|
||||
autoFocus={autoFocus}
|
||||
button="primary"
|
||||
disabled={disabled}
|
||||
onClick={type === 'openDirectory' ? this.handleDirectoryInputSelection : this.fileInputButton}
|
||||
onClick={
|
||||
type === 'openDirectory' || type === 'openFile'
|
||||
? this.handleDirectoryInputSelection
|
||||
: this.fileInputButton
|
||||
}
|
||||
label={__('Browse')}
|
||||
/>
|
||||
}
|
||||
|
||||
@@ -2054,28 +2054,4 @@ export const icons = {
|
||||
<path d="M12.5,23.24v-1A10.74,10.74,0,0,1,23.24,11.52" />
|
||||
</g>
|
||||
),
|
||||
[ICONS.HOST]: buildIcon(
|
||||
<g>
|
||||
<path d="M9 22.5 12 9l3 13.5" />
|
||||
<circle cx={12} cy={7.657} r={1.25} />
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M4 7.657c0-2.21.895-4.21 2.343-5.657l1.06 1.06A6.48 6.48 0 0 0 5.5 7.658a6.48 6.48 0 0 0 1.904 4.596l-1.06 1.06A7.975 7.975 0 0 1 4 7.658Zm13.657 5.657A7.975 7.975 0 0 0 20 7.657c0-2.21-.895-4.21-2.343-5.657l-1.06 1.06A6.48 6.48 0 0 1 18.5 7.658a6.48 6.48 0 0 1-1.904 4.596l1.06 1.06Z"
|
||||
/>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M7 7.657c0-1.38.56-2.63 1.464-3.536l1.061 1.061A3.49 3.49 0 0 0 8.5 7.657c0 .966.392 1.841 1.025 2.475l-1.06 1.06A4.984 4.984 0 0 1 7 7.657Zm8.536 3.535A4.984 4.984 0 0 0 17 7.657c0-1.38-.56-2.63-1.464-3.536l-1.061 1.061A3.49 3.49 0 0 1 15.5 7.657a3.49 3.49 0 0 1-1.025 2.475l1.06 1.06Z"
|
||||
/>
|
||||
<path d="M2 22h20" />
|
||||
</g>
|
||||
),
|
||||
[ICONS.NO_HOST]: buildIcon(
|
||||
<g>
|
||||
<path d="M9 22.5 12 9l3 13.5" />
|
||||
<circle cx={12} cy={7.657} r={1.25} />
|
||||
<path d="M2 22h20" />
|
||||
</g>
|
||||
),
|
||||
};
|
||||
@@ -4,7 +4,7 @@ import * as ICONS from 'constants/icons';
|
||||
import React from 'react';
|
||||
import classnames from 'classnames';
|
||||
import Button from 'component/button';
|
||||
import { formatNumberWithCommas } from 'util/number';
|
||||
import { formatNumber } from 'util/number';
|
||||
import NudgeFloating from 'component/nudgeFloating';
|
||||
type Props = {
|
||||
claim: StreamClaim,
|
||||
@@ -18,16 +18,8 @@ type Props = {
|
||||
};
|
||||
|
||||
function FileReactions(props: Props) {
|
||||
const {
|
||||
claim,
|
||||
uri,
|
||||
doFetchReactions,
|
||||
doReactionLike,
|
||||
doReactionDislike,
|
||||
myReaction,
|
||||
likeCount,
|
||||
dislikeCount,
|
||||
} = props;
|
||||
const { claim, uri, doFetchReactions, doReactionLike, doReactionDislike, myReaction, likeCount, dislikeCount } =
|
||||
props;
|
||||
|
||||
const claimId = claim && claim.claim_id;
|
||||
const channel = claim && claim.signing_channel && claim.signing_channel.name;
|
||||
@@ -59,7 +51,7 @@ function FileReactions(props: Props) {
|
||||
className={classnames('button--file-action button-like', {
|
||||
'button--file-action-active': myReaction === REACTION_TYPES.LIKE,
|
||||
})}
|
||||
label={<>{formatNumberWithCommas(likeCount, 0)}</>}
|
||||
label={<>{formatNumber(likeCount, 2, true)}</>}
|
||||
iconSize={18}
|
||||
icon={likeIcon}
|
||||
onClick={() => doReactionLike(uri)}
|
||||
@@ -70,7 +62,7 @@ function FileReactions(props: Props) {
|
||||
className={classnames('button--file-action button-dislike', {
|
||||
'button--file-action-active': myReaction === REACTION_TYPES.DISLIKE,
|
||||
})}
|
||||
label={<>{formatNumberWithCommas(dislikeCount, 0)}</>}
|
||||
label={<>{formatNumber(dislikeCount, 2, true)}</>}
|
||||
iconSize={18}
|
||||
icon={dislikeIcon}
|
||||
onClick={() => doReactionDislike(uri)}
|
||||
|
||||
@@ -1,16 +1,25 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doResolveUri } from 'redux/actions/claims';
|
||||
import { makeSelectClaimForUri } from 'redux/selectors/claims';
|
||||
import { makeSelectContentWatchedPercentageForUri } from 'redux/selectors/content';
|
||||
import { selectPrimaryUri, makeSelectContentWatchedPercentageForUri } from 'redux/selectors/content';
|
||||
import CardMedia from './view';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import * as SETTINGS from 'constants/settings';
|
||||
|
||||
const select = (state, props) => {
|
||||
const claimUriBeingPlayed = selectPrimaryUri(state);
|
||||
let isBeingPlayed = false;
|
||||
|
||||
if (claimUriBeingPlayed) {
|
||||
const claim = makeSelectClaimForUri(props.uri)(state);
|
||||
const claimBeingPlayed = makeSelectClaimForUri(claimUriBeingPlayed)(state);
|
||||
isBeingPlayed = claim.claim_id === claimBeingPlayed.claim_id;
|
||||
}
|
||||
|
||||
return {
|
||||
watchedPercentage: makeSelectContentWatchedPercentageForUri(props.uri)(state),
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
showPercentage: makeSelectClientSetting(SETTINGS.PERSIST_WATCH_TIME)(state),
|
||||
showPercentage: !isBeingPlayed && makeSelectClientSetting(SETTINGS.PERSIST_WATCH_TIME)(state),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import React from 'react';
|
||||
import HelpLink from 'component/common/help-link';
|
||||
import Tooltip from 'component/common/tooltip';
|
||||
import { toCompactNotation } from 'util/string';
|
||||
import { formatNumber } from 'util/number';
|
||||
|
||||
type Props = {
|
||||
claimId: ?string, // this
|
||||
@@ -14,8 +14,8 @@ type Props = {
|
||||
|
||||
function FileViewCount(props: Props) {
|
||||
const { claimId, uri, fetchViewCount, viewCount } = props; // claimId
|
||||
const countCompact = toCompactNotation(viewCount);
|
||||
const countFullResolution = Number(viewCount).toLocaleString();
|
||||
const countCompact = formatNumber(Number(viewCount), 2, true);
|
||||
const countFullResolution = formatNumber(Number(viewCount), 2, false);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (claimId) {
|
||||
@@ -24,7 +24,7 @@ function FileViewCount(props: Props) {
|
||||
}, [fetchViewCount, uri, claimId]);
|
||||
|
||||
return (
|
||||
<Tooltip label={countFullResolution}>
|
||||
<Tooltip title={`${countFullResolution}`}>
|
||||
<span className="media__subtitle--centered">
|
||||
{viewCount !== 1 ? __('%view_count% views', { view_count: countCompact }) : __('1 view')}
|
||||
{<HelpLink href="https://lbry.com/faq/views" />}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// @flow
|
||||
// import 'scss/component/_header.scss'; // ody codesplits this; no.
|
||||
|
||||
import { ENABLE_UI_NOTIFICATIONS } from 'config';
|
||||
import { Menu, MenuList, MenuButton, MenuItem } from '@reach/menu-button';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as PAGES from 'constants/pages';
|
||||
@@ -12,11 +15,14 @@ type HeaderMenuButtonProps = {
|
||||
authenticated: boolean,
|
||||
automaticDarkModeEnabled: boolean,
|
||||
currentTheme: string,
|
||||
user: ?User,
|
||||
handleThemeToggle: (boolean, string) => void,
|
||||
};
|
||||
|
||||
export default function HeaderMenuButtons(props: HeaderMenuButtonProps) {
|
||||
const { automaticDarkModeEnabled, currentTheme, handleThemeToggle } = props;
|
||||
const { automaticDarkModeEnabled, currentTheme, user, handleThemeToggle } = props;
|
||||
|
||||
const notificationsEnabled = ENABLE_UI_NOTIFICATIONS || (user && user.experimental_ui);
|
||||
|
||||
return (
|
||||
<div className="header__buttons">
|
||||
@@ -33,7 +39,7 @@ export default function HeaderMenuButtons(props: HeaderMenuButtonProps) {
|
||||
</MenuList>
|
||||
</Menu>
|
||||
|
||||
<NotificationHeaderButton />
|
||||
{notificationsEnabled && <NotificationHeaderButton />}
|
||||
|
||||
<Menu>
|
||||
<Tooltip title={__('Settings')}>
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { selectUnseenNotificationCount, selectUnseenLocalNotificationCount } from 'redux/selectors/notifications';
|
||||
import { doLbryioSeeAllNotifications, doLocalSeeAllNotifications } from 'redux/actions/notifications';
|
||||
import { selectUnseenNotificationCount } from 'redux/selectors/notifications';
|
||||
import { doSeeAllNotifications } from 'redux/actions/notifications';
|
||||
import { selectUser } from 'redux/selectors/user';
|
||||
import NotificationHeaderButton from './view';
|
||||
|
||||
const select = (state) => ({
|
||||
unseenCount: selectUnseenNotificationCount(state),
|
||||
unseenLocalCount: selectUnseenLocalNotificationCount(state),
|
||||
user: selectUser(state),
|
||||
});
|
||||
|
||||
export default connect(select, {
|
||||
doLbryioSeeAllNotifications,
|
||||
doLocalSeeAllNotifications,
|
||||
doSeeAllNotifications,
|
||||
})(NotificationHeaderButton);
|
||||
@@ -1,4 +1,7 @@
|
||||
// @flow
|
||||
// import 'scss/component/_header.scss'; // ody codesplits this; no. REMOVE THESE
|
||||
|
||||
import { ENABLE_UI_NOTIFICATIONS } from 'config';
|
||||
import { useHistory } from 'react-router';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as PAGES from 'constants/pages';
|
||||
@@ -10,22 +13,23 @@ import Tooltip from 'component/common/tooltip';
|
||||
|
||||
type Props = {
|
||||
unseenCount: number,
|
||||
unseenLocalCount: number,
|
||||
doLbryioSeeAllNotifications: () => void,
|
||||
doLocalSeeAllNotifications: () => void,
|
||||
user: ?User,
|
||||
doSeeAllNotifications: () => void,
|
||||
};
|
||||
|
||||
export default function NotificationHeaderButton(props: Props) {
|
||||
const { unseenCount, unseenLocalCount, doLbryioSeeAllNotifications, doLocalSeeAllNotifications } = props;
|
||||
const { unseenCount, user, doSeeAllNotifications } = props;
|
||||
|
||||
const { push } = useHistory();
|
||||
const notificationsEnabled = ENABLE_UI_NOTIFICATIONS || (user && user.experimental_ui);
|
||||
|
||||
function handleMenuClick() {
|
||||
if (unseenCount > 0) doLbryioSeeAllNotifications();
|
||||
if (unseenLocalCount > 0) doLocalSeeAllNotifications();
|
||||
if (unseenCount > 0) doSeeAllNotifications();
|
||||
push(`/$/${PAGES.NOTIFICATIONS}`);
|
||||
}
|
||||
|
||||
if (!notificationsEnabled) return null;
|
||||
|
||||
return (
|
||||
<Tooltip title={__('Notifications')}>
|
||||
<Button onClick={handleMenuClick} className="header__navigationItem--icon">
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import HostingSplash from './view';
|
||||
import {
|
||||
selectViewBlobSpace,
|
||||
selectViewHostingLimit,
|
||||
selectAutoBlobSpace,
|
||||
selectAutoHostingLimit,
|
||||
selectSaveBlobs,
|
||||
} from 'redux/selectors/settings';
|
||||
import { doSetDaemonSetting } from 'redux/actions/settings';
|
||||
import { selectDiskSpace } from 'redux/selectors/app';
|
||||
|
||||
const select = (state) => ({
|
||||
diskSpace: selectDiskSpace(state),
|
||||
viewHostingLimit: selectViewHostingLimit(state),
|
||||
autoHostingLimit: selectAutoHostingLimit(state),
|
||||
viewBlobSpace: selectViewBlobSpace(state),
|
||||
autoBlobSpace: selectAutoBlobSpace(state),
|
||||
saveBlobs: selectSaveBlobs(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
setDaemonSetting: (key, value) => dispatch(doSetDaemonSetting(key, value)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(HostingSplash);
|
||||
@@ -0,0 +1,156 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import { FormField } from 'component/common/form-components/form-field';
|
||||
import { Form } from 'component/common/form-components/form';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
|
||||
// $FlowFixMe cannot resolve ...
|
||||
import image from 'static/img/yrblhappy.svg';
|
||||
import * as DAEMON_SETTINGS from 'constants/daemon_settings';
|
||||
|
||||
type SetDaemonSettingArg = boolean | string | number;
|
||||
|
||||
type Props = {
|
||||
handleNextPage: () => void,
|
||||
handleDone: () => void,
|
||||
setDaemonSetting: (string, ?SetDaemonSettingArg) => void,
|
||||
// --- select ---
|
||||
diskSpace: DiskSpace, // KB
|
||||
viewHostingLimit: number, // MB
|
||||
autoHostingLimit: number,
|
||||
viewBlobSpace: number,
|
||||
autoBlobSpace: number,
|
||||
privateBlobSpace: number,
|
||||
saveBlobs: boolean,
|
||||
};
|
||||
|
||||
const TWENTY_PERCENT = 0.2;
|
||||
const TEN_PRECNT = 0.1;
|
||||
|
||||
function HostingSplash(props: Props) {
|
||||
const {
|
||||
handleNextPage,
|
||||
diskSpace,
|
||||
viewHostingLimit,
|
||||
autoHostingLimit,
|
||||
viewBlobSpace,
|
||||
autoBlobSpace,
|
||||
saveBlobs,
|
||||
setDaemonSetting,
|
||||
handleDone,
|
||||
} = props;
|
||||
|
||||
const totalMB = diskSpace && Math.floor(diskSpace.total / 1024);
|
||||
const freeMB = diskSpace && Math.floor(diskSpace.free / 1024);
|
||||
const blobSpaceUsed = viewBlobSpace + autoBlobSpace;
|
||||
|
||||
const [hostingChoice, setHostingChoice] = React.useState('MANAGED');
|
||||
function handleSubmit() {
|
||||
if (hostingChoice === 'CUSTOM') {
|
||||
handleNextPage();
|
||||
} else {
|
||||
handleAuto();
|
||||
}
|
||||
}
|
||||
|
||||
function getManagedLimitMB() {
|
||||
const value =
|
||||
freeMB > totalMB * TWENTY_PERCENT // lots of free space?
|
||||
? blobSpaceUsed > totalMB * TEN_PRECNT // using more than 10%?
|
||||
? (freeMB + blobSpaceUsed) / 2 // e.g. 40g used plus 30g free, knock back to 35g limit, freeing to 35g
|
||||
: totalMB * TEN_PRECNT // let it go up to 10%
|
||||
: (freeMB + blobSpaceUsed) / 2; // e.g. 40g used plus 10g free, knock back to 25g limit, freeing to 25g
|
||||
return value > 10240 ? Math.floor(value / 1024) * 1024 : 0;
|
||||
}
|
||||
|
||||
function getAutoLimit() {
|
||||
// return floor of 10% of total
|
||||
const totalGB = Math.floor(getManagedLimitMB() / 1024); // eg, 25GB
|
||||
return Math.floor(totalGB / 10) * 1024; // eg, 2 GB -> 2048MB
|
||||
}
|
||||
|
||||
function getViewedLimit() {
|
||||
return getManagedLimitMB() - getAutoLimit();
|
||||
}
|
||||
|
||||
function getManagedCopy() {
|
||||
if (viewHostingLimit || autoHostingLimit || !saveBlobs) {
|
||||
return __("I'm happy with my settings");
|
||||
} else if (getManagedLimitMB() > 0) {
|
||||
return __(`Host up to %percent% of my drive (%limit% GB)`, {
|
||||
percent: `${Math.round((Math.floor(getManagedLimitMB() / 1024) / Math.floor(totalMB / 1024)) * 100)}%`,
|
||||
limit: Math.floor(getManagedLimitMB() / 1024),
|
||||
});
|
||||
} else {
|
||||
return __(`Not now, my disk is almost full.`);
|
||||
}
|
||||
}
|
||||
|
||||
function getManagedHelper() {
|
||||
if (viewHostingLimit || autoHostingLimit || !saveBlobs) {
|
||||
return __(`We've noticed you already have some settings.`);
|
||||
} else if (getManagedLimitMB() > 0) {
|
||||
return __(`Donate space without filling up your drive.`);
|
||||
} else {
|
||||
return __(`You can clear some space and check hosting settings later.`);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleAuto() {
|
||||
if (viewHostingLimit || autoHostingLimit || !saveBlobs) {
|
||||
handleDone();
|
||||
} else if (getManagedLimitMB() > 0) {
|
||||
// limit to used // maybe move this to a single action function that doesn't live inside the component.
|
||||
await setDaemonSetting(DAEMON_SETTINGS.BLOB_STORAGE_LIMIT_MB, getViewedLimit());
|
||||
await setDaemonSetting(DAEMON_SETTINGS.NETWORK_STORAGE_LIMIT_MB, getAutoLimit());
|
||||
handleDone();
|
||||
} else {
|
||||
// running low on space
|
||||
handleDone();
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="main--contained">
|
||||
<div className={'columns first-run__wrapper'}>
|
||||
<div className={'first-run__left'}>
|
||||
<div>
|
||||
<h1 className="section__title--large">{__('Hosting')}</h1>
|
||||
<h3 className="section__subtitle">
|
||||
{__('Help creators and improve the P2P data network by hosting content.')}
|
||||
</h3>
|
||||
<fieldset>
|
||||
<FormField
|
||||
name={'managedhosting'}
|
||||
type="radio"
|
||||
checked={hostingChoice === 'MANAGED'}
|
||||
label={getManagedCopy()}
|
||||
helper={getManagedHelper()}
|
||||
onChange={(e) => setHostingChoice('MANAGED')}
|
||||
/>
|
||||
<FormField
|
||||
name={'customhosting'}
|
||||
type="radio"
|
||||
checked={hostingChoice === 'CUSTOM'}
|
||||
label={<>{__('Custom')}</>}
|
||||
helper={__(`You choose how much data to host.`)}
|
||||
onChange={(e) => setHostingChoice('CUSTOM')}
|
||||
/>
|
||||
</fieldset>
|
||||
</div>
|
||||
<Form onSubmit={handleSubmit} className="section__body">
|
||||
<div className={'card__actions'}>
|
||||
<Button button="primary" label={hostingChoice === 'CUSTOM' ? __('Next') : __(`Let's go`)} type="submit" />
|
||||
</div>
|
||||
</Form>
|
||||
</div>
|
||||
<div className={'first-run__image-wrapper'}>
|
||||
<img src={image} className="privacy-img" />
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export default withRouter(HostingSplash);
|
||||
@@ -0,0 +1,3 @@
|
||||
import HostingSplashCustom from './view';
|
||||
|
||||
export default HostingSplashCustom;
|
||||
@@ -0,0 +1,31 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import { Form } from 'component/common/form-components/form';
|
||||
import SettingStorage from 'component/settingStorage';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
|
||||
type Props = {
|
||||
handleNextPage: () => void,
|
||||
handleGoBack: () => void,
|
||||
};
|
||||
|
||||
function HostingSplashCustom(props: Props) {
|
||||
const { handleNextPage, handleGoBack } = props;
|
||||
|
||||
return (
|
||||
<section className="main--contained">
|
||||
<div className={'first-run__wrapper'}>
|
||||
<SettingStorage isWelcome />
|
||||
<Form onSubmit={handleNextPage} className="section__body">
|
||||
<div className={'card__actions'}>
|
||||
<Button button="primary" label={__(`Let's go`)} type="submit" />
|
||||
<Button button="link" label={__(`Go back`)} onClick={handleGoBack} />
|
||||
</div>
|
||||
</Form>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export default withRouter(HostingSplashCustom);
|
||||
@@ -1,3 +1,11 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { selectRemoteVersion } from 'redux/selectors/app';
|
||||
import LastReleaseChanges from './view';
|
||||
|
||||
export default LastReleaseChanges;
|
||||
const select = (state) => ({
|
||||
releaseVersion: selectRemoteVersion(state),
|
||||
});
|
||||
|
||||
const perform = {};
|
||||
|
||||
export default connect(select, perform)(LastReleaseChanges);
|
||||
@@ -5,11 +5,12 @@ import Button from 'component/button';
|
||||
import I18nMessage from 'component/i18nMessage';
|
||||
|
||||
type Props = {
|
||||
releaseVersion: string,
|
||||
hideReleaseVersion?: boolean,
|
||||
};
|
||||
|
||||
const LastReleaseChanges = (props: Props) => {
|
||||
const { hideReleaseVersion } = props;
|
||||
const { hideReleaseVersion, releaseVersion } = props;
|
||||
const [releaseTag, setReleaseTag] = useState('');
|
||||
const [releaseChanges, setReleaseChanges] = useState('');
|
||||
const [fetchingReleaseChanges, setFetchingReleaseChanges] = useState(false);
|
||||
@@ -35,7 +36,7 @@ const LastReleaseChanges = (props: Props) => {
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const lastReleaseUrl = 'https://api.github.com/repos/lbryio/lbry-desktop/releases/latest';
|
||||
const lastReleaseUrl = `https://api.github.com/repos/lbryio/lbry-desktop/releases/tags/${releaseVersion}`;
|
||||
const options = {
|
||||
method: 'GET',
|
||||
headers: { Accept: 'application/vnd.github.v3+json' },
|
||||
@@ -54,7 +55,7 @@ const LastReleaseChanges = (props: Props) => {
|
||||
setFetchingReleaseChanges(false);
|
||||
setFetchReleaseFailed(true);
|
||||
});
|
||||
}, []);
|
||||
}, [releaseVersion, setFetchingReleaseChanges, setReleaseTag, setReleaseChanges, setFetchReleaseFailed]);
|
||||
|
||||
if (fetchingReleaseChanges) {
|
||||
return <p>{__('Loading...')}</p>;
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
doLbryioNotificationsMarkRead,
|
||||
doLbryioDeleteNotification,
|
||||
doLocalDeleteNotification,
|
||||
} from 'redux/actions/notifications';
|
||||
import { doReadNotifications, doDeleteNotification } from 'redux/actions/notifications';
|
||||
import Notification from './view';
|
||||
|
||||
const perform = (dispatch, ownProps) => ({
|
||||
readNotification: () => dispatch(doLbryioNotificationsMarkRead([ownProps.notification.id])),
|
||||
deleteNotification: () => dispatch(doLbryioDeleteNotification(ownProps.notification.id)),
|
||||
deleteLocalNotification: () => dispatch(doLocalDeleteNotification(ownProps.notification.id)),
|
||||
readNotification: () => dispatch(doReadNotifications([ownProps.notification.id])),
|
||||
deleteNotification: () => dispatch(doDeleteNotification(ownProps.notification.id)),
|
||||
});
|
||||
|
||||
export default connect(null, perform)(Notification);
|
||||
@@ -72,9 +72,9 @@ function PrivacyAgreement(props: Props) {
|
||||
{__('No')} <span>😢</span>
|
||||
</>
|
||||
}
|
||||
helper={__(`* Note that as
|
||||
peer-to-peer software, your IP address and potentially other system information can be sent to other
|
||||
users, though this information is not stored permanently.`)}
|
||||
helper={__(
|
||||
`* Note that as peer-to-peer software, your IP address and potentially other system information can be sent to other users, though this information is not stored permanently.`
|
||||
)}
|
||||
onChange={(e) => setShare(NONE)}
|
||||
/>
|
||||
{authenticated && (
|
||||
@@ -92,7 +92,7 @@ function PrivacyAgreement(props: Props) {
|
||||
)}
|
||||
</fieldset>
|
||||
<div className={'card__actions'}>
|
||||
<Button button="primary" label={__(`Let's go`)} disabled={!share} type="submit" />
|
||||
<Button button="primary" label={__(`Next`)} disabled={!share} type="submit" />
|
||||
</div>
|
||||
{share === NONE && (
|
||||
<p className="help">
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// @flow
|
||||
import { formatCredits } from 'util/format-credits';
|
||||
|
||||
type Props = {
|
||||
uri: ?string,
|
||||
isResolvingUri: boolean,
|
||||
@@ -23,7 +25,7 @@ function BidHelpText(props: Props) {
|
||||
bidHelpText = __(
|
||||
'If you bid more than %amount% LBRY Credits, when someone navigates to %uri%, it will load your published content. However, you can get a longer version of this URL for any bid.',
|
||||
{
|
||||
amount: amountNeededForTakeover,
|
||||
amount: formatCredits(amountNeededForTakeover, 2, true),
|
||||
uri: uri,
|
||||
}
|
||||
);
|
||||
|
||||
@@ -325,6 +325,7 @@ function PublishFile(props: Props) {
|
||||
{showFileUpload && (
|
||||
<>
|
||||
<FileSelector
|
||||
type="openFile"
|
||||
label={__('File')}
|
||||
disabled={disabled}
|
||||
currentPath={currentFile}
|
||||
|
||||
@@ -5,11 +5,15 @@ import { doUpdatePublishForm, doResetThumbnailStatus } from 'redux/actions/publi
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import PublishPage from './view';
|
||||
|
||||
const select = (state) => ({
|
||||
...selectPublishFormValues(state),
|
||||
fileInfos: selectFileInfosByOutpoint(state),
|
||||
myClaimForUri: selectMyClaimForUri(state),
|
||||
});
|
||||
const select = (state, props) => {
|
||||
const publishFormFields = selectPublishFormValues(state);
|
||||
return {
|
||||
...publishFormFields,
|
||||
thumbnail: props.thumbnail || publishFormFields.thumbnail,
|
||||
fileInfos: selectFileInfosByOutpoint(state),
|
||||
myClaimForUri: selectMyClaimForUri(state),
|
||||
};
|
||||
};
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
updatePublishForm: (value) => dispatch(doUpdatePublishForm(value)),
|
||||
|
||||
@@ -26,6 +26,7 @@ type Props = {
|
||||
updatePublishForm: ({}) => void,
|
||||
updateThumbnailParams: ({}) => void,
|
||||
resetThumbnailStatus: () => void,
|
||||
usePublishFormMode: boolean,
|
||||
};
|
||||
|
||||
function SelectThumbnail(props: Props) {
|
||||
@@ -42,9 +43,10 @@ function SelectThumbnail(props: Props) {
|
||||
updateThumbnailParams,
|
||||
thumbnailPath,
|
||||
resetThumbnailStatus,
|
||||
usePublishFormMode,
|
||||
} = props;
|
||||
|
||||
const publishForm = !updateThumbnailParams;
|
||||
const publishForm = usePublishFormMode || !updateThumbnailParams;
|
||||
const thumbnail = publishForm ? props.thumbnail : thumbnailParam;
|
||||
const thumbnailError = publishForm ? props.thumbnailError : props.thumbnailParamError;
|
||||
|
||||
@@ -67,10 +69,10 @@ function SelectThumbnail(props: Props) {
|
||||
|
||||
function handleThumbnailChange(e: SyntheticInputEvent<*>) {
|
||||
const newThumbnail = e.target.value.replace(' ', '');
|
||||
|
||||
if (updateThumbnailParams) {
|
||||
updateThumbnailParams({ thumbnail_url: newThumbnail });
|
||||
} else {
|
||||
}
|
||||
if (updatePublishForm) {
|
||||
updatePublishForm({ thumbnail: newThumbnail });
|
||||
}
|
||||
}
|
||||
@@ -106,16 +108,22 @@ function SelectThumbnail(props: Props) {
|
||||
style={{ display: 'none' }}
|
||||
src={thumbnail}
|
||||
alt={__('Thumbnail Preview')}
|
||||
onError={() =>
|
||||
publishForm
|
||||
? updatePublishForm({ thumbnailError: true })
|
||||
: updateThumbnailParams({ thumbnail_error: Boolean(thumbnail) })
|
||||
}
|
||||
onLoad={() =>
|
||||
publishForm
|
||||
? updatePublishForm({ thumbnailError: !isUrlInput })
|
||||
: updateThumbnailParams({ thumbnail_error: !isUrlInput })
|
||||
}
|
||||
onError={() => {
|
||||
if (updateThumbnailParams) {
|
||||
updateThumbnailParams({ thumbnail_error: Boolean(thumbnail) });
|
||||
}
|
||||
if (publishForm) {
|
||||
updatePublishForm({ thumbnailError: true });
|
||||
}
|
||||
}}
|
||||
onLoad={() => {
|
||||
if (updateThumbnailParams) {
|
||||
updateThumbnailParams({ thumbnail_error: !isUrlInput });
|
||||
}
|
||||
if (publishForm) {
|
||||
updatePublishForm({ thumbnailError: !isUrlInput });
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
@@ -155,7 +163,7 @@ function SelectThumbnail(props: Props) {
|
||||
onFileChosen={(file) =>
|
||||
openModal(MODALS.CONFIRM_THUMBNAIL_UPLOAD, {
|
||||
file,
|
||||
cb: (url) => !publishForm && updateThumbnailParams({ thumbnail_url: url }),
|
||||
cb: (url) => updateThumbnailParams && updateThumbnailParams({ thumbnail_url: url }),
|
||||
})
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -5,6 +5,7 @@ import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import SettingAppearance from './view';
|
||||
|
||||
const select = (state) => ({
|
||||
disableBackground: makeSelectClientSetting(SETTINGS.DISABLE_BACKGROUND)(state),
|
||||
clock24h: makeSelectClientSetting(SETTINGS.CLOCK_24H)(state),
|
||||
searchInLanguage: makeSelectClientSetting(SETTINGS.SEARCH_IN_LANGUAGE)(state),
|
||||
hideBalance: makeSelectClientSetting(SETTINGS.HIDE_BALANCE)(state),
|
||||
|
||||
@@ -12,6 +12,7 @@ import ThemeSelector from 'component/themeSelector';
|
||||
import homepages from 'homepages';
|
||||
|
||||
type Props = {
|
||||
disableBackground: boolean,
|
||||
clock24h: boolean,
|
||||
searchInLanguage: boolean,
|
||||
hideBalance: boolean,
|
||||
@@ -20,7 +21,7 @@ type Props = {
|
||||
};
|
||||
|
||||
export default function SettingAppearance(props: Props) {
|
||||
const { clock24h, searchInLanguage, hideBalance, setClientSetting, setSearchInLanguage } = props;
|
||||
const { clock24h, disableBackground, searchInLanguage, hideBalance, setClientSetting, setSearchInLanguage } = props;
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -63,6 +64,14 @@ export default function SettingAppearance(props: Props) {
|
||||
checked={clock24h}
|
||||
/>
|
||||
</SettingsRow>
|
||||
<SettingsRow title={__('Disable background')}>
|
||||
<FormField
|
||||
type="checkbox"
|
||||
name="background"
|
||||
onChange={() => setClientSetting(SETTINGS.DISABLE_BACKGROUND, !disableBackground)}
|
||||
checked={disableBackground}
|
||||
/>
|
||||
</SettingsRow>
|
||||
<SettingsRow title={__('Hide wallet balance in header')}>
|
||||
<FormField
|
||||
type="checkbox"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doSetDaemonSetting, doGetDaemonStatus, doCleanBlobs } from 'redux/actions/settings';
|
||||
import { selectDaemonStatus, selectDaemonSettings } from 'redux/selectors/settings';
|
||||
import { selectDaemonStatus, selectDaemonSettings, selectSettingDaemonSettings } from 'redux/selectors/settings';
|
||||
import SettingWalletServer from './view';
|
||||
import { selectDiskSpace } from 'redux/selectors/app';
|
||||
|
||||
@@ -8,12 +8,13 @@ const select = (state) => ({
|
||||
daemonSettings: selectDaemonSettings(state),
|
||||
daemonStatus: selectDaemonStatus(state),
|
||||
diskSpace: selectDiskSpace(state),
|
||||
isSetting: selectSettingDaemonSettings(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
getDaemonStatus: () => dispatch(doGetDaemonStatus()),
|
||||
setDaemonSetting: (key, value) => dispatch(doSetDaemonSetting(key, value)),
|
||||
cleanBlobs: () => dispatch(doCleanBlobs()),
|
||||
cleanBlobs: () => dispatch(doCleanBlobs(false)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(SettingWalletServer);
|
||||
@@ -4,89 +4,36 @@ import React from 'react';
|
||||
import { FormField } from 'component/common/form';
|
||||
import Button from 'component/button';
|
||||
import * as DAEMON_SETTINGS from 'constants/daemon_settings';
|
||||
import { formatBytes } from 'util/format-bytes';
|
||||
import { isTrulyANumber } from 'util/number';
|
||||
import I18nMessage from 'component/i18nMessage';
|
||||
const BYTES_PER_MB = 1048576;
|
||||
const ENABLE_AUTOMATIC_HOSTING = false;
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as KEYCODES from 'constants/keycodes';
|
||||
|
||||
type Price = {
|
||||
currency: string,
|
||||
amount: number,
|
||||
};
|
||||
import { convertGbToMbStr, isValidHostingAmount } from 'util/hosting';
|
||||
|
||||
type DaemonStatus = {
|
||||
disk_space: {
|
||||
content_blobs_storage_used_mb: string,
|
||||
published_blobs_storage_used_mb: string,
|
||||
running: true,
|
||||
seed_blobs_storage_used_mb: string,
|
||||
total_used_mb: string,
|
||||
},
|
||||
};
|
||||
|
||||
type SetDaemonSettingArg = boolean | string | number | Price;
|
||||
type SetDaemonSettingArg = boolean | string | number;
|
||||
|
||||
type DaemonSettings = {
|
||||
download_dir: string,
|
||||
share_usage_data: boolean,
|
||||
max_key_fee?: Price,
|
||||
max_connections_per_download?: number,
|
||||
save_files: boolean,
|
||||
save_blobs: boolean,
|
||||
ffmpeg_path: string,
|
||||
};
|
||||
|
||||
type Props = {
|
||||
// --- select ---
|
||||
daemonSettings: DaemonSettings,
|
||||
daemonStatus: DaemonStatus,
|
||||
// --- perform ---
|
||||
setDaemonSetting: (string, ?SetDaemonSettingArg) => void,
|
||||
cleanBlobs: () => string,
|
||||
diskSpace?: DiskSpace,
|
||||
getDaemonStatus: () => void,
|
||||
isSetting: boolean,
|
||||
};
|
||||
|
||||
function SettingDataHosting(props: Props) {
|
||||
const { daemonSettings, daemonStatus, setDaemonSetting, cleanBlobs, diskSpace, getDaemonStatus } = props;
|
||||
const { daemonSettings, setDaemonSetting, cleanBlobs, getDaemonStatus, isSetting } = props;
|
||||
|
||||
const { disk_space: blobSpace } = daemonStatus;
|
||||
const contentSpaceUsed = Number(blobSpace.content_blobs_storage_used_mb);
|
||||
const blobLimitSetting = daemonSettings[DAEMON_SETTINGS.BLOB_STORAGE_LIMIT_MB] || '0';
|
||||
const [contentBlobSpaceLimitGB, setContentBlobSpaceLimit] = React.useState(
|
||||
blobLimitSetting ? String(blobLimitSetting / 1024) : '10'
|
||||
);
|
||||
const [applying, setApplying] = React.useState(false);
|
||||
|
||||
const networkSpaceUsed = Number(blobSpace.seed_blobs_storage_used_mb);
|
||||
const networkLimitSetting = daemonSettings[DAEMON_SETTINGS.NETWORK_STORAGE_LIMIT_MB] || '0';
|
||||
const networkLimitSetting = daemonSettings[DAEMON_SETTINGS.NETWORK_STORAGE_LIMIT_MB] || 0;
|
||||
const [networkBlobSpaceLimitGB, setNetworkBlobSpaceLimit] = React.useState(
|
||||
networkLimitSetting ? String(networkLimitSetting / 1024) : '0'
|
||||
networkLimitSetting ? String(networkLimitSetting / 1024) : 0
|
||||
);
|
||||
|
||||
const [unlimited, setUnlimited] = React.useState(blobLimitSetting === '0');
|
||||
|
||||
React.useEffect(() => {
|
||||
getDaemonStatus();
|
||||
}, []);
|
||||
|
||||
function convertGbToMb(gb) {
|
||||
return Number(gb) * 1024;
|
||||
}
|
||||
|
||||
function handleContentLimitChange(gb) {
|
||||
if (gb === '') {
|
||||
setContentBlobSpaceLimit('');
|
||||
} else if (gb === '0') {
|
||||
setContentBlobSpaceLimit('0.01'); // setting 0 means unlimited.
|
||||
} else {
|
||||
if (isTrulyANumber(Number(gb))) {
|
||||
setContentBlobSpaceLimit(gb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function handleNetworkLimitChange(gb) {
|
||||
if (gb === '') {
|
||||
setNetworkBlobSpaceLimit('');
|
||||
@@ -98,109 +45,68 @@ function SettingDataHosting(props: Props) {
|
||||
}
|
||||
}
|
||||
|
||||
async function handleApply() {
|
||||
setApplying(true);
|
||||
if (unlimited) {
|
||||
await setDaemonSetting(DAEMON_SETTINGS.BLOB_STORAGE_LIMIT_MB, '0');
|
||||
} else {
|
||||
await setDaemonSetting(
|
||||
DAEMON_SETTINGS.BLOB_STORAGE_LIMIT_MB,
|
||||
String(contentBlobSpaceLimitGB === '0.01' ? '1' : convertGbToMb(contentBlobSpaceLimitGB))
|
||||
);
|
||||
function handleKeyDown(e) {
|
||||
if (e.keyCode === KEYCODES.ESCAPE) {
|
||||
e.preventDefault();
|
||||
setNetworkBlobSpaceLimit(String(networkLimitSetting / 1024));
|
||||
} else if (e.keyCode === KEYCODES.ENTER) {
|
||||
e.preventDefault();
|
||||
handleApply();
|
||||
}
|
||||
}
|
||||
|
||||
async function handleApply() {
|
||||
await setDaemonSetting(
|
||||
DAEMON_SETTINGS.NETWORK_STORAGE_LIMIT_MB,
|
||||
String(convertGbToMb(Number(networkBlobSpaceLimitGB)))
|
||||
String(convertGbToMbStr(Number(networkBlobSpaceLimitGB)))
|
||||
);
|
||||
await cleanBlobs();
|
||||
getDaemonStatus();
|
||||
setApplying(false);
|
||||
}
|
||||
|
||||
function validHostingAmount(amountString) {
|
||||
const numberAmount = Number(amountString);
|
||||
return amountString.length && ((numberAmount && String(numberAmount)) || numberAmount === 0);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={'fieldset-section'}>
|
||||
<FormField
|
||||
type="checkbox"
|
||||
name="save_blobs"
|
||||
onChange={() => setDaemonSetting('save_blobs', !daemonSettings.save_blobs)}
|
||||
checked={daemonSettings.save_blobs}
|
||||
label={__('Enable Data Hosting')}
|
||||
helper={
|
||||
diskSpace && (
|
||||
<I18nMessage
|
||||
tokens={{
|
||||
free: formatBytes(Number(diskSpace.free) * 1024, 0),
|
||||
total: formatBytes(Number(diskSpace.total) * 1024, 0),
|
||||
}}
|
||||
>
|
||||
%free% of %total% available
|
||||
</I18nMessage>
|
||||
)
|
||||
name="network_blob_limit_gb"
|
||||
type="number"
|
||||
label={__(`Automatic Hosting (GB)`)}
|
||||
disabled={!daemonSettings.save_blobs || isSetting}
|
||||
onKeyDown={handleKeyDown}
|
||||
inputButton={
|
||||
<>
|
||||
<Button
|
||||
disabled={
|
||||
// disabled if settings are equal or not valid amounts
|
||||
String(networkLimitSetting) === convertGbToMbStr(networkBlobSpaceLimitGB) ||
|
||||
!isValidHostingAmount(String(networkBlobSpaceLimitGB)) ||
|
||||
isSetting ||
|
||||
!daemonSettings.save_blobs
|
||||
}
|
||||
type="button"
|
||||
button="alt"
|
||||
onClick={handleApply}
|
||||
aria-label={__('Apply')}
|
||||
icon={ICONS.COMPLETE}
|
||||
/>
|
||||
<Button
|
||||
disabled={
|
||||
// disabled if settings are equal or not valid amounts
|
||||
String(networkLimitSetting) === convertGbToMbStr(networkBlobSpaceLimitGB) ||
|
||||
!isValidHostingAmount(String(networkBlobSpaceLimitGB)) ||
|
||||
isSetting ||
|
||||
!daemonSettings.save_blobs
|
||||
}
|
||||
type="button"
|
||||
button="alt"
|
||||
onClick={() => setNetworkBlobSpaceLimit(String(networkLimitSetting / 1024))}
|
||||
aria-label={__('Reset')}
|
||||
icon={ICONS.REMOVE}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
{daemonSettings.save_blobs && (
|
||||
<div className={'fieldset-section'}>
|
||||
<FormField
|
||||
type="radio"
|
||||
name="no_hosting_limit"
|
||||
checked={unlimited}
|
||||
label={__('Unlimited View Hosting')}
|
||||
onChange={() => setUnlimited(true)}
|
||||
/>
|
||||
<FormField
|
||||
type="radio"
|
||||
name="set_hosting_limit"
|
||||
checked={!unlimited}
|
||||
onChange={() => setUnlimited(false)}
|
||||
label={__('Choose View Hosting Limit')}
|
||||
/>
|
||||
{!unlimited && (
|
||||
<FormField
|
||||
name="content_blob_limit_gb"
|
||||
type="number"
|
||||
min={0}
|
||||
onWheel={(e) => e.preventDefault()}
|
||||
label={__(`View Hosting Limit (GB)`)}
|
||||
onChange={(e) => handleContentLimitChange(e.target.value)}
|
||||
value={Number(contentBlobSpaceLimitGB) <= Number('0.01') ? '0' : contentBlobSpaceLimitGB}
|
||||
/>
|
||||
)}
|
||||
<div className={'help'}>{`Currently using ${formatBytes(contentSpaceUsed * BYTES_PER_MB)}`}</div>
|
||||
</div>
|
||||
)}
|
||||
{daemonSettings.save_blobs && ENABLE_AUTOMATIC_HOSTING && (
|
||||
<fieldset-section>
|
||||
<FormField
|
||||
name="network_blob_limit_gb"
|
||||
type="number"
|
||||
label={__(`Automatic Hosting (GB)`)}
|
||||
onChange={(e) => handleNetworkLimitChange(e.target.value)}
|
||||
value={networkBlobSpaceLimitGB}
|
||||
/>
|
||||
<div className={'help'}>{`Auto-hosting ${formatBytes(networkSpaceUsed * BYTES_PER_MB)}`}</div>
|
||||
</fieldset-section>
|
||||
)}
|
||||
<div className={'card__actions'}>
|
||||
<Button
|
||||
disabled={
|
||||
(unlimited && blobLimitSetting === '0') ||
|
||||
(!unlimited &&
|
||||
(blobLimitSetting === convertGbToMb(contentBlobSpaceLimitGB) || // &&
|
||||
// networkLimitSetting === convertGbToMb(networkBlobSpaceLimitGB)
|
||||
!validHostingAmount(String(contentBlobSpaceLimitGB)))) ||
|
||||
applying
|
||||
}
|
||||
type="button"
|
||||
button="primary"
|
||||
onClick={handleApply}
|
||||
label={__('Apply')}
|
||||
onChange={(e) => handleNetworkLimitChange(e.target.value)}
|
||||
value={networkBlobSpaceLimitGB}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doSetDaemonSetting, doGetDaemonStatus } from 'redux/actions/settings';
|
||||
import { selectDaemonSettings } from 'redux/selectors/settings';
|
||||
import SettingWalletServer from './view';
|
||||
import { selectDiskSpace } from 'redux/selectors/app';
|
||||
|
||||
const select = (state) => ({
|
||||
daemonSettings: selectDaemonSettings(state),
|
||||
diskSpace: selectDiskSpace(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
getDaemonStatus: () => dispatch(doGetDaemonStatus()),
|
||||
setDaemonSetting: (key, value) => dispatch(doSetDaemonSetting(key, value)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(SettingWalletServer);
|
||||
@@ -0,0 +1,34 @@
|
||||
// @flow
|
||||
|
||||
import React from 'react';
|
||||
import { FormField } from 'component/common/form';
|
||||
|
||||
type SetDaemonSettingArg = boolean | string | number;
|
||||
|
||||
type DaemonSettings = {
|
||||
save_blobs: boolean,
|
||||
};
|
||||
|
||||
type Props = {
|
||||
// --- select ---
|
||||
daemonSettings: DaemonSettings,
|
||||
// --- perform ---
|
||||
setDaemonSetting: (string, ?SetDaemonSettingArg) => void,
|
||||
};
|
||||
|
||||
function SettingDataHosting(props: Props) {
|
||||
const { daemonSettings, setDaemonSetting } = props;
|
||||
|
||||
return (
|
||||
<>
|
||||
<FormField
|
||||
type="checkbox"
|
||||
name="save_blobs"
|
||||
onChange={() => setDaemonSetting('save_blobs', !daemonSettings.save_blobs)}
|
||||
checked={daemonSettings.save_blobs}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default SettingDataHosting;
|
||||
@@ -0,0 +1,25 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doWalletStatus } from 'redux/actions/wallet';
|
||||
import { doClearCache } from 'redux/actions/app';
|
||||
import { doSetDaemonSetting, doClearDaemonSetting, doCleanBlobs } from 'redux/actions/settings';
|
||||
import { selectDaemonSettings, selectDaemonStatus, selectSettingDaemonSettings } from 'redux/selectors/settings';
|
||||
|
||||
import SettingStorage from './view';
|
||||
import { selectDiskSpace } from 'redux/selectors/app';
|
||||
|
||||
const select = (state) => ({
|
||||
daemonSettings: selectDaemonSettings(state),
|
||||
diskSpace: selectDiskSpace(state),
|
||||
daemonStatus: selectDaemonStatus(state),
|
||||
isSetting: selectSettingDaemonSettings(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
setDaemonSetting: (key, value) => dispatch(doSetDaemonSetting(key, value)),
|
||||
clearDaemonSetting: (key) => dispatch(doClearDaemonSetting(key)),
|
||||
clearCache: () => dispatch(doClearCache()),
|
||||
cleanBlobs: () => dispatch(doCleanBlobs()),
|
||||
updateWalletStatus: () => dispatch(doWalletStatus()),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(SettingStorage);
|
||||
@@ -0,0 +1,94 @@
|
||||
// @flow
|
||||
import { SETTINGS_GRP } from 'constants/settings';
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import Card from 'component/common/card';
|
||||
import SettingDataHosting from 'component/settingDataHosting';
|
||||
import SettingViewHosting from 'component/settingViewHosting';
|
||||
import SettingSaveBlobs from 'component/settingSaveBlobs';
|
||||
import SettingsRow from 'component/settingsRow';
|
||||
import AppStorageViz from 'component/appStorageVisualization';
|
||||
import Spinner from 'component/spinner';
|
||||
import classnames from 'classnames';
|
||||
|
||||
type DaemonSettings = {
|
||||
save_blobs: boolean,
|
||||
};
|
||||
|
||||
type Props = {
|
||||
daemonSettings: DaemonSettings,
|
||||
isSetting: boolean,
|
||||
isWelcome?: boolean,
|
||||
cleanBlobs: () => Promise<any>,
|
||||
};
|
||||
|
||||
export default function SettingStorage(props: Props) {
|
||||
const { daemonSettings, isSetting, isWelcome, cleanBlobs } = props;
|
||||
|
||||
const saveBlobs = daemonSettings && daemonSettings.save_blobs;
|
||||
const [isCleaning, setCleaning] = React.useState(false);
|
||||
|
||||
// currently, it seems, blob space statistics are only updated during clean
|
||||
React.useEffect(() => {
|
||||
setCleaning(true);
|
||||
cleanBlobs().then(() => {
|
||||
setCleaning(false);
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="card__title-section">
|
||||
<h2 className={classnames('card__title', { 'section__title--large': isWelcome })}>
|
||||
{isWelcome ? __('Custom Hosting') : __('Hosting')}
|
||||
{(isSetting || isCleaning) && <Spinner type={'small'} />}
|
||||
</h2>
|
||||
</div>
|
||||
<Card
|
||||
id={SETTINGS_GRP.STORAGE}
|
||||
isBodyList
|
||||
body={
|
||||
<>
|
||||
<SettingsRow
|
||||
title={__('Enable Data Hosting')}
|
||||
subtitle={
|
||||
<React.Fragment>
|
||||
{__('Help improve the P2P data network (and make LBRY users happy) by hosting data.')}
|
||||
</React.Fragment>
|
||||
}
|
||||
footer={<AppStorageViz />}
|
||||
>
|
||||
<SettingSaveBlobs />
|
||||
</SettingsRow>
|
||||
<SettingsRow
|
||||
title={__('Viewed Hosting')}
|
||||
multirow
|
||||
disabled={!saveBlobs}
|
||||
subtitle={
|
||||
<React.Fragment>
|
||||
{__("View History Hosting lets you choose how much storage to use hosting content you've consumed.")}{' '}
|
||||
<Button button="link" label={__('Learn more')} href="https://lbry.com/faq/host-content" />
|
||||
</React.Fragment>
|
||||
}
|
||||
>
|
||||
<SettingViewHosting disabled={!saveBlobs} />
|
||||
</SettingsRow>
|
||||
<SettingsRow
|
||||
title={__('Auto Hosting')}
|
||||
multirow
|
||||
disabled={!saveBlobs}
|
||||
subtitle={
|
||||
<React.Fragment>
|
||||
{__('Automatic Hosting downloads a small portion of content active on the network.')}{' '}
|
||||
<Button button="link" label={__('Learn more')} href="https://lbry.com/faq/host-content" />
|
||||
</React.Fragment>
|
||||
}
|
||||
>
|
||||
<SettingDataHosting />
|
||||
</SettingsRow>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -10,7 +10,6 @@ import I18nMessage from 'component/i18nMessage';
|
||||
import SettingAutoLaunch from 'component/settingAutoLaunch';
|
||||
import SettingClosingBehavior from 'component/settingClosingBehavior';
|
||||
import SettingCommentsServer from 'component/settingCommentsServer';
|
||||
import SettingDataHosting from 'component/settingDataHosting';
|
||||
import SettingShareUrl from 'component/settingShareUrl';
|
||||
import SettingsRow from 'component/settingsRow';
|
||||
import SettingWalletServer from 'component/settingWalletServer';
|
||||
@@ -151,24 +150,6 @@ export default function SettingSystem(props: Props) {
|
||||
checked={daemonSettings.save_files}
|
||||
/>
|
||||
</SettingsRow>
|
||||
<SettingsRow
|
||||
title={__('Data Hosting')}
|
||||
multirow
|
||||
subtitle={
|
||||
<React.Fragment>
|
||||
{__('Help improve the P2P data network (and make LBRY happy) by hosting data.')}{' '}
|
||||
{__("View History Hosting lets you choose how much storage to use helping content you've consumed.")}{' '}
|
||||
{/* {__( */}
|
||||
{/* 'Automatic Hosting lets you delegate some amount of storage for the network to automatically download and host.' */}
|
||||
{/* )}{' '} */}
|
||||
{__('Playing videos may exceed your history hosting limit until cleanup runs every 30 minutes.')}
|
||||
<br />
|
||||
<Button button="link" label={__('Learn more')} href="https://lbry.com/faq/host-content" />
|
||||
</React.Fragment>
|
||||
}
|
||||
>
|
||||
<SettingDataHosting />
|
||||
</SettingsRow>
|
||||
<SettingsRow
|
||||
title={__('Share usage and diagnostic data')}
|
||||
subtitle={
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doSetDaemonSetting, doGetDaemonStatus, doCleanBlobs } from 'redux/actions/settings';
|
||||
import { selectViewHostingLimit, selectViewBlobSpace, selectSettingDaemonSettings } from 'redux/selectors/settings';
|
||||
import SettingViewHosting from './view';
|
||||
import { selectDiskSpace } from 'redux/selectors/app';
|
||||
|
||||
const select = (state) => ({
|
||||
viewHostingLimit: selectViewHostingLimit(state),
|
||||
viewBlobSpace: selectViewBlobSpace(state),
|
||||
diskSpace: selectDiskSpace(state),
|
||||
isSetting: selectSettingDaemonSettings(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
getDaemonStatus: () => dispatch(doGetDaemonStatus()),
|
||||
setDaemonSetting: (key, value) => dispatch(doSetDaemonSetting(key, value)),
|
||||
cleanBlobs: () => dispatch(doCleanBlobs(false)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(SettingViewHosting);
|
||||
@@ -0,0 +1,182 @@
|
||||
// @flow
|
||||
|
||||
import React from 'react';
|
||||
import { FormField } from 'component/common/form';
|
||||
import Button from 'component/button';
|
||||
import * as DAEMON_SETTINGS from 'constants/daemon_settings';
|
||||
import { isTrulyANumber } from 'util/number';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as KEYCODES from 'constants/keycodes';
|
||||
import { convertGbToMbStr, isValidHostingAmount } from 'util/hosting';
|
||||
|
||||
type SetDaemonSettingArg = boolean | string | number;
|
||||
|
||||
type Props = {
|
||||
// --- select ---
|
||||
viewBlobSpace: number,
|
||||
viewHostingLimit: number,
|
||||
disabled?: boolean,
|
||||
isSetting: boolean,
|
||||
// --- perform ---
|
||||
setDaemonSetting: (string, ?SetDaemonSettingArg) => void,
|
||||
cleanBlobs: () => string,
|
||||
getDaemonStatus: () => void,
|
||||
diskSpace: DiskSpace,
|
||||
};
|
||||
|
||||
const TWENTY_PERCENT = 0.2;
|
||||
const TEN_PERCENT = 0.1;
|
||||
const MINIMUM_VIEW_SETTING = '0.01';
|
||||
|
||||
function SettingViewHosting(props: Props) {
|
||||
const {
|
||||
diskSpace,
|
||||
viewHostingLimit,
|
||||
viewBlobSpace,
|
||||
setDaemonSetting,
|
||||
cleanBlobs,
|
||||
getDaemonStatus,
|
||||
disabled,
|
||||
isSetting,
|
||||
} = props;
|
||||
|
||||
// best effort to recommend a hosting amount default for the user
|
||||
const totalMB = diskSpace && Math.floor(diskSpace.total / 1024);
|
||||
const freeMB = diskSpace && Math.floor(diskSpace.free / 1024);
|
||||
const getGB = (val) => (Number(val) / 1024).toFixed(2);
|
||||
const recommendedSpace =
|
||||
freeMB > totalMB * TWENTY_PERCENT // plenty of space?
|
||||
? Math.ceil(Number(getGB(totalMB * TEN_PERCENT))) // 10% of total
|
||||
: Math.ceil(Number(getGB(viewBlobSpace))); // current amount to avoid deleting
|
||||
// daemon settings come in as 'number', but we manage them as 'String'.
|
||||
const [contentBlobSpaceLimitGB, setContentBlobSpaceLimit] = React.useState(
|
||||
viewHostingLimit === 0 ? String(recommendedSpace) : String(viewHostingLimit / 1024)
|
||||
);
|
||||
|
||||
const [unlimited, setUnlimited] = React.useState(viewHostingLimit === 0);
|
||||
|
||||
function handleContentLimitChange(gb) {
|
||||
if (gb === '') {
|
||||
setContentBlobSpaceLimit('');
|
||||
} else if (gb === '0') {
|
||||
setContentBlobSpaceLimit(MINIMUM_VIEW_SETTING); // setting 0 means unlimited.
|
||||
} else {
|
||||
if (isTrulyANumber(Number(gb))) {
|
||||
setContentBlobSpaceLimit(gb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getContentLimitValue() {
|
||||
if (contentBlobSpaceLimitGB === '') {
|
||||
return '';
|
||||
} else if (Number(contentBlobSpaceLimitGB) <= Number(MINIMUM_VIEW_SETTING)) {
|
||||
return '0';
|
||||
} else {
|
||||
return contentBlobSpaceLimitGB;
|
||||
}
|
||||
}
|
||||
|
||||
async function handleApply() {
|
||||
if (unlimited) {
|
||||
await setDaemonSetting(DAEMON_SETTINGS.BLOB_STORAGE_LIMIT_MB, '0');
|
||||
} else {
|
||||
await setDaemonSetting(
|
||||
DAEMON_SETTINGS.BLOB_STORAGE_LIMIT_MB,
|
||||
contentBlobSpaceLimitGB === MINIMUM_VIEW_SETTING ? '1' : convertGbToMbStr(contentBlobSpaceLimitGB)
|
||||
);
|
||||
}
|
||||
await cleanBlobs();
|
||||
getDaemonStatus();
|
||||
}
|
||||
|
||||
function handleKeyDown(e) {
|
||||
if (e.keyCode === KEYCODES.ESCAPE) {
|
||||
e.preventDefault();
|
||||
setContentBlobSpaceLimit(String(viewHostingLimit / 1024));
|
||||
} else if (e.keyCode === KEYCODES.ENTER) {
|
||||
e.preventDefault();
|
||||
handleApply();
|
||||
}
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
// basically handle setUnlimited
|
||||
if (unlimited && viewHostingLimit !== 0) {
|
||||
handleApply();
|
||||
}
|
||||
}, [unlimited, viewHostingLimit]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={'fieldset-section'}>
|
||||
<FormField
|
||||
type="checkbox"
|
||||
name="hosting_limit"
|
||||
checked={unlimited}
|
||||
disabled={disabled || isSetting}
|
||||
label={__('Unlimited View Hosting')}
|
||||
onChange={() => setUnlimited(!unlimited)}
|
||||
/>
|
||||
<FormField
|
||||
name="content_blob_limit_gb"
|
||||
type="number"
|
||||
min={0}
|
||||
onKeyDown={handleKeyDown}
|
||||
inputButton={
|
||||
<>
|
||||
<Button
|
||||
disabled={
|
||||
// disabled if settings are equal or not valid amounts
|
||||
(viewHostingLimit === 1 && contentBlobSpaceLimitGB <= MINIMUM_VIEW_SETTING) ||
|
||||
(unlimited && viewHostingLimit === 0) ||
|
||||
(!unlimited &&
|
||||
(String(viewHostingLimit) === convertGbToMbStr(contentBlobSpaceLimitGB) ||
|
||||
!isValidHostingAmount(String(contentBlobSpaceLimitGB)))) ||
|
||||
(!unlimited &&
|
||||
String(viewHostingLimit) ===
|
||||
convertGbToMbStr(
|
||||
contentBlobSpaceLimitGB || !isValidHostingAmount(String(contentBlobSpaceLimitGB))
|
||||
)) ||
|
||||
isSetting ||
|
||||
disabled
|
||||
}
|
||||
type="button"
|
||||
button="alt"
|
||||
onClick={handleApply}
|
||||
aria-label={__('Apply')}
|
||||
icon={ICONS.COMPLETE}
|
||||
/>
|
||||
<Button
|
||||
disabled={
|
||||
// disabled if settings are equal or not valid amounts
|
||||
(viewHostingLimit === 1 && contentBlobSpaceLimitGB <= MINIMUM_VIEW_SETTING) ||
|
||||
(unlimited && viewHostingLimit === 0) ||
|
||||
(!unlimited &&
|
||||
String(viewHostingLimit) ===
|
||||
convertGbToMbStr(
|
||||
contentBlobSpaceLimitGB || !isValidHostingAmount(String(contentBlobSpaceLimitGB))
|
||||
)) ||
|
||||
isSetting ||
|
||||
disabled
|
||||
}
|
||||
type="button"
|
||||
button="alt"
|
||||
onClick={() => setContentBlobSpaceLimit(String(viewHostingLimit / 1024))}
|
||||
aria-label={__('Reset')}
|
||||
icon={ICONS.REMOVE}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
disabled={isSetting || disabled || unlimited}
|
||||
onWheel={(e) => e.preventDefault()}
|
||||
label={__(`View Hosting Limit (GB)`)}
|
||||
onChange={(e) => handleContentLimitChange(e.target.value)}
|
||||
value={getContentLimitValue()}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default SettingViewHosting;
|
||||
@@ -1,5 +1,9 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { selectIsWalletReconnecting } from 'redux/selectors/wallet';
|
||||
import {
|
||||
selectIsWalletReconnecting,
|
||||
selectWalletRollbackToDefault,
|
||||
selectWalletConnectingToDefault,
|
||||
} from 'redux/selectors/wallet';
|
||||
import * as DAEMON_SETTINGS from 'constants/daemon_settings';
|
||||
import {
|
||||
doSetDaemonSetting,
|
||||
@@ -15,6 +19,8 @@ const select = (state) => ({
|
||||
customWalletServers: selectSavedWalletServers(state),
|
||||
hasWalletServerPrefs: selectHasWalletServerPrefs(state),
|
||||
walletReconnecting: selectIsWalletReconnecting(state),
|
||||
walletRollbackToDefault: selectWalletRollbackToDefault(state),
|
||||
walletReconnectingToDefault: selectWalletConnectingToDefault(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
|
||||
@@ -30,6 +30,8 @@ type Props = {
|
||||
hasWalletServerPrefs: boolean,
|
||||
daemonStatus: DaemonStatus,
|
||||
walletReconnecting: boolean,
|
||||
walletRollbackToDefault: boolean,
|
||||
walletReconnectingToDefault: boolean,
|
||||
};
|
||||
|
||||
function SettingWalletServer(props: Props) {
|
||||
@@ -42,9 +44,12 @@ function SettingWalletServer(props: Props) {
|
||||
customWalletServers,
|
||||
hasWalletServerPrefs,
|
||||
walletReconnecting,
|
||||
walletRollbackToDefault,
|
||||
walletReconnectingToDefault,
|
||||
} = props;
|
||||
|
||||
const [advancedMode, setAdvancedMode] = useState(false);
|
||||
const [usingCustomServer, setUsingCustomServer] = useState(false);
|
||||
const [showCustomServers, setShowCustomServers] = useState(false);
|
||||
|
||||
const walletStatus = daemonStatus && daemonStatus.wallet;
|
||||
const activeWalletServers: ServerStatus = (walletStatus && walletStatus.servers) || [];
|
||||
@@ -73,7 +78,7 @@ function SettingWalletServer(props: Props) {
|
||||
|
||||
useEffect(() => {
|
||||
if (hasWalletServerPrefs) {
|
||||
setAdvancedMode(true);
|
||||
setUsingCustomServer(true);
|
||||
}
|
||||
}, []);
|
||||
|
||||
@@ -84,8 +89,20 @@ function SettingWalletServer(props: Props) {
|
||||
return () => clearInterval(interval);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (walletRollbackToDefault) {
|
||||
doClear();
|
||||
}
|
||||
}, [walletRollbackToDefault]);
|
||||
|
||||
useEffect(() => {
|
||||
if (usingCustomServer) {
|
||||
setShowCustomServers(true);
|
||||
}
|
||||
}, [usingCustomServer]);
|
||||
|
||||
function doClear() {
|
||||
setAdvancedMode(false);
|
||||
setUsingCustomServer(false);
|
||||
clearWalletServers();
|
||||
}
|
||||
|
||||
@@ -112,7 +129,7 @@ function SettingWalletServer(props: Props) {
|
||||
<FormField
|
||||
type="radio"
|
||||
name="default_wallet_servers"
|
||||
checked={!advancedMode}
|
||||
checked={!usingCustomServer}
|
||||
label={__('Use official LBRY wallet servers')}
|
||||
onChange={(e) => {
|
||||
if (e.target.checked) {
|
||||
@@ -123,9 +140,9 @@ function SettingWalletServer(props: Props) {
|
||||
<FormField
|
||||
type="radio"
|
||||
name="custom_wallet_servers"
|
||||
checked={advancedMode}
|
||||
checked={usingCustomServer}
|
||||
onChange={(e) => {
|
||||
setAdvancedMode(e.target.checked);
|
||||
setUsingCustomServer(e.target.checked);
|
||||
if (e.target.checked && customWalletServers.length) {
|
||||
setCustomWalletServers(stringifyServerParam(customWalletServers));
|
||||
}
|
||||
@@ -133,7 +150,7 @@ function SettingWalletServer(props: Props) {
|
||||
label={__('Use custom wallet servers')}
|
||||
/>
|
||||
|
||||
{advancedMode && (
|
||||
{showCustomServers && (
|
||||
<div>
|
||||
{serverConfig &&
|
||||
serverConfig.map((entry, index) => {
|
||||
@@ -151,7 +168,11 @@ function SettingWalletServer(props: Props) {
|
||||
{host}:{port}
|
||||
</h3>
|
||||
<span className="help">
|
||||
{available ? __('Connected') : walletReconnecting ? __('Connecting...') : __('Not connected')}
|
||||
{available
|
||||
? __('Connected')
|
||||
: walletReconnecting && !walletReconnectingToDefault
|
||||
? __('Connecting...')
|
||||
: __('Not connected')}
|
||||
</span>
|
||||
<Button
|
||||
button="close"
|
||||
|
||||
@@ -9,10 +9,11 @@ type Props = {
|
||||
useVerticalSeparator?: boolean, // Show a separator line between Label and Value. Useful when there are multiple Values.
|
||||
disabled?: boolean,
|
||||
children?: React$Node,
|
||||
footer?: React$Node,
|
||||
};
|
||||
|
||||
export default function SettingsRow(props: Props) {
|
||||
const { title, subtitle, multirow, useVerticalSeparator, disabled, children } = props;
|
||||
const { title, subtitle, multirow, useVerticalSeparator, disabled, children, footer } = props;
|
||||
return (
|
||||
<div
|
||||
className={classnames('card__main-actions settings__row', {
|
||||
@@ -23,6 +24,7 @@ export default function SettingsRow(props: Props) {
|
||||
<div className="settings__row--title">
|
||||
<p>{title}</p>
|
||||
{subtitle && <p className="settings__row--subtitle">{subtitle}</p>}
|
||||
{footer && footer}
|
||||
</div>
|
||||
<div
|
||||
className={classnames('settings__row--value', {
|
||||
|
||||
@@ -7,9 +7,7 @@ import React from 'react';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import classnames from 'classnames';
|
||||
import Button from 'component/button';
|
||||
// @if TARGET='app'
|
||||
import { IS_MAC } from 'component/app/view';
|
||||
// @endif
|
||||
import { useIsMediumScreen } from 'effects/use-screensize';
|
||||
|
||||
type SideNavLink = {
|
||||
@@ -43,6 +41,11 @@ const SIDE_LINKS: Array<SideNavLink> = [
|
||||
section: SETTINGS_GRP.SYSTEM,
|
||||
icon: ICONS.SETTINGS,
|
||||
},
|
||||
{
|
||||
title: 'Content Hosting',
|
||||
section: SETTINGS_GRP.STORAGE,
|
||||
icon: ICONS.PUBLISH,
|
||||
},
|
||||
];
|
||||
|
||||
export default function SettingsSideNavigation() {
|
||||
|
||||
@@ -6,13 +6,15 @@ import * as KEYCODES from 'constants/keycodes';
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import classnames from 'classnames';
|
||||
import Icon from 'component/common/icon';
|
||||
import NotificationBubble from 'component/notificationBubble';
|
||||
import DebouncedInput from 'component/common/debounced-input';
|
||||
import I18nMessage from 'component/i18nMessage';
|
||||
import ChannelThumbnail from 'component/channelThumbnail';
|
||||
import { useIsMobile, isTouch } from 'effects/use-screensize';
|
||||
import { IS_MAC } from 'component/app/view';
|
||||
import { useHistory } from 'react-router';
|
||||
import { ENABLE_UI_NOTIFICATIONS } from 'config';
|
||||
import { DOMAIN, ENABLE_UI_NOTIFICATIONS } from 'config';
|
||||
|
||||
const FOLLOWED_ITEM_INITIAL_LIMIT = 10;
|
||||
const touch = isTouch();
|
||||
@@ -182,6 +184,7 @@ function SideNavigation(props: Props) {
|
||||
];
|
||||
|
||||
const notificationsEnabled = ENABLE_UI_NOTIFICATIONS || (user && user.experimental_ui);
|
||||
const isAuthenticated = Boolean(email);
|
||||
|
||||
const [pulseLibrary, setPulseLibrary] = React.useState(false);
|
||||
const [expandSubscriptions, setExpandSubscriptions] = React.useState(false);
|
||||
@@ -354,6 +357,23 @@ function SideNavigation(props: Props) {
|
||||
return () => window.removeEventListener('keydown', handleKeydown);
|
||||
}, [sidebarOpen, setSidebarOpen, isAbsolute]);
|
||||
|
||||
const unAuthNudge =
|
||||
DOMAIN === 'lbry.tv' ? null : (
|
||||
<div className="navigation__auth-nudge">
|
||||
<span>
|
||||
<I18nMessage tokens={{ lbc: <Icon icon={ICONS.LBC} /> }}>
|
||||
Sign up to earn %lbc% for you and your favorite creators.
|
||||
</I18nMessage>
|
||||
</span>
|
||||
<Button
|
||||
button="secondary"
|
||||
label={__('Sign Up')}
|
||||
navigate={`/$/${PAGES.AUTH}?src=sidenav_nudge`}
|
||||
disabled={user === null}
|
||||
/>{' '}
|
||||
</div>
|
||||
);
|
||||
|
||||
const helpLinks = (
|
||||
<ul className="navigation__tertiary navigation-links--small">
|
||||
<li className="navigation-link">
|
||||
@@ -417,6 +437,7 @@ function SideNavigation(props: Props) {
|
||||
|
||||
{getSubscriptionSection()}
|
||||
{getFollowedTagsSection()}
|
||||
{!isAuthenticated && sidebarOpen && unAuthNudge}
|
||||
</div>
|
||||
)}
|
||||
{(!canDisposeMenu || sidebarOpen) && shouldRenderLargeMenu && helpLinks}
|
||||
|
||||
@@ -241,8 +241,12 @@ export default class SplashScreen extends React.PureComponent<Props, State> {
|
||||
|
||||
return (
|
||||
<div className="splash">
|
||||
<h1 className="splash__title">LBRY</h1>
|
||||
<div className="splash__details">{details}</div>
|
||||
{!error && (
|
||||
<>
|
||||
<h1 className="splash__title">LBRY</h1>
|
||||
<div className="splash__details">{details}</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{!animationHidden && !error && (
|
||||
<css-doodle class="doodle">
|
||||
@@ -290,7 +294,7 @@ export default class SplashScreen extends React.PureComponent<Props, State> {
|
||||
)}
|
||||
{error && (
|
||||
<Card
|
||||
title={__('Error starting up')}
|
||||
title={<h1 className="splash__error-title">{__('Error starting up')}</h1>}
|
||||
subtitle={
|
||||
<React.Fragment>
|
||||
<p>
|
||||
|
||||
@@ -5,6 +5,7 @@ import { parseURI } from 'util/lbryURI';
|
||||
import Button from 'component/button';
|
||||
import useHover from 'effects/use-hover';
|
||||
import { useIsMobile } from 'effects/use-screensize';
|
||||
import { ENABLE_UI_NOTIFICATIONS } from 'config';
|
||||
|
||||
type SubscriptionArgs = {
|
||||
channelName: string,
|
||||
@@ -33,6 +34,7 @@ export default function SubscribeButton(props: Props) {
|
||||
doToast,
|
||||
shrinkOnMobile = false,
|
||||
notificationsDisabled,
|
||||
user,
|
||||
uri,
|
||||
} = props;
|
||||
|
||||
@@ -40,6 +42,7 @@ export default function SubscribeButton(props: Props) {
|
||||
const isMobile = useIsMobile();
|
||||
let isHovering = useHover(buttonRef);
|
||||
isHovering = isMobile ? true : isHovering;
|
||||
const uiNotificationsEnabled = (user && user.experimental_ui) || ENABLE_UI_NOTIFICATIONS;
|
||||
|
||||
const { channelName: rawChannelName } = parseURI(uri);
|
||||
|
||||
@@ -116,7 +119,7 @@ export default function SubscribeButton(props: Props) {
|
||||
);
|
||||
}}
|
||||
/>
|
||||
{isSubscribed && (
|
||||
{isSubscribed && uiNotificationsEnabled && (
|
||||
<>
|
||||
<Button
|
||||
button="alt"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// @flow
|
||||
import * as PAGES from 'constants/pages';
|
||||
import { DOMAIN } from 'config';
|
||||
import React, { useState } from 'react';
|
||||
import { FormField, Form } from 'component/common/form';
|
||||
import Button from 'component/button';
|
||||
@@ -94,7 +95,7 @@ function UserEmailNew(props: Props) {
|
||||
title={__('Cloud Connect')}
|
||||
subtitle={__('Connect your wallet to Odysee')}
|
||||
actions={
|
||||
<div>
|
||||
<div className={classnames({ 'card--disabled': DOMAIN === 'lbry.tv' && IS_WEB })}>
|
||||
<Form onSubmit={handleSubmit} className="section">
|
||||
<FormField
|
||||
autoFocus
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimForUri, selectThumbnailForUri } from 'redux/selectors/claims';
|
||||
import {
|
||||
makeSelectNextUrlForCollectionAndUrl,
|
||||
makeSelectPreviousUrlForCollectionAndUrl,
|
||||
makeSelectPrevPlayableUrlFromCollectionAndUrl,
|
||||
makeSelectNextPlayableUrlFromCollectionAndUrl,
|
||||
} from 'redux/selectors/collections';
|
||||
import * as SETTINGS from 'constants/settings';
|
||||
import * as COLLECTIONS_CONSTS from 'constants/collections';
|
||||
@@ -38,8 +38,8 @@ const select = (state, props) => {
|
||||
let nextRecommendedUri;
|
||||
let previousListUri;
|
||||
if (collectionId) {
|
||||
nextRecommendedUri = makeSelectNextUrlForCollectionAndUrl(collectionId, uri)(state);
|
||||
previousListUri = makeSelectPreviousUrlForCollectionAndUrl(collectionId, uri)(state);
|
||||
nextRecommendedUri = makeSelectNextPlayableUrlFromCollectionAndUrl(collectionId, uri)(state);
|
||||
previousListUri = makeSelectPrevPlayableUrlFromCollectionAndUrl(collectionId, uri)(state);
|
||||
} else {
|
||||
const recommendedContent = selectRecommendedContentForUri(state, uri);
|
||||
nextRecommendedUri = recommendedContent && recommendedContent[0];
|
||||
|
||||
@@ -9,7 +9,7 @@ import HelpLink from 'component/common/help-link';
|
||||
import Card from 'component/common/card';
|
||||
import LbcSymbol from 'component/common/lbc-symbol';
|
||||
import I18nMessage from 'component/i18nMessage';
|
||||
import { formatNumberWithCommas } from 'util/number';
|
||||
import { formatCredits } from 'util/format-credits';
|
||||
|
||||
type Props = {
|
||||
balance: number,
|
||||
@@ -64,7 +64,7 @@ const WalletBalance = (props: Props) => {
|
||||
|
||||
return (
|
||||
<Card
|
||||
title={<LbcSymbol postfix={formatNumberWithCommas(totalBalance)} isTitle />}
|
||||
title={<LbcSymbol postfix={formatCredits(totalBalance, 8)} isTitle />}
|
||||
subtitle={
|
||||
totalLocked > 0 ? (
|
||||
<I18nMessage tokens={{ lbc: <LbcSymbol /> }}>
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
import { connect } from 'react-redux';
|
||||
// import { makeSelectCoverForUri, makeSelectAvatarForUri } from 'redux/selectors/claims';
|
||||
import Wallpaper from './view';
|
||||
import * as SETTINGS from 'constants/settings';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
|
||||
/*
|
||||
const select = (state, props) => {
|
||||
if (props.uri && (props.uri.indexOf('@') !== -1 || props.uri.indexOf('#') !== -1)) {
|
||||
return {
|
||||
cover: makeSelectCoverForUri(props.uri)(state),
|
||||
avatar: makeSelectAvatarForUri(props.uri)(state),
|
||||
};
|
||||
} else return {};
|
||||
};
|
||||
*/
|
||||
const select = (state) => ({
|
||||
disableBackground: makeSelectClientSetting(SETTINGS.DISABLE_BACKGROUND)(state),
|
||||
});
|
||||
|
||||
export default connect()(Wallpaper);
|
||||
const perform = {};
|
||||
|
||||
export default connect(select, perform)(Wallpaper);
|
||||
@@ -8,10 +8,11 @@ type Props = {
|
||||
// cover: ?string,
|
||||
// avatar: ?string,
|
||||
reset: ?boolean,
|
||||
disableBackground: ?boolean,
|
||||
};
|
||||
|
||||
const Wallpaper = (props: Props) => {
|
||||
// const { cover, avatar } = props;
|
||||
const { disableBackground } = props;
|
||||
|
||||
/*
|
||||
if (avatar) {
|
||||
@@ -227,12 +228,13 @@ const Wallpaper = (props: Props) => {
|
||||
}}
|
||||
/>
|
||||
*/
|
||||
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
className={'background-image'}
|
||||
style={{
|
||||
backgroundImage: `url(${freeezepeach})`,
|
||||
backgroundImage: disableBackground ? `none` : `url(${freeezepeach})`,
|
||||
}}
|
||||
/>
|
||||
<div className={'theme'} />
|
||||
|
||||
@@ -45,6 +45,8 @@ export const DOWNLOAD_UPGRADE = 'DOWNLOAD_UPGRADE';
|
||||
export const UPGRADE_DOWNLOAD_STARTED = 'UPGRADE_DOWNLOAD_STARTED';
|
||||
export const UPGRADE_DOWNLOAD_COMPLETED = 'UPGRADE_DOWNLOAD_COMPLETED';
|
||||
export const UPGRADE_DOWNLOAD_PROGRESSED = 'UPGRADE_DOWNLOAD_PROGRESSED';
|
||||
export const UPGRADE_INIT_INSTALL = 'UPGRADE_INIT_INSTALL';
|
||||
export const UPGRADE_INSTALL_ERROR = 'UPGRADE_INSTALL_ERROR';
|
||||
export const CHECK_UPGRADE_AVAILABLE = 'CHECK_UPGRADE_AVAILABLE';
|
||||
export const CHECK_UPGRADE_START = 'CHECK_UPGRADE_START';
|
||||
export const CHECK_UPGRADE_SUCCESS = 'CHECK_UPGRADE_SUCCESS';
|
||||
@@ -55,7 +57,10 @@ export const UPDATE_REMOTE_VERSION = 'UPDATE_REMOTE_VERSION';
|
||||
export const SKIP_UPGRADE = 'SKIP_UPGRADE';
|
||||
export const START_UPGRADE = 'START_UPGRADE';
|
||||
export const AUTO_UPDATE_DECLINED = 'AUTO_UPDATE_DECLINED';
|
||||
export const AUTO_UPDATE_RESET = 'AUTO_UPDATE_RESET';
|
||||
export const AUTO_UPDATE_FAILED = 'AUTO_UPDATE_FAILED';
|
||||
export const AUTO_UPDATE_DOWNLOADED = 'AUTO_UPDATE_DOWNLOADED';
|
||||
export const AUTO_UPDATE_DOWNLOADING = 'AUTO_UPDATE_DOWNLOADING';
|
||||
export const CLEAR_UPGRADE_TIMER = 'CLEAR_UPGRADE_TIMER';
|
||||
|
||||
// Wallet
|
||||
@@ -103,6 +108,7 @@ export const WALLET_STATUS_START = 'WALLET_STATUS_START';
|
||||
export const WALLET_STATUS_COMPLETED = 'WALLET_STATUS_COMPLETED';
|
||||
export const WALLET_RESTART = 'WALLET_RESTART';
|
||||
export const WALLET_RESTART_COMPLETED = 'WALLET_RESTART_COMPLETED';
|
||||
export const WALLET_ROLLBACK_DEFAULT = 'WALLET_ROLLBACK_DEFAULT';
|
||||
export const SET_TRANSACTION_LIST_FILTER = 'SET_TRANSACTION_LIST_FILTER';
|
||||
export const UPDATE_CURRENT_HEIGHT = 'UPDATE_CURRENT_HEIGHT';
|
||||
export const SET_DRAFT_TRANSACTION_AMOUNT = 'SET_DRAFT_TRANSACTION_AMOUNT';
|
||||
@@ -248,6 +254,7 @@ export const SYNC_CLIENT_SETTINGS = 'SYNC_CLIENT_SETTINGS';
|
||||
export const DAEMON_STATUS_RECEIVED = 'DAEMON_STATUS_RECEIVED';
|
||||
export const SHARED_PREFERENCE_SET = 'SHARED_PREFERENCE_SET';
|
||||
export const SAVE_CUSTOM_WALLET_SERVERS = 'SAVE_CUSTOM_WALLET_SERVERS';
|
||||
export const SETTING_DAEMON_SETTINGS = 'SETTING_DAEMON_SETTINGS';
|
||||
|
||||
// User
|
||||
export const AUTHENTICATION_STARTED = 'AUTHENTICATION_STARTED';
|
||||
@@ -324,11 +331,10 @@ export const HAS_FETCHED_SUBSCRIPTIONS = 'HAS_FETCHED_SUBSCRIPTIONS';
|
||||
export const CHECK_SUBSCRIPTION_STARTED = 'CHECK_SUBSCRIPTION_STARTED';
|
||||
export const CHECK_SUBSCRIPTION_COMPLETED = 'CHECK_SUBSCRIPTION_COMPLETED';
|
||||
export const CHECK_SUBSCRIPTIONS_SUBSCRIBE = 'CHECK_SUBSCRIPTIONS_SUBSCRIBE';
|
||||
export const FETCH_SUBSCRIPTIONS_START = 'FETCH_SUBSCRIPTIONS_START';
|
||||
export const FETCH_SUBSCRIPTIONS_FAIL = 'FETCH_SUBSCRIPTIONS_FAIL';
|
||||
export const FETCH_SUBSCRIPTIONS_SUCCESS = 'FETCH_SUBSCRIPTIONS_SUCCESS';
|
||||
export const SET_VIEW_MODE = 'SET_VIEW_MODE';
|
||||
export const SUBSCRIPTION_DOWNLOAD_ADD = 'SUBSCRIPTION_DOWNLOAD_ADD';
|
||||
export const SUBSCRIPTION_DOWNLOAD_REMOVE = 'SUBSCRIPTION_DOWNLOAD_REMOVE';
|
||||
export const SUBSCRIPTION_RELEASE_UPDATE = 'SUBSCRIPTION_RELEASE_UPDATE';
|
||||
export const SUBSCRIPTION_DOWNLOAD_TOGGLE = 'SUBSCRIPTION_DOWNLOAD_TOGGLE';
|
||||
|
||||
// Publishing
|
||||
export const CLEAR_PUBLISH = 'CLEAR_PUBLISH';
|
||||
@@ -345,23 +351,19 @@ export const MEDIA_PLAY = 'MEDIA_PLAY';
|
||||
export const MEDIA_PAUSE = 'MEDIA_PAUSE';
|
||||
|
||||
// Notifications
|
||||
export const LBRYIO_NOTIFICATION_LIST_STARTED = 'NOTIFICATION_LIST_STARTED';
|
||||
export const LBRYIO_NOTIFICATION_LIST_COMPLETED = 'NOTIFICATION_LIST_COMPLETED';
|
||||
export const LBRYIO_NOTIFICATION_LIST_FAILED = 'NOTIFICATION_LIST_FAILED';
|
||||
export const LBRYIO_NOTIFICATION_CATEGORIES_COMPLETED = 'LBRYIO_NOTIFICATION_CATEGORIES_COMPLETED';
|
||||
export const LBRYIO_NOTIFICATION_READ_STARTED = 'LBRYIO_NOTIFICATION_READ_STARTED';
|
||||
export const LBRYIO_NOTIFICATION_READ_COMPLETED = 'LBRYIO_NOTIFICATION_READ_COMPLETED';
|
||||
export const LBRYIO_NOTIFICATION_READ_FAILED = 'LBRYIO_NOTIFICATION_READ_FAILED';
|
||||
export const LBRYIO_NOTIFICATION_SEEN_STARTED = 'LBRYIO_NOTIFICATION_SEEN_STARTED';
|
||||
export const LBRYIO_NOTIFICATION_SEEN_COMPLETED = 'LBRYIO_NOTIFICATION_SEEN_COMPLETED';
|
||||
export const LBRYIO_NOTIFICATION_SEEN_FAILED = 'LBRYIO_NOTIFICATION_SEEN_FAILED';
|
||||
export const LBRYIO_NOTIFICATION_DELETE_STARTED = 'LBRYIO_NOTIFICATION_DELETE_STARTED';
|
||||
export const LBRYIO_NOTIFICATION_DELETE_COMPLETED = 'LBRYIO_NOTIFICATION_DELETE_COMPLETED';
|
||||
export const LBRYIO_NOTIFICATION_DELETE_FAILED = 'LBRYIO_NOTIFICATION_DELETE_FAILED';
|
||||
export const LOCAL_NOTIFICATION_DELETE = 'LBRYIO_NOTIFICATION_DELETE';
|
||||
export const LOCAL_NOTIFICATION_ADD = 'LBRYIO_NOTIFICATION_ADD';
|
||||
export const LOCAL_NOTIFICATION_SEEN = 'LBRYIO_NOTIFICATION_SEEN';
|
||||
|
||||
export const NOTIFICATION_LIST_STARTED = 'NOTIFICATION_LIST_STARTED';
|
||||
export const NOTIFICATION_LIST_COMPLETED = 'NOTIFICATION_LIST_COMPLETED';
|
||||
export const NOTIFICATION_LIST_FAILED = 'NOTIFICATION_LIST_FAILED';
|
||||
export const NOTIFICATION_CATEGORIES_COMPLETED = 'NOTIFICATION_CATEGORIES_COMPLETED';
|
||||
export const NOTIFICATION_READ_STARTED = 'NOTIFICATION_READ_STARTED';
|
||||
export const NOTIFICATION_READ_COMPLETED = 'NOTIFICATION_READ_COMPLETED';
|
||||
export const NOTIFICATION_READ_FAILED = 'NOTIFICATION_READ_FAILED';
|
||||
export const NOTIFICATION_SEEN_STARTED = 'NOTIFICATION_SEEN_STARTED';
|
||||
export const NOTIFICATION_SEEN_COMPLETED = 'NOTIFICATION_SEEN_COMPLETED';
|
||||
export const NOTIFICATION_SEEN_FAILED = 'NOTIFICATION_SEEN_FAILED';
|
||||
export const NOTIFICATION_DELETE_STARTED = 'NOTIFICATION_DELETE_STARTED';
|
||||
export const NOTIFICATION_DELETE_COMPLETED = 'NOTIFICATION_DELETE_COMPLETED';
|
||||
export const NOTIFICATION_DELETE_FAILED = 'NOTIFICATION_DELETE_FAILED';
|
||||
export const CREATE_TOAST = 'CREATE_TOAST';
|
||||
export const DISMISS_TOAST = 'DISMISS_TOAST';
|
||||
export const CREATE_ERROR = 'CREATE_ERROR';
|
||||
|
||||
@@ -186,5 +186,3 @@ export const MYSTERIES = 'Mysteries';
|
||||
export const TECHNOLOGY = 'Technology';
|
||||
export const EMOJI = 'Emoji';
|
||||
export const STICKER = 'Sticker';
|
||||
export const HOST = 'Host';
|
||||
export const NO_HOST = 'NoHost';
|
||||
@@ -14,6 +14,7 @@ export const THEME = 'theme';
|
||||
export const THEMES = 'themes';
|
||||
export const AUTOMATIC_DARK_MODE_ENABLED = 'automatic_dark_mode_enabled';
|
||||
export const CLOCK_24H = 'clock_24h';
|
||||
export const DISABLE_BACKGROUND = 'disableBackground';
|
||||
export const AUTOPLAY_MEDIA = 'autoplay';
|
||||
export const AUTOPLAY_NEXT = 'autoplay_next';
|
||||
export const OS_NOTIFICATIONS_ENABLED = 'os_notifications_enabled';
|
||||
@@ -53,4 +54,5 @@ export const SETTINGS_GRP = {
|
||||
ACCOUNT: 'account',
|
||||
CONTENT: 'content',
|
||||
SYSTEM: 'system',
|
||||
STORAGE: 'Storage',
|
||||
};
|
||||
+26
-3
@@ -21,6 +21,10 @@ import {
|
||||
doToggle3PAnalytics,
|
||||
doUpdateDownloadProgress,
|
||||
doNotifyUpdateAvailable,
|
||||
doShowUpgradeInstallationError,
|
||||
doAutoUpdateDownloading,
|
||||
doAutoUpdateReset,
|
||||
doAutoUpdateFail,
|
||||
} from 'redux/actions/app';
|
||||
import { isURIValid } from 'util/lbryURI';
|
||||
import { setSearchApi } from 'redux/actions/search';
|
||||
@@ -103,8 +107,6 @@ ipcRenderer.on('send-disk-space', (event, result) => {
|
||||
}
|
||||
});
|
||||
|
||||
ipcRenderer.send('get-disk-space');
|
||||
// @if TARGET='app'
|
||||
ipcRenderer.on('open-uri-requested', (event, url, newSession) => {
|
||||
function handleError() {
|
||||
app.store.dispatch(
|
||||
@@ -130,10 +132,30 @@ ipcRenderer.on('open-uri-requested', (event, url, newSession) => {
|
||||
handleError();
|
||||
});
|
||||
|
||||
autoUpdater.on('download-progress', () => {
|
||||
app.store.dispatch(doAutoUpdateDownloading());
|
||||
});
|
||||
|
||||
autoUpdater.on('checking-for-update', () => {
|
||||
app.store.dispatch(doAutoUpdateReset());
|
||||
});
|
||||
|
||||
autoUpdater.on('update-available', (e) => {
|
||||
app.store.dispatch(doNotifyUpdateAvailable(e));
|
||||
});
|
||||
|
||||
autoUpdater.on('update-downloaded', () => {
|
||||
app.store.dispatch(doAutoUpdateReset());
|
||||
});
|
||||
|
||||
autoUpdater.on('error', () => {
|
||||
app.store.dispatch(doAutoUpdateFail());
|
||||
});
|
||||
|
||||
ipcRenderer.on('upgrade-installing-error', () => {
|
||||
app.store.dispatch(doShowUpgradeInstallationError());
|
||||
});
|
||||
|
||||
ipcRenderer.on('download-progress-update', (e, p) => {
|
||||
app.store.dispatch(doUpdateDownloadProgress(Math.round(p.percent * 100)));
|
||||
});
|
||||
@@ -191,7 +213,6 @@ document.addEventListener('click', (event) => {
|
||||
target = target.parentNode;
|
||||
}
|
||||
});
|
||||
// @endif
|
||||
|
||||
document.addEventListener('dragover', (event) => {
|
||||
event.preventDefault();
|
||||
@@ -211,6 +232,8 @@ function AppWrapper() {
|
||||
const enabled = makeSelectClientSetting(SETTINGS.ENABLE_PRERELEASE_UPDATES)(state);
|
||||
if (enabled) {
|
||||
autoUpdater.allowPrerelease = true;
|
||||
} else {
|
||||
autoUpdater.allowPrerelease = false;
|
||||
}
|
||||
}
|
||||
}, [persistDone]);
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doAutoUpdateDeclined, doHideModal } from 'redux/actions/app';
|
||||
import { selectAutoUpdateFailed, selectAutoUpdateDownloading, selectIsUpgradeAvailable } from 'redux/selectors/app';
|
||||
import ModalAutoUpdateDownloaded from './view';
|
||||
|
||||
const perform = dispatch => ({
|
||||
const select = (state, props) => ({
|
||||
errorWhileUpdating: selectAutoUpdateFailed(state),
|
||||
isDownloading: selectAutoUpdateDownloading(state),
|
||||
isUpdateAvailable: selectIsUpgradeAvailable(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
closeModal: () => dispatch(doHideModal()),
|
||||
declineAutoUpdate: () => dispatch(doAutoUpdateDeclined()),
|
||||
});
|
||||
|
||||
export default connect(
|
||||
null,
|
||||
perform
|
||||
)(ModalAutoUpdateDownloaded);
|
||||
export default connect(select, perform)(ModalAutoUpdateDownloaded);
|
||||
@@ -1,5 +1,5 @@
|
||||
// @flow
|
||||
import React, { useState } from 'react';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
// @if TARGET='app'
|
||||
import { ipcRenderer } from 'electron';
|
||||
// @endif
|
||||
@@ -7,16 +7,19 @@ import { Modal } from 'modal/modal';
|
||||
import LastReleaseChanges from 'component/lastReleaseChanges';
|
||||
|
||||
type Props = {
|
||||
closeModal: any => any,
|
||||
closeModal: (any) => any,
|
||||
declineAutoUpdate: () => any,
|
||||
errorWhileUpdating: boolean,
|
||||
isDownloading: boolean,
|
||||
isUpdateAvailable: boolean,
|
||||
};
|
||||
|
||||
const ModalAutoUpdateDownloaded = (props: Props) => {
|
||||
const { closeModal, declineAutoUpdate } = props;
|
||||
const [disabled, setDisabled] = useState(false);
|
||||
const { closeModal, declineAutoUpdate, errorWhileUpdating, isDownloading, isUpdateAvailable } = props;
|
||||
const [waitingForAutoUpdateResponse, setWaitingForAutoUpdateResponse] = useState(false);
|
||||
|
||||
const handleConfirm = () => {
|
||||
setDisabled(true);
|
||||
setWaitingForAutoUpdateResponse(true);
|
||||
ipcRenderer.send('autoUpdateAccepted');
|
||||
};
|
||||
|
||||
@@ -25,19 +28,24 @@ const ModalAutoUpdateDownloaded = (props: Props) => {
|
||||
closeModal();
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
setWaitingForAutoUpdateResponse(false);
|
||||
}, [errorWhileUpdating, isDownloading, isUpdateAvailable]);
|
||||
|
||||
return (
|
||||
<Modal
|
||||
isOpen
|
||||
type="confirm"
|
||||
contentLabel={__('Upgrade Downloaded')}
|
||||
title={__('LBRY leveled up')}
|
||||
confirmButtonLabel={__('Upgrade Now')}
|
||||
abortButtonLabel={__('Not Now')}
|
||||
confirmButtonDisabled={disabled}
|
||||
confirmButtonLabel={isDownloading ? __('Downloading...') : __('Upgrade Now')}
|
||||
abortButtonLabel={isDownloading ? __('Keep browsing') : __('Not Now')}
|
||||
confirmButtonDisabled={!isUpdateAvailable || isDownloading || waitingForAutoUpdateResponse}
|
||||
onConfirmed={handleConfirm}
|
||||
onAborted={handleAbort}
|
||||
>
|
||||
<LastReleaseChanges />
|
||||
{errorWhileUpdating && <p>{__('There was an error while updating. Please try again.')}</p>}
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,15 +1,23 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doStartUpgrade, doCancelUpgrade, doHideModal } from 'redux/actions/app';
|
||||
import { selectDownloadProgress, selectDownloadComplete, selectUpgradeDownloadPath } from 'redux/selectors/app';
|
||||
import {
|
||||
selectDownloadProgress,
|
||||
selectDownloadComplete,
|
||||
selectUpgradeDownloadPath,
|
||||
selectUpgradeInitialized,
|
||||
selectUpgradeFailedInstallation,
|
||||
} from 'redux/selectors/app';
|
||||
import ModalDownloading from './view';
|
||||
|
||||
const select = state => ({
|
||||
const select = (state) => ({
|
||||
downloadProgress: selectDownloadProgress(state),
|
||||
downloadComplete: selectDownloadComplete(state),
|
||||
downloadItem: selectUpgradeDownloadPath(state),
|
||||
upgradeInitialized: selectUpgradeInitialized(state),
|
||||
failedInstallation: selectUpgradeFailedInstallation(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
const perform = (dispatch) => ({
|
||||
startUpgrade: () => dispatch(doStartUpgrade()),
|
||||
cancelUpgrade: () => {
|
||||
dispatch(doHideModal());
|
||||
@@ -17,7 +25,4 @@ const perform = dispatch => ({
|
||||
},
|
||||
});
|
||||
|
||||
export default connect(
|
||||
select,
|
||||
perform
|
||||
)(ModalDownloading);
|
||||
export default connect(select, perform)(ModalDownloading);
|
||||
@@ -10,11 +10,21 @@ type Props = {
|
||||
downloadItem: string,
|
||||
startUpgrade: () => void,
|
||||
cancelUpgrade: () => void,
|
||||
upgradeInitialized: boolean,
|
||||
failedInstallation: boolean,
|
||||
};
|
||||
|
||||
class ModalDownloading extends React.PureComponent<Props> {
|
||||
render() {
|
||||
const { downloadProgress, downloadComplete, downloadItem, startUpgrade, cancelUpgrade } = this.props;
|
||||
const {
|
||||
downloadProgress,
|
||||
downloadComplete,
|
||||
downloadItem,
|
||||
startUpgrade,
|
||||
cancelUpgrade,
|
||||
upgradeInitialized,
|
||||
failedInstallation,
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<Modal title={__('Downloading update')} isOpen contentLabel={__('Downloading update')} type="custom">
|
||||
@@ -40,9 +50,18 @@ class ModalDownloading extends React.PureComponent<Props> {
|
||||
</React.Fragment>
|
||||
) : null}
|
||||
|
||||
{failedInstallation && <p>{__('There was an error during installation. Please, try again.')}</p>}
|
||||
|
||||
<div className="card__actions">
|
||||
{downloadComplete ? <Button button="primary" label={__('Begin Upgrade')} onClick={startUpgrade} /> : null}
|
||||
<Button button="link" label={__('Cancel')} onClick={cancelUpgrade} />
|
||||
{downloadComplete ? (
|
||||
<Button
|
||||
disabled={upgradeInitialized}
|
||||
button="primary"
|
||||
label={__(upgradeInitialized ? 'Installing, please wait...' : 'Begin Upgrade')}
|
||||
onClick={startUpgrade}
|
||||
/>
|
||||
) : null}
|
||||
<Button disabled={upgradeInitialized} button="link" label={__('Cancel')} onClick={cancelUpgrade} />
|
||||
</div>
|
||||
</Modal>
|
||||
);
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
// @flow
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import React, { Fragment } from 'react';
|
||||
import React from 'react';
|
||||
import { parseURI } from 'util/lbryURI';
|
||||
import { formatNumber } from 'util/number';
|
||||
import { YOUTUBE_STATUSES } from 'lbryinc';
|
||||
import Page from 'component/page';
|
||||
import SubscribeButton from 'component/subscribeButton';
|
||||
@@ -36,7 +37,6 @@ const PAGE = {
|
||||
ABOUT: 'about',
|
||||
DISCUSSION: DISCUSSION_PAGE,
|
||||
EDIT: 'edit',
|
||||
SUBSCRIPTION: 'subscription',
|
||||
};
|
||||
|
||||
type Props = {
|
||||
@@ -94,7 +94,7 @@ function ChannelPage(props: Props) {
|
||||
const { channelName } = parseURI(uri);
|
||||
const { permanent_url: permanentUrl } = claim;
|
||||
const claimId = claim.claim_id;
|
||||
const formattedSubCount = Number(subCount).toLocaleString();
|
||||
const formattedSubCount = formatNumber(subCount, 2, true);
|
||||
const isBlocked = claim && blockedChannels.includes(claim.permanent_url);
|
||||
const isMuted = claim && mutedChannels.includes(claim.permanent_url);
|
||||
const isMyYouTubeChannel =
|
||||
@@ -160,9 +160,6 @@ function ChannelPage(props: Props) {
|
||||
case PAGE.DISCUSSION:
|
||||
tabIndex = 3;
|
||||
break;
|
||||
case PAGE.SUBSCRIPTION:
|
||||
tabIndex = 4;
|
||||
break;
|
||||
default:
|
||||
tabIndex = 0;
|
||||
break;
|
||||
@@ -178,10 +175,8 @@ function ChannelPage(props: Props) {
|
||||
search += `${PAGE_VIEW_QUERY}=${PAGE.LISTS}`;
|
||||
} else if (newTabIndex === 2) {
|
||||
search += `${PAGE_VIEW_QUERY}=${PAGE.ABOUT}`;
|
||||
} else if (newTabIndex === 3) {
|
||||
search += `${PAGE_VIEW_QUERY}=${PAGE.DISCUSSION}`;
|
||||
} else {
|
||||
search += `${PAGE_VIEW_QUERY}=${PAGE.SUBSCRIPTION}`;
|
||||
search += `${PAGE_VIEW_QUERY}=${PAGE.DISCUSSION}`;
|
||||
}
|
||||
|
||||
push(`${url}${search}`);
|
||||
|
||||
@@ -9,13 +9,8 @@ import {
|
||||
} from 'redux/selectors/notifications';
|
||||
import { doCommentReactList } from 'redux/actions/comments';
|
||||
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
||||
import {
|
||||
doLbryioNotificationsMarkRead,
|
||||
doLbryioNotificationList,
|
||||
doLbryioSeeAllNotifications,
|
||||
} from 'redux/actions/notifications';
|
||||
import { doReadNotifications, doNotificationList, doSeeAllNotifications } from 'redux/actions/notifications';
|
||||
import NotificationsPage from './view';
|
||||
import { selectUser } from 'redux/selectors/user';
|
||||
|
||||
const select = (state) => ({
|
||||
notifications: selectNotifications(state),
|
||||
@@ -25,12 +20,11 @@ const select = (state) => ({
|
||||
unreadCount: selectUnreadNotificationCount(state),
|
||||
unseenCount: selectUnseenNotificationCount(state),
|
||||
activeChannel: selectActiveChannelClaim(state),
|
||||
user: selectUser(state),
|
||||
});
|
||||
|
||||
export default connect(select, {
|
||||
doLbryioNotificationsMarkRead,
|
||||
doLbryioNotificationList,
|
||||
doLbryioSeeAllNotifications,
|
||||
doReadNotifications,
|
||||
doNotificationList,
|
||||
doSeeAllNotifications,
|
||||
doCommentReactList,
|
||||
})(NotificationsPage);
|
||||
@@ -14,38 +14,32 @@ import { RULE } from 'constants/notifications';
|
||||
|
||||
type Props = {
|
||||
notifications: Array<Notification>,
|
||||
localNotifications: Array<Notification>,
|
||||
notificationsFiltered: Array<Notification>,
|
||||
notificationCategories: Array<NotificationCategory>,
|
||||
fetching: boolean,
|
||||
unreadCount: number,
|
||||
unseenCount: number,
|
||||
doLbryioSeeAllNotifications: () => void,
|
||||
doLbryioNotificationsMarkRead: () => void,
|
||||
doLbryioNotificationList: (?Array<string>) => void,
|
||||
doSeeAllNotifications: () => void,
|
||||
doReadNotifications: () => void,
|
||||
doNotificationList: (?Array<string>) => void,
|
||||
activeChannel: ?ChannelClaim,
|
||||
doCommentReactList: (Array<string>) => Promise<any>,
|
||||
user: User,
|
||||
};
|
||||
|
||||
export default function NotificationsPage(props: Props) {
|
||||
const {
|
||||
notifications,
|
||||
notificationsFiltered,
|
||||
localNotifications,
|
||||
fetching,
|
||||
unreadCount,
|
||||
unseenCount,
|
||||
doLbryioSeeAllNotifications,
|
||||
doLbryioNotificationsMarkRead,
|
||||
doLbryioNotificationList,
|
||||
doSeeAllNotifications,
|
||||
doReadNotifications,
|
||||
doNotificationList,
|
||||
notificationCategories,
|
||||
activeChannel,
|
||||
doCommentReactList,
|
||||
user,
|
||||
} = props;
|
||||
// const localCategories = [{ name: 'New Content', types: ['new_content'] }];
|
||||
const legacyNotificationsEnabled = user && user.experimental_ui;
|
||||
const initialFetchDone = useFetched(fetching);
|
||||
const [name, setName] = usePersistedState('notifications--rule', NOTIFICATIONS.NOTIFICATION_NAME_ALL);
|
||||
const isFiltered = name !== NOTIFICATIONS.NOTIFICATION_NAME_ALL;
|
||||
@@ -87,9 +81,9 @@ export default function NotificationsPage(props: Props) {
|
||||
|
||||
React.useEffect(() => {
|
||||
if (unseenCount > 0) {
|
||||
doLbryioSeeAllNotifications();
|
||||
doSeeAllNotifications();
|
||||
}
|
||||
}, [unseenCount, doLbryioSeeAllNotifications]);
|
||||
}, [unseenCount, doSeeAllNotifications]);
|
||||
|
||||
const stringifiedNotificationCategories = JSON.stringify(notificationCategories);
|
||||
React.useEffect(() => {
|
||||
@@ -103,7 +97,7 @@ export default function NotificationsPage(props: Props) {
|
||||
try {
|
||||
const matchingCategory = arrayNotificationCategories.find((category) => category.name === name);
|
||||
if (matchingCategory) {
|
||||
doLbryioNotificationList(matchingCategory.types);
|
||||
doNotificationList(matchingCategory.types);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
@@ -119,18 +113,10 @@ export default function NotificationsPage(props: Props) {
|
||||
<div className="claim-list__alt-controls--wrap">
|
||||
{fetching && <Spinner type="small" />}
|
||||
|
||||
{legacyNotificationsEnabled && unreadCount > 0 && (
|
||||
<Button
|
||||
icon={ICONS.EYE}
|
||||
onClick={doLbryioNotificationsMarkRead}
|
||||
button="secondary"
|
||||
label={__('Mark all as read')}
|
||||
/>
|
||||
{unreadCount > 0 && (
|
||||
<Button icon={ICONS.EYE} onClick={doReadNotifications} button="secondary" label={__('Mark all as read')} />
|
||||
)}
|
||||
{!legacyNotificationsEnabled && unreadCount > 0 && (
|
||||
<Button icon={ICONS.EYE} onClick={() => alert('clear')} button="secondary" label={__('Mark all as read')} />
|
||||
)}
|
||||
{legacyNotificationsEnabled && notificationCategories && (
|
||||
{notificationCategories && (
|
||||
<FormField
|
||||
className="notification__filter"
|
||||
type="select"
|
||||
@@ -149,7 +135,7 @@ export default function NotificationsPage(props: Props) {
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{legacyNotificationsEnabled && list && list.length > 0 && !(isFiltered && fetching) && (
|
||||
{list && list.length > 0 && !(isFiltered && fetching) ? (
|
||||
<div className="card">
|
||||
<div className="notification_list">
|
||||
{list.map((notification) => {
|
||||
@@ -157,17 +143,7 @@ export default function NotificationsPage(props: Props) {
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{!legacyNotificationsEnabled && localNotifications && localNotifications.length > 0 && (
|
||||
<div className="card">
|
||||
<div className="notification_list">
|
||||
{localNotifications.map((notification) => {
|
||||
return <Notification key={notification.id} notification={notification} local />;
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{!(legacyNotificationsEnabled && list && list.length > 0 && !(isFiltered && fetching)) && (
|
||||
) : (
|
||||
<div className="main--empty">
|
||||
{!fetching && (
|
||||
<Yrbl
|
||||
|
||||
@@ -5,6 +5,7 @@ import SettingAccount from 'component/settingAccount';
|
||||
import SettingAppearance from 'component/settingAppearance';
|
||||
import SettingContent from 'component/settingContent';
|
||||
import SettingSystem from 'component/settingSystem';
|
||||
import SettingStorage from 'component/settingStorage';
|
||||
|
||||
type DaemonSettings = {
|
||||
download_dir: string,
|
||||
@@ -51,6 +52,7 @@ class SettingsPage extends React.PureComponent<Props> {
|
||||
<SettingAccount />
|
||||
<SettingContent />
|
||||
<SettingSystem />
|
||||
<SettingStorage />
|
||||
</div>
|
||||
)}
|
||||
</Page>
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import PrivacyAgreement from 'component/privacyAgreement';
|
||||
import HostingSplash from 'component/hostingSplash';
|
||||
import HostingSplashCustom from 'component/hostingSplashCustom';
|
||||
import WelcomeSplash from 'component/welcomeSplash';
|
||||
import Page from 'component/page';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
|
||||
const SPLASH_PAGE = 0;
|
||||
const PRIVACY_PAGE = 1;
|
||||
// const HOSTING_PAGE = 2;
|
||||
// const WELCOME_PAGES = [SPLASH_PAGE, PRIVACY_PAGE];
|
||||
const HOSTING_PAGE = 2;
|
||||
const HOSTING_ADVANCED = 3;
|
||||
|
||||
type DaemonStatus = {
|
||||
disk_space: {
|
||||
content_blobs_storage_used_mb: string,
|
||||
@@ -44,6 +47,16 @@ export default function Welcome(props: Props) {
|
||||
const handleNextPage = () => {
|
||||
if (welcomePage === SPLASH_PAGE) {
|
||||
setWelcomePage(PRIVACY_PAGE);
|
||||
} else if (welcomePage === PRIVACY_PAGE) {
|
||||
setWelcomePage(HOSTING_PAGE);
|
||||
} else if (welcomePage === HOSTING_PAGE) {
|
||||
setWelcomePage(HOSTING_ADVANCED);
|
||||
}
|
||||
};
|
||||
|
||||
const handleGoBack = () => {
|
||||
if (welcomePage >= 1) {
|
||||
setWelcomePage(welcomePage - 1);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -55,8 +68,11 @@ export default function Welcome(props: Props) {
|
||||
return (
|
||||
<Page noHeader noSideNavigation>
|
||||
{welcomePage === SPLASH_PAGE && <WelcomeSplash handleNextPage={handleNextPage} />}
|
||||
{welcomePage === PRIVACY_PAGE && <PrivacyAgreement handleNextPage={handleDone} />}
|
||||
{/* {welcomePage === HOSTING_PAGE && } */}
|
||||
{welcomePage === PRIVACY_PAGE && <PrivacyAgreement handleNextPage={handleNextPage} />}
|
||||
{welcomePage === HOSTING_PAGE && <HostingSplash handleNextPage={handleNextPage} handleDone={handleDone} />}
|
||||
{welcomePage === HOSTING_ADVANCED && (
|
||||
<HostingSplashCustom handleNextPage={handleDone} handleGoBack={handleGoBack} />
|
||||
)}
|
||||
</Page>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { selectYoutubeChannels } from 'redux/selectors/user';
|
||||
import { doUserFetch } from 'redux/actions/user';
|
||||
import CreatorDashboardPage from './view';
|
||||
|
||||
const select = state => ({
|
||||
youtubeChannels: selectYoutubeChannels(state),
|
||||
});
|
||||
|
||||
export default connect(select, {
|
||||
doUserFetch,
|
||||
})(CreatorDashboardPage);
|
||||
@@ -0,0 +1,216 @@
|
||||
// @flow
|
||||
import { SITE_NAME, DOMAIN } from 'config';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import SUPPORTED_LANGUAGES from 'constants/supported_languages';
|
||||
import React from 'react';
|
||||
import Page from 'component/page';
|
||||
import Button from 'component/button';
|
||||
import Card from 'component/common/card';
|
||||
import I18nMessage from 'component/i18nMessage';
|
||||
import { Form, FormField } from 'component/common/form';
|
||||
import { INVALID_NAME_ERROR } from 'constants/claim';
|
||||
import { isNameValid } from 'util/lbryURI';
|
||||
import { Lbryio } from 'lbryinc';
|
||||
import { useHistory } from 'react-router';
|
||||
import YoutubeTransferStatus from 'component/youtubeTransferStatus';
|
||||
import Nag from 'component/common/nag';
|
||||
import { getDefaultLanguage, sortLanguageMap } from 'util/default-languages';
|
||||
|
||||
const STATUS_TOKEN_PARAM = 'status_token';
|
||||
const ERROR_MESSAGE_PARAM = 'error_message';
|
||||
const NEW_CHANNEL_PARAM = 'new_channel';
|
||||
|
||||
type Props = {
|
||||
youtubeChannels: ?Array<{ transfer_state: string, sync_status: string }>,
|
||||
doUserFetch: () => void,
|
||||
inSignUpFlow?: boolean,
|
||||
doToggleInterestedInYoutubeSync: () => void,
|
||||
};
|
||||
|
||||
export default function YoutubeSync(props: Props) {
|
||||
const { youtubeChannels, doUserFetch, inSignUpFlow = false, doToggleInterestedInYoutubeSync } = props;
|
||||
const {
|
||||
location: { search, pathname },
|
||||
push,
|
||||
replace,
|
||||
} = useHistory();
|
||||
const urlParams = new URLSearchParams(search);
|
||||
const statusToken = urlParams.get(STATUS_TOKEN_PARAM);
|
||||
const errorMessage = urlParams.get(ERROR_MESSAGE_PARAM);
|
||||
const newChannelParam = urlParams.get(NEW_CHANNEL_PARAM);
|
||||
const [channel, setChannel] = React.useState('');
|
||||
const [language, setLanguage] = React.useState(getDefaultLanguage());
|
||||
const [nameError, setNameError] = React.useState(undefined);
|
||||
const [acknowledgedTerms, setAcknowledgedTerms] = React.useState(false);
|
||||
const [addingNewChannel, setAddingNewChannel] = React.useState(newChannelParam);
|
||||
const hasYoutubeChannels = youtubeChannels && youtubeChannels.length > 0;
|
||||
|
||||
React.useEffect(() => {
|
||||
const urlParamsInEffect = new URLSearchParams(search);
|
||||
if (!urlParamsInEffect.get('reset_scroll')) {
|
||||
urlParamsInEffect.append('reset_scroll', 'youtube');
|
||||
}
|
||||
|
||||
replace(`?${urlParamsInEffect.toString()}`);
|
||||
}, [pathname, search]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (statusToken && !hasYoutubeChannels) {
|
||||
doUserFetch();
|
||||
}
|
||||
}, [statusToken, hasYoutubeChannels, doUserFetch]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!newChannelParam) {
|
||||
setAddingNewChannel(false);
|
||||
}
|
||||
}, [newChannelParam]);
|
||||
|
||||
function handleCreateChannel() {
|
||||
Lbryio.call('yt', 'new', {
|
||||
type: 'sync',
|
||||
immediate_sync: true,
|
||||
channel_language: language,
|
||||
desired_lbry_channel_name: `@${channel}`,
|
||||
return_url: `https://${DOMAIN}/$/${inSignUpFlow ? PAGES.AUTH : PAGES.YOUTUBE_SYNC}`,
|
||||
}).then((ytAuthUrl) => {
|
||||
// react-router isn't needed since it's a different domain
|
||||
window.location.href = ytAuthUrl;
|
||||
});
|
||||
}
|
||||
|
||||
function handleChannelChange(e) {
|
||||
const { value } = e.target;
|
||||
setChannel(value);
|
||||
if (!isNameValid(value)) {
|
||||
setNameError(INVALID_NAME_ERROR);
|
||||
} else {
|
||||
setNameError();
|
||||
}
|
||||
}
|
||||
|
||||
function handleNewChannel() {
|
||||
urlParams.append('new_channel', 'true');
|
||||
push(`${pathname}?${urlParams.toString()}`);
|
||||
setAddingNewChannel(true);
|
||||
}
|
||||
|
||||
const Wrapper = (props: { children: any }) => {
|
||||
return inSignUpFlow ? (
|
||||
<>{props.children}</>
|
||||
) : (
|
||||
<Page noSideNavigation authPage>
|
||||
{props.children}
|
||||
</Page>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<Wrapper>
|
||||
<div className="main__channel-creation">
|
||||
{hasYoutubeChannels && !addingNewChannel ? (
|
||||
<YoutubeTransferStatus alwaysShow addNewChannel={handleNewChannel} />
|
||||
) : (
|
||||
<Card
|
||||
title={__('Sync your YouTube channel to %site_name%', { site_name: 'LBRY' })}
|
||||
subtitle={__('Get your YouTube videos in front of the %site_name% audience.', {
|
||||
site_name: 'LBRY',
|
||||
})}
|
||||
actions={
|
||||
<Form onSubmit={handleCreateChannel}>
|
||||
<fieldset-group class="fieldset-group--smushed fieldset-group--disabled-prefix">
|
||||
<fieldset-section>
|
||||
<label htmlFor="auth_first_channel">
|
||||
{nameError ? (
|
||||
<span className="error__text">{nameError}</span>
|
||||
) : (
|
||||
__('Your %site_name% channel name', { site_name: 'LBRY' })
|
||||
)}
|
||||
</label>
|
||||
<div className="form-field__prefix">@</div>
|
||||
</fieldset-section>
|
||||
|
||||
<FormField
|
||||
autoFocus
|
||||
placeholder={__('channel')}
|
||||
type="text"
|
||||
name="yt_sync_channel"
|
||||
className="form-field--short"
|
||||
value={channel}
|
||||
onChange={handleChannelChange}
|
||||
/>
|
||||
</fieldset-group>
|
||||
<FormField
|
||||
name="language_select"
|
||||
type="select"
|
||||
label={__('Channel language')}
|
||||
onChange={(event) => setLanguage(event.target.value)}
|
||||
value={language}
|
||||
>
|
||||
{sortLanguageMap(SUPPORTED_LANGUAGES).map(([langKey, langName]) => (
|
||||
<option key={langKey} value={langKey}>
|
||||
{langName}
|
||||
</option>
|
||||
))}
|
||||
</FormField>
|
||||
<FormField
|
||||
type="checkbox"
|
||||
name="yt_sync_terms"
|
||||
checked={acknowledgedTerms}
|
||||
onChange={() => setAcknowledgedTerms(!acknowledgedTerms)}
|
||||
label={
|
||||
<I18nMessage
|
||||
tokens={{
|
||||
terms: (
|
||||
<Button button="link" label={__('these terms')} href="https://lbry.com/faq/youtube-terms" />
|
||||
),
|
||||
faq: (
|
||||
<Button
|
||||
button="link"
|
||||
label={__('how the program works')}
|
||||
href="https://lbry.com/faq/youtube"
|
||||
/>
|
||||
),
|
||||
site_name: SITE_NAME,
|
||||
}}
|
||||
>
|
||||
I want to sync my content to %site_name% and the LBRY network and agree to %terms%. I have also
|
||||
read and understand %faq%.
|
||||
</I18nMessage>
|
||||
}
|
||||
/>
|
||||
|
||||
<div className="section__actions">
|
||||
<Button
|
||||
button="primary"
|
||||
type="submit"
|
||||
disabled={nameError || !channel || !acknowledgedTerms}
|
||||
label={__('Claim Now')}
|
||||
/>
|
||||
|
||||
{inSignUpFlow && !errorMessage && (
|
||||
<Button button="link" label={__('Skip')} onClick={() => doToggleInterestedInYoutubeSync()} />
|
||||
)}
|
||||
|
||||
{errorMessage && <Button button="link" label={__('Skip')} navigate={`/$/${PAGES.REWARDS}`} />}
|
||||
</div>
|
||||
<div className="help--card-actions">
|
||||
<I18nMessage
|
||||
tokens={{
|
||||
learn_more: <Button button="link" label={__('Learn more')} href="https://lbry.com/faq/youtube" />,
|
||||
}}
|
||||
>
|
||||
This will verify you are an active YouTuber. Channel names cannot be changed once chosen, please be
|
||||
extra careful. Additional instructions will be emailed to you after you verify your email on the
|
||||
next page. %learn_more%.
|
||||
</I18nMessage>
|
||||
</div>
|
||||
</Form>
|
||||
}
|
||||
nag={errorMessage && <Nag message={errorMessage} type="error" relative />}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</Wrapper>
|
||||
);
|
||||
}
|
||||
+34
-26
@@ -7,7 +7,7 @@ import * as MODALS from 'constants/modal_types';
|
||||
import * as SETTINGS from 'constants/settings';
|
||||
import * as DAEMON_SETTINGS from 'constants/daemon_settings';
|
||||
import * as SHARED_PREFERENCES from 'constants/shared_preferences';
|
||||
import { CLOUD_DOMAIN } from 'config';
|
||||
import { DOMAIN } from 'config';
|
||||
import Lbry from 'lbry';
|
||||
import { doFetchChannelListMine, doFetchCollectionListMine, doCheckPendingClaims } from 'redux/actions/claims';
|
||||
import { selectClaimForUri, selectClaimIsMineForUri, selectMyChannelClaims } from 'redux/selectors/claims';
|
||||
@@ -16,7 +16,7 @@ import { doClearSupport, doBalanceSubscribe } from 'redux/actions/wallet';
|
||||
import { doClearPublish } from 'redux/actions/publish';
|
||||
import { Lbryio } from 'lbryinc';
|
||||
import { selectFollowedTagsList } from 'redux/selectors/tags';
|
||||
import { doToast, doError, doLbryioNotificationList } from 'redux/actions/notifications';
|
||||
import { doToast, doError, doNotificationList } from 'redux/actions/notifications';
|
||||
|
||||
import {
|
||||
doFetchDaemonSettings,
|
||||
@@ -28,7 +28,6 @@ import {
|
||||
import {
|
||||
selectIsUpgradeSkipped,
|
||||
selectUpdateUrl,
|
||||
selectUpgradeDownloadItem,
|
||||
selectUpgradeDownloadPath,
|
||||
selectAutoUpdateDeclined,
|
||||
selectRemoteVersion,
|
||||
@@ -85,6 +84,15 @@ export function doStartUpgrade() {
|
||||
const upgradeDownloadPath = selectUpgradeDownloadPath(state);
|
||||
|
||||
ipcRenderer.send('upgrade', upgradeDownloadPath);
|
||||
dispatch({
|
||||
type: ACTIONS.UPGRADE_INIT_INSTALL,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function doShowUpgradeInstallationError() {
|
||||
return {
|
||||
type: ACTIONS.UPGRADE_INSTALL_ERROR,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -154,25 +162,8 @@ export function doAutoUpdateDeclined() {
|
||||
}
|
||||
|
||||
export function doCancelUpgrade() {
|
||||
return (dispatch, getState) => {
|
||||
const state = getState();
|
||||
const upgradeDownloadItem = selectUpgradeDownloadItem(state);
|
||||
|
||||
if (upgradeDownloadItem) {
|
||||
/*
|
||||
* Right now the remote reference to the download item gets garbage collected as soon as the
|
||||
* the download is over (maybe even earlier), so trying to cancel a finished download may
|
||||
* throw an error.
|
||||
*/
|
||||
try {
|
||||
upgradeDownloadItem.cancel();
|
||||
} catch (err) {
|
||||
console.error(err); // eslint-disable-line no-console
|
||||
}
|
||||
}
|
||||
|
||||
dispatch({ type: ACTIONS.UPGRADE_CANCELLED });
|
||||
};
|
||||
ipcRenderer.send('cancel-download-upgrade');
|
||||
return { type: ACTIONS.UPGRADE_CANCELLED };
|
||||
}
|
||||
|
||||
export function doCheckUpgradeAvailable() {
|
||||
@@ -229,6 +220,24 @@ export function doNotifyUpdateAvailable(e) {
|
||||
};
|
||||
}
|
||||
|
||||
export function doAutoUpdateDownloading() {
|
||||
return {
|
||||
type: ACTIONS.AUTO_UPDATE_DOWNLOADING,
|
||||
};
|
||||
}
|
||||
|
||||
export function doAutoUpdateReset() {
|
||||
return {
|
||||
type: ACTIONS.AUTO_UPDATE_RESET,
|
||||
};
|
||||
}
|
||||
|
||||
export function doAutoUpdateFail() {
|
||||
return {
|
||||
type: ACTIONS.AUTO_UPDATE_FAILED,
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
Initiate a timer that will check for an app upgrade every 10 minutes.
|
||||
*/
|
||||
@@ -336,12 +345,11 @@ export function doDaemonReady() {
|
||||
}
|
||||
},
|
||||
undefined,
|
||||
CLOUD_DOMAIN
|
||||
DOMAIN
|
||||
)
|
||||
);
|
||||
dispatch({ type: ACTIONS.DAEMON_READY });
|
||||
|
||||
// @if TARGET='app'
|
||||
dispatch(doBalanceSubscribe());
|
||||
dispatch(doSetAutoLaunch());
|
||||
dispatch(doFindFFmpeg());
|
||||
@@ -352,7 +360,7 @@ export function doDaemonReady() {
|
||||
dispatch(doCheckUpgradeAvailable());
|
||||
}
|
||||
dispatch(doCheckUpgradeSubscribe());
|
||||
// @endif
|
||||
ipcRenderer.send('get-disk-space');
|
||||
};
|
||||
}
|
||||
|
||||
@@ -509,7 +517,7 @@ export function doSignIn() {
|
||||
dispatch(doNotificationSocketConnect(notificationsEnabled));
|
||||
|
||||
if (notificationsEnabled) {
|
||||
dispatch(doLbryioNotificationList());
|
||||
dispatch(doNotificationList());
|
||||
}
|
||||
dispatch(doCheckPendingClaims());
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import Lbry from 'lbry';
|
||||
import { parseURI, buildURI, isURIEqual } from 'util/lbryURI';
|
||||
import { selectClaimsByUri, selectMyChannelClaims } from 'redux/selectors/claims';
|
||||
import { doClaimSearch } from 'redux/actions/claims';
|
||||
import { doToast, doLbryioNotificationsMarkSeen } from 'redux/actions/notifications';
|
||||
import { doToast, doSeeNotifications } from 'redux/actions/notifications';
|
||||
import {
|
||||
selectMyReactsForComment,
|
||||
selectOthersReactsForComment,
|
||||
@@ -452,7 +452,7 @@ export function doCommentReact(commentId: string, type: string) {
|
||||
}
|
||||
|
||||
if (notification && !notification.is_seen) {
|
||||
dispatch(doLbryioNotificationsMarkSeen([notification.id]));
|
||||
dispatch(doSeeNotifications([notification.id]));
|
||||
}
|
||||
|
||||
const exclusiveTypes = {
|
||||
@@ -593,7 +593,7 @@ export function doCommentCreate(
|
||||
|
||||
// send a notification
|
||||
const notification = parent_id && makeSelectNotificationForCommentId(parent_id)(state);
|
||||
if (notification && !notification.is_seen) dispatch(doLbryioNotificationsMarkSeen([notification.id]));
|
||||
if (notification && !notification.is_seen) dispatch(doSeeNotifications([notification.id]));
|
||||
|
||||
if (!signatureData) {
|
||||
return dispatch(doToast({ isError: true, message: __('Unable to verify your channel. Please try again.') }));
|
||||
@@ -1197,7 +1197,7 @@ export function doFetchModBlockedList() {
|
||||
if (blockedChannel.blocked_channel_name) {
|
||||
const channelUri = buildURI({
|
||||
channelName: blockedChannel.blocked_channel_name,
|
||||
claimId: blockedChannel.blocked_channel_id,
|
||||
channelClaimId: blockedChannel.blocked_channel_id,
|
||||
});
|
||||
|
||||
if (!blockedList.find((blockedChannel) => isURIEqual(blockedChannel.channelUri, channelUri))) {
|
||||
@@ -1215,7 +1215,7 @@ export function doFetchModBlockedList() {
|
||||
if (blockedByMap !== undefined) {
|
||||
const blockedByChannelUri = buildURI({
|
||||
channelName: blockedChannel.blocked_by_channel_name,
|
||||
claimId: blockedChannel.blocked_by_channel_id,
|
||||
channelClaimId: blockedChannel.blocked_by_channel_id,
|
||||
});
|
||||
|
||||
if (blockedByMap[channelUri]) {
|
||||
|
||||
Loaded 100 of 141 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user