Skip to content
This repository has been archived by the owner on Apr 29, 2022. It is now read-only.

Commit

Permalink
Add support for AppImageLauncher (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
quanglam2807 authored Sep 4, 2020
1 parent 489c648 commit d5c7194
Show file tree
Hide file tree
Showing 14 changed files with 114 additions and 195 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"cross-env": "7.0.2",
"del": "5.1.0",
"dotenv": "8.2.0",
"electron": "8.5.0",
"electron": "8.5.1",
"electron-builder": "22.8.1",
"electron-notarize": "1.0.0",
"eslint": "6.8.0",
Expand Down
43 changes: 1 addition & 42 deletions public/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ const {
Tray,
app,
clipboard,
dialog,
globalShortcut,
ipcMain,
nativeImage,
nativeTheme,
shell,
} = require('electron');
const fs = require('fs');
const settings = require('electron-settings');
Expand Down Expand Up @@ -143,26 +141,6 @@ if (!gotTheLock) {
{
label: getLocale('checkForUpdates'),
click: () => {
// https://github.com/atomery/webcatalog/issues/634
// https://github.com/electron-userland/electron-builder/issues/4046
// disable updater if user is using AppImageLauncher
if (process.platform === 'linux' && process.env.DESKTOPINTEGRATION === 'AppImageLauncher') {
dialog.showMessageBox(mainWindow, {
type: 'error',
message: getLocale('appImageLauncherDesc'),
buttons: [getLocale('learnMore'), getLocale('goToWebsite'), getLocale('ok')],
cancelId: 2,
defaultId: 2,
}).then(({ response }) => {
if (response === 0) {
shell.openExternal('https://github.com/electron-userland/electron-builder/issues/4046');
} else if (response === 1) {
shell.openExternal('http://translatiumapp.com/');
}
}).catch(console.log); // eslint-disable-line
return;
}

global.updateSilent = false;
autoUpdater.checkForUpdates();
},
Expand Down Expand Up @@ -308,26 +286,7 @@ if (!gotTheLock) {
});

if (autoUpdater.isUpdaterActive()) {
// https://github.com/atomery/webcatalog/issues/634
// https://github.com/electron-userland/electron-builder/issues/4046
// disable updater if user is using AppImageLauncher
if (process.platform === 'linux' && process.env.DESKTOPINTEGRATION === 'AppImageLauncher') {
dialog.showMessageBox(mainWindow, {
type: 'error',
message: getLocale('appImageLauncherDesc'),
buttons: [getLocale('learnMore'), getLocale('goToWebsite'), getLocale('ok')],
cancelId: 2,
defaultId: 2,
}).then(({ response }) => {
if (response === 0) {
shell.openExternal('https://github.com/electron-userland/electron-builder/issues/4046');
} else if (response === 1) {
shell.openExternal('http://translatiumapp.com/');
}
}).catch(console.log); // eslint-disable-line
} else {
autoUpdater.checkForUpdates();
}
autoUpdater.checkForUpdates();
}
});

Expand Down
21 changes: 0 additions & 21 deletions public/libs/create-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const {
Menu,
app,
shell,
dialog,
} = require('electron');
const { autoUpdater } = require('electron-updater');

Expand All @@ -28,26 +27,6 @@ const createMenu = () => {
});
}

// https://github.com/atomery/webcatalog/issues/634
// https://github.com/electron-userland/electron-builder/issues/4046
// disable updater if user is using AppImageLauncher
if (process.platform === 'linux' && process.env.DESKTOPINTEGRATION === 'AppImageLauncher') {
dialog.showMessageBox({
type: 'error',
message: getLocale('appImageLauncherDesc'),
buttons: [getLocale('learnMore'), getLocale('goToWebsite'), getLocale('ok')],
cancelId: 2,
defaultId: 2,
}).then(({ response }) => {
if (response === 0) {
shell.openExternal('https://github.com/electron-userland/electron-builder/issues/4046');
} else if (response === 1) {
shell.openExternal('http://translatiumapp.com/');
}
}).catch(console.log); // eslint-disable-line
return;
}

global.updateSilent = false;
autoUpdater.checkForUpdates();
};
Expand Down
3 changes: 0 additions & 3 deletions public/libs/locales/de/ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,6 @@
"history": "Verlauf",
"historyDesc": "Hier zuvor übersetzte Wörter und Redewendungen anzeigen.",
"clearHistory": "Verlauf löschen",
"appImageLauncherDesc": "Updater ist mit AppImageLauncher nicht kompatibel. Bitte laden Sie neue Updates manuell von unserer Website herunter.",
"goToWebsite": "Zur Website",
"learnMore": "Weitere Informationen",
"reset": "Zurücksetzen",
"restorePreferencesToDefault": "Einstellungen auf ihre ursprünglichen Standardwerte zurücksetzen"
}
3 changes: 0 additions & 3 deletions public/libs/locales/en/ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,6 @@
"history": "History",
"historyDesc": "View previously translated words and phrases here.",
"clearHistory": "Clear history",
"appImageLauncherDesc": "Updater is incompatible with AppImageLauncher. Please download new updates manually from our website.",
"goToWebsite": "Go to Website",
"learnMore": "Learn more",
"reset": "Reset",
"restorePreferencesToDefault": "Restore preferences to their original defaults"
}
3 changes: 0 additions & 3 deletions public/libs/locales/es-ES/ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,6 @@
"history": "Historial",
"historyDesc": "Vea aquí las palabras y frases traducidas anteriormente.",
"clearHistory": "Borrar historial",
"appImageLauncherDesc": "El actualizador es incompatible con AppImageLauncher. Descargue las nuevas actualizaciones manualmente desde nuestro sitio web.",
"goToWebsite": "Ir al sitio web",
"learnMore": "Más información",
"reset": "Restablecer",
"restorePreferencesToDefault": "Restaurar las preferencias a sus valores predeterminados originales"
}
3 changes: 0 additions & 3 deletions public/libs/locales/fr/ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,6 @@
"history": "Historique",
"historyDesc": "Consultez les mots et phrases précédemment traduits ici.",
"clearHistory": "Effacer l'historique",
"appImageLauncherDesc": "La mise à jour est incompatible avec AppImageLauncher. Veuillez télécharger les nouvelles mises à jour manuellement à partir de notre site Web.",
"goToWebsite": "Aller au site web",
"learnMore": "En savoir plus",
"reset": "Réinitialiser",
"restorePreferencesToDefault": "Restaurer les préférences à leurs valeurs par défaut"
}
3 changes: 0 additions & 3 deletions public/libs/locales/it/ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,6 @@
"history": "Cronologia",
"historyDesc": "Visualizzare qui parole e frasi tradotte in precedenza.",
"clearHistory": "Cancellare cronologia",
"appImageLauncherDesc": "Il programma di aggiornamento è incompatibile con AppImageLauncher. Scaricare manualmente i nuovi aggiornamenti dal nostro sito web.",
"goToWebsite": "Andare al sito web",
"learnMore": "Maggiori informazioni",
"reset": "Reimpostare",
"restorePreferencesToDefault": "Ripristinare le preferenze ai valori predefiniti originali"
}
3 changes: 0 additions & 3 deletions public/libs/locales/ko/ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,6 @@
"history": "기록",
"historyDesc": "이전에 번역된 단어와 구를 여기서 보세요..",
"clearHistory": "기록 지우기",
"appImageLauncherDesc": "업데이트 프로그램이 AppImageLauncher와 호환되지 않습니다. 당사 웹사이트에서 수동으로 새 업데이트를 다운로드하세요.",
"goToWebsite": "웹사이트로 이동",
"learnMore": "자세히 알아보기",
"reset": "재설정",
"restorePreferencesToDefault": "기본 설정을 원래 기본값으로 복원"
}
3 changes: 0 additions & 3 deletions public/libs/locales/ru/ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,6 @@
"history": "Журнал",
"historyDesc": "Здесь можно посмотреть ранее переведенные слова и фразы.",
"clearHistory": "Очистить журнал",
"appImageLauncherDesc": "Программа обновления несовместима с AppImageLauncher. Ззагрузите обновления вручную с нашего веб-сайта.",
"goToWebsite": "Перейти на веб-сайт",
"learnMore": "Подробнее",
"reset": "Сброс настроек",
"restorePreferencesToDefault": "Восстановить настройки по умолчанию"
}
3 changes: 0 additions & 3 deletions public/libs/locales/vi/ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,6 @@
"history": "Lịch sử",
"historyDesc": "Xem các từ và cụm từ đã dịch trong quá khứ tại đây.",
"clearHistory": "Xóa lịch sử",
"appImageLauncherDesc": "Trình cập nhật không tương thích với AppImageLauncher. Vui lòng tải cập nhật mới từ trang web của chúng tôi.",
"goToWebsite": "Đi đến Trang web",
"learnMore": "Tìm hiểu thêm",
"reset": "Thiết đặt lại",
"restorePreferencesToDefault": "Khôi phục tùy chọn về trạng thái ban đầu"
}
3 changes: 0 additions & 3 deletions public/libs/locales/zh-CN/ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,6 @@
"history": "历史记录",
"historyDesc": "在此处查看先前翻译的单词和短语。",
"clearHistory": "清除历史记录",
"appImageLauncherDesc": "更新程序与 AppImageLauncher 不兼容。请手动从我们的网站下载新的更新。",
"goToWebsite": "转到网站",
"learnMore": "了解更多信息",
"reset": "重置",
"restorePreferencesToDefault": "将首选项恢复为原始默认值"
}
8 changes: 8 additions & 0 deletions public/libs/updater.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ autoUpdater.on('update-cancelled', () => {
});

autoUpdater.on('update-downloaded', (info) => {
// workaround for AppImageLauncher
// https://github.com/atomery/webcatalog/issues/634
// https://github.com/electron-userland/electron-builder/issues/4046
// https://github.com/electron-userland/electron-builder/issues/4046#issuecomment-670367840
if (process.env.DESKTOPINTEGRATION === 'AppImageLauncher') {
process.env.APPIMAGE = process.env.ARGV0;
}

global.updaterObj = {
status: 'update-downloaded',
info,
Expand Down
Loading

0 comments on commit d5c7194

Please sign in to comment.