This commit is contained in:
Kamesuta 2020-11-27 18:16:30 +09:00
parent 9be6f755a4
commit 6a06c9c72e
3 changed files with 54 additions and 1 deletions

View File

@ -20,6 +20,7 @@ const launch_progress_label = document.getElementById('launch_progress_label')
const launch_details_text = document.getElementById('launch_details_text') const launch_details_text = document.getElementById('launch_details_text')
const server_selection_button = document.getElementById('server_selection_button') const server_selection_button = document.getElementById('server_selection_button')
const user_text = document.getElementById('user_text') const user_text = document.getElementById('user_text')
const notion = document.getElementById('notion')
const loggerLanding = LoggerUtil('%c[Landing]', 'color: #000668; font-weight: bold') const loggerLanding = LoggerUtil('%c[Landing]', 'color: #000668; font-weight: bold')
@ -1148,4 +1149,30 @@ function loadNews(){
}) })
}) })
}) })
} }
/**
* Notion injection
*/
notion.contentWindow.localStorage.setItem('theme','{"mode":"dark"}')
notion.contentWindow.addEventListener('DOMContentLoaded', event => {
const notionDoc = notion.contentWindow.document
// CSS
{
// Create the <style> tag
const style = notionDoc.createElement('style')
style.innerHTML += '.notion-topbar { display: none !important; }'
style.innerHTML += '.notion-page-content { align-items: start !important; padding-left: 0 !important; padding-right: 0 !important; padding-bottom: 0 !important; }'
style.innerHTML += '.notion-scroller > :not(.notion-page-content) { display: none !important; }'
style.innerHTML += '.notion-scroller > div > div { padding-left: 0 !important; padding-right: 0 !important; }'
style.innerHTML += '.notion-cursor-listener { background: transparent !important; }'
style.innerHTML += '.notion-frame { background: transparent !important; }'
style.innerHTML += 'body { background: transparent !important; }'
// Add the <style> element to the page
notionDoc.head.appendChild(style)
}
})

View File

@ -7,6 +7,13 @@
</div> </div>
</div> </div>
<div id="content"> <div id="content">
<iframe
id="notion"
src="https://www.notion.so/teamkun/News-be3a005c2c0c461389da5329bba85055"
allowtransparency="allowtransparency"
style="width: 100%; height: 100%; border: 0;"
>
</iframe>
</div> </div>
<div id="right"> <div id="right">
<div id="rightContainer"> <div id="rightContainer">

View File

@ -88,6 +88,9 @@ app.disableHardwareAcceleration()
// https://github.com/electron/electron/issues/18397 // https://github.com/electron/electron/issues/18397
app.allowRendererProcessReuse = true app.allowRendererProcessReuse = true
// https://github.com/electron/electron/issues/18214
app.commandLine.appendSwitch('disable-site-isolation-trials')
// Keep a global reference of the window object, if you don't, the window will // Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected. // be closed automatically when the JavaScript object is garbage collected.
let win let win
@ -128,6 +131,22 @@ function createWindow() {
win.on('closed', () => { win.on('closed', () => {
win = null win = null
}) })
// We set an intercept on incoming requests to disable x-frame-options
// headers.
win.webContents.session.webRequest.onHeadersReceived({ urls: [ 'https://www.notion.so/teamkun/*' ] },
(d, c)=>{
if(d.responseHeaders['X-Frame-Options']){
delete d.responseHeaders['X-Frame-Options']
} else if(d.responseHeaders['x-frame-options']) {
delete d.responseHeaders['x-frame-options']
}
d.responseHeaders['Access-Control-Allow-Origin'] = ['null']
c({cancel: false, responseHeaders: d.responseHeaders});
}
)
} }
function createMenu() { function createMenu() {