Compare commits

..
Author SHA1 Message Date
zeppi d4f62dbefe update default comment server 2022-02-21 12:57:20 -05:00
48 changed files with 801 additions and 1582 deletions

No files matched your search

+1 -1
View File
@@ -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
+4 -4
View File
@@ -26,7 +26,7 @@ jobs:
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
continue-on-error: true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
@@ -47,12 +47,12 @@ jobs:
- name: Build
run: |
yarn global add cross-env
yarn install --network-timeout 600000
yarn
yarn build
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NOTARIZATION_USERNAME: ${{ secrets.NOTARIZATION_USERNAME_TEST }}
NOTARIZATION_PASSWORD: ${{ secrets.NOTARIZATION_PASSWORD_TEST }}
NOTARIZATION_USERNAME: ${{ secrets.NOTARIZATION_USERNAME }}
NOTARIZATION_PASSWORD: ${{ secrets.NOTARIZATION_PASSWORD }}
WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
-21
View File
@@ -5,27 +5,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased for Desktop]
### Added
- Discover page medium duration filter ([#7506](https://github.com/lbryio/lbry-desktop/pull/7506))
- Keep last used collection for Add To ([#7491](https://github.com/lbryio/lbry-desktop/pull/7491))
- Disk space functionality on mac / windows ([#7500](https://github.com/lbryio/lbry-desktop/pull/7500))
### Changed
- Some upgrade modal improvements ([#7488](https://github.com/lbryio/lbry-desktop/pull/7488))
### Fixed
- Failed comment count increment ([#7510](https://github.com/lbryio/lbry-desktop/pull/7510))
- App crash playing media on older windows versions by updating electron ([#7509](https://github.com/lbryio/lbry-desktop/pull/7509))
- Local build failures on mac ([#7497](https://github.com/lbryio/lbry-desktop/pull/7497))
- Language change now rerenders whole app ([#7504](https://github.com/lbryio/lbry-desktop/pull/7504))
## [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
+2 -2
View File
@@ -22,8 +22,8 @@ module.exports = async function() {
await electron_notarize.notarize({
appBundleId: appId,
appPath: appPath,
appleId: process.env.NOTARIZATION_USERNAME_TEST,
appleIdPassword: process.env.NOTARIZATION_PASSWORD_TEST,
appleId: process.env.NOTARIZATION_USERNAME,
appleIdPassword: process.env.NOTARIZATION_PASSWORD,
});
} catch (error) {
console.error(error);
+2 -83
View File
@@ -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', () => {
-5
View File
@@ -6,8 +6,3 @@ declare type CommentServerDetails = {
declare type WalletServerDetails = {
};
declare type DiskSpace = {
total: string,
free: string,
};
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "lbry",
"version": "0.52.6-alpha.2",
"version": "0.52.4",
"description": "A browser for the LBRY network, a digital marketplace controlled by its users.",
"keywords": [
"lbry"
@@ -126,8 +126,8 @@
"dom-scroll-into-view": "^1.2.1",
"dotenv-defaults": "^2.0.1",
"dotenv-webpack": "^1.8.0",
"electron": "15.4.0",
"electron-builder": "^22.10.5",
"electron": "15.3.2",
"electron-builder": "^22.9.1",
"electron-devtools-installer": "^3.1.1",
"electron-is-dev": "^0.3.0",
"electron-webpack": "^2.8.2",
@@ -149,7 +149,7 @@
"eslint-plugin-standard": "^4.0.1",
"file-loader": "^4.2.0",
"flow-bin": "^0.97.0",
"flow-typed": "^3.7.0",
"flow-typed": "^2.3.0",
"formik": "^0.10.4",
"hast-util-sanitize": "^3.0.2",
"history": "^4.9.0",
@@ -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",
-8
View File
@@ -2285,13 +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",
"Short (< 4 min)": "Short (< 4 min)",
"Medium (4 - 20 min)": "Medium (4 - 20 min)",
"--end--": "--end--"
}
-2
View File
@@ -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) => ({
+3 -11
View File
@@ -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')}
+1 -3
View File
@@ -253,7 +253,7 @@ function ClaimListDiscover(props: Props) {
release_time?: string,
claim_type?: string | Array<string>,
name?: string,
duration?: string | Array<string>,
duration?: string,
reposted_claim_id?: string,
stream_types?: any,
fee_amount?: string,
@@ -345,8 +345,6 @@ function ClaimListDiscover(props: Props) {
options.duration = '<=240';
} else if (durationParam === CS.DURATION_LONG) {
options.duration = '>=1200';
} else if (durationParam === CS.DURATION_MEDIUM) {
options.duration = ['<=1200', '>=240'];
}
}
+1 -2
View File
@@ -424,8 +424,7 @@ function ClaimListHeader(props: Props) {
{CS.DURATION_TYPES.map((dur) => (
<option key={dur} value={dur}>
{/* i18fixme */}
{dur === CS.DURATION_SHORT && __('Short (< 4 min)')}
{dur === CS.DURATION_MEDIUM && __('Medium (4 - 20 min)')}
{dur === CS.DURATION_SHORT && __('Short (< 4 minutes)')}
{dur === CS.DURATION_LONG && __('Long (> 20 min)')}
{dur === CS.DURATION_ALL && __('Any')}
</option>
-12
View File
@@ -3,12 +3,10 @@ import { selectClaimForUri, selectClaimIsMine } from 'redux/selectors/claims';
import { doCollectionEdit, doFetchItemsInCollection } from 'redux/actions/collections';
import { doPrepareEdit } from 'redux/actions/publish';
import {
makeSelectCollectionForId,
makeSelectCollectionForIdHasClaimUrl,
makeSelectCollectionIsMine,
makeSelectEditedCollectionForId,
makeSelectUrlsForCollectionId,
selectLastUsedCollection,
} from 'redux/selectors/collections';
import { makeSelectFileInfoForUri } from 'redux/selectors/file_info';
import * as COLLECTIONS_CONSTS from 'constants/collections';
@@ -45,8 +43,6 @@ const select = (state, props) => {
const shuffleList = selectListShuffle(state);
const shuffle = shuffleList && shuffleList.collectionId === collectionId && shuffleList.newUrls;
const playNextUri = shuffle && shuffle[0];
const lastUsedCollectionId = selectLastUsedCollection(state);
const lastUsedCollection = makeSelectCollectionForId(lastUsedCollectionId)(state);
return {
claim,
@@ -74,14 +70,6 @@ const select = (state, props) => {
editedCollection: makeSelectEditedCollectionForId(collectionId)(state),
resolvedList: makeSelectUrlsForCollectionId(collectionId)(state),
playNextUri,
lastUsedCollection,
hasClaimInLastUsedCollection: makeSelectCollectionForIdHasClaimUrl(
lastUsedCollectionId,
contentPermanentUri
)(state),
lastUsedCollectionIsNotBuiltin:
lastUsedCollectionId !== COLLECTIONS_CONSTS.WATCH_LATER_ID &&
lastUsedCollectionId !== COLLECTIONS_CONSTS.FAVORITES_ID,
};
};
-22
View File
@@ -60,9 +60,6 @@ type Props = {
resolvedList: boolean,
fetchCollectionItems: (string) => void,
doToggleShuffleList: (string) => void,
lastUsedCollection: ?Collection,
hasClaimInLastUsedCollection: boolean,
lastUsedCollectionIsNotBuiltin: boolean,
};
function ClaimMenuList(props: Props) {
@@ -103,9 +100,6 @@ function ClaimMenuList(props: Props) {
resolvedList,
fetchCollectionItems,
doToggleShuffleList,
lastUsedCollection,
hasClaimInLastUsedCollection,
lastUsedCollectionIsNotBuiltin,
} = props;
const [doShuffle, setDoShuffle] = React.useState(false);
const incognitoClaim = contentChannelUri && !contentChannelUri.includes('@');
@@ -365,22 +359,6 @@ function ClaimMenuList(props: Props) {
{__('Add to Lists')}
</div>
</MenuItem>
{lastUsedCollection && lastUsedCollectionIsNotBuiltin && (
<MenuItem
className="comment__menu-option"
onSelect={() =>
handleAdd(hasClaimInLastUsedCollection, lastUsedCollection.name, lastUsedCollection.id)
}
>
<div className="menu__link">
{!hasClaimInLastUsedCollection && <Icon aria-hidden icon={ICONS.ADD} />}
{hasClaimInLastUsedCollection && <Icon aria-hidden icon={ICONS.DELETE} />}
{!hasClaimInLastUsedCollection &&
__('Add to %collection%', { collection: lastUsedCollection.name })}
{hasClaimInLastUsedCollection && __('In %collection%', { collection: lastUsedCollection.name })}
</div>
</MenuItem>
)}
<hr className="menu__separator" />
</>
)
+2
View File
@@ -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) => ({
+3 -1
View File
@@ -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, {
+2 -1
View File
@@ -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) => ({
+2 -1
View File
@@ -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) => ({
+2 -1
View File
@@ -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
View File
@@ -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) => ({
+113 -128
View File
@@ -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;
+7 -1
View File
@@ -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) => ({
-9
View File
@@ -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>
+2 -1
View File
@@ -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) => ({
+2 -1
View File
@@ -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),
+2 -1
View File
@@ -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 -1
View File
@@ -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) => ({
+2 -1
View File
@@ -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),
});
-1
View File
@@ -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';
+1 -2
View File
@@ -36,10 +36,9 @@ export const ORDER_BY_NEW_VALUE = ['release_time'];
export const ORDER_BY_TYPES = [ORDER_BY_TRENDING, ORDER_BY_NEW, ORDER_BY_TOP];
export const DURATION_SHORT = 'short';
export const DURATION_MEDIUM = 'medium';
export const DURATION_LONG = 'long';
export const DURATION_ALL = 'all';
export const DURATION_TYPES = [DURATION_ALL, DURATION_SHORT, DURATION_MEDIUM, DURATION_LONG];
export const DURATION_TYPES = [DURATION_ALL, DURATION_SHORT, DURATION_LONG];
export const SORT_BY = {
// key: Enumeration; can be anything as long as unique. Also used as URLParam.
-1
View File
@@ -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',
-17
View File
@@ -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)));
});
+6 -6
View File
@@ -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);
+5 -3
View File
@@ -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>
);
+2 -1
View File
@@ -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
View File
@@ -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);
};
}
+1 -4
View File
@@ -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()));
};
}
-9
View File
@@ -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 {
-10
View File
@@ -26,7 +26,6 @@ const defaultState: CollectionState = {
},
resolved: {},
unpublished: {}, // sync
lastUsedCollection: undefined,
edited: {},
pending: {},
saved: [],
@@ -54,17 +53,14 @@ const collectionsReducer = handleActions(
return {
...state,
unpublished: newLists,
lastUsedCollection: params.id,
};
},
[ACTIONS.COLLECTION_DELETE]: (state, action) => {
const { lastUsedCollection } = state;
const { id, collectionKey } = action.data;
const { edited: editList, unpublished: unpublishedList, pending: pendingList } = state;
const newEditList = Object.assign({}, editList);
const newUnpublishedList = Object.assign({}, unpublishedList);
const isDeletingLastUsedCollection = lastUsedCollection === id;
const newPendingList = Object.assign({}, pendingList);
@@ -74,7 +70,6 @@ const collectionsReducer = handleActions(
return {
...state,
[collectionKey]: newList,
lastUsedCollection: isDeletingLastUsedCollection ? undefined : lastUsedCollection,
};
} else {
if (newEditList[id]) {
@@ -90,7 +85,6 @@ const collectionsReducer = handleActions(
edited: newEditList,
unpublished: newUnpublishedList,
pending: newPendingList,
lastUsedCollection: isDeletingLastUsedCollection ? undefined : lastUsedCollection,
};
},
@@ -118,7 +112,6 @@ const collectionsReducer = handleActions(
edited: newEditList,
unpublished: newUnpublishedList,
pending: newPendingList,
lastUsedCollection: claimId,
};
},
@@ -130,7 +123,6 @@ const collectionsReducer = handleActions(
return {
...state,
[collectionKey]: { ...lists, [id]: collection },
lastUsedCollection: id,
};
}
@@ -139,14 +131,12 @@ const collectionsReducer = handleActions(
return {
...state,
edited: { ...lists, [id]: collection },
lastUsedCollection: id,
};
}
const { unpublished: lists } = state;
return {
...state,
unpublished: { ...lists, [id]: collection },
lastUsedCollection: id,
};
},
+2 -2
View File
@@ -89,7 +89,7 @@ export default handleActions(
newCommentIds.unshift(comment.comment_id);
byId[claimId] = newCommentIds;
if (totalCommentsById.hasOwnProperty(claimId)) {
if (totalCommentsById[claimId]) {
totalCommentsById[claimId] += 1;
}
@@ -562,7 +562,7 @@ export default handleActions(
}
}
if (totalCommentsById.hasOwnProperty(claimId)) {
if (totalCommentsById[claimId]) {
totalCommentsById[claimId] = Math.max(0, totalCommentsById[claimId] - 1);
}
-7
View File
@@ -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);
-2
View File
@@ -17,8 +17,6 @@ export const selectMyEditedCollections = createSelector(selectState, (state) =>
export const selectPendingCollections = createSelector(selectState, (state) => state.pending);
export const selectLastUsedCollection = createSelector(selectState, (state) => state.lastUsedCollection);
export const makeSelectEditedCollectionForId = (id: string) =>
createSelector(selectMyEditedCollections, (eLists) => eLists[id]);
-2
View File
@@ -83,5 +83,3 @@ export const selectHomepageData = createSelector(
);
export const selectosNotificationsEnabled = makeSelectClientSetting(SETTINGS.OS_NOTIFICATIONS_ENABLED);
export const selectDisableAutoUpdates = makeSelectClientSetting(SETTINGS.DISABLE_AUTO_UPDATES);
-65
View File
@@ -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,
});
});
});
};
-5
View File
@@ -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
}
+592 -1033
View File
File diff suppressed because it is too large. Load diff