diff --git a/.travis.yml b/.travis.yml
index 739fa6bbe..5a0c97194 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -50,7 +50,7 @@ addons:
artifacts:
working_dir: dist
paths:
- - $(git ls-files -o dist/{*.dmg,*.exe,*.deb} | tr "\n" ":")
+ - $(git ls-files -o dist/{*.dmg,*.exe,*.deb,*.AppImage} | tr "\n" ":")
target_paths:
- '/app/build-${TRAVIS_BUILD_NUMBER}_commit-${TRAVIS_COMMIT:0:7}$([ ! -z ${TRAVIS_TAG}
] && echo _tag-${TRAVIS_TAG})'
diff --git a/electron-builder.json b/electron-builder.json
index 0c08881c2..c1580016f 100644
--- a/electron-builder.json
+++ b/electron-builder.json
@@ -73,7 +73,7 @@
}
],
"linux": {
- "target": "deb",
+ "target": ["AppImage", "deb"],
"executableName": "lbry",
"category": "AudioVideo;Video",
"desktop": {
diff --git a/electron/index.js b/electron/index.js
index 026a42672..6851f2047 100644
--- a/electron/index.js
+++ b/electron/index.js
@@ -318,17 +318,14 @@ ipcMain.on('version-info-requested', () => {
requestLatestRelease();
});
-
+// In a few months, we can remove the keytar dependency and below calls once
+// enough users have moved over to cookies
ipcMain.on('get-auth-token', event => {
keytar.getPassword('LBRY', 'auth_token').then(token => {
event.sender.send('auth-token-response', token ? token.toString().trim() : null);
});
});
-ipcMain.on('set-auth-token', (event, token) => {
- keytar.setPassword('LBRY', 'auth_token', token ? token.toString().trim() : null);
-});
-
ipcMain.on('delete-auth-token', (event, password) => {
keytar.deletePassword('LBRY', 'auth_token', password).then(res => {
event.sender.send('delete-auth-token-response', res);
diff --git a/ui/index.jsx b/ui/index.jsx
index 352857200..f0fe7fe2b 100644
--- a/ui/index.jsx
+++ b/ui/index.jsx
@@ -109,10 +109,6 @@ Lbryio.setOverride(
authToken = response.auth_token;
setAuthToken(authToken);
- // @if TARGET='app'
- ipcRenderer.send('set-auth-token', authToken);
- // @endif
-
resolve(authToken);
});
})
@@ -123,6 +119,10 @@ Lbryio.setOverride(
() =>
new Promise(resolve => {
// @if TARGET='app'
+ // NEED TO DO SOMETHING HERE TO CHECK FOR A COOKIE AUTH TOKEN.
+ // IF IT EXISTS, SKIP AND CONTINUE BELOW THE @ENDIF
+ // IF NOT, COPY THE KEYTAR AUTH TOKEN AND PASSWORD TO THE COOKIE (SetAuthToken/SetPassword?)
+ // AND THEN DELETE KEYTAR ONE (Or leave for now?)
if (authToken) {
resolve(authToken);
}
@@ -135,7 +135,6 @@ Lbryio.setOverride(
ipcRenderer.send('get-auth-token');
// @endif
- // @if TARGET='web'
const authTokenToReturn = authToken || getAuthToken();
if (authTokenToReturn !== null) {
@@ -143,7 +142,6 @@ Lbryio.setOverride(
}
resolve(authTokenToReturn);
- // @endif
})
);
@@ -245,7 +243,7 @@ function AppWrapper() {
console.error(error.message); // eslint-disable-line no-console
});
- if (['win32', 'darwin'].includes(process.platform)) {
+ if (['win32', 'darwin'].includes(process.platform) || !!process.env.APPIMAGE) {
autoUpdater.on('update-available', () => {
console.log('Update available'); // eslint-disable-line no-console
});
diff --git a/ui/modal/modalDownloading/view.jsx b/ui/modal/modalDownloading/view.jsx
index c5fab6262..1629f25a6 100644
--- a/ui/modal/modalDownloading/view.jsx
+++ b/ui/modal/modalDownloading/view.jsx
@@ -33,6 +33,12 @@ class ModalDownloading extends React.PureComponent {
sudo dpkg -i {downloadItem}
{__('After the install is complete, please reopen the app.')}
+
+ {__('Note: You can also install the AppImage version for streamlined updates.')}{' '}
+
+
+
+
) : null}
diff --git a/ui/page/help/view.jsx b/ui/page/help/view.jsx
index 02c0e6bdd..85efa8dd3 100644
--- a/ui/page/help/view.jsx
+++ b/ui/page/help/view.jsx
@@ -111,6 +111,9 @@ class HelpPage extends React.PureComponent {
platform = `${osName} ${ver.os_release}`;
newVerLink = 'https://lbry.com/get/lbry.dmg';
+ } else if (process.env.APPIMAGE !== undefined) {
+ platform = `Linux (AppImage)`;
+ newVerLink = 'https://lbry.com/get/lbry.AppImage';
} else if (ver.os_system === 'Linux') {
platform = `Linux (${ver.platform})`;
newVerLink = 'https://lbry.com/get/lbry.deb';
diff --git a/ui/page/settings/view.jsx b/ui/page/settings/view.jsx
index 9390bd3a8..05c3778f7 100644
--- a/ui/page/settings/view.jsx
+++ b/ui/page/settings/view.jsx
@@ -103,7 +103,7 @@ class SettingsPage extends React.PureComponent {
componentDidMount() {
const { isAuthenticated } = this.props;
- if (isAuthenticated) {
+ if (isAuthenticated || !IS_WEB) {
this.props.updateWalletStatus();
getKeychainPassword().then(p => {
if (typeof p === 'string') {
@@ -416,7 +416,7 @@ class SettingsPage extends React.PureComponent {
}
/>
- {isAuthenticated && (
+ {(isAuthenticated || !IS_WEB) && (
{
- if (['win32', 'darwin'].includes(process.platform)) {
+ if (['win32', 'darwin'].includes(process.platform) || !!process.env.APPIMAGE) {
// electron-updater behavior
dispatch(doOpenModal(MODALS.AUTO_UPDATE_DOWNLOADED));
} else {
@@ -204,8 +204,8 @@ export function doCheckUpgradeAvailable() {
type: ACTIONS.CHECK_UPGRADE_START,
});
- if (['win32', 'darwin'].includes(process.platform)) {
- // On Windows and Mac, updates happen silently through
+ if (['win32', 'darwin'].includes(process.platform) || !!process.env.APPIMAGE) {
+ // On Windows, Mac, and AppImage, updates happen silently through
// electron-updater.
const autoUpdateDeclined = selectAutoUpdateDeclined(state);
diff --git a/ui/util/saved-passwords.js b/ui/util/saved-passwords.js
index 54e511608..809a8ac6d 100644
--- a/ui/util/saved-passwords.js
+++ b/ui/util/saved-passwords.js
@@ -3,6 +3,7 @@ import { ipcRenderer } from 'electron';
import { DOMAIN } from 'config';
const isProduction = process.env.NODE_ENV === 'production';
+const maxExpiration = 2147483647;
let sessionPassword;
function setCookie(name: string, value: string, days: number) {
@@ -10,7 +11,8 @@ function setCookie(name: string, value: string, days: number) {
if (days) {
let date = new Date();
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
- expires = `expires=${date.toUTCString()};`;
+ // If on PC, set to not expire (max)
+ expires = `expires=${IS_WEB ? date.toUTCString() : maxExpiration};`;
}
let cookie = `${name}=${value || ''}; ${expires} path=/; SameSite=Lax;`;
@@ -49,23 +51,12 @@ function deleteCookie(name: string) {
export const setSavedPassword = (value?: string, saveToDisk: boolean) => {
return new Promise<*>(resolve => {
- // @if TARGET='app'
- ipcRenderer.once('set-password-response', (event, success) => {
- resolve(success);
- });
- // @endif
-
const password = value === undefined || value === null ? '' : value;
sessionPassword = password;
if (saveToDisk) {
if (password) {
- // @if TARGET='app'
- ipcRenderer.send('set-password', password);
- // @endif
- // @if TARGET='web'
setCookie('saved-password', password, 14);
- // @endif
} else {
deleteSavedPassword();
}
@@ -85,32 +76,28 @@ export const getSavedPassword = () => {
export const getKeychainPassword = () => {
return new Promise<*>(resolve => {
- // @if TARGET='app'
- ipcRenderer.once('get-password-response', (event, password) => {
- resolve(password);
- });
- ipcRenderer.send('get-password');
- // @endif
-
- // @if TARGET='web'
const password = getCookie('saved-password');
- resolve(password);
+ if (password) {
+ resolve(password);
+ }
+ // We can remove this when we remove keytar
+ else {
+ ipcRenderer.once('get-password-response', (event, password) => {
+ resolve(password);
+ });
+ ipcRenderer.send('get-password');
+ }
+
+ // @if TARGET='app'
+
// @endif
});
};
export const deleteSavedPassword = () => {
return new Promise<*>(resolve => {
- // @if TARGET='app'
- ipcRenderer.once('delete-password-response', (event, success) => {
- resolve();
- });
- ipcRenderer.send('delete-password');
- // @endif;
- // @if TARGET='web'
deleteCookie('saved-password');
resolve();
- // @endif
});
};
@@ -125,17 +112,7 @@ export const setAuthToken = (value: string) => {
export const deleteAuthToken = () => {
return new Promise<*>(resolve => {
deleteCookie('auth_token');
-
- // @if TARGET='app'
- ipcRenderer.once('delete-auth-token-response', (event, success) => {
- resolve();
- });
- ipcRenderer.send('delete-auth-token');
- // @endif;
-
- // @if TARGET='web'
resolve();
- // @endif
});
};
@@ -143,17 +120,7 @@ export const doSignOutCleanup = () => {
return new Promise<*>(resolve => {
deleteCookie('auth_token');
deleteCookie('saved-password');
-
- // @if TARGET='app'
- ipcRenderer.once('delete-auth-token-response', (event, success) => {
- resolve();
- });
- ipcRenderer.send('delete-auth-token');
- // @endif;
-
- // @if TARGET='web'
resolve();
- // @endif
});
};