From 3d64a5e8c85794d1676cddf4593178987a785200 Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Sun, 11 Oct 2020 15:28:56 +1100 Subject: [PATCH] bugfixes: match up some styling better, EACCES dest chmodding, csp re-allow fonts --- repo/core/css/theme.css | 101 +++++++++++++++++++++++++++--------- repo/core/css/variables.css | 21 ++++++++ repo/core/render.js | 2 +- repo/core/tray.js | 35 +++++++++---- 4 files changed, 123 insertions(+), 36 deletions(-) diff --git a/repo/core/css/theme.css b/repo/core/css/theme.css index 7778954..735fad2 100644 --- a/repo/core/css/theme.css +++ b/repo/core/css/theme.css @@ -9,20 +9,25 @@ /** app **/ +.notion-body, +.notion-body.dark [style*='background: rgb(47, 52, 55)'], +.notion-body.dark [style*='background-color: rgb(47, 52, 55)'], +.notion-body:not(.dark) + .notion-light-theme + [style*='background: white']:not(.notion-help-button), +.notion-body:not(.dark) + .notion-dark-theme + [style*='background: white']:not(.notion-help-button):not([style*='box-shadow: rgba(15, 15, 15, 0.05) 0px 0px 0px 1px, rgba(15, 15, 15, 0.1) 0px 3px 6px, rgba(15, 15, 15, 0.2) 0px 9px 24px;']), +.notion-body:not(.dark) [style*='background-color: white'] { + background: var(--theme--main) !important; +} +.notion-sidebar > div, .notion-body.dark [style*='background: rgb(55, 60, 63)'], .notion-body.dark [style*='background: rgb(120, 123, 123)'], .notion-body:not(.dark) [style*='background: rgb(247, 246, 243)'], .notion-body:not(.dark) [style*='background: rgb(223, 223, 222)'] { background: var(--theme--sidebar) !important; } -.notion-body, -.notion-body.dark [style*='background: rgb(47, 52, 55)'], -.notion-body.dark [style*='background-color: rgb(47, 52, 55)'], -.notion-body:not(.dark) - [style*='background: white']:not(.notion-help-button):not([style*='box-shadow: rgba(15, 15, 15, 0.05) 0px 0px 0px 1px, rgba(15, 15, 15, 0.1) 0px 3px 6px, rgba(15, 15, 15, 0.2) 0px 9px 24px;']), -.notion-body:not(.dark) [style*='background-color: white'] { - background: var(--theme--main) !important; -} [style*='background: rgba(15, 15, 15, 0.6)'] { background: var(--theme--overlay) !important; } @@ -195,7 +200,8 @@ > a[style*='background: white'], .notion-body:not(.dark) [style*='background: rgb(247, 246, 243)'], .notion-body:not(.dark) - [style*='box-shadow: rgba(15, 15, 15, 0.05) 0px 0px 0px 1px, rgba(15, 15, 15, 0.1) 0px 3px 6px, rgba(15, 15, 15, 0.2) 0px 9px 24px;'] { + .notion-dark-theme + [style*='background: white'][style*='box-shadow: rgba(15, 15, 15, 0.05) 0px 0px 0px 1px, rgba(15, 15, 15, 0.1) 0px 3px 6px, rgba(15, 15, 15, 0.2) 0px 9px 24px;'] { background: var(--theme--card) !important; } .notion-body.dark @@ -206,19 +212,36 @@ [style*='background: rgba(55, 53, 47, 0.024)'] { background: var(--theme--gallery) !important; } +.notion-body.dark .notion-scroller > [style*='rgb(55, 60, 63)'], +.notion-body:not(.dark) [style*='background: rgba(242, 241, 238, 0.6)'] { + background: var(--theme--select_input) !important; +} .notion-body.dark - [style*='box-shadow: rgba(15, 15, 15, 0.2) 0px 0px 0px 1px, rgba(15, 15, 15, 0.2) 0px 2px 4px'], + [style*='box-shadow: rgba(255, 255, 255, 0.14) 0px -1px inset;'], .notion-body:not(.dark) - .notion-dark-theme - [style*='box-shadow: white -3px 0px 0px'] { - box-shadow: rgba(15, 15, 15, 0.1) 0px 0px 0px 1px, - rgba(15, 15, 15, 0.1) 0px 2px 4px !important; + [style*='box-shadow: rgba(55, 53, 47, 0.16) 0px -1px 0px inset'] { + box-shadow: rgba(55, 53, 47, 0.16) 0px -1px inset !important; +} + +.notion-body.dark [style*='box-shadow: rgba(255, 255, 255, 0.07) 0px 1px 0px'], +.notion-body:not(.dark) + [style*='box-shadow: rgba(55, 53, 47, 0.09) 0px 1px 0px'] { + box-shadow: var(--theme--ui-border) 0px 1px 0px !important; +} +.notion-body.dark + [style*='box-shadow: rgba(255, 255, 255, 0.14) 0px 1px 0px inset'], +.notion-body:not(.dark) + [style*='box-shadow: rgba(55, 53, 47, 0.16) 0px 1px 0px inset'] { + box-shadow: var(--theme--table-border) 0px 1px 0px inset !important; } .notion-body.dark [style*='box-shadow: rgb(47, 52, 55) -3px 0px 0px'] { box-shadow: var(--theme--main) -3px 0px 0px !important; } +.notion-body:not(.dark) [style*='box-shadow: white -3px 0px 0px;'] { + box-shadow: none !important; +} .notion-body.dark [style*='box-shadow: rgb(47, 52, 55) -3px 0px 0px, rgba(255, 255, 255, 0.14) 0px 1px 0px'], .notion-body:not(.dark) @@ -226,7 +249,7 @@ .notion-body:not(.dark) [style*='box-shadow: rgba(255, 255, 255, 0.07) 0px -1px 0px'] { box-shadow: var(--theme--main) -3px 0px 0px, - var(--theme--table-border) 0px 1px 0px !important; + var(--theme--ui-border) 0px 1px 0px !important; } .notion-body.dark [style*='border-top: 1px solid rgba(255, 255, 255,'], @@ -254,7 +277,7 @@ .notion-body.dark [style*='box-shadow: rgba(55, 53, 47, 0.09) 0px -1px 0px'], .notion-body:not(.dark) [style*='box-shadow: rgba(55, 53, 47, 0.09) 0px -1px 0px'] { - box-shadow: var(--theme--table-border) 0px -1px 0px !important; + box-shadow: var(--theme--ui-border) 0px -1px 0px !important; } .notion-body.dark [style*='border-left: 1px solid rgba(255, 255, 255,'], .notion-body.dark @@ -263,12 +286,6 @@ .notion-body:not(.dark) [style*='border-left: 1px solid rgba(55, 53, 47,'] { border-left: 1px solid var(--theme--table-border) !important; } -.notion-body.dark - [style*='box-shadow: rgba(255, 255, 255, 0.14) 0px 1px 0px inset'], -.notion-body:not(.dark) - [style*='box-shadow: rgba(55, 53, 47, 0.16) 0px 1px 0px inset'] { - box-shadow: var(--theme--table-border) 0px 1px 0px inset !important; -} .notion-body.dark [style*='box-shadow: rgba(255, 255, 255, 0.14) 1px 0px 0px inset'], .notion-body:not(.dark) @@ -296,6 +313,7 @@ .notion-body.dark [style*='background: rgb(71, 76, 80)'], .notion-body.dark [style*='background: rgb(80, 85, 88)'], .notion-body.dark [style*='background: rgb(98, 102, 104)'], +.notion-body.dark [style*='height: 1px; background: rgba(255, 255, 255, 0.07)'], .notion-body:not(.dark) [style*='background: rgba(55, 53, 47,'], .notion-body:not(.dark) [style*='background: rgb(239, 239, 238)'], .notion-body:not(.dark) [style*='background: rgba(206, 205, 202, 0.5)'] { @@ -395,6 +413,19 @@ background: var(--theme--primary_indicator) !important; } +.notion-body.dark + [style*='box-shadow: rgba(15, 15, 15, 0.1) 0px 0px 0px 1px, rgba(15, 15, 15, 0.2) 0px 3px 6px, rgba(15, 15, 15, 0.4) 0px 9px 24px'], +.notion-body:not(.dark) + [style*='box-shadow: rgba(15, 15, 15, 0.05) 0px 0px 0px 1px, rgba(15, 15, 15, 0.1) 0px 3px 6px, rgba(15, 15, 15, 0.2) 0px 9px 24px'] { + box-shadow: var(--theme--box-shadow_strong) !important; +} +.notion-body.dark + [style*='box-shadow: rgba(15, 15, 15, 0.2) 0px 0px 0px 1px, rgba(15, 15, 15, 0.2) 0px 2px 4px'], +.notion-body:not(.dark) + [style*='box-shadow: rgba(15, 15, 15, 0.1) 0px 0px 0px 1px, rgba(15, 15, 15, 0.1) 0px 2px 4px'] { + box-shadow: var(--theme--box-shadow) !important; +} + .notion-to_do-block > div [role='button']:hover, .notion-to_do-block > div [role='button']:hover .checkboxSquare, .notion-to_do-block > div [role='button']:hover .check { @@ -444,18 +475,38 @@ .notion-body:not(.dark) [style*='color: rgba(25, 23, 17, 0.6)'] { color: var(--theme--text_ui) !important; } +::placeholder { + opacity: 1 !important; +} +::placeholder, +[style*='-webkit-text-fill-color:'], .notion-body.dark [style*='color: rgba(255, 255, 255, 0.4)'], -.notion-body:not(.dark) [style*='color: rgba(55, 53, 47, 0.4)'] { +.notion-body.dark [style*='color: rgba(255, 255, 255, 0.4)']::before, +.notion-body:not(.dark) [style*='color: rgba(55, 53, 47, 0.4)'], +.notion-body:not(.dark) [style*='color: rgba(55, 53, 47, 0.4)']::before { color: var(--theme--text_ui_info) !important; + -webkit-text-fill-color: var(--theme--text_ui_info) !important; } .notion-body.dark [style*='fill: rgb(202, 204, 206)'] { fill: var(--theme--text) !important; } -.notion-body.dark [style*='fill: rgba(202, 204, 206,'], + +.notion-body.dark [style*='fill: rgba(255, 255, 255, 0.6)'], .notion-body:not(.dark) [style*='fill: rgba(55, 53, 47, 0.8)'], -.notion-body:not(.dark) [style*='fill: rgba(55, 53, 47,'] { +.notion-body:not(.dark) [style*='fill: rgba(55, 53, 47, 0.6)'], +.notion-body:not(.dark) [style*='fill: rgba(25, 23, 17, 0.6)'] { fill: var(--theme--text_ui) !important; } +.notion-body.dark [style*='fill: rgba(202, 204, 206, 0.6)'], +.notion-body.dark [style*='fill: rgba(202, 204, 206, 0.4)'], +.notion-body:not(.dark) [style*='fill: rgba(55, 53, 47, 0.4)'], +.notion-body:not(.dark) [style*='fill: rgba(55, 53, 47, 0.3)'] { + fill: var(--theme--text_ui_info) !important; +} +.notion-body.dark [style*='border-color:rgba(255,255,255,0.4);opacity:0.7'], +.notion-body:not(.dark) [style*='border-color:rgba(55,53,47,0.4);opacity:0.7'] { + border-color: var(--theme--text_ui_info) !important; +} .notion-body.dark [style*='caret-color: rgba(255, 255, 255, 0.9)'], .notion-body:not(.dark) [style*='caret-color: rgb(55, 53, 47)'] { caret-color: var(--theme--text) !important; diff --git a/repo/core/css/variables.css b/repo/core/css/variables.css index 76e4bbd..d394665 100644 --- a/repo/core/css/variables.css +++ b/repo/core/css/variables.css @@ -14,6 +14,10 @@ --theme_dark--sidebar: rgb(55, 60, 63); --theme_dark--overlay: rgba(15, 15, 15, 0.6); --theme_dark--dragarea: #272d2f; + --theme_dark--box-shadow: rgba(15, 15, 15, 0.2) 0px 0px 0px 1px, + rgba(15, 15, 15, 0.2) 0px 2px 4px; + --theme_dark--box-shadow_strong: rgba(15, 15, 15, 0.1) 0px 0px 0px 1px, + rgba(15, 15, 15, 0.2) 0px 3px 6px, rgba(15, 15, 15, 0.4) 0px 9px 24px; --theme_dark--page_normal-width: 900px; --theme_dark--page_full-width: 100%; --theme_dark--page-padding: calc(96px + env(safe-area-inset-left)); @@ -48,7 +52,9 @@ --theme_dark--card: rgb(63, 68, 71); --theme_dark--gallery: rgba(255, 255, 255, 0.05); + --theme_dark--select_input: rgb(55, 60, 63); --theme_dark--table-border: rgba(255, 255, 255, 0.1); + --theme_dark--ui-border: rgba(255, 255, 255, 0.07); --theme_dark--interactive_hover: rgb(71, 76, 80); --theme_dark--interactive_hover-border: transparent; --theme_dark--button_close: #e81123; @@ -189,6 +195,10 @@ --theme_light--sidebar: rgb(247, 246, 243); --theme_light--overlay: rgba(15, 15, 15, 0.6); --theme_light--dragarea: rgba(55, 53, 47, 0.04); + --theme_light--box-shadow: rgba(15, 15, 15, 0.1) 0px 0px 0px 1px, + rgba(15, 15, 15, 0.1) 0px 2px 4px; + --theme_light--box-shadow_strong: rgba(15, 15, 15, 0.05) 0px 0px 0px 1px, + rgba(15, 15, 15, 0.1) 0px 3px 6px, rgba(15, 15, 15, 0.2) 0px 9px 24px; --theme_light--page_normal-width: 900px; --theme_light--page_full-width: 100%; --theme_light--page-padding: calc(96px + env(safe-area-inset-left)); @@ -223,7 +233,9 @@ --theme_light--card: rgb(247, 247, 247); --theme_light--gallery: rgba(55, 53, 47, 0.024); + --theme_light--select_input: rgba(242, 241, 238, 0.6); --theme_light--table-border: rgba(55, 53, 47, 0.16); + --theme_light--ui-border: rgba(55, 53, 47, 0.09); --theme_light--interactive_hover: rgb(239, 239, 239); --theme_light--interactive_hover-border: transparent; --theme_light--button_close: #e81123; @@ -247,6 +259,7 @@ --theme_light--text: rgb(55, 53, 47); --theme_light--text_ui: rgba(55, 53, 47, 0.6); + --theme_light--text_ui: rgba(55, 53, 47, 0.6); --theme_light--text_ui_info: rgba(55, 53, 47, 0.4); --theme_light--text_gray: rgb(155, 154, 151); @@ -364,6 +377,8 @@ --theme--sidebar: var(--theme_dark--sidebar); --theme--overlay: var(--theme_dark--overlay); --theme--dragarea: var(--theme_dark--dragarea); + --theme--box-shadow: var(--theme_dark--box-shadow); + --theme--box-shadow_strong: var(--theme_dark--box-shadow_strong); --theme--page_normal-width: var(--theme_dark--page_normal-width); --theme--page_full-width: var(--theme_dark--page_full-width); --theme--page-padding: var(--theme_dark--page-padding); @@ -389,7 +404,9 @@ --theme--scrollbar_hover: var(--theme_dark--scrollbar_hover); --theme--card: var(--theme_dark--card); --theme--gallery: var(--theme_dark--gallery); + --theme--select_input: var(--theme_dark--select_input); --theme--table-border: var(--theme_dark--table-border); + --theme--ui-border: var(--theme_dark--ui-border); --theme--interactive_hover: var(--theme_dark--interactive_hover); --theme--interactive_hover-border: var( --theme_dark--interactive_hover-border @@ -524,6 +541,8 @@ --theme--sidebar: var(--theme_light--sidebar); --theme--overlay: var(--theme_light--overlay); --theme--dragarea: var(--theme_light--dragarea); + --theme--box-shadow: var(--theme_light--box-shadow); + --theme--box-shadow_strong: var(--theme_light--box-shadow_strong); --theme--page_normal-width: var(--theme_light--page_normal-width); --theme--page_full-width: var(--theme_light--page_full-width); --theme--page-padding: var(--theme_light--page-padding); @@ -549,7 +568,9 @@ --theme--scrollbar_hover: var(--theme_light--scrollbar_hover); --theme--card: var(--theme_light--card); --theme--gallery: var(--theme_light--gallery); + --theme--select_input: var(--theme_light--select_input); --theme--table-border: var(--theme_light--table-border); + --theme--ui-border: var(--theme_light--ui-border); --theme--interactive_hover: var(--theme_light--interactive_hover); --theme--interactive_hover-border: var( --theme_light--interactive_hover-border diff --git a/repo/core/render.js b/repo/core/render.js index 619c91f..0ac5969 100644 --- a/repo/core/render.js +++ b/repo/core/render.js @@ -23,7 +23,7 @@ const url = require('url'), const insertCSP = ` const csp = document.createElement('meta'); csp.httpEquiv = 'Content-Security-Policy'; - csp.content = "script-src 'self' 'unsafe-inline' 'unsafe-eval' enhancement: https://gist.github.com https://apis.google.com https://api.amplitude.com https://widget.intercom.io https://js.intercomcdn.com https://logs-01.loggly.com https://cdn.segment.com https://analytics.pgncs.notion.so https://checkout.stripe.com https://embed.typeform.com https://admin.typeform.com https://platform.twitter.com https://cdn.syndication.twimg.com; connect-src 'self' https://msgstore.www.notion.so wss://msgstore.www.notion.so https://notion-emojis.s3-us-west-2.amazonaws.com https://s3-us-west-2.amazonaws.com https://s3.us-west-2.amazonaws.com https://notion-production-snapshots-2.s3.us-west-2.amazonaws.com https: http: https://api.amplitude.com https://api.embed.ly https://js.intercomcdn.com https://api-iam.intercom.io wss://nexus-websocket-a.intercom.io https://logs-01.loggly.com https://api.segment.io https://api.pgncs.notion.so https://checkout.stripe.com https://cdn.contentful.com https://preview.contentful.com https://images.ctfassets.net https://api.unsplash.com https://boards-api.greenhouse.io; font-src 'self' data: https://cdnjs.cloudflare.com https://js.intercomcdn.com; img-src 'self' data: blob: https: https://platform.twitter.com https://syndication.twitter.com https://pbs.twimg.com https://ton.twimg.com; style-src 'self' 'unsafe-inline' enhancement: https://cdnjs.cloudflare.com https://github.githubassets.com https://platform.twitter.com https://ton.twimg.com; frame-src https: http:; media-src https: http:"; + csp.content = "script-src 'self' 'unsafe-inline' 'unsafe-eval' enhancement: https://gist.github.com https://apis.google.com https://api.amplitude.com https://widget.intercom.io https://js.intercomcdn.com https://logs-01.loggly.com https://cdn.segment.com https://analytics.pgncs.notion.so https://checkout.stripe.com https://embed.typeform.com https://admin.typeform.com https://platform.twitter.com https://cdn.syndication.twimg.com; connect-src 'self' https://msgstore.www.notion.so wss://msgstore.www.notion.so https://notion-emojis.s3-us-west-2.amazonaws.com https://s3-us-west-2.amazonaws.com https://s3.us-west-2.amazonaws.com https://notion-production-snapshots-2.s3.us-west-2.amazonaws.com https: http: https://api.amplitude.com https://api.embed.ly https://js.intercomcdn.com https://api-iam.intercom.io wss://nexus-websocket-a.intercom.io https://logs-01.loggly.com https://api.segment.io https://api.pgncs.notion.so https://checkout.stripe.com https://cdn.contentful.com https://preview.contentful.com https://images.ctfassets.net https://api.unsplash.com https://boards-api.greenhouse.io; font-src 'self' data: enhancement: https: http:; img-src 'self' data: blob: https: https://platform.twitter.com https://syndication.twitter.com https://pbs.twimg.com https://ton.twimg.com; style-src 'self' 'unsafe-inline' enhancement: https: http:; frame-src https: http:; media-src https: http:"; document.head.appendChild(csp); `; diff --git a/repo/core/tray.js b/repo/core/tray.js index 25be7e9..2b50971 100644 --- a/repo/core/tray.js +++ b/repo/core/tray.js @@ -17,6 +17,8 @@ module.exports = (store, __exports) => { helpers = require('../../pkg/helpers.js'); electron.app.on('ready', () => { + // tray + tray = new electron.Tray( is_win ? path.resolve(`${__dirname}/icons/windows.ico`) @@ -28,6 +30,8 @@ module.exports = (store, __exports) => { }) ); + // menu + electron.ipcMain.on('enhancer:set-menu-theme', (event, arg) => { if (!enhancer_menu) return; enhancer_menu.webContents.send('enhancer:set-menu-theme', arg); @@ -111,6 +115,19 @@ module.exports = (store, __exports) => { }); } + electron.globalShortcut.register(store().menu_toggle, () => { + if ( + electron.BrowserWindow.getAllWindows() + .filter((win) => win.getTitle() !== 'notion-enhancer menu') + .some((win) => win.isFocused()) + ) { + openExtensionMenu(); + } else if (enhancer_menu && enhancer_menu.isFocused()) + enhancer_menu.close(); + }); + + // tray + const contextMenu = electron.Menu.buildFromTemplate([ { type: 'normal', @@ -185,6 +202,13 @@ module.exports = (store, __exports) => { { type: 'separator', }, + { + label: 'Relaunch', + click: () => { + electron.app.relaunch(); + electron.app.quit(); + }, + }, { label: 'Quit', role: 'quit', @@ -193,16 +217,7 @@ module.exports = (store, __exports) => { tray.setContextMenu(contextMenu); tray.setToolTip('Notion'); - electron.globalShortcut.register(store().menu_toggle, () => { - if ( - electron.BrowserWindow.getAllWindows() - .filter((win) => win.getTitle() !== 'notion-enhancer menu') - .some((win) => win.isFocused()) - ) { - openExtensionMenu(); - } else if (enhancer_menu && enhancer_menu.isFocused()) - enhancer_menu.close(); - }); + // hotkey function showWindows() { const windows = electron.BrowserWindow.getAllWindows();