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

fix electron default session header

This commit is contained in:
Andrew Simachev 2022-06-27 15:20:49 +03:00
parent 6551d48dfe
commit 8e84a67add

View file

@ -67,6 +67,7 @@ let csp = [
"frame-src chrome-extension://react-developer-tools"
];
let autoUpdate = false;
let appIsReady = false;
if (version.match('alpha')) {
defaultChannel = 'alpha';
@ -194,15 +195,6 @@ function initTray () {
function createWindow () {
const image = nativeImage.createFromPath(path.join(__dirname, '/electron/icon512x512.png'));
session.defaultSession.webRequest.onHeadersReceived((details, callback) => {
callback({
responseHeaders: {
...details.responseHeaders,
'Content-Security-Policy': [ csp.join('; ') ]
}
})
});
initTray();
let state = windowStateKeeper({
@ -803,6 +795,15 @@ function autoUpdaterInit () {
};
app.on('ready', () => {
session.defaultSession.webRequest.onHeadersReceived((details, callback) => {
callback({
responseHeaders: {
...details.responseHeaders,
'Content-Security-Policy': [ csp.join('; ') ]
}
})
});
storage.get(CONFIG_NAME, (error, data) => {
config = data || {};
config.channel = String(config.channel || defaultChannel);
@ -857,9 +858,7 @@ app.on('before-quit', (e) => {
};
});
app.on('activate', () => {
win ? win.show() : createWindow();
});
app.on('activate', () => { win ? win.show() : createWindow(); });
app.on('open-url', (e, url) => {
e.preventDefault();