Merge branch 'main' of https://github.com/Apple-Music-Electron/Cider
This commit is contained in:
commit
75525a8e0c
5 changed files with 21 additions and 23 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,3 +6,4 @@ package-lock.json
|
||||||
.DS_Store
|
.DS_Store
|
||||||
yarn-error.log
|
yarn-error.log
|
||||||
.yarnclean
|
.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
|
// Creating the Application Window and Calling all the Functions
|
||||||
function CreateWindow() {
|
function CreateWindow() {
|
||||||
if (app.isQuiting) { app.quit(); return; }
|
if (app.isQuiting) { app.quit(); return; }
|
||||||
|
|
||||||
/** CIDER **/
|
/** CIDER **/
|
||||||
const ciderwin = require("./resources/functions/cider-base")
|
const ciderwin = require("./resources/functions/cider-base")
|
||||||
app.win = ciderwin
|
app.win = ciderwin
|
||||||
|
@ -19,7 +18,6 @@ function CreateWindow() {
|
||||||
|
|
||||||
app.on('ready', () => {
|
app.on('ready', () => {
|
||||||
if (app.isQuiting) { app.quit(); return; }
|
if (app.isQuiting) { app.quit(); return; }
|
||||||
|
|
||||||
console.log('[Cider] Application is Ready. Creating Window.')
|
console.log('[Cider] Application is Ready. Creating Window.')
|
||||||
CreateWindow()
|
CreateWindow()
|
||||||
});
|
});
|
||||||
|
|
|
@ -830,16 +830,10 @@ const app = new Vue({
|
||||||
|
|
||||||
document.addEventListener('musickitloaded', function () {
|
document.addEventListener('musickitloaded', function () {
|
||||||
// MusicKit global is now defined
|
// MusicKit global is now defined
|
||||||
fetch("https://beta.music.apple.com/", {mode: "no-cors"})
|
function initMusicKit () {
|
||||||
.then(response => response.text())
|
let parsedJson = JSON.parse(this.responseText)
|
||||||
.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({
|
MusicKit.configure({
|
||||||
developerToken: amwebCFG.MEDIA_API.token,
|
developerToken: parsedJson.Key,
|
||||||
app: {
|
app: {
|
||||||
name: 'My Cool Web App',
|
name: 'My Cool Web App',
|
||||||
build: '1978.4.1'
|
build: '1978.4.1'
|
||||||
|
@ -848,8 +842,11 @@ document.addEventListener('musickitloaded', function () {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
app.init()
|
app.init()
|
||||||
}, 1000)
|
}, 1000)
|
||||||
});
|
}
|
||||||
|
const request = new XMLHttpRequest();
|
||||||
|
request.addEventListener("load", initMusicKit);
|
||||||
|
request.open("GET", "https://devkey.cider.sh/");
|
||||||
|
request.send();
|
||||||
});
|
});
|
||||||
|
|
||||||
function xmlToJson(xml) {
|
function xmlToJson(xml) {
|
||||||
|
|
|
@ -4,6 +4,8 @@ const getPort = require("get-port");
|
||||||
const express = require("express");
|
const express = require("express");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const windowStateKeeper = require("electron-window-state");
|
const windowStateKeeper = require("electron-window-state");
|
||||||
|
const request = require('request');
|
||||||
|
const authFile = require("../auth.json");
|
||||||
|
|
||||||
const CiderBase = {
|
const CiderBase = {
|
||||||
|
|
||||||
|
@ -105,7 +107,6 @@ const CiderBase = {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return win
|
return win
|
||||||
},
|
},
|
||||||
async InitWebServer() {
|
async InitWebServer() {
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
const electron = require('electron')
|
const electron = require('electron')
|
||||||
|
|
||||||
console.log('preload is in baby')
|
console.log('Loaded Preload')
|
||||||
|
|
||||||
process.once('loaded', () => {
|
process.once('loaded', () => {
|
||||||
|
console.log("Setting ipcRenderer")
|
||||||
global.ipcRenderer = electron.ipcRenderer;
|
global.ipcRenderer = electron.ipcRenderer;
|
||||||
});
|
});
|
Loading…
Add table
Add a link
Reference in a new issue