mirror of
https://github.com/element-hq/element-desktop.git
synced 2026-01-03 21:18:12 -05:00
Compare commits
44 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf5e1eb4d4 | ||
|
|
dd494103de | ||
|
|
8a1a315938 | ||
|
|
5958166348 | ||
|
|
767445e6f6 | ||
|
|
99a3a132b3 | ||
|
|
1b1c869419 | ||
|
|
b67d48d661 | ||
|
|
922bed58ab | ||
|
|
7f28e3f1e2 | ||
|
|
2fca2151b9 | ||
|
|
303a3d46f5 | ||
|
|
8de0368c7c | ||
|
|
950657a364 | ||
|
|
bc0f370821 | ||
|
|
1455687384 | ||
|
|
3efed87d38 | ||
|
|
0c43287f98 | ||
|
|
c539f603dc | ||
|
|
b2d00f6605 | ||
|
|
27bce3b92b | ||
|
|
439ea006bf | ||
|
|
315a2107d3 | ||
|
|
43527fb609 | ||
|
|
3c946967ce | ||
|
|
0a17382901 | ||
|
|
d3508f3039 | ||
|
|
0f6f947254 | ||
|
|
bebed00200 | ||
|
|
40a248a275 | ||
|
|
c86ad29b3d | ||
|
|
8ade746fec | ||
|
|
2733b2ad11 | ||
|
|
d74631a555 | ||
|
|
944bb3c717 | ||
|
|
7fad439078 | ||
|
|
f98d1672af | ||
|
|
debeef6ee6 | ||
|
|
b216eca07a | ||
|
|
5ad645f024 | ||
|
|
75b41d65c1 | ||
|
|
cc5dc4d801 | ||
|
|
c4aeaadfbd | ||
|
|
b5fdeddec3 |
13
.eslintrc.js
13
.eslintrc.js
@@ -1,6 +1,12 @@
|
||||
module.exports = {
|
||||
plugins: [
|
||||
"matrix-org",
|
||||
],
|
||||
extends: [
|
||||
"plugin:matrix-org/javascript",
|
||||
],
|
||||
parserOptions: {
|
||||
ecmaVersion: 8,
|
||||
ecmaVersion: 2021,
|
||||
},
|
||||
env: {
|
||||
es6: true,
|
||||
@@ -8,12 +14,7 @@ module.exports = {
|
||||
// we also have some browser code (ie. the preload script)
|
||||
browser: true,
|
||||
},
|
||||
extends: ["matrix-org"],
|
||||
rules: {
|
||||
// js-sdk uses a babel rule which we can't use because we
|
||||
// don't use babel, so remove it & put the original back
|
||||
"babel/no-invalid-this": "off",
|
||||
"no-invalid-this": "error",
|
||||
"quotes": "off",
|
||||
"indent": "off",
|
||||
"prefer-promise-reject-errors": "off",
|
||||
|
||||
47
CHANGELOG.md
47
CHANGELOG.md
@@ -1,3 +1,50 @@
|
||||
Changes in [1.7.30](https://github.com/vector-im/element-desktop/releases/tag/v1.7.30) (2021-06-07)
|
||||
===================================================================================================
|
||||
[Full Changelog](https://github.com/vector-im/element-desktop/compare/v1.7.30-rc.1...v1.7.30)
|
||||
|
||||
* No changes since rc.1
|
||||
|
||||
Changes in [1.7.30-rc.1](https://github.com/vector-im/element-desktop/releases/tag/v1.7.30-rc.1) (2021-06-01)
|
||||
=============================================================================================================
|
||||
[Full Changelog](https://github.com/vector-im/element-desktop/compare/v1.7.29...v1.7.30-rc.1)
|
||||
|
||||
* Translations update from Weblate
|
||||
[\#199](https://github.com/vector-im/element-desktop/pull/199)
|
||||
* Migrate to `eslint-plugin-matrix-org`
|
||||
[\#197](https://github.com/vector-im/element-desktop/pull/197)
|
||||
* Upgrade to Electron 12.0.9
|
||||
[\#198](https://github.com/vector-im/element-desktop/pull/198)
|
||||
|
||||
Changes in [1.7.29](https://github.com/vector-im/element-desktop/releases/tag/v1.7.29) (2021-05-24)
|
||||
===================================================================================================
|
||||
[Full Changelog](https://github.com/vector-im/element-desktop/compare/v1.7.29-rc.1...v1.7.29)
|
||||
|
||||
* No changes since rc.1
|
||||
|
||||
Changes in [1.7.29-rc.1](https://github.com/vector-im/element-desktop/releases/tag/v1.7.29-rc.1) (2021-05-19)
|
||||
=============================================================================================================
|
||||
[Full Changelog](https://github.com/vector-im/element-desktop/compare/v1.7.28...v1.7.29-rc.1)
|
||||
|
||||
* Translations update from Weblate
|
||||
[\#196](https://github.com/vector-im/element-desktop/pull/196)
|
||||
* Translations update from Weblate
|
||||
[\#195](https://github.com/vector-im/element-desktop/pull/195)
|
||||
|
||||
Changes in [1.7.28](https://github.com/vector-im/element-desktop/releases/tag/v1.7.28) (2021-05-17)
|
||||
===================================================================================================
|
||||
[Full Changelog](https://github.com/vector-im/element-desktop/compare/v1.7.28-rc.1...v1.7.28)
|
||||
|
||||
* No changes since rc.1
|
||||
|
||||
Changes in [1.7.28-rc.1](https://github.com/vector-im/element-desktop/releases/tag/v1.7.28-rc.1) (2021-05-11)
|
||||
=============================================================================================================
|
||||
[Full Changelog](https://github.com/vector-im/element-desktop/compare/v1.7.27...v1.7.28-rc.1)
|
||||
|
||||
* Add Windows native module requirements
|
||||
[\#190](https://github.com/vector-im/element-desktop/pull/190)
|
||||
* Prevent black screen when closing window while in full screen mode on macOS
|
||||
[\#192](https://github.com/vector-im/element-desktop/pull/192)
|
||||
|
||||
Changes in [1.7.27](https://github.com/vector-im/element-desktop/releases/tag/v1.7.27) (2021-05-10)
|
||||
===================================================================================================
|
||||
[Full Changelog](https://github.com/vector-im/element-desktop/compare/v1.7.27-rc.1...v1.7.27)
|
||||
|
||||
@@ -65,7 +65,7 @@ yarn run build:native
|
||||
```
|
||||
|
||||
On Windows, this will automatically determine the architecture to build for based
|
||||
on the environment (ie. set up by vcvarsall.bat).
|
||||
on the environment. Make sure that you have all the [tools required to perform the native modules build](docs/windows-requirements.md)
|
||||
|
||||
Now you can build the package:
|
||||
|
||||
|
||||
26
docs/windows-requirements.md
Normal file
26
docs/windows-requirements.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# Windows
|
||||
|
||||
## Requirements to build native modules
|
||||
|
||||
If you want to build native modules, make sure that the following tools are installed on your system.
|
||||
|
||||
- [Node 14](https://nodejs.org)
|
||||
- [Python 3](https://www.python.org/downloads/)
|
||||
- [Strawberry Perl](https://strawberryperl.com/)
|
||||
- [Rust](https://rustup.rs/)
|
||||
- [Build Tools for Visual Studio 2019](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019) with the following configuration:
|
||||
- On the Workloads tab:
|
||||
- Desktop & Mobile -> C++ build tools
|
||||
- On the Individual components tab:
|
||||
- MSVC VS 2019 C++ build tools
|
||||
- Windows 10 SDK (latest version available)
|
||||
- C++ CMake tools for Windows
|
||||
|
||||
Once installed make sure all those utilities are accessible in your `PATH`.
|
||||
In order to load all the C++ utilities installed by Visual Studio you can run the following in a terminal window.
|
||||
|
||||
```
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
|
||||
```
|
||||
|
||||
You can replace `amd64` with `x86` depending on your CPU architecture.
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "element-desktop",
|
||||
"productName": "Element",
|
||||
"main": "src/electron-main.js",
|
||||
"version": "1.7.27",
|
||||
"version": "1.7.30",
|
||||
"description": "A feature-rich client for Matrix.org",
|
||||
"author": "Element",
|
||||
"repository": {
|
||||
@@ -47,8 +47,9 @@
|
||||
"electron-builder-squirrel-windows": "22.10.5",
|
||||
"electron-devtools-installer": "^3.1.1",
|
||||
"electron-notarize": "^1.0.0",
|
||||
"eslint": "7.3.1",
|
||||
"eslint-config-matrix-org": "^0.1.2",
|
||||
"eslint": "7.18.0",
|
||||
"eslint-config-google": "^0.14.0",
|
||||
"eslint-plugin-matrix-org": "github:matrix-org/eslint-plugin-matrix-org#main",
|
||||
"find-npm-prefix": "^1.0.2",
|
||||
"fs-extra": "^8.1.0",
|
||||
"glob": "^7.1.6",
|
||||
@@ -67,7 +68,7 @@
|
||||
},
|
||||
"build": {
|
||||
"appId": "im.riot.app",
|
||||
"electronVersion": "12.0.2",
|
||||
"electronVersion": "12.0.9",
|
||||
"files": [
|
||||
"package.json",
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ const PUB_KEY_URL = "https://packages.riot.im/element-release-key.asc";
|
||||
const PACKAGE_URL_PREFIX = "https://github.com/vector-im/element-web/releases/download/";
|
||||
const ASAR_PATH = 'webapp.asar';
|
||||
|
||||
const {setPackageVersion} = require('./set-version.js');
|
||||
const { setPackageVersion } = require('./set-version.js');
|
||||
|
||||
async function getLatestDevelopUrl(bkToken) {
|
||||
const buildsResult = await needle('get',
|
||||
|
||||
@@ -37,7 +37,7 @@ async function fetch(hakEnv, moduleInfo) {
|
||||
if (haveModuleBuildDir) return;
|
||||
|
||||
await new Promise((resolve) => {
|
||||
npm.load({'loglevel': 'silent'}, resolve);
|
||||
npm.load({ 'loglevel': 'silent' }, resolve);
|
||||
});
|
||||
|
||||
console.log("Fetching " + moduleInfo.name + " at version " + moduleInfo.version);
|
||||
|
||||
@@ -52,4 +52,4 @@ if (require.main === module) {
|
||||
main(process.argv.slice(2)).then((ret) => process.exit(ret));
|
||||
}
|
||||
|
||||
module.exports = {versionFromAsar, setPackageVersion};
|
||||
module.exports = { versionFromAsar, setPackageVersion };
|
||||
|
||||
@@ -24,7 +24,7 @@ const checkSquirrelHooks = require('./squirrelhooks');
|
||||
if (checkSquirrelHooks()) return;
|
||||
|
||||
const argv = require('minimist')(process.argv, {
|
||||
alias: {help: "h"},
|
||||
alias: { help: "h" },
|
||||
});
|
||||
|
||||
const {
|
||||
@@ -37,7 +37,7 @@ const tray = require('./tray');
|
||||
const buildMenuTemplate = require('./vectormenu');
|
||||
const webContentsHandler = require('./webcontents-handler');
|
||||
const updater = require('./updater');
|
||||
const {getProfileFromDeeplink, protocolInit, recordSSOSession} = require('./protocol');
|
||||
const { getProfileFromDeeplink, protocolInit, recordSSOSession } = require('./protocol');
|
||||
|
||||
const windowStateKeeper = require('electron-window-state');
|
||||
const Store = require('electron-store');
|
||||
@@ -499,7 +499,6 @@ ipcMain.on('ipcCall', async function(ev, payload) {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
const seshatDefaultPassphrase = "DEFAULT_PASSPHRASE";
|
||||
async function getOrCreatePassphrase(key) {
|
||||
if (keytar) {
|
||||
@@ -551,8 +550,8 @@ ipcMain.on('seshat', async function(ev, payload) {
|
||||
const passphrase = await getOrCreatePassphrase(passphraseKey);
|
||||
|
||||
try {
|
||||
await afs.mkdir(eventStorePath, {recursive: true});
|
||||
eventIndex = new Seshat(eventStorePath, {passphrase});
|
||||
await afs.mkdir(eventStorePath, { recursive: true });
|
||||
eventIndex = new Seshat(eventStorePath, { passphrase });
|
||||
} catch (e) {
|
||||
if (e instanceof ReindexError) {
|
||||
// If this is a reindex error, the index schema
|
||||
@@ -578,7 +577,7 @@ ipcMain.on('seshat', async function(ev, payload) {
|
||||
await recoveryIndex.reindex();
|
||||
}
|
||||
|
||||
eventIndex = new Seshat(eventStorePath, {passphrase});
|
||||
eventIndex = new Seshat(eventStorePath, { passphrase });
|
||||
} else {
|
||||
sendError(payload.id, e);
|
||||
return;
|
||||
@@ -836,17 +835,17 @@ app.on('ready', async () => {
|
||||
|
||||
protocol.registerFileProtocol('vector', (request, callback) => {
|
||||
if (request.method !== 'GET') {
|
||||
callback({error: -322}); // METHOD_NOT_SUPPORTED from chromium/src/net/base/net_error_list.h
|
||||
callback({ error: -322 }); // METHOD_NOT_SUPPORTED from chromium/src/net/base/net_error_list.h
|
||||
return null;
|
||||
}
|
||||
|
||||
const parsedUrl = new URL(request.url);
|
||||
if (parsedUrl.protocol !== 'vector:') {
|
||||
callback({error: -302}); // UNKNOWN_URL_SCHEME
|
||||
callback({ error: -302 }); // UNKNOWN_URL_SCHEME
|
||||
return;
|
||||
}
|
||||
if (parsedUrl.host !== 'vector') {
|
||||
callback({error: -105}); // NAME_NOT_RESOLVED
|
||||
callback({ error: -105 }); // NAME_NOT_RESOLVED
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -854,7 +853,7 @@ app.on('ready', async () => {
|
||||
|
||||
// path starts with a '/'
|
||||
if (target[0] !== '') {
|
||||
callback({error: -6}); // FILE_NOT_FOUND
|
||||
callback({ error: -6 }); // FILE_NOT_FOUND
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -866,7 +865,7 @@ app.on('ready', async () => {
|
||||
if (target[1] === 'webapp') {
|
||||
baseDir = asarPath;
|
||||
} else {
|
||||
callback({error: -6}); // FILE_NOT_FOUND
|
||||
callback({ error: -6 }); // FILE_NOT_FOUND
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -876,7 +875,7 @@ app.on('ready', async () => {
|
||||
|
||||
const relTarget = path.normalize(path.join(...target.slice(2)));
|
||||
if (relTarget.startsWith('..')) {
|
||||
callback({error: -6}); // FILE_NOT_FOUND
|
||||
callback({ error: -6 }); // FILE_NOT_FOUND
|
||||
return;
|
||||
}
|
||||
const absTarget = path.join(baseDir, relTarget);
|
||||
@@ -955,7 +954,15 @@ app.on('ready', async () => {
|
||||
// (this is generally how single-window Mac apps
|
||||
// behave, eg. Mail.app)
|
||||
e.preventDefault();
|
||||
mainWindow.hide();
|
||||
|
||||
if (mainWindow.isFullScreen()) {
|
||||
mainWindow.once('leave-full-screen', () => mainWindow.hide());
|
||||
|
||||
mainWindow.setFullScreen(false);
|
||||
} else {
|
||||
mainWindow.hide();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
12
src/i18n/strings/ar.json
Normal file
12
src/i18n/strings/ar.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"File": "مَلَفّ",
|
||||
"Close": "إغلاق",
|
||||
"Actual Size": "الحَجمُ الفِعلي",
|
||||
"View": "الاِطِّلاع",
|
||||
"Select All": "تَحدِيدُ الكُل",
|
||||
"Delete": "حَذف",
|
||||
"Copy": "نَسخ",
|
||||
"Edit": "تَحرير",
|
||||
"Close Element": "إغلَاقُ Element",
|
||||
"Cancel": "إلغَاء"
|
||||
}
|
||||
46
src/i18n/strings/is.json
Normal file
46
src/i18n/strings/is.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"Add to dictionary": "Bæta við orðabók",
|
||||
"The image failed to save": "Myndin mistóksts að vista",
|
||||
"Failed to save image": "Mistókst að vista mynd",
|
||||
"Save image as...": "Vista mynd sem...",
|
||||
"Copy link address": "Afrita nethlekk",
|
||||
"Copy email address": "Afrita tölvupóstfang",
|
||||
"Copy image": "Afrita mynd",
|
||||
"File": "Skrá",
|
||||
"Bring All to Front": "Koma Öllum að Framan",
|
||||
"Zoom": "Stærð",
|
||||
"Stop Speaking": "Hætta Tal",
|
||||
"Start Speaking": "Byrja Tal",
|
||||
"Speech": "Tal",
|
||||
"Unhide": "Birta",
|
||||
"Hide Others": "Fela Aðra",
|
||||
"Hide": "Fela",
|
||||
"Services": "Þjónustur",
|
||||
"About": "Um",
|
||||
"Element Help": "Element Hjálp",
|
||||
"Help": "Hjálp",
|
||||
"Close": "Loka",
|
||||
"Minimize": "Lágmarka",
|
||||
"Window": "Gluggi",
|
||||
"Toggle Developer Tools": "Skipta Framkvæmdaraðilaverkfæri",
|
||||
"Toggle Full Screen": "Skipta um Fullskjá",
|
||||
"Preferences": "Stillingar",
|
||||
"Zoom Out": "Minnka",
|
||||
"Zoom In": "Stækka",
|
||||
"Actual Size": "Raunveruleg Stærð",
|
||||
"View": "Skoða",
|
||||
"Select All": "Velja Allt",
|
||||
"Delete": "Eyða",
|
||||
"Paste and Match Style": "Líma og Passa Stíl",
|
||||
"Paste": "Líma",
|
||||
"Copy": "Afrita",
|
||||
"Cut": "Klippa",
|
||||
"Redo": "Endurgera",
|
||||
"Undo": "Afturkalla",
|
||||
"Edit": "Breyta",
|
||||
"Quit": "Hætta",
|
||||
"Show/Hide": "Sýna/Fela",
|
||||
"Are you sure you want to quit?": "Ertu viss um að þú viljir hætta?",
|
||||
"Close Element": "Loka Element",
|
||||
"Cancel": "Hætta við"
|
||||
}
|
||||
@@ -40,5 +40,7 @@
|
||||
"Show/Hide": "Mostra/Nascondi",
|
||||
"Are you sure you want to quit?": "Vuoi veramente uscire?",
|
||||
"Close Element": "Chiudi Element",
|
||||
"Cancel": "Annulla"
|
||||
"Cancel": "Annulla",
|
||||
"Stop Speaking": "Smetti di parlare",
|
||||
"Speech": "Dettatura"
|
||||
}
|
||||
|
||||
44
src/i18n/strings/pt_BR.json
Normal file
44
src/i18n/strings/pt_BR.json
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"Add to dictionary": "Adicionar a dicionário",
|
||||
"The image failed to save": "A imagem falhou para salvar",
|
||||
"Failed to save image": "Falha para salvar imagem",
|
||||
"Save image as...": "Salvar imagem como...",
|
||||
"Copy link address": "Copiar endereço de link",
|
||||
"Copy email address": "Copiar endereço de email",
|
||||
"Copy image": "Copiar imagem",
|
||||
"File": "Arquivo",
|
||||
"Zoom": "Zoom",
|
||||
"Stop Speaking": "Parar de Falar",
|
||||
"Start Speaking": "Começar a Falar",
|
||||
"Speech": "Fala",
|
||||
"Unhide": "Desesconder",
|
||||
"Hide": "Esconder",
|
||||
"Services": "Serviços",
|
||||
"About": "Sobre",
|
||||
"Element Help": "Ajuda de Element",
|
||||
"Help": "Ajuda",
|
||||
"Close": "Fechar",
|
||||
"Minimize": "Minimizar",
|
||||
"Window": "Janela",
|
||||
"Toggle Developer Tools": "Ativar/Desativar Ferramentas de Desenvolvimento",
|
||||
"Toggle Full Screen": "Pôr em/Tirar de Tela Cheia",
|
||||
"Preferences": "Preferências",
|
||||
"Zoom Out": "Dar Zoom Out",
|
||||
"Zoom In": "Dar Zoom In",
|
||||
"Actual Size": "Tamanho de Verdade",
|
||||
"View": "Ver",
|
||||
"Select All": "Selecionar Tudo",
|
||||
"Delete": "Deletar",
|
||||
"Paste and Match Style": "Colar e Adequar Estilo",
|
||||
"Paste": "Colar",
|
||||
"Copy": "Copiar",
|
||||
"Cut": "Cortar",
|
||||
"Redo": "Refazer",
|
||||
"Undo": "Desfazer",
|
||||
"Edit": "Editar",
|
||||
"Quit": "Sair",
|
||||
"Show/Hide": "Mostrar/Esconder",
|
||||
"Are you sure you want to quit?": "Você tem certeza que quer sair?",
|
||||
"Close Element": "Fechar Element",
|
||||
"Cancel": "Cancelar"
|
||||
}
|
||||
1
src/i18n/strings/ro.json
Normal file
1
src/i18n/strings/ro.json
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
@@ -37,5 +37,10 @@
|
||||
"Unhide": "Göm inte",
|
||||
"Zoom Out": "Zooma ut",
|
||||
"Zoom In": "Zooma in",
|
||||
"Close Element": "Stäng Element"
|
||||
"Close Element": "Stäng Element",
|
||||
"Show/Hide": "Visa/dölj",
|
||||
"Add to dictionary": "Lägg till i ordlistan",
|
||||
"The image failed to save": "Bilden sparades inte",
|
||||
"Failed to save image": "Misslyckades med att spara bilden",
|
||||
"Are you sure you want to quit?": "Är du säker att du vill avsluta?"
|
||||
}
|
||||
|
||||
46
src/i18n/strings/zh_Hans.json
Normal file
46
src/i18n/strings/zh_Hans.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"Add to dictionary": "添加到字典",
|
||||
"The image failed to save": "图片保存失败",
|
||||
"Failed to save image": "图片保存失败",
|
||||
"Save image as...": "保存图片为……",
|
||||
"Copy link address": "复制链接地址",
|
||||
"Copy email address": "复制邮箱地址",
|
||||
"Copy image": "复制图片",
|
||||
"File": "文件",
|
||||
"Bring All to Front": "置前",
|
||||
"Zoom": "放大",
|
||||
"Stop Speaking": "停止讲话",
|
||||
"Start Speaking": "开始讲话",
|
||||
"Speech": "讲话",
|
||||
"Unhide": "显示",
|
||||
"Hide Others": "隐藏其他",
|
||||
"Hide": "隐藏",
|
||||
"Services": "服务",
|
||||
"About": "关于",
|
||||
"Element Help": "Element 帮助",
|
||||
"Help": "帮助",
|
||||
"Close": "关闭",
|
||||
"Minimize": "最小化",
|
||||
"Window": "窗口",
|
||||
"Toggle Developer Tools": "切换开发工具",
|
||||
"Toggle Full Screen": "切换全屏",
|
||||
"Preferences": "外观",
|
||||
"Zoom Out": "缩小",
|
||||
"Zoom In": "放大",
|
||||
"Actual Size": "实际大小",
|
||||
"View": "查看",
|
||||
"Select All": "选中全部",
|
||||
"Delete": "删除",
|
||||
"Paste and Match Style": "粘贴并匹配样式",
|
||||
"Paste": "粘贴",
|
||||
"Copy": "复制",
|
||||
"Cut": "剪贴",
|
||||
"Redo": "重做",
|
||||
"Undo": "撤销",
|
||||
"Edit": "编辑",
|
||||
"Quit": "退出",
|
||||
"Show/Hide": "显示/隐藏",
|
||||
"Are you sure you want to quit?": "你确定要退出吗?",
|
||||
"Close Element": "关闭 Element",
|
||||
"Cancel": "取消"
|
||||
}
|
||||
@@ -48,7 +48,7 @@ function _t(text, variables = {}) {
|
||||
if (translated === undefined && count !== undefined) {
|
||||
// counterpart does not do fallback if no pluralisation exists
|
||||
// in the preferred language, so do it here
|
||||
translated = counterpart.translate(text, Object.assign({}, args, {locale: DEFAULT_LOCALE}));
|
||||
translated = counterpart.translate(text, Object.assign({}, args, { locale: DEFAULT_LOCALE }));
|
||||
}
|
||||
|
||||
// The translation returns text so there's no XSS vector here (no unsafe HTML, no code execution)
|
||||
@@ -56,10 +56,10 @@ function _t(text, variables = {}) {
|
||||
}
|
||||
|
||||
class AppLocalization {
|
||||
static STORE_KEY = "locale"
|
||||
store = null
|
||||
|
||||
constructor({ store, components = [] }) {
|
||||
// TODO: Should be static field, but that doesn't parse without Babel
|
||||
this.STORE_KEY = "locale";
|
||||
|
||||
counterpart.registerTranslations("en", this.fetchTranslationJson("en_EN"));
|
||||
counterpart.setFallbackLocale('en');
|
||||
counterpart.setSeparator('|');
|
||||
@@ -69,8 +69,8 @@ class AppLocalization {
|
||||
}
|
||||
|
||||
this.store = store;
|
||||
if (this.store.has(AppLocalization.STORE_KEY)) {
|
||||
const locales = this.store.get(AppLocalization.STORE_KEY);
|
||||
if (this.store.has(this.STORE_KEY)) {
|
||||
const locales = this.store.get(this.STORE_KEY);
|
||||
this.setAppLocale(locales);
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ class AppLocalization {
|
||||
});
|
||||
|
||||
counterpart.setLocale(locales);
|
||||
this.store.set(AppLocalization.STORE_KEY, locales);
|
||||
this.store.set(this.STORE_KEY, locales);
|
||||
|
||||
this.resetLocalizedUI();
|
||||
}
|
||||
@@ -121,7 +121,6 @@ class AppLocalization {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
module.exports = {
|
||||
AppLocalization,
|
||||
_t,
|
||||
|
||||
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
const {app} = require("electron");
|
||||
const { app } = require("electron");
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ limitations under the License.
|
||||
|
||||
const path = require('path');
|
||||
const spawn = require('child_process').spawn;
|
||||
const {app} = require('electron');
|
||||
const { app } = require('electron');
|
||||
const fsProm = require('fs').promises;
|
||||
|
||||
function runUpdateExe(args) {
|
||||
|
||||
@@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
const {app, Tray, Menu, nativeImage} = require('electron');
|
||||
const { app, Tray, Menu, nativeImage } = require('electron');
|
||||
const pngToIco = require('png-to-ico');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
const {app, shell, Menu} = require('electron');
|
||||
const { app, shell, Menu } = require('electron');
|
||||
const { _t } = require('./language-helper');
|
||||
|
||||
function buildMenuTemplate() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const {clipboard, nativeImage, Menu, MenuItem, shell, dialog, ipcMain} = require('electron');
|
||||
const { clipboard, nativeImage, Menu, MenuItem, shell, dialog, ipcMain } = require('electron');
|
||||
const url = require('url');
|
||||
const fs = require('fs');
|
||||
const request = require('request');
|
||||
@@ -50,7 +50,6 @@ function writeNativeImage(filePath, img) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function onLinkContextMenu(ev, params) {
|
||||
let url = params.linkURL || params.srcURL;
|
||||
|
||||
@@ -112,7 +111,7 @@ function onLinkContextMenu(ev, params) {
|
||||
accelerator: 'a',
|
||||
async click() {
|
||||
const targetFileName = params.titleText || "image.png";
|
||||
const {filePath} = await dialog.showSaveDialog({
|
||||
const { filePath } = await dialog.showSaveDialog({
|
||||
defaultPath: targetFileName,
|
||||
});
|
||||
|
||||
@@ -215,7 +214,7 @@ function onEditableContextMenu(ev, params) {
|
||||
ev.preventDefault();
|
||||
}
|
||||
|
||||
ipcMain.on('userDownloadOpen', function(ev, {path}) {
|
||||
ipcMain.on('userDownloadOpen', function(ev, { path }) {
|
||||
shell.openPath(path);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user