Completely fix api calls
Fix web browser api call
This commit is contained in:
parent
a7d1ce0069
commit
56defb0e5b
4 changed files with 11 additions and 18 deletions
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<head>
|
||||
<link rel="preconnect" href="https://amp-api.music.apple.com/" crossorigin/>
|
||||
|
|
|
@ -779,9 +779,10 @@ const app = new Vue({
|
|||
|
||||
document.addEventListener('musickitloaded', function () {
|
||||
// MusicKit global is now defined
|
||||
ipcRenderer.on('devkey', (event, key) => {
|
||||
function initMusicKit () {
|
||||
let parsedJson = JSON.parse(this.responseText)
|
||||
MusicKit.configure({
|
||||
developerToken: key,
|
||||
developerToken: parsedJson.Key,
|
||||
app: {
|
||||
name: 'My Cool Web App',
|
||||
build: '1978.4.1'
|
||||
|
@ -790,7 +791,11 @@ document.addEventListener('musickitloaded', function () {
|
|||
setTimeout(() => {
|
||||
app.init()
|
||||
}, 1000)
|
||||
})
|
||||
}
|
||||
const request = new XMLHttpRequest();
|
||||
request.addEventListener("load", initMusicKit);
|
||||
request.open("GET", "https://devkey.cider.sh/");
|
||||
request.send();
|
||||
});
|
||||
|
||||
function xmlToJson(xml) {
|
||||
|
|
|
@ -107,19 +107,6 @@ const CiderBase = {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
win.webContents.on('did-finish-load', () => {
|
||||
let authFile = require("../auth.json")
|
||||
request({url: "https://devkey.cider.sh/",
|
||||
headers: {
|
||||
"Authorization": "Bearer "+authFile.authHeader
|
||||
}
|
||||
}, function (error, response, body) {
|
||||
if (error) return console.log(error);
|
||||
let parsedJson = JSON.parse(body)
|
||||
win.webContents.send("devkey", parsedJson.Key)
|
||||
})
|
||||
})
|
||||
return win
|
||||
},
|
||||
async InitWebServer() {
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
const electron = require('electron')
|
||||
|
||||
console.log('preload is in baby')
|
||||
console.log('Loaded Preload')
|
||||
|
||||
process.once('loaded', () => {
|
||||
console.log("Setting ipcRenderer")
|
||||
global.ipcRenderer = electron.ipcRenderer;
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue