1
0
Fork 0
mirror of https://github.com/anyproto/anytype-ts.git synced 2025-06-08 05:57:02 +09:00

Merge branch 'master' of github.com:anytypeio/js-anytype into feature/protocol-refactoring

This commit is contained in:
Andrew Simachev 2022-04-25 19:14:30 +03:00
commit ae01cf5caa
40 changed files with 392 additions and 129 deletions

View file

@ -62,8 +62,8 @@ let csp = [
"media-src 'self' http://*:* https://*:* data: blob: file://*",
"style-src 'unsafe-inline' http://localhost:* file://*",
"font-src data: file://*",
"connect-src http://localhost:* http://127.0.0.1:* ws://localhost:* https://sentry.anytype.io https://anytype.io https://api.amplitude.com/ devtools://devtools data:",
"script-src-elem file: http://localhost:* https://sentry.io devtools://devtools 'unsafe-inline'",
"connect-src http://localhost:* http://127.0.0.1:* ws://localhost:* https://sentry.anytype.io https://anytype.io https://api.amplitude.com/ devtools://devtools data: https://*.wistia.com https://*.wistia.net https://embedwistia-a.akamaihd.net",
"script-src-elem file: http://localhost:* https://sentry.io devtools://devtools 'unsafe-inline' https://*.wistia.com https://*.wistia.net",
"frame-src chrome-extension://react-developer-tools"
];
let autoUpdate = false;
@ -124,16 +124,23 @@ function trayIcon () {
if (is.windows) {
return path.join(__dirname, '/electron/icon64x64.png');
} else {
const dark = nativeTheme.shouldUseDarkColors || nativeTheme.shouldUseHighContrastColors || nativeTheme.shouldUseInvertedColorScheme;
return path.join(__dirname, '/electron/icon-tray-' + (dark ? 'white' : 'black') + '.png');
return path.join(__dirname, '/electron/icon-tray-' + (isDarkTheme() ? 'white' : 'black') + '.png');
};
};
nativeTheme.on('updated', () => {
nativeTheme.on('updated', () => { initTheme(); });
function isDarkTheme () {
return nativeTheme.shouldUseDarkColors || nativeTheme.shouldUseHighContrastColors || nativeTheme.shouldUseInvertedColorScheme;
};
function initTheme () {
if (tray) {
tray.setImage(trayIcon());
};
});
send('native-theme', isDarkTheme());
};
function initTray () {
tray = new Tray (trayIcon());
@ -287,8 +294,7 @@ function createWindow () {
};
ipcMain.on('appLoaded', () => {
send('dataPath', dataPath.join('/'));
send('config', config);
send('init', dataPath.join('/'), config, isDarkTheme());
});
ipcMain.on('keytarSet', (e, key, value) => {
@ -398,14 +404,23 @@ function createWindow () {
function getBgColor () {
let { theme } = config;
let bg = '#fff';
let light = '#fff';
let dark = '#2c2b27';
let bg = '';
switch (theme) {
default:
bg = light;
break;
case 'dark':
bg = '#2c2b27';
bg = dark;
break;
case 'system':
bg = isDarkTheme() ? dark : light;
break;
};
return bg;
};