From c1f05876e35d4f2536c120c035b85d40f93aa018 Mon Sep 17 00:00:00 2001 From: putyy Date: Mon, 19 Aug 2024 16:55:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8B=A6=E6=88=AA=E8=A7=84?= =?UTF-8?q?=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron/main/proxyServer.ts | 16 ++++------------ package.json | 6 +++--- src/components/layout/Index.vue | 5 ++++- src/route.ts | 3 +++ src/views/Index.vue | 11 ++++++----- 5 files changed, 20 insertions(+), 21 deletions(-) diff --git a/electron/main/proxyServer.ts b/electron/main/proxyServer.ts index 893b0ed..ff7f07c 100755 --- a/electron/main/proxyServer.ts +++ b/electron/main/proxyServer.ts @@ -71,12 +71,12 @@ export async function startServer({win, upstreamProxy, setProxyErrorCallback = f res.string = 'ok' res.statusCode = 200 try { - if (!req.json?.description || req.json?.media?.length <= 0) { + if (req.json?.media?.length <= 0) { return } const media = req.json?.media[0] const url_sign: string = hexMD5(media.url) - if (global.videoList.hasOwnProperty(url_sign) === true) { + if (!media?.decodeKey || global.videoList.hasOwnProperty(url_sign) === true) { return } const urlInfo = urlTool.parse(media.url, true) @@ -88,7 +88,7 @@ export async function startServer({win, upstreamProxy, setProxyErrorCallback = f size: media?.fileSize ? toSize(media.fileSize) : 0, type: "video/mp4", type_str: 'video', - decode_key: media?.decodeKey ? media?.decodeKey : '', + decode_key: media.decodeKey, description: req.json.description, })) } catch (e) { @@ -114,6 +114,7 @@ export async function startServer({win, upstreamProxy, setProxyErrorCallback = f proxy.intercept( { phase: 'response', + hostname: 'res.wx.qq.com', as: 'string', }, async (req, res) => { @@ -121,14 +122,6 @@ export async function startServer({win, upstreamProxy, setProxyErrorCallback = f res.string = res.string.replaceAll('.js"', '.js?v=' + vv + '"'); } if (req.url.includes("web/web-finder/res/js/virtual_svg-icons-register.publish")) { - // console.log(res.string.match(/return\s*\{\s*width:([\s\S]*?)scalingInfo:([\s\S]*?)\}/)) -// res.string = res.string.replace( -// /return\s*{\s*width:(.*?)scalingInfo:(.*?)\s*}/, -// `var mediaInfo = {width:$1scalingInfo:$2}; -// console.log("mediaInfo", mediaInfo); -// console.log("this.objectDesc", this.objectDesc); -// return mediaInfo;` -// ) res.string = res.string.replace(/get\s*media\s*\(\)\s*\{/, ` get media(){ if(this.objectDesc){ @@ -231,7 +224,6 @@ export async function startServer({win, upstreamProxy, setProxyErrorCallback = f type_str: 'm3u8', })) break - } } catch (e) { log.log(e.toString()) diff --git a/package.json b/package.json index 49ab379..b8a5c84 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "res-downloader", - "version": "2.0.0", + "version": "2.0.1", "main": "dist-electron/main/index.js", - "description": "res-downloader(爱享素材下载器),支持视频号、小程序、抖音、快手、小红书、酷狗音乐、qq音乐下载等", + "description": "res-downloader(爱享素材下载器),支持视频号、小程序、抖音、快手、小红书、酷狗音乐、qq音乐、qq短视频等", "author": "putyy@qq.com", "license": "MIT", "private": true, @@ -50,7 +50,7 @@ "vite-plugin-electron-renderer": "^0.14.5", "vue": "^3.3.4", "vue-router": "^4.2.4", - "vue-tsc": "^1.8.8" + "vue-tsc": "^2.0.29" }, "dependencies": { "axios": "^1.5.0", diff --git a/src/components/layout/Index.vue b/src/components/layout/Index.vue index 7d6438a..b4d478f 100755 --- a/src/components/layout/Index.vue +++ b/src/components/layout/Index.vue @@ -12,7 +12,10 @@ el-container Sidebar el-container el-main - router-view + router-view(v-slot="{ Component, route }") + keep-alive(v-if="route.meta.keepAlive") + component(:is="Component") + component(v-else :is="Component") el-footer Footer diff --git a/src/route.ts b/src/route.ts index 20ccd49..e01585f 100755 --- a/src/route.ts +++ b/src/route.ts @@ -13,16 +13,19 @@ const routes = [ { path: '/index', name: 'Index', + meta: {keepAlive: true}, component: () => import('./views/Index.vue'), }, { path: '/about', name: 'about', + meta: {keepAlive: true}, component: () => import('./views/About.vue'), }, { path: '/setting', name: 'Setting', + meta: {keepAlive: true}, component: () => import('./views/Setting.vue'), }, ] diff --git a/src/views/Index.vue b/src/views/Index.vue index 4b5bc35..7aeb6d3 100755 --- a/src/views/Index.vue +++ b/src/views/Index.vue @@ -317,10 +317,10 @@ el-container.container el-main el-table(ref="multipleTableRef" @selection-change="handleSelectionChange" :data="tableData" max-height="100%" stripe) el-table-column(type="selection") - el-table-column(label="预览" show-overflow-tooltip width="300px") + el-table-column(label="预览" show-overflow-tooltip width="150px") template(#default="scope") div.show_res - video.video(v-if="scope.row.type_str === 'video'" :src="scope.row.url" controls preload="none") 您的浏览器不支持 video 标签。 + video.video(v-if="scope.row.type_str === 'video'" :src="scope.row.url" controls preload="none") img.img(v-if="scope.row.type_str === 'image'" :src="scope.row.url" crossorigin="anonymous") audio.audio(v-if="scope.row.type_str === 'audio'" controls preload="none") source(:src="scope.row.url" :type="scope.row.type") @@ -374,12 +374,13 @@ el-container.container } .show_res { - width: 100%; - height: auto; - .img { max-height: 200px; } + .video { + width: auto; + max-height: 200px; + } } .actions {