Skip to content

Commit

Permalink
升级openssl、linux测试版本
Browse files Browse the repository at this point in the history
  • Loading branch information
putyy committed Sep 3, 2024
1 parent 619ac47 commit 7fd4877
Show file tree
Hide file tree
Showing 33 changed files with 755 additions and 196 deletions.
43 changes: 39 additions & 4 deletions electron-builder.json5
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,48 @@
],
"extraResources": [
{
"from": "electron/res/mac/aria2/aria2.conf",
"to": "electron/res/mac/aria2/aria2.conf",
"from": "electron/res/darwin/aria2/aria2.conf",
"to": "electron/res/darwin/aria2/aria2.conf",
"filter": ["**/*"]
},
{
"from": "electron/res/mac/aria2/${arch}/aria2c",
"to": "electron/res/mac/aria2/aria2c",
"from": "electron/res/darwin/aria2/${arch}/aria2c",
"to": "electron/res/darwin/aria2/aria2c",
"filter": ["**/*"],
}
]
},
"linux": {
"icon": "electron/res/icon/icon.png",
"artifactName": "${productName}_${version}.${arch}.${ext}",
"category": "Network",
"target": [
{
"target": "AppImage",
"arch": [
"x64",
"arm64",
"armv7l"
]
},
{
"target": "deb",
"arch": [
"x64",
"arm64",
"armv7l"
]
}
],
"extraResources": [
{
"from": "electron/res/linux/aria2/aria2.conf",
"to": "electron/res/linux/aria2/aria2.conf",
"filter": ["**/*"]
},
{
"from": "electron/res/linux/aria2/${arch}/aria2c",
"to": "electron/res/linux/aria2/aria2c",
"filter": ["**/*"],
}
]
Expand Down
12 changes: 12 additions & 0 deletions electron/main/cert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ export async function installCert(checkInstalled = true) {
message: `命令已复制到剪贴板,粘贴命令到终端并运行以安装并信任证书`,
});

reject()
});
} else if (process.platform === 'linux') {
return new Promise((resolve, reject) => {
clipboard.writeText(
"https://github.com/putyy/res-downloader/blob/master/electron/res/keys/public.pem",
)
dialog.showMessageBoxSync({
type: "info",
message: `Linux系统请手动安装证书,已复制下载地址`,
});

reject()
});
} else {
Expand Down
8 changes: 4 additions & 4 deletions electron/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ function createPreviewWindow(parent: BrowserWindow) {
})
}

function createArua2Process() {
function createAria2Process() {
// 根据操作系统选择 aria2 的路径
try {
let aria2Path, aria2Conf
Expand All @@ -178,8 +178,8 @@ function createArua2Process() {
aria2Path = path.join(CONFIG.EXECUTABLE_PATH, "./win/aria2/aria2c.exe")
aria2Conf = path.join(CONFIG.EXECUTABLE_PATH, "./win/aria2/aria2.conf")
} else {
aria2Path = path.join(CONFIG.EXECUTABLE_PATH, "./mac/aria2" + (CONFIG.IS_DEV ? `/${process.arch}` : '/') + "/aria2c");
aria2Conf = path.join(CONFIG.EXECUTABLE_PATH, "./mac/aria2/aria2.conf")
aria2Path = path.join(CONFIG.EXECUTABLE_PATH, `./${process.platform}/aria2` + (CONFIG.IS_DEV ? `/${process.arch}` : '/') + "/aria2c");
aria2Conf = path.join(CONFIG.EXECUTABLE_PATH, `./${process.platform}/aria2/aria2.conf`)
}
// 启动 aria2
console.log("启动 aria2")
Expand Down Expand Up @@ -208,6 +208,6 @@ app.whenReady().then(() => {
initIPC()
createWindow()
createPreviewWindow(mainWindow)
createArua2Process()
createAria2Process()
setWin(mainWindow, previewWin)
})
3 changes: 1 addition & 2 deletions electron/main/proxyServer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import fs from 'fs'
import log from 'electron-log'
import CONFIG from './const'
import {closeProxy, setProxy} from './setProxy'
import {app} from "electron"
import {setProxy} from './setProxy'
import * as urlTool from "url"
import {toSize} from "./utils"
// @ts-ignore
Expand Down
12 changes: 12 additions & 0 deletions electron/main/setProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {exec} from 'child_process'
// @ts-ignore
import regedit from 'regedit'
import CONFIG from './const'
import {dialog} from "electron";

regedit.setExternalVBSLocation(CONFIG.REGEDIT_VBS_PATH)

Expand Down Expand Up @@ -34,6 +35,12 @@ export async function setProxy(host, port) {
});
}),
);
} else if (process.platform === 'linux') {
dialog.showMessageBoxSync({
type: "info",
message: `请手动设置系统代理`,
});
return new Promise((resolve, reject) => {})
} else {
const valuesToPut = {
'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings': {
Expand Down Expand Up @@ -81,6 +88,11 @@ export async function closeProxy() {
});
}),
);
} else if (process.platform === 'linux') {
dialog.showMessageBoxSync({
type: "info",
message: `请手动取消系统代理`,
});
} else {
const valuesToPut = {
'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings': {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
25 changes: 25 additions & 0 deletions electron/res/linux/aria2/aria2.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#允许rpc
enable-rpc=true
#允许非外部访问
rpc-listen-all=true

#最大同时下载数(任务数), 路由建议值: 3
max-concurrent-downloads=3
#断点续传
continue=true
#同服务器连接数
max-connection-per-server=10
#最小文件分片大小, 下载线程数上限取决于能分出多少片, 对于小文件重要
min-split-size=10M
#单文件最大线程数, 路由建议值: 5
split=10
#下载速度限制
max-overall-download-limit=0
#单文件速度限制
max-download-limit=0
#上传速度限制
max-overall-upload-limit=0
#单文件速度限制
max-upload-limit=0

check-certificate=false
Binary file added electron/res/linux/aria2/arm64/aria2c
Binary file not shown.
Binary file added electron/res/linux/aria2/armv7l/aria2c
Binary file not shown.
Binary file added electron/res/linux/aria2/x64/aria2c
Binary file not shown.
Loading

0 comments on commit 7fd4877

Please sign in to comment.