Merge pull request #8 from BrandonPlank/main
Support developerToken API
This commit is contained in:
commit
42f6836dcc
5 changed files with 21 additions and 23 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,3 +6,4 @@ package-lock.json
|
|||
.DS_Store
|
||||
yarn-error.log
|
||||
.yarnclean
|
||||
auth.json
|
||||
|
|
2
index.js
2
index.js
|
@ -4,7 +4,6 @@ const {app} = require('electron');
|
|||
// Creating the Application Window and Calling all the Functions
|
||||
function CreateWindow() {
|
||||
if (app.isQuiting) { app.quit(); return; }
|
||||
|
||||
/** CIDER **/
|
||||
const ciderwin = require("./resources/functions/cider-base")
|
||||
app.win = ciderwin
|
||||
|
@ -19,7 +18,6 @@ function CreateWindow() {
|
|||
|
||||
app.on('ready', () => {
|
||||
if (app.isQuiting) { app.quit(); return; }
|
||||
|
||||
console.log('[Cider] Application is Ready. Creating Window.')
|
||||
CreateWindow()
|
||||
});
|
||||
|
|
|
@ -830,26 +830,23 @@ const app = new Vue({
|
|||
|
||||
document.addEventListener('musickitloaded', function () {
|
||||
// MusicKit global is now defined
|
||||
fetch("https://beta.music.apple.com/", {mode: "no-cors"})
|
||||
.then(response => response.text())
|
||||
.then(data => {
|
||||
var el = document.createElement("html");
|
||||
el.innerHTML = data;
|
||||
var u = el.querySelector(`[name="desktop-music-app/config/environment"]`)
|
||||
var amwebCFG = JSON.parse(decodeURIComponent(u.getAttribute("content")));
|
||||
console.log(amwebCFG.MEDIA_API.token)
|
||||
MusicKit.configure({
|
||||
developerToken: amwebCFG.MEDIA_API.token,
|
||||
app: {
|
||||
name: 'My Cool Web App',
|
||||
build: '1978.4.1'
|
||||
}
|
||||
});
|
||||
setTimeout(() => {
|
||||
app.init()
|
||||
}, 1000)
|
||||
function initMusicKit () {
|
||||
let parsedJson = JSON.parse(this.responseText)
|
||||
MusicKit.configure({
|
||||
developerToken: parsedJson.Key,
|
||||
app: {
|
||||
name: 'My Cool Web App',
|
||||
build: '1978.4.1'
|
||||
}
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
app.init()
|
||||
}, 1000)
|
||||
}
|
||||
const request = new XMLHttpRequest();
|
||||
request.addEventListener("load", initMusicKit);
|
||||
request.open("GET", "https://devkey.cider.sh/");
|
||||
request.send();
|
||||
});
|
||||
|
||||
function xmlToJson(xml) {
|
||||
|
|
|
@ -4,6 +4,8 @@ const getPort = require("get-port");
|
|||
const express = require("express");
|
||||
const path = require("path");
|
||||
const windowStateKeeper = require("electron-window-state");
|
||||
const request = require('request');
|
||||
const authFile = require("../auth.json");
|
||||
|
||||
const CiderBase = {
|
||||
|
||||
|
@ -105,7 +107,6 @@ const CiderBase = {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
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