-
Notifications
You must be signed in to change notification settings - Fork 0
/
preload.js
54 lines (49 loc) · 1.69 KB
/
preload.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// All of the Node.js APIs are available in the preload process.
// It has the same sandbox as a Chrome extension.
const { contextBridge, ipcRenderer, app } = require("electron");
const mm = require("music-metadata")
const os = require("os")
//const {Titlebar, Color} = require('custom-electron-titlebar');
/*window.addEventListener('DOMContentLoaded', () => {
console.log("titlebar")
new Titlebar({
backgroundColor: Color.fromHex('#2f3241'),
});
});*/
window.Bridge = {
IP: "null",
songs: {
"All Songs": {
"albumArt": "./assets/all-album.png",
"extraText": "",
"type": "album",
"artists": [],
"duration": 0,
"songCount": 0,
"songs": {},
"songFilePaths": []
},
"Other": {
"albumArt": './assets/other-album.png',
"extraText": "",
"type": "album",
"artists": [], // this would have all songData['albumartist']'s in it,
"duration": 0,
"songCount": 0,
"songs": {},
"songFilePaths": []
}
},
userAccent: (process.platform == "win32" && os.release().split('.')[0] === '10') ? systemPreferences.getAccentColor().substr(0, 6) : "#ff00ff",
isPackaged: null,
version: null
}
ipcRenderer.invoke("songs:getSongList").then((value) => {
window.Bridge.songs = value
console.log(value)
})
ipcRenderer.invoke("main:getVersion").then(value=>{
window.Bridge.isPackaged = value.isPackaged
window.Bridge.version = value.version
})
//ipcRenderer.invoke("wss:getIp").then((value) => {window.Bridge.IP = value})