Formatted and resolved issues in browserwindow.ts

This commit is contained in:
Core 2022-04-19 19:05:21 +01:00
parent c1d7548169
commit 24a5d1111f
No known key found for this signature in database
GPG key ID: FE9BF1B547F8F3C6

View file

@ -14,11 +14,8 @@ import {utils} from './utils';
import {Plugins} from "./plugins"; import {Plugins} from "./plugins";
import {watch} from "chokidar"; import {watch} from "chokidar";
import * as os from "os"; import * as os from "os";
const wallpaper = require('wallpaper'); import wallpaper from "wallpaper";
// @ts-ignore
import * as AdmZip from "adm-zip"; import * as AdmZip from "adm-zip";
import * as util from "util";
/** /**
* @file Creates the BrowserWindow * @file Creates the BrowserWindow
@ -325,7 +322,7 @@ export class BrowserWindow {
this.options.transparent = true; this.options.transparent = true;
} }
this.options.autoHideMenuBar = true this.options.autoHideMenuBar = true
if(utils.getStoreValue("visual.nativeTitleBar")) { if (utils.getStoreValue("visual.nativeTitleBar")) {
this.options.titleBarStyle = "visible"; this.options.titleBarStyle = "visible";
this.options.frame = true this.options.frame = true
} }
@ -333,7 +330,7 @@ export class BrowserWindow {
case "linux": case "linux":
this.options.backgroundColor = "#1E1E1E"; this.options.backgroundColor = "#1E1E1E";
this.options.autoHideMenuBar = true this.options.autoHideMenuBar = true
if(utils.getStoreValue("visual.nativeTitleBar")) { if (utils.getStoreValue("visual.nativeTitleBar")) {
this.options.titleBarStyle = "visible"; this.options.titleBarStyle = "visible";
this.options.frame = true this.options.frame = true
} }
@ -552,7 +549,7 @@ export class BrowserWindow {
remote.use(express.static(join(utils.getPath('srcPath'), "./web-remote/"))) remote.use(express.static(join(utils.getPath('srcPath'), "./web-remote/")))
remote.set("views", join(utils.getPath('srcPath'), "./web-remote/views")); remote.set("views", join(utils.getPath('srcPath'), "./web-remote/views"));
remote.set("view engine", "ejs"); remote.set("view engine", "ejs");
getPort({port: 6942}).then((port) => { getPort({port: 6942}).then((port: number) => {
this.remotePort = port; this.remotePort = port;
// Start Remote Discovery // Start Remote Discovery
this.broadcastRemote() this.broadcastRemote()
@ -615,7 +612,8 @@ export class BrowserWindow {
details.requestHeaders['Accept-Language'] = 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6', details.requestHeaders['Accept-Language'] = 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
details.requestHeaders['Referer'] = 'https://y.qq.com/', details.requestHeaders['Referer'] = 'https://y.qq.com/',
details.requestHeaders['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X; zh-CN) AppleWebKit/537.51.1 (' details.requestHeaders['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X; zh-CN) AppleWebKit/537.51.1 ('
'KHTML, like Gecko) Mobile/17D50 UCBrowser/12.8.2.1268 Mobile AliApp(TUnionSDK/0.1.20.3) '} 'KHTML, like Gecko) Mobile/17D50 UCBrowser/12.8.2.1268 Mobile AliApp(TUnionSDK/0.1.20.3) '
}
if (details.url.includes("https://c.y.qq.com/lyric/fcgi-bin/fcg_query_lyric_new.fcg")) { if (details.url.includes("https://c.y.qq.com/lyric/fcgi-bin/fcg_query_lyric_new.fcg")) {
details.requestHeaders['Accept'] = '*/*', details.requestHeaders['Accept'] = '*/*',
details.requestHeaders['Accept-Encoding'] = 'gzip, deflate, br', details.requestHeaders['Accept-Encoding'] = 'gzip, deflate, br',
@ -1053,7 +1051,7 @@ export class BrowserWindow {
return Math.max(-32768, Math.min(32768, v)); // clamp return Math.max(-32768, Math.min(32768, v)); // clamp
} }
function bitratechange(e: any){ function bitratechange(e: any) {
var t = e.length; var t = e.length;
let sampleRate = 96.0; let sampleRate = 96.0;
let outputSampleRate = 48.0; let outputSampleRate = 48.0;