Skip to content

Commit

Permalink
Notion削除
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamesuta committed Aug 19, 2021
1 parent 3690a29 commit 64579a0
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 172 deletions.
22 changes: 0 additions & 22 deletions app/assets/css/launcher.css
Original file line number Diff line number Diff line change
Expand Up @@ -4754,25 +4754,3 @@ form[name='submitSecretQuestion'] p {
.rotatingBack {
animation: rotatingBack 25s linear infinite;
}

/* Notion */
#notionContainer {
margin-top: 120px;
width: 100%;
height: calc(100% - 120px);
overflow: hidden;
}

#notion {
width: calc(100% / 0.65);
height: calc(100% / 0.65);
border: 0;

zoom: 1;
-moz-transform: scale(0.65);
-moz-transform-origin: 0 0;
-o-transform: scale(0.65);
-o-transform-origin: 0 0;
-webkit-transform: scale(0.65);
-webkit-transform-origin: 0 0;
}
126 changes: 0 additions & 126 deletions app/assets/js/scripts/landing.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ const launch_details_text = document.getElementById('launch_details_text')
const server_selection_button = document.getElementById('server_selection_button')
const server_selection_button_status = document.getElementById('server_selection_button_status')
const user_text = document.getElementById('user_text')
const notion = document.getElementById('notion')

const loggerLanding = LoggerUtil('%c[Landing]', 'color: #000668; font-weight: bold')
const logger = LoggerUtil('%c[NotionLoader]', 'color: #a02d2a; font-weight: bold')

/* Launch Progress Wrapper Functions */

Expand Down Expand Up @@ -136,9 +134,6 @@ function updateSelectedAccount(authUser){
if(authUser.uuid != null){
document.getElementById('avatarContainer').style.backgroundImage = `url('https://crafatar.com/renders/body/${authUser.uuid}?overlay')`
}
if (DistroManager.fetchNews !== undefined) {
DistroManager.fetchNews()
}
}
user_text.innerHTML = username
}
Expand Down Expand Up @@ -1292,124 +1287,3 @@ document.getElementById('settingsFileSystemButton').onclick = () => {
DropinModUtil.validateDir(CACHE_SETTINGS_MODS_DIR)
shell.openPath(CACHE_SETTINGS_MODS_DIR)
}

/**
* Fetch Notion URL
*/
function joinSession(uuid, accessToken, serverId) {
return new Promise((resolve, reject) => {
request.post('https://sessionserver.mojang.com/session/minecraft/join',
{
json: true,
body: {
selectedProfile: uuid,
accessToken,
serverId
}
},
function (error, response, body) {
if (error) {
logger.error('Error during validation.', error)
reject(error)
} else {
if (response.statusCode === 403) {
resolve(false)
} else {
// 204 if valid
resolve(true)
}
}
})
})
}

function fetchNotionURL(uuid, username) {
return new Promise((resolve, reject) => {
request.post('https://asia-northeast1-kuncraft.cloudfunctions.net/numalauncher-news',
{
json: true,
body: {
uuid,
username
}
},
function (error, response, body) {
if (error) {
logger.error('Error during validation.', error)
reject(error)
} else {
resolve(body)
}
})
})
}

DistroManager.fetchNews = async function() {
const serverId = 'numalauncher-news'
const {uuid, displayName, accessToken} = ConfigManager.getSelectedAccount()
if (await joinSession(uuid, accessToken, serverId)) {
const news = await fetchNotionURL(uuid, displayName)
notion.src = news.url

if (news.pack !== undefined) {
DistroManager.distroURL = news.pack
DistroManager.pullRemote(news.pack).then((data) => {
logger.log('Loaded custom distribution index.')

DistroManager.onDistroLoad = (data) => {}
DistroManager.onCustomDistroLoad(data)

})
}
}
}
DistroManager.fetchNews()

/**
* Notion injection
*/
notion.contentWindow.localStorage.setItem('theme','{"mode":"dark"}')
notion.onload = (() => {
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-frame > .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 += '.notion-collection_view-block > div { background: transparent !important; }'
style.innerHTML += '.notion-collection_view-block { overflow-x: hidden !important; }'
style.innerHTML += '.notion-collection_view-block > .notion-scroller { overflow: hidden !important; }'
style.innerHTML += 'body { background: transparent !important; }'
style.innerHTML += '.notion-page-content { color: #ffffff !important; }'
style.innerHTML += '.notion-selectable { color: #ffffff !important; }'

// Add the <style> element to the page
notionDoc.head.appendChild(style)
}

function closest(elem, selector) {
do {
if(elem.matches && elem.matches(selector))
return elem
elem = elem.parentNode
} while(elem)
}

{
notionDoc.addEventListener('click', e => {
const a = closest(e.target, 'a')
if (a) {
e.preventDefault()
e.stopImmediatePropagation()
open(a.href)
}
}, true)
}
})
8 changes: 0 additions & 8 deletions app/landing.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@
</div>
</div>
<div id="content">
<div id="notionContainer">
<iframe
id="notion"
src="about:blank"
allowtransparency="allowtransparency"
>
</iframe>
</div>
</div>
<div id="right">
<div id="rightContainer">
Expand Down
16 changes: 0 additions & 16 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,22 +372,6 @@ function createWindow() {
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})
}
)

// Open web browser on new window
const handleRedirect = async (e, url) => {
if(url !== win.webContents.getURL()) {
Expand Down

0 comments on commit 64579a0

Please sign in to comment.