Skip to content

Commit

Permalink
去除vipparse,新增下载进度提示,新增视频号自行下载后解密功能,优化打开文件位置等
Browse files Browse the repository at this point in the history
  • Loading branch information
putyy committed Jan 11, 2024
1 parent 525c8bb commit 366c79f
Show file tree
Hide file tree
Showing 14 changed files with 151 additions and 168 deletions.
3 changes: 0 additions & 3 deletions components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,10 @@ declare module 'vue' {
ElFormItem: typeof import('element-plus/es')['ElFormItem']
ElHeader: typeof import('element-plus/es')['ElHeader']
ElIcon: typeof import('element-plus/es')['ElIcon']
ElInput: typeof import('element-plus/es')['ElInput']
ElMain: typeof import('element-plus/es')['ElMain']
ElMenu: typeof import('element-plus/es')['ElMenu']
ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
ElOption: typeof import('element-plus/es')['ElOption']
ElRow: typeof import('element-plus/es')['ElRow']
ElSelect: typeof import('element-plus/es')['ElSelect']
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
Footer: typeof import('./src/components/layout/Footer.vue')['default']
Index: typeof import('./src/components/layout/Index.vue')['default']
Expand Down
2 changes: 1 addition & 1 deletion electron/main/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default {
CERT_PUBLIC_PATH: path.join(EXECUTABLE_PATH, './keys/public.pem'),
INSTALL_CERT_FLAG: path.join(HOME_PATH, './installed.lock'),
WIN_CERT_INSTALL_HELPER: path.join(EXECUTABLE_PATH, './w_c.exe'),
APP_CN_NAME: '资源下载器',
APP_CN_NAME: '爱享素材下载器',
APP_EN_NAME: 'ResDownloader',
REGEDIT_VBS_PATH: path.join(EXECUTABLE_PATH, './regedit-vbs'),
OPEN_SSL_BIN_PATH: path.join(EXECUTABLE_PATH, './openssl/openssl.exe'),
Expand Down
29 changes: 15 additions & 14 deletions electron/main/ipc.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import {ipcMain, dialog, BrowserWindow, app, shell} from 'electron'
import {startServer} from './proxyServer'
import {installCert, checkCertInstalled} from './cert'
import {downloadFile} from './utils'
import {downloadFile, decodeWxFile} from './utils'
// @ts-ignore
import {hexMD5} from '../../src/common/md5'
import fs from "fs"
import CryptoJS from 'crypto-js'
import {closeProxy, setProxy} from "./setProxy"
import log from "electron-log"
import {floor} from "lodash";

let getMac = require("getmac").default
let win: BrowserWindow
Expand All @@ -17,16 +18,6 @@ let isOpenProxy = false

let aesKey = "as5d45as4d6qe6wqfar6gt4749q6y7w6h34v64tv7t37ty5qwtv6t6qv"

const toSize = (size: number) => {
if (size > 1048576) {
return (size / 1048576).toFixed(2) + "MB"
}
if (size > 1024) {
return (size / 1024).toFixed(2) + "KB"
}
return size + 'b'
}

const suffix = (type: string) => {
switch (type) {
case "video/mp4":
Expand Down Expand Up @@ -104,6 +95,16 @@ export default function initIPC() {
return result?.[0]
})

ipcMain.handle('invoke_select_wx_file', async (event, {index, data}) => {
// 选择下载位置
const result = dialog.showOpenDialogSync({title: '保存', properties: ['openFile']})
if (!result?.[0]) {
return false
}
return decodeWxFile(result?.[0], data.decode_key, result?.[0].replace(".mp4", "_解密.mp4"))
})


ipcMain.handle('invoke_file_exists', async (event, {save_path, url}) => {
let url_sign = hexMD5(url)
let res = fs.existsSync(`${save_path}/${url_sign}.mp4`)
Expand Down Expand Up @@ -131,7 +132,7 @@ export default function initIPC() {
data.decode_key,
save_path_file,
(res) => {
return save_path_file
win?.webContents.send('on_down_file_schedule', {schedule: floor(res * 100)})
}
).catch(err => {
// console.log('invoke_down_file:err', err)
Expand Down Expand Up @@ -167,8 +168,8 @@ export default function initIPC() {
shell.openExternal(url).then(r => {})
})

ipcMain.handle('invoke_open_dir', (event, {dir}) => {
shell.openPath(dir).then(r => {})
ipcMain.handle('invoke_open_file_dir', (event, {save_path}) => {
shell.showItemInFolder(save_path)
})
}

Expand Down
6 changes: 3 additions & 3 deletions electron/main/proxyServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export async function startServer({
progress_bar: '',
save_path: '',
downing: false,
decode_key: req.json.decode_key,
decode_key: '',
description: '',
uploader: '',
})
Expand All @@ -219,7 +219,7 @@ export async function startServer({
progress_bar: '',
save_path: '',
downing: false,
decode_key: req.json.decode_key,
decode_key: '',
description: '',
uploader: '',
})
Expand All @@ -237,7 +237,7 @@ export async function startServer({
progress_bar: '',
save_path: '',
downing: false,
decode_key: req.json.decode_key,
decode_key: '',
description: '',
uploader: '',
})
Expand Down
18 changes: 17 additions & 1 deletion electron/main/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,22 @@ function downloadFile(url, decodeKey, fullFileName, progressCallback) {
});
}

function decodeWxFile(fileName, decodeKey, fullFileName) {
let xorStream = xorTransform(getDecryptionArray(decodeKey));
let data = fs.createReadStream(fileName);

return new Promise((resolve, reject) => {
data.on('error', err => reject(err));
data.pipe(xorStream).pipe(
fs.createWriteStream(fullFileName).on('finish', () => {
resolve({
fullFileName,
});
}),
);
});
}

function toSize(size: number) {
if (size > 1048576) {
return (size / 1048576).toFixed(2) + "MB"
Expand All @@ -76,4 +92,4 @@ function toSize(size: number) {
return size + 'b'
}

export {downloadFile, toSize}
export {downloadFile, toSize, decodeWxFile}
2 changes: 1 addition & 1 deletion electron/res/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>资源下载器</title>
<title>爱享素材下载器</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
<title>资源下载器</title>
<title>爱享素材下载器</title>
</head>
<body>
<div id="app"></div>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "res-downloader",
"version": "1.0.3",
"version": "1.0.4",
"main": "dist-electron/main/index.js",
"description": "Electron + Vue + Vite 实现的资源下载软件,支持微信视频号下载、抖音视频下载、快手视频下载、酷狗音乐下载等",
"author": "[email protected]",
Expand Down
18 changes: 16 additions & 2 deletions src/components/layout/Footer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const jump = (scene: number)=>{
switch (scene) {
case 1:
ipcRenderer.invoke('invoke_open_default_browser', {
url: "https://github.com/putyy/res-downloader"
url: "https://s.gowas.cn/d/4089-quan-ping-tai-zi-yuan-xia-zai-ruan-jian"
})
break;
case 2:
Expand All @@ -24,6 +24,16 @@ const jump = (scene: number)=>{
url: "https://github.com/putyy/res-downloader/issues"
})
break;
case 5:
ipcRenderer.invoke('invoke_open_default_browser', {
url: "https://haokawx.lot-ml.com/Product/Index/22550"
})
break;
case 6:
ipcRenderer.invoke('invoke_open_default_browser', {
url: "https://github.com/putyy/res-downloader"
})
break;
}
}
</script>
Expand All @@ -33,15 +43,19 @@ div.line
a.item 站长邮箱: [email protected]
a.item(@click="jump(1)") 获取更新
a.item(@click="jump(2)") 云盘资源
a.item(@click="jump(3)") 图片压缩
div.line
a.item(@click="jump(3)") 图片无损压缩
a.item(@click="jump(4)") 问题反馈
a.item(@click="jump(5)") 流量卡推荐
a.item(@click="jump(6)") 软件源码
</template>

<style lang="less" scoped>
.line{
display: flex;
flex-direction: row;
justify-content: center;
flex-wrap: wrap;
.item{
padding: 0 5px;
cursor: pointer;
Expand Down
8 changes: 2 additions & 6 deletions src/components/layout/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import {inject, onMounted, ref, watch} from 'vue'
import localStorageCache from "../../common/localStorage";
const appName = "资源下载器"
const appName = "爱享素材"
const sidebarCollapse = ref(inject('sidebarCollapse'))
const defaultActive = ref("/index")
Expand All @@ -20,11 +20,7 @@ div.sidebar
el-menu-item(key="1" index="/index")
el-icon
VideoCamera
span 拦截下载
el-menu-item(key="7" index="/vip-parse")
el-icon
VideoCamera
span 影视解析
span 嗅探
el-menu-item(key="2" index="/about")
el-icon
Share
Expand Down
5 changes: 0 additions & 5 deletions src/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ const routes = [
name: 'Setting',
component: () => import('./views/Setting.vue'),
},
{
path: '/vip-parse',
name: 'VipParse',
component: () => import('./views/VipParse.vue'),
},
]
},
]
Expand Down
22 changes: 22 additions & 0 deletions src/views/About.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,22 @@ const jump = (scene: number)=>{
break;
}
}
const str = "使用方法\n" +
" 1. 打开本软件\n" +
" 2. 软件首页选择要获取的资源类型(默认选中的视频)\n" +
" 3. 打开要捕获的源, 如:视频号、网页、小程序等等\n" +
" 4. 返回软件首页即可看到要下载的资源\n" +
"常见问题\n" +
" 1. 无法拦截获取\n" +
" 手动检测系统代理是否设置正确 本软件代理地址: 127.0.0.1:8899\n" +
" 2. 关闭软件后无法正常上网\n" +
" 手动关闭系统代理设置\n" +
"实现原理\n" +
" 通过代理网络抓包拦截响应,筛选出有用的资源,\n" +
" 同fiddler、charles等抓包软件、浏览器F12打开控制也能达到目的,\n" +
" 只不过这些软件需要手动进行筛选,对于小白用户上手还是有点难度,本软件对部分资源做了特殊处理,\n" +
" 更适合大众用户,所以就有了本项目这样的软件。\n"
</script>
<template lang="pug">
div.about
Expand All @@ -36,6 +52,9 @@ div.about
el-button(@click="jump(3)") 获取更新
div 4. 问题反馈 &nbsp;
el-button(@click="jump(4)") 点击前往
div.more
pre {{str}}

</template>

<style lang="less">
Expand All @@ -50,5 +69,8 @@ div.about
padding: .3rem;
white-space: pre-wrap;
}
.more{
}
}
</style>
Loading

0 comments on commit 366c79f

Please sign in to comment.