connect auth works, now for settings sync
This commit is contained in:
parent
4e8a160600
commit
a844903dff
7 changed files with 51 additions and 22 deletions
|
@ -167,9 +167,6 @@ export class AppEvents {
|
||||||
utils.getWindow().webContents.send('LastfmAuthenticated', authKey);
|
utils.getWindow().webContents.send('LastfmAuthenticated', authKey);
|
||||||
this.plugin.callPlugin('lastfm', 'authenticate', authKey);
|
this.plugin.callPlugin('lastfm', 'authenticate', authKey);
|
||||||
}
|
}
|
||||||
} else if (arg.includes("callback/discord?oauth=")){ // Discord OAuth [Connect]
|
|
||||||
utils.setStoreValue('connectUser', JSON.parse(arg.split("callback/discord?oauth=")[1]));
|
|
||||||
utils.getWindow().webContents.executeJavaScript("$root.appRoute('connect-linked')")
|
|
||||||
}
|
}
|
||||||
// Play
|
// Play
|
||||||
else if (arg.includes('/play/')) { //Steer away from protocol:// specific conditionals
|
else if (arg.includes('/play/')) { //Steer away from protocol:// specific conditionals
|
||||||
|
@ -206,6 +203,8 @@ export class AppEvents {
|
||||||
shell.openExternal('https://opencollective.com/ciderapp')
|
shell.openExternal('https://opencollective.com/ciderapp')
|
||||||
} else if (arg.includes('/beep')) {
|
} else if (arg.includes('/beep')) {
|
||||||
shell.beep()
|
shell.beep()
|
||||||
|
} else {
|
||||||
|
utils.getWindow().webContents.executeJavaScript(`app.appRoute('${arg.split('//')[1]}')`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ const wallpaper = require('wallpaper');
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import * as AdmZip from "adm-zip";
|
import * as AdmZip from "adm-zip";
|
||||||
|
import * as util from "util";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file Creates the BrowserWindow
|
* @file Creates the BrowserWindow
|
||||||
|
@ -526,16 +527,23 @@ export class BrowserWindow {
|
||||||
console.log(ex);
|
console.log(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
//region Connect Integration
|
||||||
app.get("/connect/get-user", (req, res) => {
|
app.get("/connect/set-cc-user/:data", (req, res) => {
|
||||||
res.send(utils.getStoreValue('connectUser')); // [Connect] Session redirect for webview
|
//utils.getStoreValue('connectUser', JSON.parse()) // [Connect] Save user in store
|
||||||
|
utils.setStoreValue('connectUser', JSON.parse(req.params.data))
|
||||||
|
res.redirect(`https://connect.cidercollective.dev/linked.html`)
|
||||||
});
|
});
|
||||||
//app.use(express.static())
|
// [Connect] Set auth URL in store for `shell.openExternal`
|
||||||
|
utils.setStoreValue('cc_authURL', `https://connect.cidercollective.dev/callback/discord?app=cider&appPort=${this.clientPort}`)
|
||||||
|
console.log(`[Connect] Auth URL: ${utils.getStoreValue('cc_authURL')}`)
|
||||||
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
app.listen(this.clientPort, () => {
|
app.listen(this.clientPort, () => {
|
||||||
console.log(`Cider client port: ${this.clientPort}`);
|
console.log(`Cider client port: ${this.clientPort}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Remote Client -@quacksire
|
* Remote Client -@quacksire
|
||||||
* https://github.com/ciderapp/Apple-Music-Electron/blob/818189ed40ff600d76eb59d22016723a75885cd5/resources/functions/handler.js#L1173
|
* https://github.com/ciderapp/Apple-Music-Electron/blob/818189ed40ff600d76eb59d22016723a75885cd5/resources/functions/handler.js#L1173
|
||||||
|
@ -1107,6 +1115,8 @@ export class BrowserWindow {
|
||||||
//}
|
//}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
if (process.platform === "darwin") { //macOS
|
if (process.platform === "darwin") { //macOS
|
||||||
app.setUserActivity('com.CiderCollective.remote.pair', {
|
app.setUserActivity('com.CiderCollective.remote.pair', {
|
||||||
ip: `${BrowserWindow.getIP()}`
|
ip: `${BrowserWindow.getIP()}`
|
||||||
|
@ -1161,6 +1171,10 @@ export class BrowserWindow {
|
||||||
ipcMain.on('open-appdata', (_event) => {
|
ipcMain.on('open-appdata', (_event) => {
|
||||||
shell.openPath(app.getPath('userData'));
|
shell.openPath(app.getPath('userData'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcMain.on('cc-auth', (_event) => {
|
||||||
|
shell.openExternal(String(utils.getStoreValue('cc_authURL')));
|
||||||
|
});
|
||||||
/* *********************************************************************************************
|
/* *********************************************************************************************
|
||||||
* Window Events
|
* Window Events
|
||||||
* **********************************************************************************************/
|
* **********************************************************************************************/
|
||||||
|
|
|
@ -4,7 +4,7 @@ import * as electron from 'electron'
|
||||||
import {utils} from './utils';
|
import {utils} from './utils';
|
||||||
|
|
||||||
//
|
//
|
||||||
// Hello, this our loader for the various plugins that the Cider Development Team built for our
|
// Hello, this is our loader for the various plugins that the Cider Development Team built for our
|
||||||
// numerous plugins internally and ones made by the community
|
// numerous plugins internally and ones made by the community
|
||||||
//
|
//
|
||||||
// To learn how to make your own, visit https://github.com/ciderapp/Cider/wiki/Plugins
|
// To learn how to make your own, visit https://github.com/ciderapp/Cider/wiki/Plugins
|
||||||
|
|
|
@ -4256,6 +4256,9 @@ const app = new Vue({
|
||||||
document.getElementById('settings.option.general.updateCider.check').innerHTML = app.getLz('term.check')
|
document.getElementById('settings.option.general.updateCider.check').innerHTML = app.getLz('term.check')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
authCC(){
|
||||||
|
ipcRenderer.send('cc-auth')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
<template v-if="page == 'connect-linked'">
|
<script type="text/x-template" id="connected">
|
||||||
<div style="display:flex;width:100%;height:100%">
|
<div style="display:flex;width:100%;height:100%;padding-top: var(--navigationBarHeight);position:absolute;top:0;left:0;">
|
||||||
<webview id="foo" :src="https://connect.cidercollective.dev/linked.html" nodeintegration="true" style="display:inline-flex; width:100%;"></webview>
|
<webview id="foo" src="https://cider.sh" style="display:inline-flex; width:100%;"></webview>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
Vue.component('connect-linked', {
|
Vue.component('connected', {
|
||||||
template: '#connect-linked',
|
template: '#connected',
|
||||||
mounted() {
|
async mounted() {
|
||||||
document.querySelector("#foo").addEventListener("dom-ready", ()=>{
|
ipcRenderer.send('get-connected-url')
|
||||||
|
ipcRenderer.on('send-connected-url', (event, url) => {
|
||||||
|
this.url = url
|
||||||
|
app.webview.src = url
|
||||||
|
document.getElementById('foo').src = url;
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -982,8 +982,16 @@
|
||||||
<div class="md-option-header">
|
<div class="md-option-header">
|
||||||
<span>{{$root.getLz('settings.header.connect')}}</span>
|
<span>{{$root.getLz('settings.header.connect')}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="settings-option-body">
|
<div class="md-option-line update-check">
|
||||||
<webview url="https://connect.cidercollective.dev/app-redirect.html"></webview>
|
<div class="md-option-segment">
|
||||||
|
{{$root.getLz('settings.option.connect.link_account')}}
|
||||||
|
</div>
|
||||||
|
<div class="md-option-segment md-option-segment_auto">
|
||||||
|
<button class="md-btn" id='settings.option.general.updateCider.check' @click="authCC()">
|
||||||
|
{{$root.getLz('term.connect')}}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{{ app.cfg.connectUser}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1224,7 +1232,10 @@
|
||||||
ipcRenderer.send('relaunchApp', '');
|
ipcRenderer.send('relaunchApp', '');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
authCC() {
|
||||||
|
ipcRenderer.send('cc-auth')
|
||||||
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
|
@ -1,6 +1,5 @@
|
||||||
<template v-if="page == 'webview'">
|
<template v-if="page == 'webview'">
|
||||||
<div style="display:flex;width:100%;height:100%">
|
<div style="display:flex;width:100%;height:100%">
|
||||||
|
<webview id="foo" :src="webview.url" nodeintegration="true" style="display:inline-flex; width:100%;"></webview>
|
||||||
<<webview id="foo" :src="webview.url" nodeintegration="true" style="display:inline-flex; width:100%;"></webview>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue