diff --git a/.electron-vue/dev-runner.js b/.electron-vue/dev-runner.js index 1e82e4a61e..05174b9ddb 100644 --- a/.electron-vue/dev-runner.js +++ b/.electron-vue/dev-runner.js @@ -173,7 +173,8 @@ function greeting() { const cols = process.stdout.columns; let text = ''; - if (cols > 76) text = 'SPlayer'; + if (cols > 104) text = 'electron-vue'; + else if (cols > 76) text = 'electron-|vue'; else text = false; if (text) { @@ -182,7 +183,7 @@ function greeting() { font: 'simple3d', space: false, }); - } else console.log(chalk.yellow.bold('\n SPlayer')); + } else console.log(chalk.yellow.bold('\n electron-vue')); console.log(chalk.blue(' getting ready...') + '\n'); } diff --git a/.electron-vue/webpack.renderer.config.js b/.electron-vue/webpack.renderer.config.js index 58a3cac1ef..a07d4330b4 100644 --- a/.electron-vue/webpack.renderer.config.js +++ b/.electron-vue/webpack.renderer.config.js @@ -62,7 +62,6 @@ let rendererConfig = { about: path.join(__dirname, '../src/renderer/about.js'), labor: path.join(__dirname, '../src/renderer/labor.ts'), index: path.join(__dirname, '../src/renderer/main.ts'), - browsing: path.join(__dirname, '../src/renderer/browsing.ts'), }, externals: [ ...Object.keys(Object.assign({}, dependencies, optionalDependencies)).filter( @@ -111,6 +110,17 @@ let rendererConfig = { use: 'babel-loader', exclude: /node_modules/, }, + { + // 匹配 *.worker.js + test: /\.worker\.js$/, + use: { + loader: 'workerize-loader', + }, + }, + { + test: /\.node$/, + use: 'node-loader', + }, { test: /\.vue$/, use: { @@ -201,7 +211,6 @@ let rendererConfig = { new HtmlWebpackPlugin(generateHtmlWebpackPluginConfig('labor')), new HtmlWebpackPlugin(generateHtmlWebpackPluginConfig('about')), new HtmlWebpackPlugin(generateHtmlWebpackPluginConfig('preference')), - new HtmlWebpackPlugin(generateHtmlWebpackPluginConfig('browsing')), new webpack.HotModuleReplacementPlugin(), ], output: { diff --git a/appveyor-appx.yml b/appveyor-appx.yml index c09992045c..e3aa40b44b 100644 --- a/appveyor-appx.yml +++ b/appveyor-appx.yml @@ -18,6 +18,12 @@ platform: configuration: Release +cache: + - node_modules + - '%APPDATA%\npm-cache' + - '%USERPROFILE%\.electron' + - '%USERPROFILE%\AppData\Local\Yarn\cache' + init: - git config --global core.autocrlf input # Provide a short commit SHA1 too diff --git a/appveyor.yml b/appveyor.yml index 557e670b3b..093f794a4c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -18,6 +18,12 @@ platform: configuration: Release +cache: + - node_modules + - '%APPDATA%\npm-cache' + - '%USERPROFILE%\.electron' + - '%USERPROFILE%\AppData\Local\Yarn\cache' + init: - git config --global core.autocrlf input diff --git a/build/icons/mojave-pip.png b/build/icons/mojave-pip.png deleted file mode 100644 index ddd34d8b67..0000000000 Binary files a/build/icons/mojave-pip.png and /dev/null differ diff --git a/build/icons/mojave-window.png b/build/icons/mojave-window.png deleted file mode 100644 index 8378801c51..0000000000 Binary files a/build/icons/mojave-window.png and /dev/null differ diff --git a/build/icons/normal-pip.png b/build/icons/normal-pip.png deleted file mode 100644 index eccb223164..0000000000 Binary files a/build/icons/normal-pip.png and /dev/null differ diff --git a/build/icons/normal-window.png b/build/icons/normal-window.png deleted file mode 100644 index 44be09cbe3..0000000000 Binary files a/build/icons/normal-window.png and /dev/null differ diff --git a/package.json b/package.json index 9bd0cd2eb0..dc7b31aa02 100644 --- a/package.json +++ b/package.json @@ -2,13 +2,13 @@ "name": "splayer", "productName": "splayer", "homepage": "https://splayer.org", - "version": "4.4.0-beta.0", + "version": "4.3.1", "author": "tomasen ", "description": "a media player", "license": "GPL-3.0-or-later", "main": "./dist/electron/main.js", "engines": { - "node": ">=11.0.0" + "node": "^11" }, "scripts": { "build": "node .electron-vue/build.js && electron-builder --p never", @@ -19,13 +19,15 @@ "start": "npm run stage", "dev": "cross-env SAGI_API=sagi-api:8443 node .electron-vue/dev-runner.js", "stage": "node .electron-vue/dev-runner.js", + "e2e": "npm run pack && electron-mocha test/e2e", "install-app-deps": "electron-builder install-app-deps", "lint": "eslint --ext .ts,.js,.vue -f ./node_modules/eslint-friendly-formatter src test", "lint:fix": "eslint --ext .ts,.js,.vue -f ./node_modules/eslint-friendly-formatter --fix src test", "pack": "npm run pack:main && npm run pack:renderer", "pack:main": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.main.config.js", "pack:renderer": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.renderer.config.js", - "test": "npm run unit", + "rebuild:win-mouse": "electron-rebuild -f -e node_modules/@chiflix/electron -w win-mouse", + "test": "npm run unit && npm run e2e", "unit": "karma start test/unit/karma.conf.js", "postinstall": "node ./scripts/post-install.js" }, @@ -43,7 +45,7 @@ "@types/fs-extra": "^7.0.0", "@types/lodash": "^4.14.134", "@types/lolex": "^3.1.1", - "ass-compiler": "github:YvonTre/ass-compiler", + "ass-compiler": "0.0.10", "axios": "^0.19.0", "chardet": "^0.7.0", "configcat-js": "^1.1.19", @@ -54,6 +56,7 @@ "fs-extra": "^7.0.1", "get-video-id": "^3.1.4", "google-protobuf": "^3.6.0", + "highlight.js": "~9.3.0", "iconv-lite": "^0.4.24", "idb": "^4.0.3", "lethargy": "^1.0.4", @@ -65,6 +68,7 @@ "os-locale": "^3.0.1", "p-queue": "^6.0.0", "rimraf": "^2.6.3", + "rollup": "^1.17.0", "romanize": "^1.1.1", "sagi-api": "^0.0.19", "source-map-support": "^0.5.9", @@ -72,7 +76,7 @@ "traditional-or-simplified": "^1.0.3", "url-parse-lax": "^3.0.0", "uuid": "^3.2.1", - "vue": "^2.6.10", + "vue": "^2.5.18", "vue-analytics": "^5.16.1", "vue-async-computed": "^3.5.1", "vue-axios": "^2.1.4", @@ -86,7 +90,6 @@ "winston-daily-rotate-file": "^3.9.0" }, "optionalDependencies": { - "osx-mouse-cocoa": "github:Pat1enceLos/osx-mouse-cocoa", "win-mouse": "1.3.0" }, "devDependencies": { @@ -109,12 +112,11 @@ "@babel/plugin-syntax-import-meta": "^7.0.0", "@babel/preset-env": "^7.0.0", "@babel/register": "^7.0.0", - "@chiflix/electron": "5.0.10-dev.5", + "@chiflix/electron": "5.0.10", "@sentry/webpack-plugin": "^1.6.2", "@types/chai": "^4.1.7", "@types/mkdirp": "^0.5.2", "@types/mocha": "^5.2.7", - "@types/node": "^12.7.4", "@types/os-locale": "^2.1.0", "@types/rimraf": "^2.0.2", "@types/sinon": "^7.0.12", @@ -133,9 +135,10 @@ "css-loader": "^2.1.1", "del": "^3.0.0", "devtron": "^1.4.0", - "electron-builder": "21.2.0", - "electron-debug": "^3.0.1", - "electron-mocha": "^8.1.2", + "electron-builder": "20.38.2", + "electron-debug": "^1.4.0", + "electron-mocha": "^6.0.4", + "electron-rebuild": "^1.8.5", "eslint": "^5.16.0", "eslint-config-airbnb-base": "^13.1.0", "eslint-friendly-formatter": "^4.0.1", @@ -146,7 +149,7 @@ "eslint-plugin-vue": "^5.2.2", "exports-loader": "^0.7.0", "extract-text-webpack-plugin": "^4.0.0-beta.0", - "file-loader": "^4.2.0", + "file-loader": "^2.0.0", "fork-ts-checker-webpack-plugin": "^1.4.3", "html-webpack-plugin": "^3.2.0", "istanbul": "github:Xesenix/istanbul", @@ -161,30 +164,35 @@ "karma-webpack": "^3.0.5", "mocha": "^5.2.0", "mocha-webpack": "^1.1.0", + "mock-fs": "^4.8.0", "module-alias": "^2.0.6", "multispinner": "^0.2.1", + "node-loader": "^0.6.0", "node-sass": "^4.12.0", "raw-loader": "^2.0.0", + "require-dir": "^1.2.0", "sass-loader": "^7.1.0", "sass-resources-loader": "^2.0.0", "sinon": "^7.2.3", "sinon-chai": "^3.3.0", + "spectron": "^3.8.0", "style-loader": "^0.23.1", "svg-sprite-loader": "^4.1.3", "terser-webpack-plugin": "^1.4.1", "ts-loader": "^6.0.0", - "typescript": "~3.5.3", + "typescript": "^3.5.2", "url-loader": "^1.1.2", "vue-eslint-parser": "^6.0.4", "vue-html-loader": "^1.2.4", "vue-i18n-loader": "^1.0.0", - "vue-loader": "^15.7.1", + "vue-loader": "^15.4.2", "vue-style-loader": "^4.1.2", - "vue-template-compiler": "^2.6.10", - "webpack": "^4.39.3", - "webpack-cli": "^3.3.7", + "vue-template-compiler": "^2.5.18", + "webpack": "^4.39.2", + "webpack-cli": "^3.3.6", "webpack-dev-server": "^3.8.0", "webpack-hot-middleware": "^2.25.0", - "webpack-merge": "^4.2.2" + "webpack-merge": "^4.2.1", + "workerize-loader": "^1.0.4" } } diff --git a/scripts/patch/appx/AppxTarget.js b/scripts/patch/appx/AppxTarget.js index 0a05e2912f..cd387480a3 100644 --- a/scripts/patch/appx/AppxTarget.js +++ b/scripts/patch/appx/AppxTarget.js @@ -35,10 +35,10 @@ function _fs() { return data; } -function _fsExtra() { - const data = require("fs-extra"); +function _fsExtraP() { + const data = require("fs-extra-p"); - _fsExtra = function () { + _fsExtraP = function () { return data; }; @@ -67,6 +67,16 @@ function _core() { return data; } +function _platformPackager() { + const data = require("../platformPackager"); + + _platformPackager = function () { + return data; + }; + + return data; +} + function _pathManager() { const data = require("../util/pathManager"); @@ -156,11 +166,11 @@ class AppXTarget extends _core().Target { const outFile = vm.toVmFile(stageDir.getTempFile("resources.pri")); const makePriPath = vm.toVmFile(path.join(vendorPath, "windows-10", _builderUtil().Arch[arch], "makepri.exe")); const assetRoot = stageDir.getTempFile("appx/assets"); - await (0, _fsExtra().emptyDir)(assetRoot); + await (0, _fsExtraP().emptyDir)(assetRoot); await _bluebirdLst().default.map(assetInfo.allAssets, it => (0, _fs().copyOrLinkFile)(it, path.join(assetRoot, path.basename(it)))); await vm.exec(makePriPath, ["new", "/Overwrite", "/Manifest", vm.toVmFile(manifestFile), "/ProjectRoot", vm.toVmFile(path.dirname(assetRoot)), "/ConfigXml", vm.toVmFile(path.join((0, _pathManager().getTemplatePath)("appx"), "priconfig.xml")), "/OutputFile", outFile]); // in addition to resources.pri, resources.scale-140.pri and other such files will be generated - for (const resourceFile of (await (0, _fsExtra().readdir)(stageDir.dir)).filter(it => it.startsWith("resources.")).sort()) { + for (const resourceFile of (await (0, _fsExtraP().readdir)(stageDir.dir)).filter(it => it.startsWith("resources.")).sort()) { mappingList.push([`"${vm.toVmFile(stageDir.getTempFile(resourceFile))}" "${resourceFile}"`]); } @@ -173,7 +183,7 @@ class AppXTarget extends _core().Target { mapping += "\r\n" + list.join("\r\n"); } - await (0, _fsExtra().writeFile)(mappingFile, mapping); + await (0, _fsExtraP().writeFile)(mappingFile, mapping); packager.debugLogger.add("appx.mapping", mapping); if (this.options.makeappxArgs != null) { @@ -201,7 +211,7 @@ class AppXTarget extends _core().Target { if (userAssetDir == null) { userAssets = []; } else { - userAssets = (await (0, _fsExtra().readdir)(userAssetDir)).filter(it => !it.startsWith(".") && !it.endsWith(".db") && it.includes(".")); + userAssets = (await (0, _fsExtraP().readdir)(userAssetDir)).filter(it => !it.startsWith(".") && !it.endsWith(".db") && it.includes(".")); for (const name of userAssets) { mappings.push(`"${vm.toVmFile(userAssetDir)}${vm.pathSep}${name}" "assets\\${name}"`); @@ -250,7 +260,7 @@ class AppXTarget extends _core().Target { const options = this.options; const executable = `app\\${appInfo.productFilename}.exe`; const displayName = options.displayName || appInfo.productName; - const manifest = (await (0, _fsExtra().readFile)(path.join((0, _pathManager().getTemplatePath)("appx"), "appxmanifest.xml"), "utf8")).replace(/\${([a-zA-Z0-9]+)}/g, (match, p1) => { + const manifest = (await (0, _fsExtraP().readFile)(path.join((0, _pathManager().getTemplatePath)("appx"), "appxmanifest.xml"), "utf8")).replace(/\${([a-zA-Z0-9]+)}/g, (match, p1) => { switch (p1) { case "publisher": return publisher; @@ -265,7 +275,7 @@ class AppXTarget extends _core().Target { return name; case "version": - return appInfo.getVersionInWeirdWindowsForm(options.setBuildNumber === true); + return appInfo.getVersionInWeirdWindowsForm(false); case "applicationId": const result = options.applicationId || options.identityName || appInfo.name; @@ -328,7 +338,7 @@ class AppXTarget extends _core().Target { throw new Error(`Macro ${p1} is not defined`); } }); - await (0, _fsExtra().writeFile)(outFile, manifest); + await (0, _fsExtraP().writeFile)(outFile, manifest); } getExtensions(executable, displayName) { @@ -341,7 +351,7 @@ class AppXTarget extends _core().Target { isAddAutoLaunchExtension = deps != null && deps["electron-winstore-auto-launch"] != null; } - if (!isAddAutoLaunchExtension && uriSchemes.length === 0) { + if (!isAddAutoLaunchExtension && uriSchemes.length === 0 && fileAssociations.length === 0) { return ""; } @@ -365,7 +375,6 @@ class AppXTarget extends _core().Target { } } - if (fileAssociations.length) { const appName = this.options.applicationId || this.options.identityName || this.packager.appInfo.name; const sectionName = appName.toLowerCase().replace(/[^-_.a-z0-9]/g, '_'); @@ -391,6 +400,7 @@ class AppXTarget extends _core().Target { } extensions += ""; + return extensions; } @@ -455,6 +465,6 @@ function isDefaultAssetIncluded(userAssets, defaultAsset) { function isScaledAssetsProvided(userAssets) { return userAssets.some(it => it.includes(".scale-") || it.includes(".targetsize-")); -} +} // __ts-babel@6.0.4 //# sourceMappingURL=AppxTarget.js.map \ No newline at end of file diff --git a/scripts/patch/mac/electronMac.js b/scripts/patch/mac/electronMac.js index 6d63d818e2..911333e5ea 100644 --- a/scripts/patch/mac/electronMac.js +++ b/scripts/patch/mac/electronMac.js @@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { exports.createMacApp = createMacApp; function _bluebirdLst() { - const data = _interopRequireDefault(require("bluebird-lst")); + const data = _interopRequireWildcard(require("bluebird-lst")); _bluebirdLst = function () { return data; @@ -35,10 +35,20 @@ function _fs() { return data; } -function _fsExtra() { - const data = require("fs-extra"); +function _promise() { + const data = require("builder-util/out/promise"); - _fsExtra = function () { + _promise = function () { + return data; + }; + + return data; +} + +function _fsExtraP() { + const data = require("fs-extra-p"); + + _fsExtraP = function () { return data; }; @@ -47,30 +57,30 @@ function _fsExtra() { var path = _interopRequireWildcard(require("path")); -function _appInfo() { - const data = require("../appInfo"); +function _plist() { + const data = require("plist"); - _appInfo = function () { + _plist = function () { return data; }; return data; } -function _platformPackager() { - const data = require("../platformPackager"); +function _appInfo() { + const data = require("../appInfo"); - _platformPackager = function () { + _appInfo = function () { return data; }; return data; } -function _appBuilder() { - const data = require("../util/appBuilder"); +function _platformPackager() { + const data = require("../platformPackager"); - _appBuilder = function () { + _platformPackager = function () { return data; }; @@ -79,10 +89,8 @@ function _appBuilder() { function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - function doRename(basePath, oldName, newName) { - return (0, _fsExtra().rename)(path.join(basePath, oldName), path.join(basePath, newName)); + return (0, _fsExtraP().rename)(path.join(basePath, oldName), path.join(basePath, newName)); } function moveHelpers(helperSuffixes, frameworksPath, appName, prefix) { @@ -92,7 +100,7 @@ function moveHelpers(helperSuffixes, frameworksPath, appName, prefix) { }); } -function getAvailableHelperSuffixes(helperEHPlist, helperNPPlist, helperRendererPlist, helperPluginPlist, helperGPUPlist) { +function getAvailableHelperSuffixes(helperEHPlist, helperNPPlist) { const result = [" Helper"]; if (helperEHPlist != null) { @@ -103,205 +111,156 @@ function getAvailableHelperSuffixes(helperEHPlist, helperNPPlist, helperRenderer result.push(" Helper NP"); } - if (helperRendererPlist != null) { - result.push(" Helper (Renderer)"); - } - - if (helperPluginPlist != null) { - result.push(" Helper (Plugin)"); - } - - if (helperGPUPlist != null) { - result.push(" Helper (GPU)"); - } - return result; } /** @internal */ -async function createMacApp(packager, appOutDir, asarIntegrity, isMas) { - const appInfo = packager.appInfo; - const appFilename = appInfo.productFilename; - const contentsPath = path.join(appOutDir, packager.info.framework.distMacOsAppName, "Contents"); - const frameworksPath = path.join(contentsPath, "Frameworks"); - const loginItemPath = path.join(contentsPath, "Library", "LoginItems"); - const appPlistFilename = path.join(contentsPath, "Info.plist"); - const helperPlistFilename = path.join(frameworksPath, "Electron Helper.app", "Contents", "Info.plist"); - const helperEHPlistFilename = path.join(frameworksPath, "Electron Helper EH.app", "Contents", "Info.plist"); - const helperNPPlistFilename = path.join(frameworksPath, "Electron Helper NP.app", "Contents", "Info.plist"); - const helperRendererPlistFilename = path.join(frameworksPath, "Electron Helper (Renderer).app", "Contents", "Info.plist"); - const helperPluginPlistFilename = path.join(frameworksPath, "Electron Helper (Plugin).app", "Contents", "Info.plist"); - const helperGPUPlistFilename = path.join(frameworksPath, "Electron Helper (GPU).app", "Contents", "Info.plist"); - const helperLoginPlistFilename = path.join(loginItemPath, "Electron Login Helper.app", "Contents", "Info.plist"); - const plistContent = await (0, _appBuilder().executeAppBuilderAsJson)(["decode-plist", "-f", appPlistFilename, "-f", helperPlistFilename, "-f", helperEHPlistFilename, "-f", helperNPPlistFilename, "-f", helperRendererPlistFilename, "-f", helperPluginPlistFilename, "-f", helperGPUPlistFilename, "-f", helperLoginPlistFilename]); - - if (plistContent[0] == null) { - throw new Error("corrupted Electron dist"); - } - - const appPlist = plistContent[0]; - const helperPlist = plistContent[1]; - const helperEHPlist = plistContent[2]; - const helperNPPlist = plistContent[3]; - const helperRendererPlist = plistContent[4]; - const helperPluginPlist = plistContent[5]; - const helperGPUPlist = plistContent[6]; - const helperLoginPlist = plistContent[7]; // if an extend-info file was supplied, copy its contents in first - - if (plistContent[8] != null) { - Object.assign(appPlist, plistContent[8]); - } - - const buildMetadata = packager.config; - const oldHelperBundleId = buildMetadata["helper-bundle-id"]; - - if (oldHelperBundleId != null) { - _builderUtil().log.warn("build.helper-bundle-id is deprecated, please set as build.mac.helperBundleId"); - } - - const helperBundleIdentifier = (0, _appInfo().filterCFBundleIdentifier)(packager.platformSpecificBuildOptions.helperBundleId || oldHelperBundleId || `${appInfo.macBundleIdentifier}.helper`); - await packager.applyCommonInfo(appPlist, contentsPath); // required for electron-updater proxy - - if (!isMas) { - configureLocalhostAts(appPlist); - } - - helperPlist.CFBundleExecutable = `${appFilename} Helper`; - helperPlist.CFBundleDisplayName = `${appInfo.productName} Helper`; - helperPlist.CFBundleIdentifier = helperBundleIdentifier; - helperPlist.CFBundleVersion = appPlist.CFBundleVersion; - - function configureHelper(helper, postfix) { - helper.CFBundleExecutable = `${appFilename} Helper ${postfix}`; - helper.CFBundleDisplayName = `${appInfo.productName} Helper ${postfix}`; - helper.CFBundleIdentifier = `${helperBundleIdentifier}.${postfix}`; - helper.CFBundleVersion = appPlist.CFBundleVersion; - } - - if (helperRendererPlist != null) { - configureHelper(helperRendererPlist, "(Renderer)"); - } - - if (helperPluginPlist != null) { - configureHelper(helperPluginPlist, "(Plugin)"); - } - - if (helperGPUPlist != null) { - configureHelper(helperGPUPlist, "(GPU)"); - } - - if (helperEHPlist != null) { - configureHelper(helperEHPlist, "EH"); - } - - if (helperNPPlist != null) { - configureHelper(helperNPPlist, "NP"); - } - - if (helperLoginPlist != null) { - helperLoginPlist.CFBundleExecutable = `${appFilename} Login Helper`; - helperLoginPlist.CFBundleDisplayName = `${appInfo.productName} Login Helper`; // noinspection SpellCheckingInspection - - helperLoginPlist.CFBundleIdentifier = `${appInfo.macBundleIdentifier}.loginhelper`; - helperLoginPlist.CFBundleVersion = appPlist.CFBundleVersion; - } - - const protocols = (0, _builderUtil().asArray)(buildMetadata.protocols).concat((0, _builderUtil().asArray)(packager.platformSpecificBuildOptions.protocols)); - - if (protocols.length > 0) { - appPlist.CFBundleURLTypes = protocols.map(protocol => { - const schemes = (0, _builderUtil().asArray)(protocol.schemes); - - if (schemes.length === 0) { - throw new (_builderUtil().InvalidConfigurationError)(`Protocol "${protocol.name}": must be at least one scheme specified`); - } - - return { - CFBundleURLName: protocol.name, - CFBundleTypeRole: protocol.role || "Editor", - CFBundleURLSchemes: schemes.slice() - }; - }); - } - - const fileAssociations = packager.fileAssociations; - - if (fileAssociations.length > 0) { - appPlist.CFBundleDocumentTypes = await _bluebirdLst().default.map(fileAssociations, async fileAssociation => { - const extensions = (0, _builderUtil().asArray)(fileAssociation.ext).map(_platformPackager().normalizeExt); - const customIcon = await packager.getResource((0, _builderUtil().getPlatformIconFileName)(fileAssociation.icon, true), `${extensions[0]}.icns`); - let iconFile = appPlist.CFBundleIconFile; - - if (customIcon != null) { - iconFile = path.basename(customIcon); - await (0, _fs().copyOrLinkFile)(customIcon, path.join(path.join(contentsPath, "Resources"), iconFile)); - } - - const result = { - CFBundleTypeExtensions: extensions, - CFBundleTypeName: fileAssociation.name || extensions[0], - CFBundleTypeRole: fileAssociation.role || "Editor", - LSHandlerRank: fileAssociation.rank || "Default", - CFBundleTypeIconFile: iconFile - }; - - if (fileAssociation.isPackage) { - result.LSTypeIsPackage = true; - } - - return result; - }); - } - - if (asarIntegrity != null) { - appPlist.AsarIntegrity = JSON.stringify(asarIntegrity); - } - - const plistDataToWrite = { - [appPlistFilename]: appPlist, - [helperPlistFilename]: helperPlist - }; - - if (helperEHPlist != null) { - plistDataToWrite[helperEHPlistFilename] = helperEHPlist; - } - - if (helperNPPlist != null) { - plistDataToWrite[helperNPPlistFilename] = helperNPPlist; - } - - if (helperRendererPlist != null) { - plistDataToWrite[helperRendererPlistFilename] = helperRendererPlist; - } - - if (helperPluginPlist != null) { - plistDataToWrite[helperPluginPlistFilename] = helperPluginPlist; - } - - if (helperGPUPlist != null) { - plistDataToWrite[helperGPUPlistFilename] = helperGPUPlist; - } - - if (helperLoginPlist != null) { - plistDataToWrite[helperLoginPlistFilename] = helperLoginPlist; - } - - await Promise.all([(0, _appBuilder().executeAppBuilderAndWriteJson)(["encode-plist"], plistDataToWrite), doRename(path.join(contentsPath, "MacOS"), "Electron", appPlist.CFBundleExecutable), (0, _fs().unlinkIfExists)(path.join(appOutDir, "LICENSE")), (0, _fs().unlinkIfExists)(path.join(appOutDir, "LICENSES.chromium.html"))]); - await moveHelpers(getAvailableHelperSuffixes(helperEHPlist, helperNPPlist, helperRendererPlist, helperPluginPlist, helperGPUPlist), frameworksPath, appFilename, "Electron"); - - if (helperLoginPlist != null) { - const prefix = "Electron"; - const suffix = " Login Helper"; - const executableBasePath = path.join(loginItemPath, `${prefix}${suffix}.app`, "Contents", "MacOS"); - await doRename(executableBasePath, `${prefix}${suffix}`, appFilename + suffix).then(() => doRename(loginItemPath, `${prefix}${suffix}.app`, `${appFilename}${suffix}.app`)); - } - - const appPath = path.join(appOutDir, `${appFilename}.app`); - await (0, _fsExtra().rename)(path.dirname(contentsPath), appPath); // https://github.com/electron-userland/electron-builder/issues/840 +function createMacApp(_x, _x2, _x3, _x4) { + return _createMacApp.apply(this, arguments); +} - const now = Date.now() / 1000; - await (0, _fsExtra().utimes)(appPath, now, now); +function _createMacApp() { + _createMacApp = (0, _bluebirdLst().coroutine)(function* (packager, appOutDir, asarIntegrity, isMas) { + const appInfo = packager.appInfo; + const appFilename = appInfo.productFilename; + const contentsPath = path.join(appOutDir, packager.info.framework.distMacOsAppName, "Contents"); + const frameworksPath = path.join(contentsPath, "Frameworks"); + const loginItemPath = path.join(contentsPath, "Library", "LoginItems"); + const appPlistFilename = path.join(contentsPath, "Info.plist"); + const helperPlistFilename = path.join(frameworksPath, `${packager.electronDistMacOsExecutableName} Helper.app`, "Contents", "Info.plist"); + const helperEHPlistFilename = path.join(frameworksPath, `${packager.electronDistMacOsExecutableName} Helper EH.app`, "Contents", "Info.plist"); + const helperNPPlistFilename = path.join(frameworksPath, `${packager.electronDistMacOsExecutableName} Helper NP.app`, "Contents", "Info.plist"); + const helperLoginPlistFilename = path.join(loginItemPath, `${packager.electronDistMacOsExecutableName} Login Helper.app`, "Contents", "Info.plist"); + const buildMetadata = packager.config; + const fileContents = yield _bluebirdLst().default.map([appPlistFilename, helperPlistFilename, helperEHPlistFilename, helperNPPlistFilename, helperLoginPlistFilename, buildMetadata["extend-info"]], it => it == null ? it : (0, _promise().orIfFileNotExist)((0, _fsExtraP().readFile)(it, "utf8"), null)); + const appPlist = (0, _plist().parse)(fileContents[0]); + const helperPlist = (0, _plist().parse)(fileContents[1]); + const helperEHPlist = fileContents[2] == null ? null : (0, _plist().parse)(fileContents[2]); + const helperNPPlist = fileContents[3] == null ? null : (0, _plist().parse)(fileContents[3]); + const helperLoginPlist = fileContents[4] == null ? null : (0, _plist().parse)(fileContents[4]); // if an extend-info file was supplied, copy its contents in first + + if (fileContents[5] != null) { + Object.assign(appPlist, (0, _plist().parse)(fileContents[5])); + } + + const oldHelperBundleId = buildMetadata["helper-bundle-id"]; + + if (oldHelperBundleId != null) { + _builderUtil().log.warn("build.helper-bundle-id is deprecated, please set as build.mac.helperBundleId"); + } + + const helperBundleIdentifier = (0, _appInfo().filterCFBundleIdentifier)(packager.platformSpecificBuildOptions.helperBundleId || oldHelperBundleId || `${appInfo.macBundleIdentifier}.helper`); + yield packager.applyCommonInfo(appPlist, contentsPath); // required for electron-updater proxy + + if (!isMas) { + configureLocalhostAts(appPlist); + } + + helperPlist.CFBundleExecutable = `${appFilename} Helper`; + helperPlist.CFBundleDisplayName = `${appInfo.productName} Helper`; + helperPlist.CFBundleIdentifier = helperBundleIdentifier; + helperPlist.CFBundleVersion = appPlist.CFBundleVersion; + + function configureHelper(helper, postfix) { + helper.CFBundleExecutable = `${appFilename} Helper ${postfix}`; + helper.CFBundleDisplayName = `${appInfo.productName} Helper ${postfix}`; + helper.CFBundleIdentifier = `${helperBundleIdentifier}.${postfix}`; + helper.CFBundleVersion = appPlist.CFBundleVersion; + } + + if (helperEHPlist != null) { + configureHelper(helperEHPlist, "EH"); + } + + if (helperNPPlist != null) { + configureHelper(helperNPPlist, "NP"); + } + + if (helperLoginPlist != null) { + helperLoginPlist.CFBundleExecutable = `${appFilename} Login Helper`; + helperLoginPlist.CFBundleDisplayName = `${appInfo.productName} Login Helper`; // noinspection SpellCheckingInspection + + helperLoginPlist.CFBundleIdentifier = `${appInfo.macBundleIdentifier}.loginhelper`; + helperLoginPlist.CFBundleVersion = appPlist.CFBundleVersion; + } + + const protocols = (0, _builderUtil().asArray)(buildMetadata.protocols).concat((0, _builderUtil().asArray)(packager.platformSpecificBuildOptions.protocols)); + + if (protocols.length > 0) { + appPlist.CFBundleURLTypes = protocols.map(protocol => { + const schemes = (0, _builderUtil().asArray)(protocol.schemes); + + if (schemes.length === 0) { + throw new (_builderUtil().InvalidConfigurationError)(`Protocol "${protocol.name}": must be at least one scheme specified`); + } + + return { + CFBundleURLName: protocol.name, + CFBundleTypeRole: protocol.role || "Editor", + CFBundleURLSchemes: schemes.slice() + }; + }); + } + + const fileAssociations = packager.fileAssociations; + + if (fileAssociations.length > 0) { + appPlist.CFBundleDocumentTypes = yield _bluebirdLst().default.map(fileAssociations, + /*#__PURE__*/ + function () { + var _ref = (0, _bluebirdLst().coroutine)(function* (fileAssociation) { + const extensions = (0, _builderUtil().asArray)(fileAssociation.ext).map(_platformPackager().normalizeExt); + const customIcon = yield packager.getResource((0, _builderUtil().getPlatformIconFileName)(fileAssociation.icon, true), `${extensions[0]}.icns`); + let iconFile = appPlist.CFBundleIconFile; + + if (customIcon != null) { + iconFile = path.basename(customIcon); + yield (0, _fs().copyOrLinkFile)(customIcon, path.join(path.join(contentsPath, "Resources"), iconFile)); + } + + const result = { + CFBundleTypeExtensions: extensions, + CFBundleTypeName: fileAssociation.name || extensions[0], + CFBundleTypeRole: fileAssociation.role || "Editor", + LSHandlerRank: fileAssociation.rank || "Default", + CFBundleTypeIconFile: iconFile + }; + + if (fileAssociation.isPackage) { + result.LSTypeIsPackage = true; + } + + return result; + }); + + return function (_x5) { + return _ref.apply(this, arguments); + }; + }()); + } + + if (asarIntegrity != null) { + appPlist.AsarIntegrity = JSON.stringify(asarIntegrity); + } + + yield Promise.all([(0, _fsExtraP().writeFile)(appPlistFilename, (0, _plist().build)(appPlist)), (0, _fsExtraP().writeFile)(helperPlistFilename, (0, _plist().build)(helperPlist)), helperEHPlist == null ? Promise.resolve() : (0, _fsExtraP().writeFile)(helperEHPlistFilename, (0, _plist().build)(helperEHPlist)), helperNPPlist == null ? Promise.resolve() : (0, _fsExtraP().writeFile)(helperNPPlistFilename, (0, _plist().build)(helperNPPlist)), helperLoginPlist == null ? Promise.resolve() : (0, _fsExtraP().writeFile)(helperLoginPlistFilename, (0, _plist().build)(helperLoginPlist)), doRename(path.join(contentsPath, "MacOS"), packager.electronDistMacOsExecutableName, appPlist.CFBundleExecutable), (0, _fs().unlinkIfExists)(path.join(appOutDir, "LICENSE")), (0, _fs().unlinkIfExists)(path.join(appOutDir, "LICENSES.chromium.html"))]); + yield moveHelpers(getAvailableHelperSuffixes(helperEHPlist, helperNPPlist), frameworksPath, appFilename, packager.electronDistMacOsExecutableName); + + if (helperLoginPlist != null) { + const prefix = packager.electronDistMacOsExecutableName; + const suffix = " Login Helper"; + const executableBasePath = path.join(loginItemPath, `${prefix}${suffix}.app`, "Contents", "MacOS"); + yield doRename(executableBasePath, `${prefix}${suffix}`, appFilename + suffix).then(() => doRename(loginItemPath, `${prefix}${suffix}.app`, `${appFilename}${suffix}.app`)); + } + + const appPath = path.join(appOutDir, `${appFilename}.app`); + yield (0, _fsExtraP().rename)(path.dirname(contentsPath), appPath); // https://github.com/electron-userland/electron-builder/issues/840 + + const now = Date.now() / 1000; + yield (0, _fsExtraP().utimes)(appPath, now, now); + }); + return _createMacApp.apply(this, arguments); } function configureLocalhostAts(appPlist) { @@ -313,9 +272,7 @@ function configureLocalhostAts(appPlist) { appPlist.NSAppTransportSecurity = ats; } - ats.NSAllowsLocalNetworking = true; // https://github.com/electron-userland/electron-builder/issues/3377#issuecomment-446035814 - - ats.NSAllowsArbitraryLoads = true; + ats.NSAllowsLocalNetworking = true; let exceptionDomains = ats.NSExceptionDomains; if (exceptionDomains == null) { diff --git a/scripts/post-install.js b/scripts/post-install.js index 6682f6f9a2..738156a8a7 100644 --- a/scripts/post-install.js +++ b/scripts/post-install.js @@ -4,11 +4,12 @@ const { exec } = require('child_process'); require('events').EventEmitter.prototype._maxListeners = 10000; -const commands = [ - 'npx rimraf node_modules/**/.git', - 'npm run lint:fix', - 'npm run install-app-deps', -]; +const commands = ['npx rimraf node_modules/**/.git', 'npm run lint:fix']; + +if (process.platform === 'win32') { + commands.push('npm run install-app-deps'); + commands.push('npm run rebuild:win-mouse'); +} exec(commands.join('&&'), (error, stdout) => { if (error) throw error; diff --git a/src/main/helpers/BrowserViewManager.ts b/src/main/helpers/BrowserViewManager.ts deleted file mode 100644 index 413ad89234..0000000000 --- a/src/main/helpers/BrowserViewManager.ts +++ /dev/null @@ -1,280 +0,0 @@ -import { BrowserView } from 'electron'; -import { remove } from 'lodash'; -import { bilibiliVideoPause, bilibiliFindType } from '../../shared/pip/bilibili'; - -type ChannelData = { - currentIndex: number, - lastUpdateTime: number, - list: BrowserViewHistoryItem[] -} - -type BrowserViewHistoryItem = { - url: string, - view: BrowserView -} - -export class BrowserViewManager implements IBrowserViewManager { - private historyByChannel: Map; - - private currentChannel: string; - - // 当前画中画BrowserView的info - private currentPip: { - pipIndex: number, - pipChannel: string, - pipPage: BrowserViewHistoryItem | null, - }; - - // 浏览器中后退操作所记录下来的BrowserView - private history: BrowserViewHistoryItem[]; - - public constructor() { - this.historyByChannel = new Map(); - this.currentPip = { - pipIndex: -1, - pipChannel: '', - pipPage: null, - }; - this.history = []; - } - - public create(channel: string, args: { url: string, isNewWindow?: boolean }): BrowserViewData { - // 初始化频道数据 - if (!this.historyByChannel[channel]) { - this.historyByChannel[channel] = { - currentIndex: 0, - lastUpdateTime: Date.now(), - list: [], - }; - } - - // 当前BrowserView更新url - const index = this.historyByChannel[channel].currentIndex; - const lastUrl = this.historyByChannel[channel].list.length - ? this.historyByChannel[channel].list[index].url : args.url; - if (this.historyByChannel[channel].list.length) { - this.historyByChannel[channel].list[index].url = args.url; - if (args.isNewWindow) { - this.historyByChannel[channel].list[index].view.webContents.loadURL(args.url); - } - } - - // 创建上一个view数据 - const page = { - url: lastUrl, - view: new BrowserView({ - webPreferences: { - preload: `${require('path').resolve(__static, 'pip/preload.js')}`, - nativeWindowOpen: true, - }, - }), - }; - // 新建BrowserView Load Url以及禁止视频自动播放 - page.view.webContents.loadURL(page.url); - if (channel === this.currentChannel) { - const hasLastPage = this.historyByChannel[channel].list.length; - if (hasLastPage) { - page.view.webContents.once('media-started-playing', () => { - if (lastUrl !== page.url) return; - if (this.currentChannel.includes('bilibili')) { - let type = ''; - page.view.webContents - .executeJavaScript(bilibiliFindType).then((r: (HTMLElement | null)[]) => { - type = ['bangumi', 'videoStreaming', 'iframeStreaming', 'iframeStreaming', 'video'][r.findIndex(i => i)] || 'others'; - page.view.webContents.executeJavaScript(bilibiliVideoPause(type)); - }); - } else { - page.view.webContents.executeJavaScript('setTimeout(() => { document.querySelector("video").pause(); }, 100)'); - } - }); - } - } - - // 清空后退操作产生的history以及切换频道时暂停视频 - if (this.currentChannel) { - if (channel !== this.currentChannel) { - const currentIndex = this.historyByChannel[this.currentChannel].currentIndex; - const view = this.historyByChannel[this.currentChannel].list[currentIndex].view; - this.pauseVideo(view); - } else if (this.history.length) { - // 清除后退的记录 - remove(this.historyByChannel[this.currentChannel].list, - (list: BrowserViewHistoryItem) => { - if (this.history.includes(list)) { - list.view.destroy(); - return true; - } - return false; - }); - this.history = []; - } - } - - // 插入view到当前view的上一个位置 - this.historyByChannel[channel].list.splice(index, 0, page); - this.historyByChannel[channel].currentIndex = this.historyByChannel[channel].list.length - 1; - this.historyByChannel[channel].lastUpdateTime = Date.now(); - this.currentChannel = channel; - return { - canBack: this.historyByChannel[channel].list.length > 1, - canForward: false, - view: page.view, - }; - } - - // 浏览器后退 - public back(): BrowserViewData { - const index = this.historyByChannel[this.currentChannel].currentIndex; - this.history.push(this.historyByChannel[this.currentChannel].list[index]); - return this.jump(true); - } - - // 浏览器前进 - public forward(): BrowserViewData { - if (this.history.length) { - this.history.pop(); - } - return this.jump(false); - } - - // 浏览器切换频道 - public changeChanel(channel: string, - args: { url: string, isNewWindow?: boolean }): BrowserViewData { - if (!this.historyByChannel[channel]) { - return this.create(channel, args); - } - this.pauseVideo(); - this.currentChannel = channel; - this.historyByChannel[channel].lastUpdateTime = Date.now(); - return { - canBack: this.historyByChannel[channel].currentIndex > 0, - canForward: this.historyByChannel[channel].currentIndex - < this.historyByChannel[channel].list.length - 1, - page: this.historyByChannel[channel].list[this.historyByChannel[channel].currentIndex], - }; - } - - // 进入画中画 - public enterPip(): { pipBrowser: BrowserView; mainBrowser: BrowserViewData } { - const currentIndex = this.historyByChannel[this.currentChannel].currentIndex; - const list = this.historyByChannel[this.currentChannel].list; - const pipBrowser = list[currentIndex].view; - const mainBrowser = { - canBack: currentIndex - 1 > 0, - canForward: false, - page: list[currentIndex - 1], - }; - this.currentPip = { - pipIndex: currentIndex, - pipChannel: this.currentChannel, - pipPage: this.historyByChannel[this.currentChannel].list.splice(currentIndex, 1)[0], - }; - this.historyByChannel[this.currentChannel].list.splice(currentIndex, 1); - this.historyByChannel[this.currentChannel].lastUpdateTime = Date.now(); - this.historyByChannel[this.currentChannel].currentIndex = currentIndex - 1; - return { pipBrowser, mainBrowser }; - } - - // 退出画中画 - public exitPip(): BrowserViewData { - const { pipIndex, pipChannel } = this.currentPip; - const list = this.historyByChannel[pipChannel].list; - this.historyByChannel[pipChannel].list = list - .filter((page: BrowserViewHistoryItem, index: number) => index < pipIndex); - const deleteList = list.slice(pipIndex, list.length); - deleteList.forEach((page: BrowserViewHistoryItem) => { - page.view.destroy(); - }); - this.historyByChannel[pipChannel].list.push(this.currentPip.pipPage); - this.historyByChannel[pipChannel].currentIndex = pipIndex; - this.historyByChannel[pipChannel].lastUpdateTime = Date.now(); - this.currentChannel = pipChannel; - this.currentPip = { - pipIndex: -1, - pipChannel: '', - pipPage: null, - }; - return { - canBack: this.historyByChannel[this.currentChannel].currentIndex > 0, - canForward: false, - page: this.historyByChannel[this.currentChannel] - .list[this.historyByChannel[this.currentChannel].currentIndex], - }; - } - - // 在画中画模式下切换画中画 - public changePip(channel: string): { pipBrowser: Electron.BrowserView; - mainBrowser: BrowserViewData } { - this.currentChannel = channel; - this.pauseVideo((this.currentPip.pipPage as BrowserViewHistoryItem).view, - this.currentPip.pipChannel); - return this.enterPip(); - } - - // 暂停当前BrowserView下的视频 - public pauseVideo(view?: BrowserView, currentChannel?: string): void { - const pausedChannel = currentChannel || this.currentChannel; - const currentIndex = this.historyByChannel[this.currentChannel].currentIndex; - const currentView = view || this.historyByChannel[this.currentChannel].list[currentIndex].view; - if (currentView.webContents.isCurrentlyAudible()) { - if (pausedChannel.includes('bilibili')) { - let type = ''; - currentView.webContents - .executeJavaScript(bilibiliFindType).then((r: (HTMLElement | null)[]) => { - type = ['bangumi', 'videoStreaming', 'iframeStreaming', 'iframeStreaming', 'video'][r.findIndex(i => i)] || 'others'; - currentView.webContents.executeJavaScript(bilibiliVideoPause(type)); - }); - } else { - currentView.webContents.executeJavaScript('setTimeout(() => { document.querySelector("video").pause(); }, 100)'); - } - } - } - - // 关闭画中画窗口 - public pipClose(): void { - if (this.currentPip.pipPage) this.currentPip.pipPage.view.destroy(); - this.currentPip.pipIndex = -1; - this.currentPip.pipChannel = ''; - this.currentPip.pipPage = null; - } - - private jump(left: boolean): BrowserViewData { - this.pauseVideo(); - const channel: ChannelData = this.historyByChannel[this.currentChannel]; - const result: BrowserViewData = { - canBack: false, - canForward: false, - page: undefined, - }; - if (!channel) return result; - const { list, currentIndex } = channel; - const index = left ? currentIndex - 1 : currentIndex + 1; - if (!list || index < 0) return result; - if (!list[currentIndex]) return result; - if (index > 0) result.canBack = true; - if (index < list.length - 1) result.canForward = true; - result.page = list[index]; - channel.lastUpdateTime = Date.now(); - channel.currentIndex = index; - return result; - } -} - -export type BrowserViewData = { - canBack: boolean, - canForward: boolean, - page?: BrowserViewHistoryItem - view?: BrowserView, -} - -export interface IBrowserViewManager { - create(channel: string, args: { url: string, isNewWindow?: boolean }): BrowserViewData - back(): BrowserViewData - forward(): BrowserViewData - changeChanel(channel: string, args: { url: string, isNewWindow?: boolean }): BrowserViewData - enterPip(): { pipBrowser: BrowserView, mainBrowser: BrowserViewData } - exitPip(): BrowserViewData - changePip(channel: string): { pipBrowser: BrowserView, mainBrowser: BrowserViewData } - pipClose(): void - pauseVideo(view?: BrowserView, currentChannel?: string): void -} diff --git a/src/main/helpers/mediaTasksPlugin.ts b/src/main/helpers/mediaTasksPlugin.ts index e250e82d6a..aa0c703f4e 100644 --- a/src/main/helpers/mediaTasksPlugin.ts +++ b/src/main/helpers/mediaTasksPlugin.ts @@ -61,117 +61,25 @@ export default function registerMediaTasks() { reply(event, 'snapshot-reply', 'File does not exist.'); } }); - let lastVideoPath = ''; - let lastStreamIndex = -1; - const videoSubtitlesMap: Map> = new Map(); - ipcMain.on('subtitle-metadata-request', async (event: Event, videoPath: string, streamIndex: number, subtitlePath: string) => { - if ((lastVideoPath || lastStreamIndex !== -1) - && (lastVideoPath !== videoPath || lastStreamIndex !== streamIndex)) { - await splayerxProxy.stopExtractSubtitles(); - } - lastVideoPath = videoPath; - lastStreamIndex = streamIndex; - if (!videoSubtitlesMap.has(videoPath)) videoSubtitlesMap.set(videoPath, new Map()); - const streamSubtitlesMap = videoSubtitlesMap.get(videoPath); - if (streamSubtitlesMap) { - const subtitle = streamSubtitlesMap.get(streamIndex) || { - path: subtitlePath, - metadata: '', - payload: '', - position: 0, - finished: false, - lastLines: [], - }; - if (existsSync(subtitlePath) || subtitle.finished) { - subtitle.finished = true; - reply(event, 'subtitle-metadata-reply', undefined, subtitle.finished); - } else if (!subtitle.metadata) { - splayerxProxy.extractSubtitles(videoPath, streamIndex, 0, false, 1, - (error, pos, data) => { - if (error || !data) { - reply(event, 'subtitle-metadata-reply', new Error(error || 'Missing subtitle data.')); - } else { - subtitle.position = pos; - subtitle.payload = subtitle.metadata = data.toString('utf8') - .replace(/\n(Dialogue|Comment)[\s\S]*/g, '') - .split(/\r?\n/) - .join('\n'); - } - reply(event, 'subtitle-metadata-reply', undefined, subtitle.finished, subtitle.metadata); - }); - } else { - reply(event, 'subtitle-metadata-reply', undefined, subtitle.finished, subtitle.metadata); - } - streamSubtitlesMap.set(streamIndex, subtitle); - } - }); - ipcMain.on('subtitle-cache-request', async (event: Event, videoPath: string, streamIndex: number) => { - if ((lastVideoPath || lastStreamIndex !== -1) - && (lastVideoPath !== videoPath || lastStreamIndex !== streamIndex)) { - await splayerxProxy.stopExtractSubtitles(); - } - lastVideoPath = videoPath; - lastStreamIndex = streamIndex; - const streamSubtitlesMap = videoSubtitlesMap.get(videoPath); - if (streamSubtitlesMap) { - const subtitle = streamSubtitlesMap.get(streamIndex); - if (subtitle) { - splayerxProxy.extractSubtitles(videoPath, streamIndex, subtitle.position, false, 20, - (error, pos, data) => { - if (pos) subtitle.position = pos; - if (data) { - const newLines = data.toString('utf8').split(/\r?\n/); - const finalPayload = newLines.filter(line => !subtitle.lastLines.includes(line)).join('\n'); - subtitle.lastLines = newLines; - subtitle.payload += `\n${finalPayload}`; - } - if (error === 'EOF') { - subtitle.finished = true; - reply(event, 'subtitle-cache-reply', undefined, subtitle.finished, subtitle.payload); - } else if (error) { - reply(event, 'subtitle-cache-reply', new Error(error)); - } else { - reply(event, 'subtitle-cache-reply', undefined, subtitle.finished); - } - }); - streamSubtitlesMap.set(streamIndex, subtitle); - } else reply(event, 'subtitle-cache-reply', new Error('Missing subtitle entry, should request metadata first.')); - } else reply(event, 'subtitle-cache-reply', new Error('Missing videoPath entry, should request metadata first.')); - }); - ipcMain.on('subtitle-stream-request', (event: Event, videoPath: string, streamIndex: number, time: number) => { - const streamSubtitlesMap = videoSubtitlesMap.get(videoPath); - if (streamSubtitlesMap) { - const subtitle = streamSubtitlesMap.get(streamIndex); - if (subtitle) { - splayerxProxy.extractSubtitles(videoPath, streamIndex, time, true, 20, - (error, pos, data) => { - if (data) { - reply(event, 'subtitle-stream-reply', undefined, data.toString('utf8')); - } else { - reply(event, 'subtitle-stream-reply', new Error(!error || !data ? 'Missing subtitle data' : error)); - } - }); - } else reply(event, 'subtitle-stream-reply', new Error('Missing subtitle entry, should request metadata first.')); - } else reply(event, 'subtitle-stream-reply', new Error('Missing videoPath entry, should request metadata first.')); - }); - ipcMain.on('subtitle-destroy-request', async (event: Event, videoPath: string, streamIndex: number) => { - const streamSubtitlesMap = videoSubtitlesMap.get(videoPath); - if (streamSubtitlesMap) { - const subtitle = streamSubtitlesMap.get(streamIndex); - if (subtitle) { - await splayerxProxy.stopExtractSubtitles(); - lastVideoPath = ''; - lastStreamIndex = -1; - } + ipcMain.on('subtitle-request', (event, videoPath, subtitlePath, streamIndex) => { + if (existsSync(subtitlePath)) { + reply(event, 'subtitle-reply', null, subtitlePath); + } else if (existsSync(videoPath)) { + splayerxProxy.extractSubtitles( + videoPath, subtitlePath, + streamIndex, + (err) => { + if (err === '0' && existsSync(subtitlePath)) { + reply(event, 'subtitle-reply', null, subtitlePath); + } else { + if (typeof err !== 'string') err = `${err}, type: ${typeof err}`; + reply(event, 'subtitle-reply', `subtitle-reply: ${err}`); + } + }, + ); + } else { + reply(event, 'subtitle-reply', 'File does not exist.'); } - reply(event, 'subtitle-destroy-reply'); }); ipcMain.on('thumbnail-request', (event, videoPath, imagePath, interval, diff --git a/src/main/helpers/mouse.ts b/src/main/helpers/mouse.ts index bbede8f3a1..422b2afb02 100644 --- a/src/main/helpers/mouse.ts +++ b/src/main/helpers/mouse.ts @@ -4,7 +4,7 @@ interface IMouse { dispose(): void, } -class Mouse implements IMouse { +class WinMouse implements IMouse { private mouse: { on(channel: string, callback: (x: number, y: number) => void): void, off(channel: string, callback?: (x: number, y: number) => void): void, @@ -13,7 +13,7 @@ class Mouse implements IMouse { public constructor() { try { - const mouseConstructor = process.platform === 'win32' ? require('win-mouse') : require('osx-mouse-cocoa'); //eslint-disable-line + const mouseConstructor = require('win-mouse'); //eslint-disable-line this.mouse = mouseConstructor(); } catch (ex) { console.error(ex); @@ -34,4 +34,14 @@ class Mouse implements IMouse { } } +class FakeMouse implements IMouse { + public on() {} //eslint-disable-line + + public off() {} //eslint-disable-line + + public dispose() {} //eslint-disable-line +} + +const Mouse = process.platform === 'win32' ? WinMouse : FakeMouse; + export const mouse: IMouse = new Mouse(); diff --git a/src/main/index.js b/src/main/index.js index 9880451308..8bf74457be 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -1,15 +1,14 @@ // Be sure to call Sentry function as early as possible in the main process import '../shared/sentry'; -import { app, BrowserWindow, session, Tray, ipcMain, globalShortcut, nativeImage, splayerx, systemPreferences, BrowserView, webContents } from 'electron' // eslint-disable-line +import { app, BrowserWindow, session, Tray, ipcMain, globalShortcut, nativeImage, splayerx, systemPreferences } from 'electron' // eslint-disable-line import { throttle, debounce, uniq } from 'lodash'; import os from 'os'; import path, { - basename, dirname, extname, join, resolve, + basename, dirname, extname, join, } from 'path'; import fs from 'fs'; import rimraf from 'rimraf'; -import urlParse from 'url-parse-lax'; // import { audioHandler } from './helpers/audioHandler'; import { audioGrabService } from './helpers/AudioGrabService'; import './helpers/electronPrototypes'; @@ -18,7 +17,6 @@ import { getValidVideoRegex, getValidSubtitleRegex } from '../shared/utils'; import { mouse } from './helpers/mouse'; import MenuService from './menu/MenuService'; import registerMediaTasks from './helpers/mediaTasksPlugin'; -import { BrowserViewManager } from './helpers/BrowserViewManager'; // requestSingleInstanceLock is not going to work for mas // https://github.com/electron-userland/electron-packager/issues/923 @@ -59,7 +57,6 @@ if (process.env.NODE_ENV !== 'development') { app.commandLine.appendSwitch('autoplay-policy', 'no-user-gesture-required'); -let sidebar = false; let welcomeProcessDone = false; let menuService = null; let routeName = null; @@ -67,23 +64,15 @@ let mainWindow = null; let laborWindow = null; let aboutWindow = null; let preferenceWindow = null; -let browsingWindow = null; -let browserViewManager = null; -let pipControlView = null; -let titlebarView = null; -let isBrowsingWindowMax = false; let tray = null; -let pipTimer = 0; let needToRestore = false; let forceQuit = false; // 大退app 关闭所有windows let needBlockCloseLaborWindow = true; // 标记是否阻塞nsfw窗口关闭 let inited = false; -let hideBrowsingWindow = false; let finalVideoToOpen = []; const tmpVideoToOpen = []; const tmpSubsToOpen = []; const subRegex = getValidSubtitleRegex(); -const titlebarUrl = process.platform === 'darwin' ? `file:${resolve(__static, 'pip/macTitlebar.html')}` : `file:${resolve(__static, 'pip/winTitlebar.html')}`; const mainURL = process.env.NODE_ENV === 'development' ? 'http://localhost:9080' : `file://${__dirname}/index.html`; @@ -96,9 +85,6 @@ const aboutURL = process.env.NODE_ENV === 'development' const preferenceURL = process.env.NODE_ENV === 'development' ? 'http://localhost:9080/preference.html' : `file://${__dirname}/preference.html`; -const browsingURL = process.env.NODE_ENV === 'development' - ? 'http://localhost:9080/browsing.html' - : `file://${__dirname}/browsing.html`; const tempFolderPath = path.join(app.getPath('temp'), 'splayer'); if (!fs.existsSync(tempFolderPath)) fs.mkdirSync(tempFolderPath); @@ -131,39 +117,6 @@ function handleBossKey() { } } -function createPipControlView() { - if (pipControlView && !pipControlView.isDestroyed()) pipControlView.destroy(); - pipControlView = new BrowserView({ - webPreferences: { - preload: `${require('path').resolve(__static, 'pip/preload.js')}`, - }, - }); - browsingWindow.addBrowserView(pipControlView); - pipControlView.webContents.loadURL(`file:${require('path').resolve(__static, 'pip/pipControl.html')}`); - pipControlView.setBackgroundColor('#00FFFFFF'); - pipControlView.setBounds({ - x: Math.round(browsingWindow.getSize()[0] - 65), - y: Math.round(browsingWindow.getSize()[1] / 2 - 54), - width: 50, - height: 104, - }); -} - -function createTitlebarView() { - if (titlebarView) titlebarView.destroy(); - titlebarView = new BrowserView({ - webPreferences: { - preload: `${require('path').resolve(__static, 'pip/titlebarPreload.js')}`, - }, - }); - browsingWindow.addBrowserView(titlebarView); - titlebarView.webContents.loadURL(titlebarUrl); - titlebarView.setBackgroundColor('#00FFFFFF'); - titlebarView.setBounds({ - x: 0, y: 0, width: browsingWindow.getSize()[0], height: 36, - }); -} - function markNeedToRestore() { fs.closeSync(fs.openSync(path.join(app.getPath('userData'), 'NEED_TO_RESTORE_MARK'), 'w')); } @@ -305,46 +258,6 @@ function createAboutWindow() { }); } -function createBrowsingWindow(args) { - const browsingWindowOptions = { - useContentSize: true, - frame: false, - titleBarStyle: 'none', - transparent: true, - webPreferences: { - webSecurity: false, - nodeIntegration: true, - experimentalFeatures: true, - webviewTag: true, - }, - backgroundColor: '#000000', - acceptFirstMouse: false, - show: false, - }; - if (!browsingWindow) { - browsingWindow = new BrowserWindow(browsingWindowOptions); - browsingWindow.loadURL(`${browsingURL}`); - browsingWindow.on('closed', () => { - browsingWindow = null; - }); - } - browsingWindow.once('ready-to-show', () => { - browsingWindow.setSize(args.size[0], args.size[1]); - if (args.position.length) { - browsingWindow.setPosition(args.position[0], args.position[1]); - } - browsingWindow.on('focus', () => { - menuService.updateFocusedWindow(false, mainWindow && mainWindow.isVisible()); - }); - }); - browsingWindow.on('leave-full-screen', () => { - if (hideBrowsingWindow) { - hideBrowsingWindow = false; - browsingWindow.hide(); - } - }); -} - function createLaborWindow() { const laborWindowOptions = { show: false, @@ -451,13 +364,6 @@ function registerMainWindowEvent(mainWindow) { } }); - ipcMain.on('callBrowsingWindowMethod', (evt, method, args = []) => { - try { - browsingWindow[method](...args); - } catch (ex) { - console.error('callBrowsingWindowMethod', method, JSON.stringify(args), '\n', ex); - } - }); ipcMain.on('callMainWindowMethod', (evt, method, args = []) => { try { mainWindow[method](...args); @@ -465,422 +371,9 @@ function registerMainWindowEvent(mainWindow) { console.error('callMainWindowMethod', method, JSON.stringify(args), '\n', ex); } }); - ipcMain.on('pip-watcher', (evt, args) => { - browsingWindow.getBrowserViews()[0].webContents.executeJavaScript(args); - }); - ipcMain.on('pip-window-close', (evt, args) => { - const views = browsingWindow.getBrowserViews(); - if (views.length) { - views.forEach((view) => { - browsingWindow.removeBrowserView(view); - }); - browserViewManager.pipClose(); - mainWindow.send('update-pip-state', args); - } - }); - ipcMain.on('remove-main-window', () => { - browserViewManager.pauseVideo(mainWindow.getBrowserView()); - mainWindow.hide(); - }); - ipcMain.on('remove-browser', () => { - const mainView = mainWindow.getBrowserView(); - mainWindow.removeBrowserView(mainView); - browserViewManager.pauseVideo(); - if (browsingWindow) { - const views = browsingWindow.getBrowserViews(); - views.forEach((view) => { - browsingWindow.removeBrowserView(view); - }); - browserViewManager.pipClose(); - browsingWindow.close(); - } - }); - ipcMain.on('go-to-offset', (evt, val) => { - if (!browserViewManager) return; - const newBrowser = val === 1 ? browserViewManager.forward() : browserViewManager.back(); - const id = mainWindow.getBrowserView().id; - mainWindow.addBrowserView(newBrowser.page.view); - setTimeout(() => { - mainWindow.removeBrowserView(BrowserView.fromId(id)); - mainWindow.send('update-browser-state', { - url: newBrowser.page.url, - canGoBack: newBrowser.canBack, - canGoForward: newBrowser.canForward, - }); - }, 150); - newBrowser.page.view.setBounds({ - x: sidebar ? 76 : 0, - y: 40, - width: sidebar ? mainWindow.getSize()[0] - 76 : mainWindow.getSize()[0], - height: mainWindow.getSize()[1] - 40, - }); - newBrowser.page.view.setAutoResize({ - width: true, height: true, - }); - }); - ipcMain.on('change-channel', (evt, args) => { - if (!browserViewManager) browserViewManager = new BrowserViewManager(); - const hostname = urlParse(args.url).hostname; - let channel = hostname.slice(hostname.indexOf('.') + 1, hostname.length); - if (args.url.includes('youtube')) { - channel = 'youtube.com'; - } - const newChannel = browserViewManager.changeChanel(channel, args); - const view = newChannel.view ? newChannel.view : newChannel.page.view; - const url = newChannel.view ? args.url : newChannel.page.url; - const mainBrowser = mainWindow.getBrowserView(); - mainWindow.addBrowserView(view); - setTimeout(() => { - if (mainBrowser) mainWindow.removeBrowserView(BrowserView.fromId(mainBrowser.id)); - mainWindow.send('update-browser-state', { - url, - canGoBack: newChannel.canBack, - canGoForward: newChannel.canForward, - }); - }, 150); - view.setBounds({ - x: sidebar ? 76 : 0, - y: 40, - width: sidebar ? mainWindow.getSize()[0] - 76 : mainWindow.getSize()[0], - height: mainWindow.getSize()[1] - 40, - }); - view.setAutoResize({ - width: true, height: true, - }); - }); - ipcMain.on('create-browser-view', (evt, args) => { - if (!browserViewManager) browserViewManager = new BrowserViewManager(); - const hostname = urlParse(args.url).hostname; - let channel = hostname.slice(hostname.indexOf('.') + 1, hostname.length); - if (args.url.includes('youtube')) { - channel = 'youtube.com'; - } - const currentMainBrowserView = browserViewManager.create(channel, args); - setTimeout(() => { - mainWindow.send('update-browser-state', { - url: args.url, - canGoBack: currentMainBrowserView.canBack, - canGoForward: currentMainBrowserView.canForward, - }); - }, 0); - }); - ipcMain.on('update-danmu-state', (evt, val) => { - pipControlView.webContents.executeJavaScript(`document.querySelector(".danmu").src = ${val} ? "assets/danmu-default-icon.svg" : "assets/noDanmu-default-icon.svg"`); - }); - ipcMain.on('pip', () => { - mainWindow.send('handle-exit-pip'); - }); - ipcMain.on('danmu', () => { - mainWindow.send('handle-danmu-display'); - }); - ipcMain.on('handle-danmu-display', (evt, code) => { - browsingWindow.getBrowserViews()[0].webContents.executeJavaScript(code); - }); - ipcMain.on('mousemove', () => { - if (browsingWindow && browsingWindow.isFocused()) { - pipControlView.webContents.executeJavaScript('document.querySelector(".pip-buttons").style.display = "flex";'); - if (pipTimer) { - clearTimeout(pipTimer); - } - pipTimer = setTimeout(() => { - if (pipControlView && !pipControlView.isDestroyed()) { - pipControlView.webContents.executeJavaScript('document.querySelector(".pip-buttons").style.display = "none";'); - } - }, 3000); - } - }); - ipcMain.on('pip-btn-mousemove', () => { - if (pipTimer) { - clearTimeout(pipTimer); - } - }); - ipcMain.on('pip-btn-mouseout', () => { - if (pipTimer) { - clearTimeout(pipTimer); - } - pipTimer = setTimeout(() => { - if (pipControlView && !pipControlView.isDestroyed()) { - pipControlView.webContents.executeJavaScript('document.querySelector(".pip-buttons").style.display = "none";'); - } - }, 3000); - }); - ipcMain.on('mouseout', () => { - if (browsingWindow && browsingWindow.isFocused()) { - if (pipTimer) { - clearTimeout(pipTimer); - } - pipControlView.webContents.executeJavaScript('document.querySelector(".pip-buttons").style.display = "none";'); - } - }); - ipcMain.on('maximizable', (evt, val) => { - if (val) { - titlebarView.webContents.executeJavaScript('document.querySelector(".titlebarMax").style.display = "block";' - + 'document.querySelector(".titlebarFull").style.display = "none"'); - } else { - titlebarView.webContents.executeJavaScript('document.querySelector(".titlebarMax").style.display = "none";' - + 'document.querySelector(".titlebarFull").style.display = "block";'); - } - }); - ipcMain.on('update-mouse-info', (evt, args) => { - if (browsingWindow && browsingWindow.isFocused()) { - browsingWindow.send('update-mouse-info', args); - } - }); - ipcMain.on('mouseup', (evt, type) => { - switch (type) { - case 'close': - browsingWindow.close(); - break; - case 'min': - browsingWindow.minimize(); - break; - case 'full': - browsingWindow.setFullScreen(true); - if (process.platform === 'darwin') { - titlebarView.webContents.executeJavaScript('document.querySelector(".titlebarMin").style.pointerEvents = "none";' - + 'document.querySelector(".titlebarMin").style.opacity = "0.25";' - + 'document.querySelector(".titlebarFull").style.display = "none";' - + 'document.querySelector(".titlebarRecover").style.display = "block";'); - } else { - titlebarView.webContents.executeJavaScript('document.querySelector(".titlebarMax").style.display = "none";' - + 'document.querySelector(".titlebarUnMax").style.display = "none";' - + 'document.querySelector(".titlebarRecover").style.display = "block";'); - } - break; - case 'recover': - browsingWindow.setFullScreen(false); - if (process.platform === 'darwin') { - titlebarView.webContents.executeJavaScript('document.querySelector(".titlebarMin").style.pointerEvents = "";' - + 'document.querySelector(".titlebarMin").style.opacity = "1";' - + 'document.querySelector(".titlebarFull").style.display = "";' - + 'document.querySelector(".titlebarRecover").style.display = "none";'); - } else { - titlebarView.webContents.executeJavaScript('document.querySelector(".titlebarMax").style.display = "block";' - + 'document.querySelector(".titlebarUnMax").style.display = "none";' - + 'document.querySelector(".titlebarRecover").style.display = "none";'); - } - break; - case 'max': - if (browsingWindow.isMaximized()) { - browsingWindow.unmaximize(); - isBrowsingWindowMax = false; - } else { - browsingWindow.maximize(); - isBrowsingWindowMax = true; - if (process.platform === 'win32') { - titlebarView.webContents.executeJavaScript('document.querySelector(".titlebarMax").style.display = "none";' - + 'document.querySelector(".titlebarUnMax").style.display = "block";' - + 'document.querySelector(".titlebarRecover").style.display = "none";'); - } - } - break; - case 'unmax': - browsingWindow.unmaximize(); - isBrowsingWindowMax = false; - if (process.platform === 'win32') { - titlebarView.webContents.executeJavaScript('document.querySelector(".titlebarMax").style.display = "block";' - + 'document.querySelector(".titlebarUnMax").style.display = "none";' - + 'document.querySelector(".titlebarRecover").style.display = "none";'); - } - break; - default: - break; - } - }); - ipcMain.on('shift-pip', (evt, args) => { - if (!browserViewManager) return; - const mainView = mainWindow.getBrowserView(); - mainWindow.removeBrowserView(mainView); - const browViews = browsingWindow.getBrowserViews(); - browViews.forEach((view) => { - browsingWindow.removeBrowserView(view); - }); - const hostname = urlParse(mainView.webContents.getURL()).hostname; - let channel = hostname.slice(hostname.indexOf('.') + 1, hostname.length); - if (mainView.webContents.getURL().includes('youtube')) { - channel = 'youtube.com'; - } - const browsers = browserViewManager.changePip(channel); - const pipBrowser = browsers.pipBrowser; - const mainBrowser = browsers.mainBrowser; - mainWindow.addBrowserView(mainBrowser.page.view); - browsingWindow.addBrowserView(pipBrowser); - createPipControlView(); - createTitlebarView(); - if (args.isGlobal) { - browserViewManager.pauseVideo(mainWindow.getBrowserView()); - mainWindow.hide(); - } - mainBrowser.page.view.setBounds({ - x: sidebar ? 76 : 0, - y: 40, - width: sidebar ? mainWindow.getSize()[0] - 76 : mainWindow.getSize()[0], - height: mainWindow.getSize()[1] - 40, - }); - mainBrowser.page.view.setAutoResize({ - width: true, height: true, - }); - pipBrowser.setBounds({ - x: 0, y: 0, width: browsingWindow.getSize()[0], height: browsingWindow.getSize()[1], - }); - pipBrowser.setAutoResize({ - width: true, height: true, - }); - mainWindow.send('update-browser-state', { - url: mainBrowser.page.url, - canGoBack: mainBrowser.canBack, - canGoForward: mainBrowser.canForward, - }); - pipControlView.webContents.executeJavaScript( - `const danmu = document.querySelector(".danmu"); - danmu.src = ${args.barrageOpen} ? "assets/danmu-default-icon.svg" : "assets/noDanmu-default-icon.svg"; - danmu.style.opacity = ${args.opacity}; - danmu.style.cursor = ${args.opacity} === 1 ? "cursor" : "default"`, - ); - menuService.updateFocusedWindow(false, mainWindow && mainWindow.isVisible()); - browsingWindow.focus(); - }); - ipcMain.on('enter-pip', (evt, args) => { - if (!browserViewManager) return; - const browsers = browserViewManager.enterPip(); - const pipBrowser = browsers.pipBrowser; - const mainBrowser = browsers.mainBrowser; - if (!browsingWindow) { - createBrowsingWindow(); - browsingWindow.setSize(args.pipInfo.pipSize[0], args.pipInfo.pipSize[1]); - browsingWindow.setPosition(args.pipInfo.pipPos[0], args.pipInfo.pipPos[1]); - mainWindow.send('init-pip-position'); - mainWindow.removeBrowserView(mainWindow.getBrowserView()); - mainWindow.addBrowserView(mainBrowser.page.view); - browsingWindow.addBrowserView(pipBrowser); - createPipControlView(); - createTitlebarView(); - browsingWindow.show(); - } else { - mainWindow.removeBrowserView(mainWindow.getBrowserView()); - mainWindow.addBrowserView(mainBrowser.page.view); - browsingWindow.setSize(browsingWindow.getSize()[0] + 1, browsingWindow.getSize()[1]); - browsingWindow.addBrowserView(pipBrowser); - createPipControlView(); - createTitlebarView(); - browsingWindow.show(); - } - if (args.isGlobal) { - browserViewManager.pauseVideo(mainWindow.getBrowserView()); - mainWindow.hide(); - } - browsingWindow.setAspectRatio(args.pipInfo.aspectRatio); - browsingWindow.setMinimumSize(args.pipInfo.minimumSize[0], args.pipInfo.minimumSize[1]); - mainBrowser.page.view.setBounds({ - x: sidebar ? 76 : 0, - y: 40, - width: sidebar ? mainWindow.getSize()[0] - 76 : mainWindow.getSize()[0], - height: mainWindow.getSize()[1] - 40, - }); - mainBrowser.page.view.setAutoResize({ - width: true, - height: true, - }); - pipBrowser.setBounds({ - x: 0, y: 0, width: browsingWindow.getSize()[0], height: browsingWindow.getSize()[1], - }); - pipBrowser.setAutoResize({ - width: true, height: true, - }); - browsingWindow.send('update-pip-listener'); - mainWindow.send('update-browser-state', { - url: mainBrowser.page.url, - canGoBack: mainBrowser.canBack, - canGoForward: mainBrowser.canForward, - }); - pipControlView.webContents.executeJavaScript( - `const danmu = document.querySelector(".danmu"); - danmu.src = ${args.barrageOpen} ? "assets/danmu-default-icon.svg" : "assets/noDanmu-default-icon.svg"; - danmu.style.opacity = ${args.opacity}; - danmu.style.cursor = ${args.opacity} === 1 ? "cursor" : "default"`, - ); - menuService.updateFocusedWindow(false, mainWindow && mainWindow.isVisible()); - browsingWindow.focus(); - }); - ipcMain.on('update-pip-size', (evt, args) => { - mainWindow.send('update-pip-size', args); - }); - ipcMain.on('update-sidebar', (evt, sidebarstate) => { - sidebar = sidebarstate; - }); - ipcMain.on('set-bounds', (evt, args) => { - if (pipControlView) pipControlView.setBounds(args.control); - if (titlebarView) titlebarView.setBounds(args.titlebar); - }); - ipcMain.on('exit-pip', () => { - if (!browserViewManager) return; - browsingWindow.send('remove-pip-listener'); - mainWindow.show(); - const mainView = mainWindow.getBrowserView(); - mainWindow.removeBrowserView(mainView); - const browViews = browsingWindow.getBrowserViews(); - browViews.forEach((view) => { - browsingWindow.removeBrowserView(view); - }); - const exitBrowser = browserViewManager.exitPip(); - mainWindow.addBrowserView(exitBrowser.page.view); - exitBrowser.page.view.setBounds({ - x: sidebar ? 76 : 0, - y: 40, - width: sidebar ? mainWindow.getSize()[0] - 76 : mainWindow.getSize()[0], - height: mainWindow.getSize()[1] - 40, - }); - exitBrowser.page.view.setAutoResize({ - width: true, - height: true, - }); - mainWindow.send('update-browser-state', { - url: exitBrowser.page.url, - canGoBack: exitBrowser.canBack, - canGoForward: exitBrowser.canForward, - }); - if (browsingWindow.isFullScreen()) { - hideBrowsingWindow = true; - browsingWindow.setFullScreen(false); - } else { - browsingWindow.hide(); - } - menuService.updateFocusedWindow(true, mainWindow && mainWindow.isVisible()); - mainWindow.focus(); - }); - ipcMain.on('set-window-maximize', () => { - if (mainWindow && mainWindow.isFocused()) { - if (!mainWindow.isMaximized()) { - mainWindow.maximize(); - } else { - mainWindow.unmaximize(); - } - } else if (browsingWindow && browsingWindow.isFocused()) { - if (!isBrowsingWindowMax) { - browsingWindow.maximize(); - isBrowsingWindowMax = true; - if (process.platform === 'win32') { - titlebarView.webContents.executeJavaScript('document.querySelector(".titlebarMax").style.display = "none";' - + 'document.querySelector(".titlebarUnMax").style.display = "block";' - + 'document.querySelector(".titlebarRecover").style.display = "none";'); - } - } else { - browsingWindow.unmaximize(); - isBrowsingWindowMax = false; - if (process.platform === 'win32') { - titlebarView.webContents.executeJavaScript('document.querySelector(".titlebarMax").style.display = "block";' - + 'document.querySelector(".titlebarUnMax").style.display = "none";' - + 'document.querySelector(".titlebarRecover").style.display = "none";'); - } - } - } - }); ipcMain.on('update-route-name', (e, route) => { routeName = route; }); - ipcMain.on('key-events', (e, keyCode) => { - browsingWindow.getBrowserViews()[0].webContents.executeJavaScript(`var event = new KeyboardEvent("keydown", { keyCode: ${keyCode} });window.dispatchEvent(event)`); - }); ipcMain.on('drop-subtitle', (event, args) => { if (!mainWindow || mainWindow.webContents.isDestroyed()) return; args.forEach((file) => { @@ -932,9 +425,6 @@ function registerMainWindowEvent(mainWindow) { app.quit(); }); ipcMain.on('add-preference', createPreferenceWindow); - ipcMain.on('add-browsing', (e, args) => { - createBrowsingWindow(args); - }); ipcMain.on('preference-to-main', (e, args) => { if (mainWindow && !mainWindow.webContents.isDestroyed()) { mainWindow.webContents.send('mainDispatch', 'setPreference', args); @@ -1048,12 +538,8 @@ function createMainWindow(openDialog, playlistId) { ['left-drag', 'left-up'].forEach((channel) => { mouse.on(channel, (...args) => { - if (process.platform === 'win32') { - const focusedWindow = BrowserWindow.getFocusedWindow(); - if (focusedWindow) focusedWindow.send(`mouse-${channel}`, ...args); - } else if (browsingWindow && browsingWindow.isFocused()) { - browsingWindow.webContents.send(`mouse-${channel}`, ...args); - } + if (!mainWindow || mainWindow.webContents.isDestroyed()) return; + mainWindow.webContents.send(`mouse-${channel}`, ...args); }); }); @@ -1198,11 +684,6 @@ if (process.platform === 'darwin') { app.on('ready', () => { menuService = new MenuService(); if (process.platform === 'darwin') { - systemPreferences.subscribeNotification('AppleInterfaceThemeChangedNotification', () => { - if (routeName === 'browsing-view') { - menuService.updatePipIcon(); - } - }); systemPreferences.setUserDefault('NSDisabledDictationMenuItem', 'boolean', true); systemPreferences.setUserDefault('NSDisabledCharacterPaletteMenuItem', 'boolean', true); } @@ -1241,7 +722,7 @@ const oauthRegex = [ /^https:\/\/account.xiaomi.com\/pass\//i, ]; app.on('web-contents-created', (webContentsCreatedEvent, contents) => { - if (contents.getType() === 'browserView') { + if (contents.getType() === 'webview') { contents.on('new-window', (newWindowEvent, url) => { if (!oauthRegex.some(re => re.test(url))) { newWindowEvent.preventDefault(); @@ -1262,7 +743,7 @@ app.on('menu-create-main-window', () => { if (!mainWindow) createMainWindow(); else if (mainWindow.isMinimized()) { mainWindow.restore(); - } else if (!mainWindow.isVisible() && (!browsingWindow || !browsingWindow.isVisible())) { + } else if (!mainWindow.isVisible()) { mainWindow.show(); } }); @@ -1274,10 +755,7 @@ app.on('menu-open-dialog', (playlistId) => { app.on('activate', () => { if (!mainWindow) { if (app.isReady()) createMainWindow(); - } else if (!mainWindow.isVisible() && (!browsingWindow || !browsingWindow.isVisible())) { + } else if (!mainWindow.isVisible()) { mainWindow.show(); } - if (browsingWindow && browsingWindow.isMinimized()) { - browsingWindow.restore(); - } }); diff --git a/src/main/menu/Menu.ts b/src/main/menu/Menu.ts index 2a29c90517..954fef1529 100644 --- a/src/main/menu/Menu.ts +++ b/src/main/menu/Menu.ts @@ -1,22 +1,22 @@ import { - app, Menu, MenuItem, shell, nativeImage, systemPreferences, + Menu, MenuItem, app, shell, } from 'electron'; import { cloneDeep } from 'lodash'; import { + MenubarMenuItem, IMenubarMenu, + IMenubarMenuItemSubmenu, + IMenubarMenuItemSeparator, IMenubarMenuItemAction, IMenubarMenuItemRole, - IMenubarMenuItemSeparator, - IMenubarMenuItemSubmenu, IMenubarMenuState, - MenubarMenuItem, MenuName, } from './common/Menubar'; import { isMacintosh, isWindowsExE, isMacintoshDMG } from '../../shared/common/platform'; import Locale from '../../shared/common/localize'; import menuTemplate from './menu.json'; import { IMenuDisplayInfo } from '../../renderer/interfaces/IRecentPlay'; -import { ISubtitleControlListItem, Type } from '../../renderer/interfaces/ISubtitle'; +import { SubtitleControlListItem, Type } from '../../renderer/interfaces/ISubtitle'; function separator(): Electron.MenuItem { return new MenuItem({ type: 'separator' }); @@ -44,15 +44,13 @@ export default class Menubar { private audioTracks: { id: string, label: string }[]; - private focusOnMainWindow = true; - private primarySubs: { - id: string, label: string, checked: boolean, subtitleItem: ISubtitleControlListItem, + id: string, label: string, checked: boolean, subtitleItem: SubtitleControlListItem, }[]; private secondarySubs: { id: string, label: string, checked: boolean, - enabled: boolean, subtitleItem: ISubtitleControlListItem, + enabled: boolean, subtitleItem: SubtitleControlListItem, }[]; private _routeName: string; @@ -62,25 +60,6 @@ export default class Menubar { this.menuStateControl(); } - public updateFocusedWindow(isMainWindow: boolean, isNewWindow: boolean) { - if (this.focusOnMainWindow !== isMainWindow) { - if (!isMainWindow) { - this.updateMenuItemEnabled('history.back', false); - this.updateMenuItemEnabled('history.forward', false); - this.updateMenuItemEnabled('history.reload', false); - this.updateMenuItemEnabled(isNewWindow ? 'browsing.window.playInNewWindow' : 'browsing.window.pip', true); - this.updateMenuItemEnabled('browsing.window.keepPipFront', true); - this.updateMenuItemLabel('browsing.window.pip', 'msg.window.exitPip'); - this.updateMenuItemLabel('browsing.window.playInNewWindow', 'msg.window.backToBrowser'); - } else { - this.updateMenuItemEnabled('browsing.window.keepPipFront', false); - this.updateMenuItemLabel('browsing.window.pip', 'msg.window.enterPip'); - this.updateMenuItemLabel('browsing.window.playInNewWindow', 'msg.window.playInNewWindow'); - } - this.focusOnMainWindow = isMainWindow; - } - } - public constructor() { this.locale = new Locale(); this.currentMenuState = cloneDeep(menuTemplate as IMenubarMenuState); @@ -223,10 +202,6 @@ export default class Menubar { } } - public updatePipIcon() { - this.refreshMenu('browsing.window'); - } - public updateMenuItemEnabled(id: string, enabled: boolean) { const result = this.getMenuStateById(id); // @ts-ignore @@ -264,7 +239,7 @@ export default class Menubar { public updatePrimarySub( items?: { - id: string, label: string, checked: boolean, subtitleItem: ISubtitleControlListItem, + id: string, label: string, checked: boolean, subtitleItem: SubtitleControlListItem, }[], ) { if (items) this.primarySubs = items; @@ -297,7 +272,7 @@ export default class Menubar { public updateSecondarySub( items?: { id: string, label: string, checked: boolean, - enabled: boolean, subtitleItem: ISubtitleControlListItem, + enabled: boolean, subtitleItem: SubtitleControlListItem, }[], ) { if (items) this.secondarySubs = items; @@ -754,52 +729,62 @@ export default class Menubar { ]); actions.forEach(i => applicationMenu.append(i)); - return new MenuItem({ label: this.$t('msg.splayerx.name'), submenu: applicationMenu }); + const applicationMenuItem = new MenuItem({ label: this.$t('msg.splayerx.name'), submenu: applicationMenu }); + return applicationMenuItem; } private createFileMenu(): Electron.MenuItem { const fileMenu = this.convertFromMenuItemTemplate('file'); - return new MenuItem({ id: 'file', label: this.$t('msg.file.name'), submenu: fileMenu }); + const fileMenuItem = new MenuItem({ id: 'file', label: this.$t('msg.file.name'), submenu: fileMenu }); + return fileMenuItem; } private createPlaybackMenu() { const playbackMenu = this.convertFromMenuItemTemplate('playback'); - return new MenuItem({ id: 'playback', label: this.$t('msg.playback.name'), submenu: playbackMenu }); + const playbackMenuItem = new MenuItem({ id: 'playback', label: this.$t('msg.playback.name'), submenu: playbackMenu }); + return playbackMenuItem; } private createAudioMenu() { const audioMenu = this.convertFromMenuItemTemplate('audio'); - return new MenuItem({ id: 'audio', label: this.$t('msg.audio.name'), submenu: audioMenu }); + const audioMenuItem = new MenuItem({ id: 'audio', label: this.$t('msg.audio.name'), submenu: audioMenu }); + return audioMenuItem; } private createSubtitleMenu() { const subtitleMenu = this.convertFromMenuItemTemplate('subtitle'); - return new MenuItem({ id: 'subtitle', label: this.$t('msg.subtitle.name'), submenu: subtitleMenu }); + const subtitleMenuItem = new MenuItem({ id: 'subtitle', label: this.$t('msg.subtitle.name'), submenu: subtitleMenu }); + return subtitleMenuItem; } private createEditMenu() { const editMenu = this.convertFromMenuItemTemplate('edit'); - return new MenuItem({ id: 'edit', label: this.$t('msg.edit.name'), submenu: editMenu }); + const editMenuItem = new MenuItem({ id: 'edit', label: this.$t('msg.edit.name'), submenu: editMenu }); + return editMenuItem; } private createHistoryMenu() { const historyMenu = this.convertFromMenuItemTemplate('history'); - return new MenuItem({ id: 'history', label: this.$t('msg.history.name'), submenu: historyMenu }); + const historyMenuItem = new MenuItem({ id: 'history', label: this.$t('msg.history.name'), submenu: historyMenu }); + return historyMenuItem; } private createFavouriteMenu() { const favouriteMenu = this.convertFromMenuItemTemplate('favourite'); - return new MenuItem({ id: 'favourite', label: this.$t('msg.favourite.name'), submenu: favouriteMenu }); + const favouriteMenuItem = new MenuItem({ id: 'favourite', label: this.$t('msg.favourite.name'), submenu: favouriteMenu }); + return favouriteMenuItem; } private createBrowsingWindowMenu() { const window = this.convertFromMenuItemTemplate('browsing.window'); - return new MenuItem({ id: 'browsing.window', label: this.$t('msg.window.name'), submenu: window }); + const windowMenuItem = new MenuItem({ id: 'browsing.window', label: this.$t('msg.window.name'), submenu: window }); + return windowMenuItem; } private createWindowMenu() { const windowMenu = this.convertFromMenuItemTemplate('window'); - return new MenuItem({ id: 'window', label: this.$t('msg.window.name'), submenu: windowMenu }); + const windowMenuItem = new MenuItem({ id: 'window', label: this.$t('msg.window.name'), submenu: windowMenu }); + return windowMenuItem; } private createHelpMenu() { @@ -966,18 +951,7 @@ export default class Menubar { return new MenuItem(options); } if (arg1.enabled === undefined) arg1.enabled = true; - let menuIcon: string | Electron.nativeImage = ''; - switch (arg1.icon) { - case 'enter-pip': - menuIcon = systemPreferences.isDarkMode() ? nativeImage.createFromDataURL(require('../../../build/icons/mojave-pip.png')) : nativeImage.createFromDataURL(require('../../../build/icons/normal-pip.png')); - break; - case 'play-in-new-window': - menuIcon = systemPreferences.isDarkMode() ? nativeImage.createFromDataURL(require('../../../build/icons/mojave-window.png')) : nativeImage.createFromDataURL(require('../../../build/icons/normal-window.png')); - break; - default: - menuIcon = ''; - break; - } + const label = this.$t(arg1.label); const options: Electron.MenuItemConstructorOptions = { @@ -991,7 +965,6 @@ export default class Menubar { }, enabled: arg1.enabled, accelerator: arg1.accelerator, - icon: menuIcon, }; if (arg1.id === 'file.open') { @@ -1016,6 +989,7 @@ export default class Menubar { options.type = 'checkbox'; options.checked = arg1.checked; } + return new MenuItem(options); } diff --git a/src/main/menu/MenuService.ts b/src/main/menu/MenuService.ts index 96b4fa726d..67145fac55 100644 --- a/src/main/menu/MenuService.ts +++ b/src/main/menu/MenuService.ts @@ -1,7 +1,7 @@ import { ipcMain } from 'electron'; import Menu from './Menu'; import { IMenuDisplayInfo } from '../../renderer/interfaces/IRecentPlay'; -import { ISubtitleControlListItem } from '../../renderer/interfaces/ISubtitle'; +import { SubtitleControlListItem } from '../../renderer/interfaces/ISubtitle'; export default class MenuService { private menu: Menu; @@ -20,14 +20,6 @@ export default class MenuService { this.menu.enableMenu(enable); } - public updateFocusedWindow(isFocusedOnMain: boolean, isNewWindow: boolean) { - this.menu.updateFocusedWindow(isFocusedOnMain, isNewWindow); - } - - public updatePipIcon() { - this.menu.updatePipIcon(); - } - private registeMenuActions() { ipcMain.on('popup-menu', () => { this.menu.popupMenu(); @@ -38,10 +30,10 @@ export default class MenuService { ipcMain.on('update-recent-play', (e: Event, items: IMenuDisplayInfo[]) => { this.menu.updateRecentPlay(items); }); - ipcMain.on('update-primary-sub', (e: Event, items: { id: string, label: string, checked: boolean, subtitleItem: ISubtitleControlListItem }[]) => { + ipcMain.on('update-primary-sub', (e: Event, items: { id: string, label: string, checked: boolean, subtitleItem: SubtitleControlListItem }[]) => { this.menu.updatePrimarySub(items); }); - ipcMain.on('update-secondary-sub', (e: Event, items: { id: string, label: string, checked: boolean, enabled: boolean, subtitleItem: ISubtitleControlListItem }[]) => { + ipcMain.on('update-secondary-sub', (e: Event, items: { id: string, label: string, checked: boolean, enabled: boolean, subtitleItem: SubtitleControlListItem }[]) => { this.menu.updateSecondarySub(items); }); ipcMain.on('update-audio-track', (e: Event, items: { id: string, label: string }[]) => { @@ -59,8 +51,5 @@ export default class MenuService { ipcMain.on('update-enabled', (e: Event, id: string, enabled: boolean) => { this.menu.updateMenuItemEnabled(id, enabled); }); - ipcMain.on('update-focused-window', (e: Event, isFocusedOnMain: boolean, isNewWindow: boolean) => { - this.menu.updateFocusedWindow(isFocusedOnMain, isNewWindow); - }); } } diff --git a/src/main/menu/common/Menubar.ts b/src/main/menu/common/Menubar.ts index 5ac3de2b86..06a143dcf0 100644 --- a/src/main/menu/common/Menubar.ts +++ b/src/main/menu/common/Menubar.ts @@ -22,7 +22,6 @@ export interface IMenubarMenuItemAction { winAccelerator?: string, checked?: boolean; // Assumed false if missing enabled?: boolean; // Assumed true if missing - icon?: string, } export interface IMenubarMenuItemRole { diff --git a/src/main/menu/menu.json b/src/main/menu/menu.json index 88dcabda5d..083e94545d 100644 --- a/src/main/menu/menu.json +++ b/src/main/menu/menu.json @@ -409,17 +409,9 @@ { "id": "browsing.window.pip", "label": "msg.window.enterPip", - "icon": "enter-pip", "accelerator": "P", "enabled": false }, - { - "id": "browsing.window.playInNewWindow", - "label": "msg.window.playInNewWindow", - "icon": "play-in-new-window", - "accelerator": "O", - "enabled": false - }, { "id": "menubar.separator" }, diff --git a/src/renderer/App.vue b/src/renderer/App.vue index 3fbed1d263..c2c3c34a28 100644 --- a/src/renderer/App.vue +++ b/src/renderer/App.vue @@ -5,31 +5,19 @@ class="application" > - - - @@ -38,10 +26,7 @@ - - diff --git a/src/renderer/components/BrowsingView.vue b/src/renderer/components/BrowsingView.vue index 67cc786013..b8b971c886 100644 --- a/src/renderer/components/BrowsingView.vue +++ b/src/renderer/components/BrowsingView.vue @@ -1,24 +1,15 @@ @@ -45,6 +44,10 @@ export default { Icon, }, props: { + handleUrlReload: { + type: Function, + required: true, + }, handleUrlBack: { type: Function, required: true, @@ -71,42 +74,31 @@ export default { return process.platform === 'darwin'; }, }, - methods: { - handleSidebar() { - this.$event.emit('side-bar-mouseup'); - }, - }, }; diff --git a/src/renderer/components/BrowsingView/BrowsingFavicons.vue b/src/renderer/components/BrowsingView/BrowsingFavicons.vue index 1d55baa469..93a54847c9 100644 --- a/src/renderer/components/BrowsingView/BrowsingFavicons.vue +++ b/src/renderer/components/BrowsingView/BrowsingFavicons.vue @@ -52,7 +52,7 @@ export default { type: Object, required: true, }, - handleBookmarkOpen: { + updateInitialUrl: { type: Function, required: true, }, @@ -61,16 +61,16 @@ export default { return { showFavicon: true, favicon: [ - { name: '爱奇艺', type: 'iqiyi', url: 'https://www.iqiyi.com/' }, - { name: 'Bilibili', type: 'bilibili', url: 'https://www.bilibili.com/' }, - { name: 'YouTube', type: 'youtube', url: 'https://www.youtube.com/' }, + { name: '爱奇艺', type: 'iqiyi', url: 'https://www.iqiyi.com' }, + { name: 'Bilibili', type: 'bilibili', url: 'https://www.bilibili.com' }, + { name: 'YouTube', type: 'youtube', url: 'https://www.youtube.com' }, ], faviconIndex: -1, }; }, computed: { calculateWidth() { - return this.isDarwin ? 'calc(100% - 70px - 114px - 80px)' : 'calc(100% - 100px - 110px - 135px)'; + return this.isDarwin ? 'calc(100% - 70px - 114px - 40px)' : 'calc(100% - 50px - 110px - 135px)'; }, favAnimClass() { if (this.isDarwin) { @@ -96,7 +96,7 @@ export default { this.faviconIndex = -1; }, handleFavOpen(item: { name: string, type: string, url: string }) { - this.handleBookmarkOpen(item.url); + this.updateInitialUrl(this.recordUrl[item.type] ? this.recordUrl[item.type] : item.url); }, handleFavAnimEnd(e: AnimationEvent) { const target = e.target as HTMLElement; @@ -120,6 +120,7 @@ export default { .fav-icon-container { width: auto; height: 20px; + cursor: pointer; display: flex; border-radius: 13px; .icon-detail { @@ -134,6 +135,7 @@ export default { .fav-display { width: 10px; height: 10px; + cursor: pointer; } } .fav-show-animation { diff --git a/src/renderer/components/BrowsingView/BrowsingHeader.vue b/src/renderer/components/BrowsingView/BrowsingHeader.vue index 0b7eeb82f6..86294ca02f 100644 --- a/src/renderer/components/BrowsingView/BrowsingHeader.vue +++ b/src/renderer/components/BrowsingView/BrowsingHeader.vue @@ -1,59 +1,69 @@ diff --git a/src/renderer/components/BrowsingView/BrowsingInput.vue b/src/renderer/components/BrowsingView/BrowsingInput.vue index 2d4911f460..e18a8d4796 100644 --- a/src/renderer/components/BrowsingView/BrowsingInput.vue +++ b/src/renderer/components/BrowsingView/BrowsingInput.vue @@ -1,27 +1,27 @@ @@ -34,18 +34,6 @@ export default { Icon, }, props: { - title: { - type: String, - default: 'Splayer', - }, - isReloading: { - type: Boolean, - required: true, - }, - handleUrlReload: { - type: Function, - required: true, - }, closeUrlInput: { type: Function, required: true, @@ -61,13 +49,6 @@ export default { }, }, methods: { - handleDbClick() { - if (!this.$electron.remote.getCurrentWindow().isMaximized()) { - this.$electron.ipcRenderer.send('callMainWindowMethod', 'maximize'); - } else { - this.$electron.ipcRenderer.send('callMainWindowMethod', 'unmaximize'); - } - }, handleCloseUrlInput() { this.closeUrlInput(); }, @@ -90,41 +71,29 @@ export default { } .search-url { display: flex; - justify-content: flex-start; - align-items: center; - width: calc(100% - 176px); - height: 40px; + width: auto; + height: 24px; + position: absolute; + top: 6px; z-index: 6; .url-search { - width: 100%; + width: 275px; + height: 24px; outline: none; - background-color: #FFF; + background: rgba(255, 255, 255, 0.08); + border-radius: 12px; border: none; z-index: 6; - - font-size: 12px; - color: #7E808E; - letter-spacing: 0.09px; - text-align: center; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; + text-indent: 15px; + font-size: 13px; + color: rgba(255, 255, 255, 0.8); } - .control-button { - width: 30px; - height: 30px; - border-radius: 100%; + .close-search-icon { + width: 10px; + height: 10px; + z-index: 6; display: flex; - justify-content: center; - align-items: center; - transition: background-color 100ms ease-in; - &:hover { - background-color: #ECEEF0; - } - } - .page-refresh-icon { - margin-right: 8px; - margin-left: 8px; + cursor: pointer; } } diff --git a/src/renderer/components/BrowsingView/BrowsingPipControl.vue b/src/renderer/components/BrowsingView/BrowsingPipControl.vue deleted file mode 100644 index c59c81cc47..0000000000 --- a/src/renderer/components/BrowsingView/BrowsingPipControl.vue +++ /dev/null @@ -1,131 +0,0 @@ - - - diff --git a/src/renderer/components/BrowsingView/BrowsingTitleBar.vue b/src/renderer/components/BrowsingView/BrowsingTitleBar.vue deleted file mode 100644 index d766d47333..0000000000 --- a/src/renderer/components/BrowsingView/BrowsingTitleBar.vue +++ /dev/null @@ -1,92 +0,0 @@ - - - diff --git a/src/renderer/components/LandingView/BilibiliSidebarIcon.vue b/src/renderer/components/LandingView/BilibiliSidebarIcon.vue index 4b98518313..1c5c6a6035 100644 --- a/src/renderer/components/LandingView/BilibiliSidebarIcon.vue +++ b/src/renderer/components/LandingView/BilibiliSidebarIcon.vue @@ -1,115 +1,92 @@ diff --git a/src/renderer/components/LandingView/SidebarIcon.vue b/src/renderer/components/LandingView/SidebarIcon.vue index 2108cd1515..528108f78f 100644 --- a/src/renderer/components/LandingView/SidebarIcon.vue +++ b/src/renderer/components/LandingView/SidebarIcon.vue @@ -1,7 +1,5 @@