This commit is contained in:
Airradda 2020-06-21 22:51:11 -05:00
commit 9850a9ebe2
3 changed files with 52 additions and 30 deletions

View File

@ -14,7 +14,7 @@ app.setName(productName)
// disable electron warning // disable electron warning
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = 'true' process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = 'true'
const gotTheLock = app.requestSingleInstanceLock() // const gotTheLock = app.requestSingleInstanceLock()
const isDev = process.env.NODE_ENV === 'development' const isDev = process.env.NODE_ENV === 'development'
const isDebug = process.argv.includes('--debug') const isDebug = process.argv.includes('--debug')
let mainWindow let mainWindow
@ -24,25 +24,26 @@ let mainWindow
// This line can possible be removed if the issue is fixed upstream // This line can possible be removed if the issue is fixed upstream
app.commandLine.appendSwitch('disable-features', 'OutOfBlinkCors') app.commandLine.appendSwitch('disable-features', 'OutOfBlinkCors')
// TODO: Uncomment if needed
// only allow single instance of application // only allow single instance of application
if (!isDev) { // if (!isDev) {
if (gotTheLock) { // if (gotTheLock) {
app.on('second-instance', () => { // app.on('second-instance', () => {
// Someone tried to run a second instance, we should focus our window. // // Someone tried to run a second instance, we should focus our window.
if (mainWindow && mainWindow.isMinimized()) { // if (mainWindow && mainWindow.isMinimized()) {
mainWindow.restore() // mainWindow.restore()
} // }
mainWindow.focus() // mainWindow.focus()
}) // })
} else { // } else {
app.quit() // app.quit()
process.exit(0) // process.exit(0)
} // }
} else { // } else {
require('electron-debug')({ // require('electron-debug')({
showDevTools: !(process.env.RENDERER_REMOTE_DEBUGGING === 'true') // showDevTools: !(process.env.RENDERER_REMOTE_DEBUGGING === 'true')
}) // })
} // }
async function installDevTools () { async function installDevTools () {
try { try {
@ -70,7 +71,6 @@ function createWindow () {
webSecurity: false, webSecurity: false,
backgroundThrottling: false backgroundThrottling: false
}, },
show: false
}) })
// eslint-disable-next-line // eslint-disable-next-line

View File

@ -53,18 +53,37 @@ const actions = {
return state.colorClasses[randomInt] return state.colorClasses[randomInt]
}, },
getVideoIdFromUrl ({ state }, url) { getVideoIdFromUrl (_, url) {
console.log('checking for id') /** @type {URL} */
console.log(url) let urlObject
const rx = /^.*(?:(?:(you|hook)tu\.?be\/|v\/|vi\/|u\/\w\/|embed\/)|(?:(?:watch)?\?v(?:i)?=|&v(?:i)?=))([^#&?]*).*/ try {
urlObject = new URL(url)
const match = url.match(rx) } catch (e) {
if (match) {
return match[2]
} else {
return false return false
} }
const extractors = [
// anything with /watch?v=
function() {
if (urlObject.pathname === '/watch' && urlObject.searchParams.has('v')) {
return urlObject.searchParams.get('v')
}
},
// youtu.be
function() {
if (urlObject.host === 'youtu.be' && urlObject.pathname.match(/^\/[A-Za-z0-9_-]+$/)) {
return urlObject.pathname.slice(1)
}
},
// cloudtube
function() {
if (urlObject.host.match(/^cadence\.(gq|moe)$/) && urlObject.pathname.match(/^\/cloudtube\/video\/[A-Za-z0-9_-]+$/)) {
return urlObject.pathname.slice('/cloudtube/video/'.length)
}
}
]
return extractors.reduce((a, c) => a || c(), null) || false
} }
} }

View File

@ -454,6 +454,7 @@ a:link {
a:visited { a:visited {
color: var(--link-visited-color); color: var(--link-visited-color);
} }
<<<<<<< HEAD
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 10px; width: 10px;
} }
@ -465,3 +466,5 @@ a:visited {
::-webkit-scrollbar-thumb:hover { ::-webkit-scrollbar-thumb:hover {
background: var(--scrollbar-color-hover); background: var(--scrollbar-color-hover);
} }
=======
>>>>>>> 9b9313d348ab019cb17ffb3478fe3c4c7b0292e5