Fixed acrylic

when out of focus, fills with #592027 (emphasizes color of cider)
This commit is contained in:
yazninja 2022-01-10 23:34:23 +08:00 committed by GitHub
parent ff64894a37
commit 65b1073ae8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,416 +1,412 @@
const { BrowserWindow, ipcMain, shell, app, screen } = require("electron") const { BrowserWindow, ipcMain, shell, app, screen } = require("electron")
const { join } = require("path") const { join } = require("path")
const getPort = require("get-port"); 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 os = require('os'); const os = require('os');
const yt = require('youtube-search-without-api-key'); const yt = require('youtube-search-without-api-key');
const discord = require('./discordrpc'); const discord = require('./discordrpc');
const lastfm = require('./lastfm'); const lastfm = require('./lastfm');
const { writeFile, writeFileSync, existsSync, mkdirSync } = require('fs'); const { writeFile, writeFileSync, existsSync, mkdirSync } = require('fs');
const fs = require('fs'); const fs = require('fs');
const mpris = require('./mpris'); const mpris = require('./mpris');
const mm = require('music-metadata'); const mm = require('music-metadata');
const fetch = require('electron-fetch').default; const fetch = require('electron-fetch').default;
const { Stream } = require('stream'); const { Stream } = require('stream');
// Analytics for debugging. // Analytics for debugging.
const ElectronSentry = require("@sentry/electron"); 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 = { const CiderBase = {
win: null, win: null,
requests: [], requests: [],
audiostream: new Stream.PassThrough(), audiostream: new Stream.PassThrough(),
async Start() { async Start() {
this.clientPort = await getPort({ port: 9000 }); this.clientPort = await getPort({ port: 9000 });
this.win = this.CreateBrowserWindow() this.win = this.CreateBrowserWindow()
}, },
clientPort: 0, clientPort: 0,
CreateBrowserWindow() { CreateBrowserWindow() {
this.VerifyFiles() this.VerifyFiles()
// Set default window sizes // Set default window sizes
const mainWindowState = windowStateKeeper({ const mainWindowState = windowStateKeeper({
defaultWidth: 1024, defaultWidth: 1024,
defaultHeight: 600 defaultHeight: 600
}); });
let win = null let win = null
const options = { const options = {
icon: join(__dirname, `../../resources/icons/icon.` + (process.platform === "win32" ? "ico" : "png")), icon: join(__dirname, `../../resources/icons/icon.` + (process.platform === "win32" ? "ico" : "png")),
width: mainWindowState.width, width: mainWindowState.width,
height: mainWindowState.height, height: mainWindowState.height,
x: mainWindowState.x, x: mainWindowState.x,
y: mainWindowState.y, y: mainWindowState.y,
minWidth: 844, minWidth: 844,
minHeight: 410, minHeight: 410,
frame: false, frame: false,
title: "Cider", title: "Cider",
vibrancy: 'dark', vibrancy: 'dark',
// transparent: true, //transparent: true,
hasShadow: false, hasShadow: false,
webPreferences: { webPreferences: {
webviewTag: true, webviewTag: true,
plugins: true, plugins: true,
nodeIntegration: true, nodeIntegration: true,
nodeIntegrationInWorker: false, nodeIntegrationInWorker: false,
webSecurity: false, webSecurity: false,
allowRunningInsecureContent: true, allowRunningInsecureContent: true,
enableRemoteModule: true, enableRemoteModule: true,
sandbox: true, sandbox: true,
nativeWindowOpen: true, nativeWindowOpen: true,
contextIsolation: false, contextIsolation: false,
preload: join(__dirname, '../preload/cider-preload.js') preload: join(__dirname, '../preload/cider-preload.js')
} }
} }
CiderBase.InitWebServer() CiderBase.InitWebServer()
// Create the BrowserWindow // Create the BrowserWindow
if (process.platform === "darwin" || process.platform === "linux") { if (process.platform === "darwin" || process.platform === "linux") {
win = new BrowserWindow(options) win = new BrowserWindow(options)
} else { } else {
// i don't know why but we have to do this for acrylic to work properly if (app.cfg.get("visual.window_transparency") !== "disabled") {
if (app.cfg.get("visual.window_transparency") !== "disabled") { const { BrowserWindow } = require("electron-acrylic-window");
const { BrowserWindow } = require("electron-acrylic-window"); win = new BrowserWindow(options)
win = new BrowserWindow(options) win.setVibrancy("#59202700") // when out of focus, fills with #592027, 00 is aplha values
win.setVibrancy("dark") }
} else {
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
win.webContents.session.webRequest.onBeforeRequest(
} {
urls: ["https://*/*.js"]
// 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 },
win.webContents.session.webRequest.onBeforeRequest( (details, callback) => {
{ if (details.url.includes("hls.js")) {
urls: ["https://*/*.js"] callback({
}, redirectURL: `http://localhost:${CiderBase.clientPort}/apple-hls.js`
(details, callback) => { })
if (details.url.includes("hls.js")) { } else {
callback({ callback({
redirectURL: `http://localhost:${CiderBase.clientPort}/apple-hls.js` cancel: false
}) })
} else { }
callback({ }
cancel: false )
})
} win.webContents.session.webRequest.onBeforeSendHeaders(async (details, callback) => {
} if (details.url === "https://buy.itunes.apple.com/account/web/info") {
) details.requestHeaders['sec-fetch-site'] = 'same-site';
details.requestHeaders['DNT'] = '1';
win.webContents.session.webRequest.onBeforeSendHeaders(async (details, callback) => { let itspod = await win.webContents.executeJavaScript(`window.localStorage.getItem("music.ampwebplay.itspod")`)
if (details.url === "https://buy.itunes.apple.com/account/web/info") { if (itspod != null)
details.requestHeaders['sec-fetch-site'] = 'same-site'; details.requestHeaders['Cookie'] = `itspod=${itspod}`
details.requestHeaders['DNT'] = '1'; }
let itspod = await win.webContents.executeJavaScript(`window.localStorage.getItem("music.ampwebplay.itspod")`) callback({ requestHeaders: details.requestHeaders })
if (itspod != null) })
details.requestHeaders['Cookie'] = `itspod=${itspod}`
} let location = `http://localhost:${CiderBase.clientPort}/`
callback({ requestHeaders: details.requestHeaders }) win.loadURL(location)
}) win.on("closed", () => {
win = null
let location = `http://localhost:${CiderBase.clientPort}/` })
win.loadURL(location)
win.on("closed", () => { // Register listeners on Window to track size and position of the Window.
win = null mainWindowState.manage(win);
})
// IPC stuff (senders)
// Register listeners on Window to track size and position of the Window. ipcMain.on("cider-platform", (event) => {
mainWindowState.manage(win); event.returnValue = process.platform
})
// IPC stuff (senders)
ipcMain.on("cider-platform", (event) => { ipcMain.on("get-gpu-mode", (event) => {
event.returnValue = process.platform event.returnValue = process.platform
}) })
ipcMain.on("get-gpu-mode", (event) => { ipcMain.on("is-dev", (event) => {
event.returnValue = process.platform event.returnValue = !app.isPackaged
}) })
ipcMain.on("is-dev", (event) => { // IPC stuff (listeners)
event.returnValue = !app.isPackaged ipcMain.on('close', () => { // listen for close event
}) win.close();
})
// IPC stuff (listeners)
ipcMain.on('close', () => { // listen for close event ipcMain.on('put-library-songs', (event, arg) => {
win.close(); fs.writeFileSync(join(app.paths.ciderCache, "library-songs.json"), JSON.stringify(arg))
}) })
ipcMain.on('put-library-songs', (event, arg) => { ipcMain.on('put-library-artists', (event, arg) => {
fs.writeFileSync(join(app.paths.ciderCache, "library-songs.json"), JSON.stringify(arg)) fs.writeFileSync(join(app.paths.ciderCache, "library-artists.json"), JSON.stringify(arg))
}) })
ipcMain.on('put-library-artists', (event, arg) => { ipcMain.on('put-library-albums', (event, arg) => {
fs.writeFileSync(join(app.paths.ciderCache, "library-artists.json"), JSON.stringify(arg)) fs.writeFileSync(join(app.paths.ciderCache, "library-albums.json"), JSON.stringify(arg))
}) })
ipcMain.on('put-library-albums', (event, arg) => { ipcMain.on('put-library-playlists', (event, arg) => {
fs.writeFileSync(join(app.paths.ciderCache, "library-albums.json"), JSON.stringify(arg)) fs.writeFileSync(join(app.paths.ciderCache, "library-playlists.json"), JSON.stringify(arg))
}) })
ipcMain.on('put-library-playlists', (event, arg) => { ipcMain.on('put-library-recentlyAdded', (event, arg) => {
fs.writeFileSync(join(app.paths.ciderCache, "library-playlists.json"), JSON.stringify(arg)) fs.writeFileSync(join(app.paths.ciderCache, "library-recentlyAdded.json"), JSON.stringify(arg))
}) })
ipcMain.on('put-library-recentlyAdded', (event, arg) => { ipcMain.on('get-library-songs', (event) => {
fs.writeFileSync(join(app.paths.ciderCache, "library-recentlyAdded.json"), JSON.stringify(arg)) let librarySongs = fs.readFileSync(join(app.paths.ciderCache, "library-songs.json"), "utf8")
}) event.returnValue = JSON.parse(librarySongs)
})
ipcMain.on('get-library-songs', (event) => {
let librarySongs = fs.readFileSync(join(app.paths.ciderCache, "library-songs.json"), "utf8") ipcMain.on('get-library-artists', (event) => {
event.returnValue = JSON.parse(librarySongs) let libraryArtists = fs.readFileSync(join(app.paths.ciderCache, "library-artists.json"), "utf8")
}) event.returnValue = JSON.parse(libraryArtists)
})
ipcMain.on('get-library-artists', (event) => {
let libraryArtists = fs.readFileSync(join(app.paths.ciderCache, "library-artists.json"), "utf8") ipcMain.on('get-library-albums', (event) => {
event.returnValue = JSON.parse(libraryArtists) let libraryAlbums = fs.readFileSync(join(app.paths.ciderCache, "library-albums.json"), "utf8")
}) event.returnValue = JSON.parse(libraryAlbums)
})
ipcMain.on('get-library-albums', (event) => {
let libraryAlbums = fs.readFileSync(join(app.paths.ciderCache, "library-albums.json"), "utf8") ipcMain.on('get-library-playlists', (event) => {
event.returnValue = JSON.parse(libraryAlbums) let libraryPlaylists = fs.readFileSync(join(app.paths.ciderCache, "library-playlists.json"), "utf8")
}) event.returnValue = JSON.parse(libraryPlaylists)
})
ipcMain.on('get-library-playlists', (event) => {
let libraryPlaylists = fs.readFileSync(join(app.paths.ciderCache, "library-playlists.json"), "utf8") ipcMain.on('get-library-recentlyAdded', (event) => {
event.returnValue = JSON.parse(libraryPlaylists) let libraryRecentlyAdded = fs.readFileSync(join(app.paths.ciderCache, "library-recentlyAdded.json"), "utf8")
}) event.returnValue = JSON.parse(libraryRecentlyAdded)
})
ipcMain.on('get-library-recentlyAdded', (event) => {
let libraryRecentlyAdded = fs.readFileSync(join(app.paths.ciderCache, "library-recentlyAdded.json"), "utf8") ipcMain.handle('getYTLyrics', async (event, track, artist) => {
event.returnValue = JSON.parse(libraryRecentlyAdded) var u = track + " " + artist + " official video";
}) const videos = await yt.search(u);
return videos
ipcMain.handle('getYTLyrics', async (event, track, artist) => { })
var u = track + " " + artist + " official video";
const videos = await yt.search(u); ipcMain.handle('getStoreValue', (event, key, defaultValue) => {
return videos return (defaultValue ? app.cfg.get(key, true) : app.cfg.get(key));
}) });
ipcMain.handle('getStoreValue', (event, key, defaultValue) => { ipcMain.handle('setStoreValue', (event, key, value) => {
return (defaultValue ? app.cfg.get(key, true) : app.cfg.get(key)); app.cfg.set(key, value);
}); });
ipcMain.handle('setStoreValue', (event, key, value) => { ipcMain.on('getStore', (event) => {
app.cfg.set(key, value); event.returnValue = app.cfg.store
}); })
ipcMain.on('getStore', (event) => { ipcMain.on('setStore', (event, store) => {
event.returnValue = app.cfg.store app.cfg.store = store
}) })
ipcMain.on('setStore', (event, store) => { ipcMain.handle('setVibrancy', (event, key, value) => {
app.cfg.store = store win.setVibrancy(value)
}) });
ipcMain.handle('setVibrancy', (event, key, value) => { ipcMain.on('maximize', () => { // listen for maximize event
win.setVibrancy(value) if (win.isMaximized()) {
}); win.unmaximize()
} else {
ipcMain.on('maximize', () => { // listen for maximize event win.maximize()
if (win.isMaximized()) { }
win.unmaximize() })
} else {
win.maximize() ipcMain.on('minimize', () => { // listen for minimize event
} win.minimize();
}) })
ipcMain.on('minimize', () => { // listen for minimize event ipcMain.on('setFullScreen',(event, flag) => {
win.minimize(); win.setFullScreen(flag)
}) })
ipcMain.on('setFullScreen',(event, flag) => { if (process.platform === "win32") {
win.setFullScreen(flag) let WND_STATE = {
}) MINIMIZED: 0,
NORMAL: 1,
if (process.platform === "win32") { MAXIMIZED: 2,
let WND_STATE = { FULL_SCREEN: 3
MINIMIZED: 0, }
NORMAL: 1, let wndState = WND_STATE.NORMAL
MAXIMIZED: 2,
FULL_SCREEN: 3 win.on("resize", (_event) => {
} const isMaximized = win.isMaximized()
let wndState = WND_STATE.NORMAL const isMinimized = win.isMinimized()
const isFullScreen = win.isFullScreen()
win.on("resize", (_event) => { const state = wndState;
const isMaximized = win.isMaximized() if (isMinimized && state !== WND_STATE.MINIMIZED) {
const isMinimized = win.isMinimized() wndState = WND_STATE.MINIMIZED
const isFullScreen = win.isFullScreen() } else if (isFullScreen && state !== WND_STATE.FULL_SCREEN) {
const state = wndState; wndState = WND_STATE.FULL_SCREEN
if (isMinimized && state !== WND_STATE.MINIMIZED) { } else if (isMaximized && state !== WND_STATE.MAXIMIZED) {
wndState = WND_STATE.MINIMIZED wndState = WND_STATE.MAXIMIZED
} else if (isFullScreen && state !== WND_STATE.FULL_SCREEN) { win.webContents.executeJavaScript(`app.chrome.maximized = true`)
wndState = WND_STATE.FULL_SCREEN } else if (state !== WND_STATE.NORMAL) {
} else if (isMaximized && state !== WND_STATE.MAXIMIZED) { wndState = WND_STATE.NORMAL
wndState = WND_STATE.MAXIMIZED win.webContents.executeJavaScript(`app.chrome.maximized = false`)
win.webContents.executeJavaScript(`app.chrome.maximized = true`) }
} else if (state !== WND_STATE.NORMAL) { })
wndState = WND_STATE.NORMAL }
win.webContents.executeJavaScript(`app.chrome.maximized = false`)
} // Set window Handler
}) win.webContents.setWindowOpenHandler(({ url }) => {
} if (url.includes("apple") || url.includes("localhost")) {
return { action: "allow" }
// Set window Handler }
win.webContents.setWindowOpenHandler(({ url }) => { shell.openExternal(url).catch(() => {
if (url.includes("apple") || url.includes("localhost")) { })
return { action: "allow" } return {
} action: 'deny'
shell.openExternal(url).catch(() => { }
}) })
return {
action: 'deny' // Set scale
} ipcMain.on('setScreenScale', (event, scale) => {
}) win.webContents.setZoomFactor(parseFloat(scale))
})
// Set scale
ipcMain.on('setScreenScale', (event, scale) => { win.webContents.setZoomFactor(screen.getPrimaryDisplay().scaleFactor)
win.webContents.setZoomFactor(parseFloat(scale))
}) mpris.connect(win)
win.webContents.setZoomFactor(screen.getPrimaryDisplay().scaleFactor) lastfm.authenticate()
// Discord
mpris.connect(win) discord.connect((app.cfg.get("general.discord_rpc") == 1) ? '911790844204437504' : '886578863147192350');
ipcMain.on('playbackStateDidChange', (_event, a) => {
lastfm.authenticate() app.media = a;
// Discord discord.updateActivity(a)
discord.connect((app.cfg.get("general.discord_rpc") == 1) ? '911790844204437504' : '886578863147192350'); mpris.updateState(a)
ipcMain.on('playbackStateDidChange', (_event, a) => { lastfm.scrobbleSong(a)
app.media = a; lastfm.updateNowPlayingSong(a)
discord.updateActivity(a) });
mpris.updateState(a)
lastfm.scrobbleSong(a) ipcMain.on('nowPlayingItemDidChange', (_event, a) => {
lastfm.updateNowPlayingSong(a) app.media = a;
}); discord.updateActivity(a)
mpris.updateAttributes(a)
ipcMain.on('nowPlayingItemDidChange', (_event, a) => { lastfm.scrobbleSong(a)
app.media = a; lastfm.updateNowPlayingSong(a)
discord.updateActivity(a) });
mpris.updateAttributes(a)
lastfm.scrobbleSong(a) ipcMain.on("getPreviewURL", (_event, url) => {
lastfm.updateNowPlayingSong(a) fetch(url)
}); .then(res => res.buffer())
.then(async (buffer) => {
ipcMain.on("getPreviewURL", (_event, url) => { try {
fetch(url) const metadata = await mm.parseBuffer(buffer, 'audio/x-m4a');
.then(res => res.buffer()) SoundCheckTag = metadata.native.iTunes[1].value
.then(async (buffer) => { win.webContents.send('SoundCheckTag', SoundCheckTag)
try { } catch (error) {
const metadata = await mm.parseBuffer(buffer, 'audio/x-m4a'); console.error(error.message);
SoundCheckTag = metadata.native.iTunes[1].value }
win.webContents.send('SoundCheckTag', SoundCheckTag) })
} catch (error) { });
console.error(error.message);
} ipcMain.on('writeAudio', function (event, buffer) {
}) CiderBase.audiostream.write(Buffer.from(buffer));
}); })
ipcMain.on('writeAudio', function (event, buffer) { return win
CiderBase.audiostream.write(Buffer.from(buffer)); },
}) VerifyFiles() {
const expectedDirectories = [
return win "CiderCache"
}, ]
VerifyFiles() { const expectedFiles = [
const expectedDirectories = [ "library-songs.json",
"CiderCache" "library-artists.json",
] "library-albums.json",
const expectedFiles = [ "library-playlists.json",
"library-songs.json", "library-recentlyAdded.json",
"library-artists.json", ]
"library-albums.json", for (let i = 0; i < expectedDirectories.length; i++) {
"library-playlists.json", if (!existsSync(path.join(app.getPath("userData"), expectedDirectories[i]))) {
"library-recentlyAdded.json", mkdirSync(path.join(app.getPath("userData"), expectedDirectories[i]))
] }
for (let i = 0; i < expectedDirectories.length; i++) { }
if (!existsSync(path.join(app.getPath("userData"), expectedDirectories[i]))) { for (let i = 0; i < expectedFiles.length; i++) {
mkdirSync(path.join(app.getPath("userData"), expectedDirectories[i])) const file = path.join(app.paths.ciderCache, expectedFiles[i])
} if (!existsSync(file)) {
} writeFileSync(file, JSON.stringify([]))
for (let i = 0; i < expectedFiles.length; i++) { }
const file = path.join(app.paths.ciderCache, expectedFiles[i]) }
if (!existsSync(file)) { },
writeFileSync(file, JSON.stringify([])) EnvironmentVariables: {
} "env": {
} platform: os.platform(),
}, dev: app.isPackaged
EnvironmentVariables: { }
"env": { },
platform: os.platform(), LinkHandler: (startArgs) => {
dev: app.isPackaged if (!startArgs) return;
} console.log("lfmtoken", String(startArgs))
}, if (String(startArgs).includes('auth')) {
LinkHandler: (startArgs) => { let authURI = String(startArgs).split('/auth/')[1]
if (!startArgs) return; if (authURI.startsWith('lastfm')) { // If we wanted more auth options
console.log("lfmtoken", String(startArgs)) const authKey = authURI.split('lastfm?token=')[1];
if (String(startArgs).includes('auth')) { app.cfg.set('lastfm.enabled', true);
let authURI = String(startArgs).split('/auth/')[1] app.cfg.set('lastfm.auth_token', authKey);
if (authURI.startsWith('lastfm')) { // If we wanted more auth options CiderBase.win.webContents.send('LastfmAuthenticated', authKey);
const authKey = authURI.split('lastfm?token=')[1]; lastfm.authenticate()
app.cfg.set('lastfm.enabled', true); }
app.cfg.set('lastfm.auth_token', authKey); } else {
CiderBase.win.webContents.send('LastfmAuthenticated', authKey); const formattedSongID = startArgs.replace('ame://', '').replace('/', '');
lastfm.authenticate() console.warn(`[LinkHandler] Attempting to load song id: ${formattedSongID}`);
}
} else { // setQueue can be done with album, song, url, playlist id
const formattedSongID = startArgs.replace('ame://', '').replace('/', ''); this.win.webContents.executeJavaScript(`
console.warn(`[LinkHandler] Attempting to load song id: ${formattedSongID}`); MusicKit.getInstance().setQueue({ song: '${formattedSongID}'}).then(function(queue) {
MusicKit.getInstance().play();
// setQueue can be done with album, song, url, playlist id });
this.win.webContents.executeJavaScript(` `).catch((err) => console.error(err));
MusicKit.getInstance().setQueue({ song: '${formattedSongID}'}).then(function(queue) { }
MusicKit.getInstance().play();
}); },
`).catch((err) => console.error(err));
} async InitWebServer() {
const webapp = express();
}, const webRemotePath = path.join(__dirname, '../renderer/');
webapp.set("views", path.join(webRemotePath, "views"));
async InitWebServer() { webapp.set("view engine", "ejs");
const webapp = express();
const webRemotePath = path.join(__dirname, '../renderer/'); webapp.use(function (req, res, next) {
webapp.set("views", path.join(webRemotePath, "views")); // if not localhost
webapp.set("view engine", "ejs"); if (req.url.includes("audio.webm") || (req.headers.host.includes("localhost") && req.headers["user-agent"].includes("Cider"))) {
next();
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"))) {
next(); webapp.use(express.static(webRemotePath));
} webapp.get('/', function (req, res) {
}); //res.sendFile(path.join(webRemotePath, 'index_old.html'));
res.render("main", CiderBase.EnvironmentVariables)
webapp.use(express.static(webRemotePath)); });
webapp.get('/', function (req, res) { webapp.get('/audio.webm', function (req, res) {
//res.sendFile(path.join(webRemotePath, 'index_old.html')); try {
res.render("main", CiderBase.EnvironmentVariables) req.connection.setTimeout(Number.MAX_SAFE_INTEGER);
}); // CiderBase.requests.push({req: req, res: res});
webapp.get('/audio.webm', function (req, res) { // var pos = CiderBase.requests.length - 1;
try { // req.on("close", () => {
req.connection.setTimeout(Number.MAX_SAFE_INTEGER); // console.info("CLOSED", CiderBase.requests.length);
// CiderBase.requests.push({req: req, res: res}); // requests.splice(pos, 1);
// var pos = CiderBase.requests.length - 1; // console.info("CLOSED", CiderBase.requests.length);
// req.on("close", () => { // });
// console.info("CLOSED", CiderBase.requests.length); CiderBase.audiostream.on('data', (data) => {
// requests.splice(pos, 1); try {
// console.info("CLOSED", CiderBase.requests.length); res.write(data);
// }); } catch (ex) {
CiderBase.audiostream.on('data', (data) => { console.log(ex)
try { }
res.write(data); })
} catch (ex) { } catch (ex) { console.log(ex) }
console.log(ex) });
} webapp.listen(CiderBase.clientPort, function () {
}) console.log(`Cider client port: ${CiderBase.clientPort}`);
} catch (ex) { console.log(ex) } });
}); },
webapp.listen(CiderBase.clientPort, function () {
console.log(`Cider client port: ${CiderBase.clientPort}`); }
});
}, module.exports = CiderBase;
}
module.exports = CiderBase;