Skip to content

Commit e1ea242

Browse files
committed
修正magnet的正则
1 parent 93c3134 commit e1ea242

File tree

5 files changed

+20
-15
lines changed

5 files changed

+20
-15
lines changed

src/index.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<head>
44
<meta charset="utf-8">
5-
<title><%= htmlWebpackPlugin.options.title %> - <%= htmlWebpackPlugin.options.description %></title>
5+
<title><%= htmlWebpackPlugin.options.title %></title>
66
<meta name="robots" content="noindex,nofollow,noarchive">
77
<meta name="format-detection" content="telephone=no,email=no,adress=no">
88
<meta http-equiv="window-target" content="_top">

src/main/format-parser.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ module.exports = {
6262
*/
6363
extractMagnet (url) {
6464
if (url) {
65-
if (/magnet:?[^\\"]+/.test(url)) {
65+
// 如果是磁力链 直接返回
66+
if (/^(magnet:\?xt=urn:btih:)/.test(url)) {
6667
return url.toLowerCase()
6768
} else {
6869
// 如果不是磁力链 就提取 连续字母数字32-40位

src/main/ipc.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,24 @@ const logger = require('./logger')
44
const path = require('path')
55
const {ipcMain, app} = require('electron')
66
const request = require('request-promise-native')
7-
const {reload, start, getProxyNetworkInfo} = require('./api')
7+
const {reload, start, isStarting, getProxyNetworkInfo} = require('./api')
88
const {defaultConfig, extractConfigVariable, getConfig} = require('./process-config')
99
const Store = require('electron-store')
1010
const store = new Store()
1111

1212
async function registerServer () {
13-
const configVariable = store.get('config_variable')
14-
const newConfig = getConfig(configVariable)
15-
configVariable ? console.info('使用自定义配置加载服务', configVariable, newConfig) : console.info('使用默认配置加载服务', configVariable, newConfig)
16-
const {port, ip, local, message} = await start(newConfig, false)
17-
if (message) {
18-
console.error(message)
13+
if (isStarting()) {
14+
console.info('服务已启动')
1915
} else {
20-
console.info(`启动成功,本地访问 http://${local}:${port},IP访问 http://${ip}:${port}`)
16+
const configVariable = store.get('config_variable')
17+
const newConfig = getConfig(configVariable)
18+
configVariable ? console.info('使用自定义配置加载服务', configVariable, newConfig) : console.info('使用默认配置加载服务', configVariable, newConfig)
19+
const {port, ip, local, message} = await start(newConfig, false)
20+
if (message) {
21+
console.error(message)
22+
} else {
23+
console.info(`启动成功,本地访问 http://${local}:${port},IP访问 http://${ip}:${port}`)
24+
}
2125
}
2226
}
2327

src/main/menu.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ module.exports = function (mainWindow) {
2525
{label: '重新加载', role: 'reload'},
2626
{label: '最小化', role: 'minimize'},
2727
{label: '最大化', click: () => mainWindow.isMaximized() ? mainWindow.unmaximize() : mainWindow.maximize()},
28+
{type: 'separator'},
29+
{label: '关闭', role: 'close'},
2830
...(is.macOS() ? [
2931
{type: 'separator'},
3032
{label: '前置全部窗口', role: 'front'}

src/renderer/plugins/config.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,12 @@ Vue.use({
1010
baseUrl: `${baseURL}/favicon`,
1111
extension: 'ico'
1212
},
13-
searchPlaceholder: ['火影忍者', '钢铁侠', '美国队长', '犬夜叉', '七龙珠', '奥特曼', '千与千寻', '你的名字。'],
13+
searchPlaceholder: ['火影忍者', '钢铁侠', '美国队长', '犬夜叉', '七龙珠', '奥特曼', '英雄联盟'],
1414
proxyDocURL: `${baseURL}/guide/proxy.html`,
1515
guide: {
16-
content: [
17-
]
16+
content: []
1817
},
19-
menu: [
20-
]
18+
menu: []
2119
}
2220
}
2321
}

0 commit comments

Comments
 (0)