css changes, transparency disabled will now disable acrylic on startup
This commit is contained in:
parent
3d1156ade1
commit
d34270b3ab
3 changed files with 69 additions and 46 deletions
|
@ -1,5 +1,5 @@
|
|||
const {BrowserWindow, ipcMain, shell, app, screen} = require("electron")
|
||||
const {join} = require("path")
|
||||
const { BrowserWindow, ipcMain, shell, app, screen } = require("electron")
|
||||
const { join } = require("path")
|
||||
const getPort = require("get-port");
|
||||
const express = require("express");
|
||||
const path = require("path");
|
||||
|
@ -8,22 +8,22 @@ const os = require('os');
|
|||
const yt = require('youtube-search-without-api-key');
|
||||
const discord = require('./discordrpc');
|
||||
const lastfm = require('./lastfm');
|
||||
const {writeFile} = require('fs');
|
||||
const { writeFile } = require('fs');
|
||||
const mpris = require('./mpris');
|
||||
const mm = require('music-metadata');
|
||||
const fetch = require('electron-fetch').default;
|
||||
const {Stream} = require('stream');
|
||||
const { Stream } = require('stream');
|
||||
|
||||
// Analytics for debugging.
|
||||
const ElectronSentry = require("@sentry/electron");
|
||||
ElectronSentry.init({dsn: "https://68c422bfaaf44dea880b86aad5a820d2@o954055.ingest.sentry.io/6112214"});
|
||||
ElectronSentry.init({ dsn: "https://68c422bfaaf44dea880b86aad5a820d2@o954055.ingest.sentry.io/6112214" });
|
||||
|
||||
const CiderBase = {
|
||||
win: null,
|
||||
requests : [],
|
||||
audiostream : new Stream.PassThrough(),
|
||||
requests: [],
|
||||
audiostream: new Stream.PassThrough(),
|
||||
async Start() {
|
||||
this.clientPort = await getPort({port: 9000});
|
||||
this.clientPort = await getPort({ port: 9000 });
|
||||
this.win = this.CreateBrowserWindow()
|
||||
},
|
||||
clientPort: 0,
|
||||
|
@ -69,8 +69,11 @@ const CiderBase = {
|
|||
if (process.platform === "darwin" || process.platform === "linux") {
|
||||
win = new BrowserWindow(options)
|
||||
} else {
|
||||
const {BrowserWindow} = require("electron-acrylic-window");
|
||||
if (app.cfg.get("visual.window_transparency") !== "disabled") {
|
||||
const { BrowserWindow } = require("electron-acrylic-window");
|
||||
}
|
||||
win = new BrowserWindow(options)
|
||||
win.setVibrancy("dark")
|
||||
}
|
||||
|
||||
// intercept "https://js-cdn.music.apple.com/hls.js/2.141.0/hls.js/hls.js" and redirect to local file "./apple-hls.js" instead
|
||||
|
@ -99,7 +102,7 @@ const CiderBase = {
|
|||
if (itspod != null)
|
||||
details.requestHeaders['Cookie'] = `itspod=${itspod}`
|
||||
}
|
||||
callback({requestHeaders: details.requestHeaders})
|
||||
callback({ requestHeaders: details.requestHeaders })
|
||||
})
|
||||
|
||||
let location = `http://localhost:${CiderBase.clientPort}/`
|
||||
|
@ -151,6 +154,10 @@ const CiderBase = {
|
|||
app.cfg.store = store
|
||||
})
|
||||
|
||||
ipcMain.handle('setVibrancy', (event, key, value) => {
|
||||
win.setVibrancy(value)
|
||||
});
|
||||
|
||||
ipcMain.on('maximize', () => { // listen for maximize event
|
||||
if (win.isMaximized()) {
|
||||
win.unmaximize()
|
||||
|
@ -192,9 +199,9 @@ const CiderBase = {
|
|||
}
|
||||
|
||||
// Set window Handler
|
||||
win.webContents.setWindowOpenHandler(({url}) => {
|
||||
win.webContents.setWindowOpenHandler(({ url }) => {
|
||||
if (url.includes("apple") || url.includes("localhost")) {
|
||||
return {action: "allow"}
|
||||
return { action: "allow" }
|
||||
}
|
||||
shell.openExternal(url).catch(() => {
|
||||
})
|
||||
|
@ -233,19 +240,19 @@ const CiderBase = {
|
|||
|
||||
ipcMain.on("getPreviewURL", (_event, url) => {
|
||||
fetch(url)
|
||||
.then(res => res.buffer())
|
||||
.then(async (buffer) => {
|
||||
try {
|
||||
const metadata = await mm.parseBuffer(buffer, 'audio/x-m4a');
|
||||
SoundCheckTag = metadata.native.iTunes[1].value
|
||||
win.webContents.send('SoundCheckTag',SoundCheckTag)
|
||||
} catch (error) {
|
||||
console.error(error.message);
|
||||
}
|
||||
})
|
||||
.then(res => res.buffer())
|
||||
.then(async (buffer) => {
|
||||
try {
|
||||
const metadata = await mm.parseBuffer(buffer, 'audio/x-m4a');
|
||||
SoundCheckTag = metadata.native.iTunes[1].value
|
||||
win.webContents.send('SoundCheckTag', SoundCheckTag)
|
||||
} catch (error) {
|
||||
console.error(error.message);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
ipcMain.on('writeAudio', function(event,buffer){
|
||||
ipcMain.on('writeAudio', function (event, buffer) {
|
||||
CiderBase.audiostream.write(Buffer.from(buffer));
|
||||
})
|
||||
|
||||
|
@ -260,7 +267,7 @@ const CiderBase = {
|
|||
},
|
||||
LinkHandler: (startArgs) => {
|
||||
if (!startArgs) return;
|
||||
console.log("lfmtoken",String(startArgs))
|
||||
console.log("lfmtoken", String(startArgs))
|
||||
if (String(startArgs).includes('auth')) {
|
||||
let authURI = String(startArgs).split('/auth/')[1]
|
||||
if (authURI.startsWith('lastfm')) { // If we wanted more auth options
|
||||
|
@ -292,7 +299,7 @@ const CiderBase = {
|
|||
|
||||
webapp.use(function (req, res, next) {
|
||||
// if not localhost
|
||||
if (req.url.includes("audio.webm") ||(req.headers.host.includes("localhost") && req.headers["user-agent"].includes("Cider"))) {
|
||||
if (req.url.includes("audio.webm") || (req.headers.host.includes("localhost") && req.headers["user-agent"].includes("Cider"))) {
|
||||
next();
|
||||
}
|
||||
});
|
||||
|
@ -304,22 +311,22 @@ const CiderBase = {
|
|||
});
|
||||
webapp.get('/audio.webm', function (req, res) {
|
||||
try {
|
||||
req.connection.setTimeout(Number.MAX_SAFE_INTEGER);
|
||||
// CiderBase.requests.push({req: req, res: res});
|
||||
// var pos = CiderBase.requests.length - 1;
|
||||
// req.on("close", () => {
|
||||
// console.info("CLOSED", CiderBase.requests.length);
|
||||
// requests.splice(pos, 1);
|
||||
// console.info("CLOSED", CiderBase.requests.length);
|
||||
// });
|
||||
CiderBase.audiostream.on('data', (data) => {
|
||||
try {
|
||||
res.write(data);
|
||||
} catch (ex) {
|
||||
console.log(ex)
|
||||
}
|
||||
})
|
||||
} catch (ex) {console.log(ex)}
|
||||
req.connection.setTimeout(Number.MAX_SAFE_INTEGER);
|
||||
// CiderBase.requests.push({req: req, res: res});
|
||||
// var pos = CiderBase.requests.length - 1;
|
||||
// req.on("close", () => {
|
||||
// console.info("CLOSED", CiderBase.requests.length);
|
||||
// requests.splice(pos, 1);
|
||||
// console.info("CLOSED", CiderBase.requests.length);
|
||||
// });
|
||||
CiderBase.audiostream.on('data', (data) => {
|
||||
try {
|
||||
res.write(data);
|
||||
} catch (ex) {
|
||||
console.log(ex)
|
||||
}
|
||||
})
|
||||
} catch (ex) { console.log(ex) }
|
||||
});
|
||||
webapp.listen(CiderBase.clientPort, function () {
|
||||
console.log(`Cider client port: ${CiderBase.clientPort}`);
|
||||
|
|
|
@ -346,9 +346,12 @@ const app = new Vue({
|
|||
default:
|
||||
document.querySelector("html").style.background = "";
|
||||
document.querySelector("body").style.background = "";
|
||||
document.querySelector("body").classList.remove("notransparency")
|
||||
break;
|
||||
case "disabled":
|
||||
document.querySelector("html").style.background = "#222";
|
||||
document.querySelector("body").classList.add("notransparency")
|
||||
|
||||
// document.querySelector("body").style.background = "#222";
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -50,6 +50,17 @@ body[platform='linux'] {
|
|||
background: #222;
|
||||
}
|
||||
|
||||
body.notransparency::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
right:0;
|
||||
bottom:0;
|
||||
opacity: 0.5;
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAMAAAAp4XiDAAAAUVBMVEWFhYWDg4N3d3dtbW17e3t1dXWBgYGHh4d5eXlzc3OLi4ubm5uVlZWPj4+NjY19fX2JiYl/f39ra2uRkZGZmZlpaWmXl5dvb29xcXGTk5NnZ2c8TV1mAAAAG3RSTlNAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAvEOwtAAAFVklEQVR4XpWWB67c2BUFb3g557T/hRo9/WUMZHlgr4Bg8Z4qQgQJlHI4A8SzFVrapvmTF9O7dmYRFZ60YiBhJR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hlCafZvpskfncCfx8pOhJzd76bJWeYFnFciwcYfubRc12Ip/ppIhA1/mSZ/RxjFDrJC5xifFjJpY2Xl5zXdguFqYyTR1zSp1Y9p+tktDYYSNflcxI0iyO4TPBdlRcpeqjK/piF5bklq77VSEaA+z8qmJTFzIWiitbnzR794USKBUaT0NTEsVjZqLaFVqJoPN9ODG70IPbfBHKK+/q/AWR0tJzYHRULOa4MP+W/HfGadZUbfw177G7j/OGbIs8TahLyynl4X4RinF793Oz+BU0saXtUHrVBFT/DnA3ctNPoGbs4hRIjTok8i+algT1lTHi4SxFvONKNrgQFAq2/gFnWMXgwffgYMJpiKYkmW3tTg3ZQ9Jq+f8XN+A5eeUKHWvJWJ2sgJ1Sop+wwhqFVijqWaJhwtD8MNlSBeWNNWTa5Z5kPZw5+LbVT99wqTdx29lMUH4OIG/D86ruKEauBjvH5xy6um/Sfj7ei6UUVk4AIl3MyD4MSSTOFgSwsH/QJWaQ5as7ZcmgBZkzjjU1UrQ74ci1gWBCSGHtuV1H2mhSnO3Wp/3fEV5a+4wz//6qy8JxjZsmxxy5+4w9CDNJY09T072iKG0EnOS0arEYgXqYnXcYHwjTtUNAcMelOd4xpkoqiTYICWFq0JSiPfPDQdnt+4/wuqcXY47QILbgAAAABJRU5ErkJggg==);
|
||||
}
|
||||
|
||||
*,
|
||||
*:before,
|
||||
*:after {
|
||||
|
@ -348,7 +359,7 @@ input[type=range].web-slider::-webkit-slider-runnable-track {
|
|||
height: 100%;
|
||||
|
||||
.bg-artwork-container .bg-artwork {
|
||||
filter: brightness(100%) blur(180px) saturate(280%) contrast(1);
|
||||
filter: brightness(80%) blur(180px) saturate(180%) contrast(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2696,7 +2707,7 @@ input[type="range"].web-slider.display--small::-webkit-slider-thumb {
|
|||
font-size: 14px;
|
||||
justify-content: center-between;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid rgb(200 200 200 / 10%);
|
||||
border-radius: var(--mediaItemRadius);
|
||||
|
||||
.artwork {
|
||||
height: 42px;
|
||||
|
@ -2802,7 +2813,7 @@ input[type="range"].web-slider.display--small::-webkit-slider-thumb {
|
|||
|
||||
&:hover {
|
||||
background: rgb(200 200 200 / 10%);
|
||||
|
||||
box-shadow: var(--mediaItemShadow);
|
||||
.overlay-play {
|
||||
opacity: 1;
|
||||
}
|
||||
|
@ -2810,11 +2821,13 @@ input[type="range"].web-slider.display--small::-webkit-slider-thumb {
|
|||
|
||||
&.mediaitem-selected {
|
||||
background: var(--selected);
|
||||
box-shadow: var(--mediaItemShadow);
|
||||
}
|
||||
|
||||
|
||||
&:active {
|
||||
background: var(--selected-click);
|
||||
box-shadow: var(--mediaItemShadow);
|
||||
color: #eee;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue