mirror of
https://github.com/putyy/res-downloader.git
synced 2026-01-12 14:14:55 +08:00
优化拦截规则
This commit is contained in:
@@ -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())
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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
|
||||
</template>
|
||||
|
||||
@@ -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'),
|
||||
},
|
||||
]
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user