diff --git a/README.md b/README.md index 913c498..d5178ca 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ 开发者边车,命名取自service-mesh的service-sidecar,意为为开发者打辅助的边车工具(以下简称ds) 通过本地代理的方式将https请求代理到一些国内的加速通道上 -GitHub stars +`GitHub stars``` > Gitee上的同步项目已被封禁,此项目将不再更新与维护 【狗头保命】 > @@ -12,7 +12,7 @@ ## 打个广告 -> +> [https://github.com/certd/certd](https://github.com/certd/certd) > 我的开源证书管理工具项目,全自动申请和部署证书,有需求的可以去试试,帮忙点个star ## 重要提醒 @@ -22,7 +22,7 @@ > 注意:由于electron无法监听windows的关机事件,开着ds情况下直接重启电脑,会导致无法上网,你可以手动启动ds即可恢复网络,你也可以将ds设置为开机自启。 > > 关于此问题的更多讨论请前往: -> +> [https://github.com/docmirror/dev-sidecar/issues/109](https://github.com/docmirror/dev-sidecar/issues/109) > ------------------------------重要提醒2--------------------------------- > @@ -54,12 +54,12 @@ - 解决git push 偶尔失败需要输入账号密码的问题(fatal: TaskCanceledException encountered / fatal: HttpRequestException encountered) - raw/blame加速 -> 以上部分功能通过`X.I.U`的油猴脚本实现, 以下是仓库和脚本下载链接,大家可以去支持一下。 +> 以上部分功能通过 `X.I.U` 的油猴脚本实现, 以下是仓库和脚本下载链接,大家可以去支持一下。 > -> - -> - +> - [https://github.com/XIU2/UserScript](https://github.com/XIU2/UserScript) +> - [https://greasyfork.org/scripts/412245](https://greasyfork.org/scripts/412245) > -> 由于此脚本在ds中是打包在本地的,更新会不及时,你可以直接通过浏览器安装油猴插件使用此脚本,从而获得最新更新(ds本地的可以通过`加速服务->基本设置->启用脚本`进行关闭)。 +> 由于此脚本在ds中是打包在本地的,更新会不及时,你可以直接通过浏览器安装油猴插件使用此脚本,从而获得最新更新(ds本地的可以通过 `加速服务->基本设置->启用脚本` 进行关闭)。 ### 1.4、 Stack Overflow 加速 @@ -152,12 +152,14 @@ #### 1)git clone 加速 - 方式1:快捷复制: - > 开启脚本支持,然后在复制clone链接下方,即可复制到加速链接 + + > 开启脚本支持,然后在复制clone链接下方,即可复制到加速链接 - 方式2: - > 1. 使用方式:用实际的名称替换 `{}` 的内容,即可加速clone - > 2. clone 出来的 remote "origin" 为fastgit的地址,需要手动改回来 - > 3. 你也可以直接使用他们的clone加速工具 [fgit-go](https://github.com/FastGitORG/fgit-go) + + > 1. 使用方式:用实际的名称替换 `{}` 的内容,即可加速clone [https://hub.fastgit.org/{username}/{reponame}.git](https://hub.fastgit.org/%7Busername%7D/%7Breponame%7D.git) + > 2. clone 出来的 remote "origin" 为fastgit的地址,需要手动改回来 + > 3. 你也可以直接使用他们的clone加速工具 [fgit-go](https://github.com/FastGitORG/fgit-go) #### 2)`github.com` 的镜像网站(注意:部分镜像网站不能登录) @@ -258,7 +260,7 @@ networksetup -setwebproxy 'WiFi' 127.0.0.1 31181 1. 本应用仅支持https加速 请务必确认你访问的地址是https开头的 - 比如: + 比如: [https://github.com/](https://github.com/) 2. 检查浏览器是否装了什么插件,与ds有冲突 3. 检查是否安装了其他代理软件,与ds有冲突 4. 请确认浏览器的代理设置为使用IE代理/或者使用系统代理状态 @@ -279,7 +281,7 @@ networksetup -setwebproxy 'WiFi' 127.0.0.1 31181 1. 火狐浏览器->选项->隐私与安全->证书->查看证书 2. 证书颁发机构->导入 -3. 选择证书文件`C:\Users(用户)\Administrator(你的账号)\.dev-sidecar\dev-sidecar.ca.crt`(Mac或linux为`~/.dev-sidecar`目录) +3. 选择证书文件 `C:\Users(用户)\Administrator(你的账号)\.dev-sidecar\dev-sidecar.ca.crt`(Mac或linux为 `~/.dev-sidecar` 目录) 4. 勾选信任由此证书颁发机构来标识网站,确定即可 ### 6.4、打开github显示连接超时 diff --git a/packages/core/src/config.js b/packages/core/src/config.js index fba00d6..a591d09 100644 --- a/packages/core/src/config.js +++ b/packages/core/src/config.js @@ -1,5 +1,5 @@ -const fs = require('fs') -const path = require('path') +const fs = require('node:fs') +const path = require('node:path') const jsonApi = require('@docmirror/mitmproxy/src/json') const lodash = require('lodash') const request = require('request') diff --git a/packages/core/src/config/index.js b/packages/core/src/config/index.js index 21e6ac8..e950a17 100644 --- a/packages/core/src/config/index.js +++ b/packages/core/src/config/index.js @@ -1,4 +1,4 @@ -const path = require('path') +const path = require('node:path') function getUserBasePath () { const userHome = process.env.USERPROFILE || process.env.HOME || '/' diff --git a/packages/core/src/event.js b/packages/core/src/event.js index 94df100..ea136cf 100644 --- a/packages/core/src/event.js +++ b/packages/core/src/event.js @@ -6,7 +6,9 @@ function register (channel, handle, order = 10) { handles = listener[channel] = [] } handles.push({ id: index, handle, order }) - handles.sort((a, b) => { return a.order - b.order }) + handles.sort((a, b) => { + return a.order - b.order + }) return index++ } function fire (channel, event) { diff --git a/packages/core/src/modules/server/index.js b/packages/core/src/modules/server/index.js index d625d75..fa0e4db 100644 --- a/packages/core/src/modules/server/index.js +++ b/packages/core/src/modules/server/index.js @@ -1,10 +1,10 @@ +const fork = require('node:child_process').fork +const fs = require('node:fs') +const path = require('node:path') const lodash = require('lodash') const config = require('../../config') const event = require('../../event') const status = require('../../status') -const fork = require('child_process').fork -const fs = require('fs') -const path = require('path') const jsonApi = require('@docmirror/mitmproxy/src/json') const log = require('../../utils/util.log') diff --git a/packages/core/src/shell/scripts/extra-path/index.js b/packages/core/src/shell/scripts/extra-path/index.js index c1d3a0c..09d5513 100644 --- a/packages/core/src/shell/scripts/extra-path/index.js +++ b/packages/core/src/shell/scripts/extra-path/index.js @@ -1,4 +1,4 @@ -const path = require('path') +const path = require('node:path') const log = require('../../../utils/util.log') function getExtraPath () { diff --git a/packages/core/src/shell/scripts/set-system-proxy/index.js b/packages/core/src/shell/scripts/set-system-proxy/index.js index 735600e..07b8ae5 100644 --- a/packages/core/src/shell/scripts/set-system-proxy/index.js +++ b/packages/core/src/shell/scripts/set-system-proxy/index.js @@ -1,8 +1,8 @@ /** * 获取环境变量 */ -const fs = require('fs') -const path = require('path') +const fs = require('node:fs') +const path = require('node:path') const request = require('request') const Registry = require('winreg') const log = require('../../../utils/util.log') diff --git a/packages/core/src/shell/shell.js b/packages/core/src/shell/shell.js index 0c06d6d..9ab1fac 100644 --- a/packages/core/src/shell/shell.js +++ b/packages/core/src/shell/shell.js @@ -1,5 +1,5 @@ -const childProcess = require('child_process') -const os = require('os') +const childProcess = require('node:child_process') +const os = require('node:os') const fixPath = require('fix-path') const iconv = require('iconv-lite') const PowerShell = require('node-powershell') @@ -78,7 +78,7 @@ class WindowsSystemShell extends SystemShell { function _childExec (composeCmds, options = {}) { return new Promise((resolve, reject) => { - const childProcess = require('child_process') + const childProcess = require('node:child_process') log.info('shell:', composeCmds) childProcess.exec(composeCmds, options, (error, stdout, stderr) => { if (error) { @@ -101,7 +101,7 @@ function childExec (composeCmds, options = {}) { const encoding = 'cp936' const binaryEncoding = 'binary' - const childProcess = require('child_process') + const childProcess = require('node:child_process') log.info('shell:', composeCmds) childProcess.exec(composeCmds, { encoding: binaryEncoding }, (error, stdout, stderr) => { if (error) { diff --git a/packages/core/src/shell/test.js b/packages/core/src/shell/test.js index 6748a02..af7b20b 100644 --- a/packages/core/src/shell/test.js +++ b/packages/core/src/shell/test.js @@ -34,7 +34,7 @@ // console.error(e) // }) -const fs = require('fs') +const fs = require('node:fs') const request = require('request') request({ diff --git a/packages/core/start/index.js b/packages/core/start/index.js index b41aaae..125e4be 100644 --- a/packages/core/start/index.js +++ b/packages/core/start/index.js @@ -1,7 +1,6 @@ -const fs = require('fs') -const jsonApi = require('@docmirror/mitmproxy/src/json') +const fs = require('node:fs') const DevSidecar = require('../index') -const log = require('../src/utils/util.log') +const jsonApi = require('@docmirror/mitmproxy/src/json') // 启动服务 const mitmproxyPath = './start/mitmproxy' @@ -13,7 +12,7 @@ async function startup () { if (fs.existsSync(configPath)) { const file = fs.readFileSync(configPath) const userConfig = jsonApi.parse(file.toString()) - log.info('读取 user_config.json5 成功:', configPath) + console.info('读取 user_config.json5 成功:', configPath) DevSidecar.api.config.set(userConfig) } diff --git a/packages/core/start/mitmproxy.js b/packages/core/start/mitmproxy.js index 57cbe5d..a86035d 100644 --- a/packages/core/start/mitmproxy.js +++ b/packages/core/start/mitmproxy.js @@ -1,5 +1,5 @@ -const fs = require('fs') -const path = require('path') +const fs = require('node:fs') +const path = require('node:path') const server = require('@docmirror/mitmproxy') const jsonApi = require('@docmirror/mitmproxy/src/json') const log = require('../src/utils/util.log') diff --git a/packages/core/test/httpsVerifyTest.js b/packages/core/test/httpsVerifyTest.js index 30c03b9..f2f4133 100644 --- a/packages/core/test/httpsVerifyTest.js +++ b/packages/core/test/httpsVerifyTest.js @@ -1,4 +1,4 @@ -const https = require('https') +const https = require('node:https') process.env.NODE_TLS_REJECT_UNAUTHORIZED = '1' diff --git a/packages/gui/pkg/after-all-artifact-build.js b/packages/gui/pkg/after-all-artifact-build.js index 9c61f50..5ab9487 100644 --- a/packages/gui/pkg/after-all-artifact-build.js +++ b/packages/gui/pkg/after-all-artifact-build.js @@ -1,5 +1,5 @@ -const fs = require('fs') -const path = require('path') +const fs = require('node:fs') +const path = require('node:path') const pkg = require('../package.json') function appendIntro (context, systemType, latest) { diff --git a/packages/gui/pkg/after-pack.js b/packages/gui/pkg/after-pack.js index 4855117..699593b 100644 --- a/packages/gui/pkg/after-pack.js +++ b/packages/gui/pkg/after-pack.js @@ -1,5 +1,5 @@ -const fs = require('fs') -const path = require('path') +const fs = require('node:fs') +const path = require('node:path') const AdmZip = require('adm-zip') const pkg = require('../package.json') diff --git a/packages/gui/src/background.js b/packages/gui/src/background.js index 38ad0a1..bbd30a3 100644 --- a/packages/gui/src/background.js +++ b/packages/gui/src/background.js @@ -1,6 +1,6 @@ 'use strict' /* global __static */ -import path from 'path' +import path from 'node:path' import DevSidecar from '@docmirror/dev-sidecar' import { app, BrowserWindow, dialog, globalShortcut, ipcMain, Menu, nativeImage, nativeTheme, powerMonitor, protocol, Tray } from 'electron' import minimist from 'minimist' diff --git a/packages/gui/src/bridge/api/backend.js b/packages/gui/src/bridge/api/backend.js index 1ebcf78..7fbd341 100644 --- a/packages/gui/src/bridge/api/backend.js +++ b/packages/gui/src/bridge/api/backend.js @@ -1,5 +1,5 @@ -import fs from 'fs' -import path from 'path' +import fs from 'node:fs' +import path from 'node:path' import DevSidecar from '@docmirror/dev-sidecar' import { ipcMain } from 'electron' import lodash from 'lodash' diff --git a/packages/gui/src/bridge/mitmproxy.js b/packages/gui/src/bridge/mitmproxy.js index 5590874..e5dedc8 100644 --- a/packages/gui/src/bridge/mitmproxy.js +++ b/packages/gui/src/bridge/mitmproxy.js @@ -1,5 +1,5 @@ -const fs = require('fs') -const path = require('path') +const fs = require('node:fs') +const path = require('node:path') const server = require('@docmirror/mitmproxy') const jsonApi = require('@docmirror/mitmproxy/src/json') const log = require('../utils/util.log') diff --git a/packages/gui/src/bridge/on-close/front.js b/packages/gui/src/bridge/on-close/front.js index 7c8e871..033c6d5 100644 --- a/packages/gui/src/bridge/on-close/front.js +++ b/packages/gui/src/bridge/on-close/front.js @@ -12,7 +12,7 @@ function install (app, api) { } app.$confirm({ title: '关闭策略', - content: h => ( + content: (h) => (
diff --git a/packages/gui/src/bridge/update/backend.js b/packages/gui/src/bridge/update/backend.js index 32e0f02..3b8eda1 100644 --- a/packages/gui/src/bridge/update/backend.js +++ b/packages/gui/src/bridge/update/backend.js @@ -1,5 +1,5 @@ -import fs from 'fs' -import path from 'path' +import fs from 'node:fs' +import path from 'node:path' import DevSidecar from '@docmirror/dev-sidecar' import AdmZip from 'adm-zip' import { ipcMain } from 'electron' diff --git a/packages/gui/src/bridge/update/front.js b/packages/gui/src/bridge/update/front.js index b19d9d3..51a0436 100644 --- a/packages/gui/src/bridge/update/front.js +++ b/packages/gui/src/bridge/update/front.js @@ -75,7 +75,6 @@ function install (app, api) { function goManualUpdate (value) { updateParams.newVersion = false app.$confirm({ - // title: '暂不支持自动升级', title: '暂不提供自动升级', cancelText: '取消', okText: '打开链接', @@ -83,7 +82,11 @@ function install (app, api) { content: (h) => { return (
-
请前往 github项目release页面 下载新版本手动安装
+
+ 请前往 + github项目release页面 + 下载新版本手动安装 +
) @@ -154,7 +157,10 @@ function install (app, api) { const releaseNotes = value.releaseNotes.replace(/\r\n/g, '\n') return (
- +
                   {releaseNotes}
@@ -167,7 +173,10 @@ function install (app, api) {
             }
             return (
               
- +
更新内容:
    {notes}
@@ -200,7 +209,10 @@ function install (app, api) { const releaseNotes = value.releaseNotes.replace(/\r\n/g, '\n') return (
- +
                   {releaseNotes}
@@ -213,7 +225,10 @@ function install (app, api) {
             }
             return (
               
- +
更新内容:
    {notes}
diff --git a/packages/gui/src/utils/util.apppath.js b/packages/gui/src/utils/util.apppath.js index 18878bb..ea4941c 100644 --- a/packages/gui/src/utils/util.apppath.js +++ b/packages/gui/src/utils/util.apppath.js @@ -1,5 +1,5 @@ -import os from 'os' -import path from 'path' +import os from 'node:os' +import path from 'node:path' function getSystemPlatform () { switch (os.platform()) { diff --git a/packages/gui/src/view/App.vue b/packages/gui/src/view/App.vue index 17b666c..2e0d1ea 100644 --- a/packages/gui/src/view/App.vue +++ b/packages/gui/src/view/App.vue @@ -88,17 +88,17 @@ export default { diff --git a/packages/gui/src/view/components/container.vue b/packages/gui/src/view/components/container.vue index 35610a0..8df89dd 100644 --- a/packages/gui/src/view/components/container.vue +++ b/packages/gui/src/view/components/container.vue @@ -7,21 +7,27 @@ export default { diff --git a/packages/gui/src/view/pages/index.vue b/packages/gui/src/view/pages/index.vue index d8f2f02..5115d8d 100644 --- a/packages/gui/src/view/pages/index.vue +++ b/packages/gui/src/view/pages/index.vue @@ -386,7 +386,7 @@ export default { flex-direction: row; align-items: center; justify-content: space-between; - padding:10px; + padding: 10px; .donate { cursor: pointer; } diff --git a/packages/gui/src/view/pages/plugin/git.vue b/packages/gui/src/view/pages/plugin/git.vue index 7060a38..998e413 100644 --- a/packages/gui/src/view/pages/plugin/git.vue +++ b/packages/gui/src/view/pages/plugin/git.vue @@ -115,8 +115,12 @@ export default {
diff --git a/packages/gui/src/view/pages/plugin/node.vue b/packages/gui/src/view/pages/plugin/node.vue index e7b7aaa..1956c56 100644 --- a/packages/gui/src/view/pages/plugin/node.vue +++ b/packages/gui/src/view/pages/plugin/node.vue @@ -136,8 +136,12 @@ export default {
diff --git a/packages/gui/src/view/pages/plugin/overwall.vue b/packages/gui/src/view/pages/plugin/overwall.vue index c6f062f..1cf2757 100644 --- a/packages/gui/src/view/pages/plugin/overwall.vue +++ b/packages/gui/src/view/pages/plugin/overwall.vue @@ -213,8 +213,12 @@ export default {
diff --git a/packages/gui/src/view/pages/plugin/pip.vue b/packages/gui/src/view/pages/plugin/pip.vue index 1c09d9d..c9c7be1 100644 --- a/packages/gui/src/view/pages/plugin/pip.vue +++ b/packages/gui/src/view/pages/plugin/pip.vue @@ -120,8 +120,12 @@ export default {
diff --git a/packages/gui/src/view/pages/proxy.vue b/packages/gui/src/view/pages/proxy.vue index 51c361b..93360bf 100644 --- a/packages/gui/src/view/pages/proxy.vue +++ b/packages/gui/src/view/pages/proxy.vue @@ -113,7 +113,9 @@ export default { - 去设置 + + 去设置 +
解决OneNoteMicrosoftStoreOutlookUWP应用开启代理后无法访问网络的问题
@@ -162,8 +164,12 @@ export default { @@ -179,7 +185,9 @@ export default { >
1、此设置用于解决OneNote、MicrosoftStore、Outlook等UWP应用无法访问网络的问题。
diff --git a/packages/gui/src/view/pages/server.vue b/packages/gui/src/view/pages/server.vue index 1562f84..b353dfd 100644 --- a/packages/gui/src/view/pages/server.vue +++ b/packages/gui/src/view/pages/server.vue @@ -407,8 +407,12 @@ export default { - 立即重新测速 - 刷新 + + 立即重新测速 + + + 刷新 + @@ -434,8 +438,12 @@ export default {
@@ -454,7 +462,7 @@ export default { } .jsoneditor-vue { - height: 100% + height: 100%; } .ant-tabs { diff --git a/packages/gui/src/view/pages/setting.vue b/packages/gui/src/view/pages/setting.vue index 776368b..607c0f9 100644 --- a/packages/gui/src/view/pages/setting.vue +++ b/packages/gui/src/view/pages/setting.vue @@ -235,11 +235,19 @@ export default { try { const remoteConfig = {} - await this.$api.config.readRemoteConfigStr().then((ret) => { remoteConfig.old1 = ret }) - await this.$api.config.readRemoteConfigStr('_personal').then((ret) => { remoteConfig.old2 = ret }) + await this.$api.config.readRemoteConfigStr().then((ret) => { + remoteConfig.old1 = ret + }) + await this.$api.config.readRemoteConfigStr('_personal').then((ret) => { + remoteConfig.old2 = ret + }) await this.$api.config.downloadRemoteConfig() - await this.$api.config.readRemoteConfigStr().then((ret) => { remoteConfig.new1 = ret }) - await this.$api.config.readRemoteConfigStr('_personal').then((ret) => { remoteConfig.new2 = ret }) + await this.$api.config.readRemoteConfigStr().then((ret) => { + remoteConfig.new1 = ret + }) + await this.$api.config.readRemoteConfigStr('_personal').then((ret) => { + remoteConfig.new2 = ret + }) if (remoteConfig.old1 === remoteConfig.new1 && remoteConfig.old2 === remoteConfig.new2) { this.$message.info('远程配置没有变化,不做任何处理。') @@ -276,7 +284,9 @@ export default { 1. 找到备份文件,路径: ~/.dev-sidecar/config.json.时间戳.bak.json
- 2. 将该备份文件重命名为config.json,再重启软件即可恢复个性化配置。 + 2. 将该备份文件重命名为 + config.json + ,再重启软件即可恢复个性化配置。

@@ -316,7 +326,9 @@ export default { 本应用开机自启 - 日志 + + 日志 +
windows下建议开启开机自启。更多说明参考
diff --git a/packages/gui/src/view/style/index.scss b/packages/gui/src/view/style/index.scss index f58178e..cae2839 100644 --- a/packages/gui/src/view/style/index.scss +++ b/packages/gui/src/view/style/index.scss @@ -1,62 +1,93 @@ -.footer-bar{ - padding:10px; +.footer-bar { + padding: 10px; text-align: right; - border-top:#eee 1px solid; + border-top: #eee 1px solid; } -.flex-l-r{ - align-content: center; +.flex-l-r { + align-content: center; display: flex; justify-content: flex-end; align-items: center; - &>a{ - align-content: center; + & > a { + align-content: center; display: flex; align-items: center; } } -.md-mr-5{margin-right: 5px;} -.md-mr-10{margin-right: 10px;} -.md-mr-15{margin-right: 15px;} -.md-mr-20{margin-right: 20px;} - -.md-mt-5{margin-top: 5px;} -.md-mt-10{margin-top: 10px;} -.md-mt-15{margin-top: 15px;} -.md-mt-20{margin-top: 20px;} +.md-mr-5 { + margin-right: 5px; +} +.md-mr-10 { + margin-right: 10px; +} +.md-mr-15 { + margin-right: 15px; +} +.md-mr-20 { + margin-right: 20px; +} +.md-mt-5 { + margin-top: 5px; +} +.md-mt-10 { + margin-top: 10px; +} +.md-mt-15 { + margin-top: 15px; +} +.md-mt-20 { + margin-top: 20px; +} -.md-ml-5{margin-left: 5px;} -.md-ml-10{margin-left: 10px;} -.md-ml-15{margin-left: 15px;} -.md-ml-20{margin-left: 20px;} +.md-ml-5 { + margin-left: 5px; +} +.md-ml-10 { + margin-left: 10px; +} +.md-ml-15 { + margin-left: 15px; +} +.md-ml-20 { + margin-left: 20px; +} -.md-mb-5{margin-bottom: 5px;} -.md-mb-10{margin-bottom: 10px;} -.md-mb-15{margin-bottom: 15px;} -.md-mb-20{margin-bottom: 20px;} +.md-mb-5 { + margin-bottom: 5px; +} +.md-mb-10 { + margin-bottom: 10px; +} +.md-mb-15 { + margin-bottom: 15px; +} +.md-mb-20 { + margin-bottom: 20px; +} -ol{ +ol { margin-block-start: 0em; margin-block-end: 0em; padding-inline-start: 20px; } -.form-help{ - font-size:12px; +.form-help { + font-size: 12px; line-height: 15px; color: #a1a1a1; - i{ - font-family: "Microsoft YaHei", serif; + i { + font-family: 'Microsoft YaHei', serif; font-style: normal; font-weight: bold; } code { - padding: 0 .4em; + padding: 0 0.4em; } } @@ -66,13 +97,13 @@ code { border-radius: 6px; color: #888; background-color: #f1f1f1; - margin-left: .2em; - margin-right: .2em; - padding: .2em .4em; + margin-left: 0.2em; + margin-right: 0.2em; + padding: 0.2em 0.4em; white-space: break-spaces; } -.ace_search_form .ace_searchbtn{ +.ace_search_form .ace_searchbtn { width: auto; min-width: 27px; } @@ -106,4 +137,4 @@ hr { padding: 2px 5px; margin: 0 5px 5px 5px; } -} \ No newline at end of file +} diff --git a/packages/gui/src/view/style/theme/dark.scss b/packages/gui/src/view/style/theme/dark.scss index d11c2a1..8e72d35 100644 --- a/packages/gui/src/view/style/theme/dark.scss +++ b/packages/gui/src/view/style/theme/dark.scss @@ -1,24 +1,28 @@ /* 暗色主题 */ -$dark-logo: url("../../../../public/logo/logo-lang-light.svg"); +$dark-logo: url('../../../../public/logo/logo-lang-light.svg'); $dark-bg: #1e1f22; //背景 $dark-bg-highlight: #333; //高亮块:背景 $dark-text: #ddd; //字体颜色 $dark-bd: #333; //边框和分隔线 $dark-btn: #444; //按钮:边框和背景颜色 $dark-input: #777; //输入框:背景色 -.theme-dark{ +.theme-dark { hr { border-color: $dark-bd; } /* 背景色和字体颜色 */ - .ds_layout, .ant-layout, - .ds-container, .ds-container .container-header, - .ant-layout-footer{ + .ds_layout, + .ant-layout, + .ds-container, + .ds-container .container-header, + .ant-layout-footer { background: $dark-bg; color: $dark-text; } - div, span, label { + div, + span, + label { color: $dark-text; } .form-help { @@ -31,7 +35,7 @@ $dark-input: #777; //输入框:背景色 /* 高亮块:背景色和字体颜色 */ /* 警告类型 */ - .ant-alert-warning{ + .ant-alert-warning { background: $dark-bg-highlight; border-color: $dark-bg-highlight; color: $dark-text; @@ -41,7 +45,7 @@ $dark-input: #777; //输入框:背景色 } } /* 消息类型 */ - .ant-alert-info{ + .ant-alert-info { background: $dark-bg-highlight; border-color: $dark-bg-highlight; color: $dark-text; @@ -55,7 +59,7 @@ $dark-input: #777; //输入框:背景色 .footer-bar, .ant-layout-footer, .ant-tabs .ant-tabs-left-bar, - .ant-tabs .ant-tabs-left-content{ + .ant-tabs .ant-tabs-left-content { border-color: $dark-bd; } .ant-radio-button-wrapper:not(:first-child)::before { @@ -67,138 +71,146 @@ $dark-input: #777; //输入框:背景色 /* 左侧 */ /** 背景色 **/ - .ant-layout-sider{ + .ant-layout-sider { background: $dark-bg; } /** Logo **/ - .logo{ + .logo { background-image: $dark-logo; /* logo使用亮色的 */ } /** 菜单 **/ - .ant-menu{ + .ant-menu { background: $dark-bg; color: $dark-text; } /* 菜单选中时,或鼠标移到菜单上时的样式 */ .ant-menu-item:hover, .ant-menu-submenu .ant-menu-submenu-title:hover, - .ant-menu:not(.ant-menu-horizontal) .ant-menu-item-selected{ + .ant-menu:not(.ant-menu-horizontal) .ant-menu-item-selected { background: $dark-bg-highlight; color: #1890ff; - span{ color: #1890ff; } + span { + color: #1890ff; + } } /* 输入框、下拉框 */ .ant-input, - .ant-input-number-input, .ant-input-number, + .ant-input-number-input, + .ant-input-number, .ant-select-selection, - .ant-input-group-addon{ + .ant-input-group-addon { background: $dark-input; border-color: #aaa; color: $dark-text; - &:hover, &:focus{ + &:hover, + &:focus { border-color: #fff; } } /* 卡片消息:IP测速 */ - .ant-card{ + .ant-card { background: $dark-input; border-color: $dark-input; - .ant-card-head{ + .ant-card-head { border-bottom-color: #929292; } } /* 标签:未启用 */ - .ant-tag-red{ + .ant-tag-red { background: #4f4749; border-color: #4f4749; color: #bf8285; } /* 标签:已启用 */ - .ant-tag-green{ + .ant-tag-green { background: #505f5f; border-color: #505f5f; color: #90cb9f; } /* 标签:警告 */ - .ant-tag-orange{ + .ant-tag-orange { background: #5a5750; border-color: #5a5750; color: #cfa572; } /* 按钮 */ - .ant-btn:not(.ant-btn-danger, .ant-btn-primary){ + .ant-btn:not(.ant-btn-danger, .ant-btn-primary) { background: $dark-btn; border-color: $dark-btn; color: $dark-text; - &:hover{ + &:hover { opacity: 0.8; } } /* 单选框:开关式 */ - .ant-switch:not(.ant-switch-checked){ + .ant-switch:not(.ant-switch-checked) { background: $dark-btn; border-color: $dark-btn; - &:hover{ + &:hover { opacity: 0.8; } } /* 单选框:按钮式 */ - .ant-radio-button-wrapper{ + .ant-radio-button-wrapper { background: $dark-btn; border-color: $dark-btn; color: $dark-text; - &:hover{ + &:hover { opacity: 0.8; } } /* JSON编辑器:应用于拦截设置 */ - .jsoneditor-vue{ + .jsoneditor-vue { /*整个编辑框:背景色和边框*/ - div.jsoneditor{ + div.jsoneditor { background: $dark-bg-highlight; border: none; } /* 头部菜单栏:边框 */ - div.jsoneditor-menu{ + div.jsoneditor-menu { background: $dark-bg-highlight; border-color: $dark-bg-highlight; } /* 内容区域左边:行号 */ - .ace_gutter{ + .ace_gutter { background: #444; - .ace_gutter-cell { color: #aaa; } + .ace_gutter-cell { + color: #aaa; + } } /* 内容区域右边:JSON内容 */ - .ace_scroller{ + .ace_scroller { background: #555; } /* key的颜色 */ - .ace_variable, .ace_text-layer{ + .ace_variable, + .ace_text-layer { color: #eee; } /* 字符串值的颜色 */ - .ace_string, .ace_cjk{ + .ace_string, + .ace_cjk { color: #a6eaa6; } - .ace_constant{ + .ace_constant { /* 数字的颜色 */ - &.ace_numeric{ + &.ace_numeric { color: #ec9999; } /* 布尔值的颜色 */ - &.ace_language{ + &.ace_language { color: #f4c995; } } /* 当前行高亮样式 */ .ace_gutter-active-line, - .ace_marker-layer .ace_active-line{ + .ace_marker-layer .ace_active-line { background: #838774; } /* 选中行高亮样式 */ @@ -213,7 +225,9 @@ $dark-input: #777; //输入框:背景色 } } /* 搜索框 */ - .ace_button, button, .ace_search_field { + .ace_button, + button, + .ace_search_field { color: #000; } /* 搜索结果 */ @@ -221,4 +235,4 @@ $dark-input: #777; //输入框:背景色 border-color: #8b2929; } } -} \ No newline at end of file +} diff --git a/packages/gui/vue.config.js b/packages/gui/vue.config.js index df53d2c..dcc7f25 100644 --- a/packages/gui/vue.config.js +++ b/packages/gui/vue.config.js @@ -1,13 +1,10 @@ -const path = require('path') +const path = require('node:path') const webpack = require('webpack') const publishUrl = process.env.VUE_APP_PUBLISH_URL const publishProvider = process.env.VUE_APP_PUBLISH_PROVIDER console.log('Publish url:', publishUrl) -/** - * @type {import('@vue/cli-service').ProjectOptions} - */ module.exports = { pages: { index: { diff --git a/packages/mitmproxy/src/json.js b/packages/mitmproxy/src/json.js index 3b2d307..1e90c94 100644 --- a/packages/mitmproxy/src/json.js +++ b/packages/mitmproxy/src/json.js @@ -1,5 +1,6 @@ -const log = require('./utils/util.log') let JSON5 = require('json5') +const log = require('./utils/util.log') + if (JSON5.default) { JSON5 = JSON5.default } diff --git a/packages/mitmproxy/src/lib/dns/https.js b/packages/mitmproxy/src/lib/dns/https.js index 2cd39c8..3175da0 100644 --- a/packages/mitmproxy/src/lib/dns/https.js +++ b/packages/mitmproxy/src/lib/dns/https.js @@ -1,4 +1,4 @@ -const { promisify } = require('util') +const { promisify } = require('node:util') const doh = require('dns-over-http') const log = require('../../utils/util.log') const matchUtil = require('../../utils/util.match') diff --git a/packages/mitmproxy/src/lib/dns/ipaddress.js b/packages/mitmproxy/src/lib/dns/ipaddress.js index 9ed0bf3..900995e 100644 --- a/packages/mitmproxy/src/lib/dns/ipaddress.js +++ b/packages/mitmproxy/src/lib/dns/ipaddress.js @@ -14,7 +14,7 @@ module.exports = class DNSOverIpAddress extends BaseDNS { } const ret = res.data - const regexp = /IP Address<\/th>
  • ([^<]*)<\/li><\/ul><\/td><\/tr>/gm + const regexp = /IP Address<\/th>
    • ([^<]*)<\/li><\/ul><\/td><\/tr>/g const matched = regexp.exec(ret) let ip = null diff --git a/packages/mitmproxy/src/lib/interceptor/impl/req/proxy.js b/packages/mitmproxy/src/lib/interceptor/impl/req/proxy.js index 6dcf19c..90efd33 100644 --- a/packages/mitmproxy/src/lib/interceptor/impl/req/proxy.js +++ b/packages/mitmproxy/src/lib/interceptor/impl/req/proxy.js @@ -1,4 +1,4 @@ -const url = require('url') +const url = require('node:url') const lodash = require('lodash') // 替换占位符 diff --git a/packages/mitmproxy/src/lib/monkey/index.js b/packages/mitmproxy/src/lib/monkey/index.js index fbd1daa..df00bd7 100644 --- a/packages/mitmproxy/src/lib/monkey/index.js +++ b/packages/mitmproxy/src/lib/monkey/index.js @@ -1,5 +1,5 @@ -const fs = require('fs') -const path = require('path') +const fs = require('node:fs') +const path = require('node:path') const log = require('../../utils/util.log') let scripts @@ -57,10 +57,10 @@ if (!((window.__ds_global__ || {}).GM_getValue || (() => true))("ds_enabled", tr initStr}\r\n${ checkEnabledStr}\r\n\r\n${ grantStr ? (`${grantStr}\r\n\r\n`) : '' - }${content - }\r\nconsole.log("${scriptKey} completed")` - + `\r\n})` - + `\r\nconsole.log("${scriptKey} loaded")` + }${content + }\r\nconsole.log("${scriptKey} completed")` + + `\r\n})` + + `\r\nconsole.log("${scriptKey} loaded")` } function loadScript (content, scriptName) { diff --git a/packages/mitmproxy/src/lib/proxy/common/config.js b/packages/mitmproxy/src/lib/proxy/common/config.js index 0453c1b..617fbc9 100644 --- a/packages/mitmproxy/src/lib/proxy/common/config.js +++ b/packages/mitmproxy/src/lib/proxy/common/config.js @@ -1,4 +1,4 @@ -const path = require('path') +const path = require('node:path') const config = exports diff --git a/packages/mitmproxy/src/lib/proxy/common/util.js b/packages/mitmproxy/src/lib/proxy/common/util.js index 0ab2a04..31e1cd1 100644 --- a/packages/mitmproxy/src/lib/proxy/common/util.js +++ b/packages/mitmproxy/src/lib/proxy/common/util.js @@ -1,4 +1,4 @@ -const url = require('url') +const url = require('node:url') const tunnelAgent = require('tunnel-agent') const log = require('../../../utils/util.log') const matchUtil = require('../../../utils/util.match') diff --git a/packages/mitmproxy/src/lib/proxy/compatible/compatible.js b/packages/mitmproxy/src/lib/proxy/compatible/compatible.js index dd4eb2b..e9ffba3 100644 --- a/packages/mitmproxy/src/lib/proxy/compatible/compatible.js +++ b/packages/mitmproxy/src/lib/proxy/compatible/compatible.js @@ -5,8 +5,8 @@ * * @author WangLiang */ -const fs = require('fs') -const path = require('path') +const fs = require('node:fs') +const path = require('node:path') const jsonApi = require('../../../json') const log = require('../../../utils/util.log') const matchUtil = require('../../../utils/util.match') diff --git a/packages/mitmproxy/src/lib/proxy/middleware/InsertScriptMiddleware.js b/packages/mitmproxy/src/lib/proxy/middleware/InsertScriptMiddleware.js index ce3b107..d179149 100644 --- a/packages/mitmproxy/src/lib/proxy/middleware/InsertScriptMiddleware.js +++ b/packages/mitmproxy/src/lib/proxy/middleware/InsertScriptMiddleware.js @@ -1,4 +1,4 @@ -const zlib = require('zlib') +const zlib = require('node:zlib') const through = require('through2') const log = require('../../../utils/util.log') diff --git a/packages/mitmproxy/src/lib/proxy/middleware/overwall.js b/packages/mitmproxy/src/lib/proxy/middleware/overwall.js index d6b2a16..0b0d070 100644 --- a/packages/mitmproxy/src/lib/proxy/middleware/overwall.js +++ b/packages/mitmproxy/src/lib/proxy/middleware/overwall.js @@ -1,7 +1,7 @@ -const { Buffer } = require('buffer') -const fs = require('fs') -const path = require('path') -const url = require('url') +const { Buffer } = require('node:buffer') +const fs = require('node:fs') +const path = require('node:path') +const url = require('node:url') const lodash = require('lodash') const request = require('request') const log = require('../../../utils/util.log') @@ -49,7 +49,7 @@ function loadPacLastModifiedTime (pacTxt) { if (matched && matched.length > 0) { try { return new Date(matched[0]) - } catch (ignore) { + } catch { return null } } @@ -74,7 +74,7 @@ function savePacFile (pacTxt) { // 尝试解析和修改 pac.txt 文件时间 const lastModifiedTime = loadPacLastModifiedTime(pacTxt) if (lastModifiedTime) { - fs.stat(pacFilePath, (err, stats) => { + fs.stat(pacFilePath, (err, _stats) => { if (err) { log.error('修改 pac.txt 文件时间失败:', err) return @@ -113,13 +113,11 @@ async function downloadPacAsync (pacConfig) { // 尝试解析Base64(注:https://gitlab.com/gfwlist/gfwlist/raw/master/gfwlist.txt 下载下来的是Base64格式) let pacTxt = body - try { - if (!pacTxt.includes('!---------------------EOF')) { + if (!pacTxt.includes('!---------------------EOF')) { + try { pacTxt = Buffer.from(pacTxt, 'base64').toString('utf8') // log.debug('解析 base64 后的 pax:', pacTxt) - } - } catch (e) { - if (!pacTxt.includes('!---------------------EOF')) { + } catch { log.error(`远程 pac.txt 文件内容即不是base64格式,也不是要求的格式,url: ${remotePacFileUrl},body: ${body}`) return } @@ -153,11 +151,11 @@ function createOverwallMiddleware (overWallConfig) { } const overWallTargetMap = matchUtil.domainMapRegexply(overWallConfig.targets) return { - sslConnectInterceptor: (req, cltSocket, head) => { + sslConnectInterceptor: (req, _cltSocket, _head) => { const hostname = req.url.split(':')[0] return matched(hostname, overWallTargetMap) }, - requestIntercept (context, req, res, ssl, next) { + requestIntercept (context, req, res, _ssl, _next) { const { rOptions, log, RequestCounter } = context if (rOptions.protocol === 'http:') { return diff --git a/packages/mitmproxy/src/lib/proxy/middleware/source/pac.js b/packages/mitmproxy/src/lib/proxy/middleware/source/pac.js index 6a0bd29..c0fae9d 100644 --- a/packages/mitmproxy/src/lib/proxy/middleware/source/pac.js +++ b/packages/mitmproxy/src/lib/proxy/middleware/source/pac.js @@ -1,5 +1,5 @@ -const fs = require('fs') -const path = require('path') +const fs = require('node:fs') +const path = require('node:path') const log = require('../../../../utils/util.log') function createPacClient (pacFilePath) { diff --git a/packages/mitmproxy/src/lib/proxy/mitmproxy/createConnectHandler.js b/packages/mitmproxy/src/lib/proxy/mitmproxy/createConnectHandler.js index 401ea23..9453409 100644 --- a/packages/mitmproxy/src/lib/proxy/mitmproxy/createConnectHandler.js +++ b/packages/mitmproxy/src/lib/proxy/mitmproxy/createConnectHandler.js @@ -1,5 +1,5 @@ -const net = require('net') -const url = require('url') +const net = require('node:net') +const url = require('node:url') const jsonApi = require('../../../json') const log = require('../../../utils/util.log') const DnsUtil = require('../../dns/index') diff --git a/packages/mitmproxy/src/lib/proxy/mitmproxy/createFakeServerCenter.js b/packages/mitmproxy/src/lib/proxy/mitmproxy/createFakeServerCenter.js index bbd4db5..f0b2a14 100644 --- a/packages/mitmproxy/src/lib/proxy/mitmproxy/createFakeServerCenter.js +++ b/packages/mitmproxy/src/lib/proxy/mitmproxy/createFakeServerCenter.js @@ -1,4 +1,4 @@ -const fs = require('fs') +const fs = require('node:fs') const forge = require('node-forge') const log = require('../../../utils/util.log') const FakeServersCenter = require('../tls/FakeServersCenter') diff --git a/packages/mitmproxy/src/lib/proxy/mitmproxy/createRequestHandler.js b/packages/mitmproxy/src/lib/proxy/mitmproxy/createRequestHandler.js index 00f68b2..a6e8fa0 100644 --- a/packages/mitmproxy/src/lib/proxy/mitmproxy/createRequestHandler.js +++ b/packages/mitmproxy/src/lib/proxy/mitmproxy/createRequestHandler.js @@ -1,5 +1,5 @@ -const http = require('http') -const https = require('https') +const http = require('node:http') +const https = require('node:https') const jsonApi = require('../../../json') const log = require('../../../utils/util.log') const RequestCounter = require('../../choice/RequestCounter') diff --git a/packages/mitmproxy/src/lib/proxy/mitmproxy/createUpgradeHandler.js b/packages/mitmproxy/src/lib/proxy/mitmproxy/createUpgradeHandler.js index 69de41a..df38598 100644 --- a/packages/mitmproxy/src/lib/proxy/mitmproxy/createUpgradeHandler.js +++ b/packages/mitmproxy/src/lib/proxy/mitmproxy/createUpgradeHandler.js @@ -1,5 +1,5 @@ -const http = require('http') -const https = require('https') +const http = require('node:http') +const https = require('node:https') const log = require('../../../utils/util.log') const util = require('../common/util') diff --git a/packages/mitmproxy/src/lib/proxy/mitmproxy/dnsLookup.js b/packages/mitmproxy/src/lib/proxy/mitmproxy/dnsLookup.js index dbea703..fe5edac 100644 --- a/packages/mitmproxy/src/lib/proxy/mitmproxy/dnsLookup.js +++ b/packages/mitmproxy/src/lib/proxy/mitmproxy/dnsLookup.js @@ -1,4 +1,4 @@ -const defaultDns = require('dns') +const defaultDns = require('node:dns') const log = require('../../../utils/util.log') const speedTest = require('../../speed') diff --git a/packages/mitmproxy/src/lib/proxy/mitmproxy/index.js b/packages/mitmproxy/src/lib/proxy/mitmproxy/index.js index daaf661..9c272fb 100644 --- a/packages/mitmproxy/src/lib/proxy/mitmproxy/index.js +++ b/packages/mitmproxy/src/lib/proxy/mitmproxy/index.js @@ -1,4 +1,4 @@ -const http = require('http') +const http = require('node:http') const log = require('../../../utils/util.log') const speedTest = require('../../speed/index.js') const config = require('../common/config') diff --git a/packages/mitmproxy/src/lib/proxy/tls/FakeServersCenter.js b/packages/mitmproxy/src/lib/proxy/tls/FakeServersCenter.js index 598cbb3..df32037 100644 --- a/packages/mitmproxy/src/lib/proxy/tls/FakeServersCenter.js +++ b/packages/mitmproxy/src/lib/proxy/tls/FakeServersCenter.js @@ -1,15 +1,14 @@ -const http = require('http') -const https = require('https') +const http = require('node:http') +const https = require('node:https') const forge = require('node-forge') +const tls = require('node:tls') const CertAndKeyContainer = require('./CertAndKeyContainer') const tlsUtils = require('./tlsUtils') - -const pki = forge.pki -// const colors = require('colors') -const tls = require('tls') const log = require('../../../utils/util.log') const compatible = require('../compatible/compatible') +const pki = forge.pki + function arraysHaveSameElements (arr1, arr2) { if (arr1.length !== arr2.length) { return false diff --git a/packages/mitmproxy/src/lib/proxy/tls/tlsUtils.js b/packages/mitmproxy/src/lib/proxy/tls/tlsUtils.js index df9535e..d2df029 100644 --- a/packages/mitmproxy/src/lib/proxy/tls/tlsUtils.js +++ b/packages/mitmproxy/src/lib/proxy/tls/tlsUtils.js @@ -1,5 +1,5 @@ -const fs = require('fs') -const path = require('path') +const fs = require('node:fs') +const path = require('node:path') const _ = require('lodash') const mkdirp = require('mkdirp') const forge = require('node-forge') diff --git a/packages/mitmproxy/src/lib/speed/SpeedTester.js b/packages/mitmproxy/src/lib/speed/SpeedTester.js index f6b2f34..a5f915e 100644 --- a/packages/mitmproxy/src/lib/speed/SpeedTester.js +++ b/packages/mitmproxy/src/lib/speed/SpeedTester.js @@ -1,5 +1,5 @@ // 1个小时不访问,取消获取 -const net = require('net') +const net = require('node:net') const _ = require('lodash') const log = require('../../utils/util.log.js') const config = require('./config.js') diff --git a/packages/mitmproxy/src/options.js b/packages/mitmproxy/src/options.js index 7cf3598..82bebc5 100644 --- a/packages/mitmproxy/src/options.js +++ b/packages/mitmproxy/src/options.js @@ -1,5 +1,5 @@ -const fs = require('fs') -const path = require('path') +const fs = require('node:fs') +const path = require('node:path') const lodash = require('lodash') const jsonApi = require('./json') const dnsUtil = require('./lib/dns') @@ -210,7 +210,9 @@ module.exports = (serverConfig) => { } } - matchIntercepts.sort((a, b) => { return a.priority - b.priority }) + matchIntercepts.sort((a, b) => { + return a.priority - b.priority + }) // for (const interceptor of matchIntercepts) { // log.info('interceptor:', interceptor.name, 'priority:', interceptor.priority) // } diff --git a/packages/mitmproxy/test/proxyTest.js b/packages/mitmproxy/test/proxyTest.js index 84a402a..55d3bab 100644 --- a/packages/mitmproxy/test/proxyTest.js +++ b/packages/mitmproxy/test/proxyTest.js @@ -1,4 +1,4 @@ -const http = require('http') +const http = require('node:http') const options = { headers: {