From a6bfa0daa8f0224ff0a7cf908e8d1cdf13d89d33 Mon Sep 17 00:00:00 2001 From: caorushizi <84996057@qq.com> Date: Sun, 21 Mar 2021 20:53:18 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=99=A5=20=E7=94=9F=E4=BA=A7=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/index.ts | 4 +--- main/window/windowList.ts | 8 ++++---- package.json | 23 +++++++++++------------ vite.config.ts | 1 + 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/main/index.ts b/main/index.ts index ed7c4d6..a159a7e 100644 --- a/main/index.ts +++ b/main/index.ts @@ -41,9 +41,7 @@ app.on("activate", async () => { app.whenReady().then(async () => { protocol.registerFileProtocol("mediago", (request, callback) => { const url = request.url.substr(10); - console.log("url: ", url); - console.log("after: ", resolve(__dirname, "../electron", url)); - callback({ path: resolve(__dirname, "../electron", url) }); + callback({ path: resolve(__dirname, "../", url) }); }); await init(); diff --git a/main/window/windowList.ts b/main/window/windowList.ts index 19097ce..6509776 100644 --- a/main/window/windowList.ts +++ b/main/window/windowList.ts @@ -8,8 +8,8 @@ const windowList = new Map(); windowList.set(WindowName.MAIN_WINDOW, { url: is.development - ? "mediago://main_window.html" - : "mediago://main_window.html", + ? "http://localhost:3000/main_window.html" + : "mediago://electron/main_window.html", options() { return { width: 590, @@ -30,8 +30,8 @@ windowList.set(WindowName.MAIN_WINDOW, { windowList.set(WindowName.BROWSER_WINDOW, { url: is.development - ? "mediago://browser_window.html" - : "mediago://browser_window.html", + ? "http://localhost:3000/browser_window.html" + : "mediago://electron/browser_window.html", options() { return { width: 800, diff --git a/package.json b/package.json index f2fb8eb..80bec62 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "vite-project-1", + "name": "media-downloader", "version": "0.0.0", "description": "在线视频下载", "author": "caorushizi", @@ -10,7 +10,7 @@ "electron": "cross-env NODE_ENV=development node esbuild.config.js && electron dist/main/index.js", "prestart": "script/prestart", "start": "concurrently -n=vite,electron -c=green,blue \"npm run dev\" \"npm run electron\"", - "build": "tsc && vite build", + "build": "tsc && vite build && node esbuild.config.js", "serve": "vite preview", "pack": "electron-builder --dir", "dist": "electron-builder" @@ -58,20 +58,19 @@ "vite": "^2.1.0" }, "build": { - "productName": "xxxx", - "appId": "com.xxx.xxxxx", - "copyright": "xxxx", + "productName": "在线视频下载", + "appId": "mediago.ziying.site", + "copyright": "caorushizi", "directories": { "output": "build" }, "files": [ "dist/electron", "dist/main", - "node_modules/", "package.json" ], "win": { - "icon": "build/icons/aims.ico", + "icon": "", "target": [ { "target": "nsis" @@ -92,14 +91,14 @@ "oneClick": false, "allowElevation": true, "allowToChangeInstallationDirectory": true, - "installerIcon": "./build/icons/aaa.ico", - "uninstallerIcon": "./build/icons/bbb.ico", - "installerHeaderIcon": "./build/icons/aaa.ico", + "installerIcon": "", + "uninstallerIcon": "", + "installerHeaderIcon": "", "createDesktopShortcut": true, "createStartMenuShortcut": true, "shortcutName": "xxxx", - "include": "build/script/installer.nsh", - "script": "build/script/installer.nsh" + "include": "", + "script": "" } } } diff --git a/vite.config.ts b/vite.config.ts index b6b2e32..2238d2c 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -6,6 +6,7 @@ import { resolve } from "path"; export default defineConfig({ plugins: [reactRefresh()], build: { + target: "es2015", rollupOptions: { input: { main: resolve(__dirname, "main_window.html"),