Browse Source

fix Style

pull/396/head
王良 3 days ago
parent
commit
6b697a8979
  1. 22
      README.md
  2. 4
      packages/core/src/config.js
  3. 2
      packages/core/src/config/index.js
  4. 4
      packages/core/src/event.js
  5. 6
      packages/core/src/modules/server/index.js
  6. 2
      packages/core/src/shell/scripts/extra-path/index.js
  7. 4
      packages/core/src/shell/scripts/set-system-proxy/index.js
  8. 8
      packages/core/src/shell/shell.js
  9. 2
      packages/core/src/shell/test.js
  10. 7
      packages/core/start/index.js
  11. 4
      packages/core/start/mitmproxy.js
  12. 2
      packages/core/test/httpsVerifyTest.js
  13. 4
      packages/gui/pkg/after-all-artifact-build.js
  14. 4
      packages/gui/pkg/after-pack.js
  15. 2
      packages/gui/src/background.js
  16. 4
      packages/gui/src/bridge/api/backend.js
  17. 4
      packages/gui/src/bridge/mitmproxy.js
  18. 2
      packages/gui/src/bridge/on-close/front.js
  19. 4
      packages/gui/src/bridge/update/backend.js
  20. 27
      packages/gui/src/bridge/update/front.js
  21. 4
      packages/gui/src/utils/util.apppath.js
  22. 46
      packages/gui/src/view/App.vue
  23. 32
      packages/gui/src/view/components/container.vue
  24. 2
      packages/gui/src/view/pages/index.vue
  25. 8
      packages/gui/src/view/pages/plugin/git.vue
  26. 8
      packages/gui/src/view/pages/plugin/node.vue
  27. 8
      packages/gui/src/view/pages/plugin/overwall.vue
  28. 8
      packages/gui/src/view/pages/plugin/pip.vue
  29. 16
      packages/gui/src/view/pages/proxy.vue
  30. 18
      packages/gui/src/view/pages/server.vue
  31. 24
      packages/gui/src/view/pages/setting.vue
  32. 95
      packages/gui/src/view/style/index.scss
  33. 96
      packages/gui/src/view/style/theme/dark.scss
  34. 5
      packages/gui/vue.config.js
  35. 3
      packages/mitmproxy/src/json.js
  36. 2
      packages/mitmproxy/src/lib/dns/https.js
  37. 2
      packages/mitmproxy/src/lib/dns/ipaddress.js
  38. 2
      packages/mitmproxy/src/lib/interceptor/impl/req/proxy.js
  39. 4
      packages/mitmproxy/src/lib/monkey/index.js
  40. 2
      packages/mitmproxy/src/lib/proxy/common/config.js
  41. 2
      packages/mitmproxy/src/lib/proxy/common/util.js
  42. 4
      packages/mitmproxy/src/lib/proxy/compatible/compatible.js
  43. 2
      packages/mitmproxy/src/lib/proxy/middleware/InsertScriptMiddleware.js
  44. 22
      packages/mitmproxy/src/lib/proxy/middleware/overwall.js
  45. 4
      packages/mitmproxy/src/lib/proxy/middleware/source/pac.js
  46. 4
      packages/mitmproxy/src/lib/proxy/mitmproxy/createConnectHandler.js
  47. 2
      packages/mitmproxy/src/lib/proxy/mitmproxy/createFakeServerCenter.js
  48. 4
      packages/mitmproxy/src/lib/proxy/mitmproxy/createRequestHandler.js
  49. 4
      packages/mitmproxy/src/lib/proxy/mitmproxy/createUpgradeHandler.js
  50. 2
      packages/mitmproxy/src/lib/proxy/mitmproxy/dnsLookup.js
  51. 2
      packages/mitmproxy/src/lib/proxy/mitmproxy/index.js
  52. 11
      packages/mitmproxy/src/lib/proxy/tls/FakeServersCenter.js
  53. 4
      packages/mitmproxy/src/lib/proxy/tls/tlsUtils.js
  54. 2
      packages/mitmproxy/src/lib/speed/SpeedTester.js
  55. 8
      packages/mitmproxy/src/options.js
  56. 2
      packages/mitmproxy/test/proxyTest.js

22
README.md

@ -3,7 +3,7 @@
开发者边车,命名取自service-mesh的service-sidecar,意为为开发者打辅助的边车工具(以下简称ds)
通过本地代理的方式将https请求代理到一些国内的加速通道上
<a href='https://github.com/docmirror/dev-sidecar'><img alt="GitHub stars" src="https://img.shields.io/github/stars/docmirror/dev-sidecar?logo=github"></a>
`<a href='https://github.com/docmirror/dev-sidecar'><img alt="GitHub stars" src="https://img.shields.io/github/stars/docmirror/dev-sidecar?logo=github">``</a>`
> Gitee上的同步项目已被封禁,此项目将不再更新与维护 【狗头保命】
>
@ -12,7 +12,7 @@
## 打个广告
> <https://github.com/certd/certd>
> [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](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://greasyfork.org/scripts/412245>
> - [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,10 +152,12 @@
#### 1)git clone 加速
- 方式1:快捷复制:
> 开启脚本支持,然后在复制clone链接下方,即可复制到加速链接
- 方式2:
> 1. 使用方式:用实际的名称替换 `{}` 的内容,即可加速clone <https://hub.fastgit.org/{username}/{reponame}.git>
> 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)
@ -258,7 +260,7 @@ networksetup -setwebproxy 'WiFi' 127.0.0.1 31181
1. 本应用仅支持https加速
请务必确认你访问的地址是https开头的
比如: <https://github.com/>
比如: [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显示连接超时

4
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')

2
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 || '/'

4
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) {

6
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')

2
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 () {

4
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')

8
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) {

2
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({

7
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)
}

4
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')

2
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'

4
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) {

4
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')

2
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'

4
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'

4
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')

2
packages/gui/src/bridge/on-close/front.js

@ -12,7 +12,7 @@ function install (app, api) {
}
app.$confirm({
title: '关闭策略',
content: h => (
content: (h) => (
<div>
<div style="margin-top:10px">
<a-radio-group vOn:change={onRadioChange} defaultValue={closeType}>

4
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'

27
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 (
<div>
<div>请前往 <a onClick={openGithubUrl}>github项目release页面</a> </div>
<div>
请前往
<a onClick={openGithubUrl}>github项目release页面</a>
下载新版本手动安装
</div>
<div><a onClick={openGithubUrl}>https://github.com/docmirror/dev-sidecar/releases</a></div>
</div>
)
@ -154,7 +157,10 @@ function install (app, api) {
const releaseNotes = value.releaseNotes.replace(/\r\n/g, '\n')
return (
<div>
<div>发布公告<a onClick={openGithubUrl}>https://github.com/docmirror/dev-sidecar/releases</a></div>
<div>
发布公告
<a onClick={openGithubUrl}>https://github.com/docmirror/dev-sidecar/releases</a>
</div>
<hr />
<pre style="max-height:350px;font-family:auto">
{releaseNotes}
@ -167,7 +173,10 @@ function install (app, api) {
}
return (
<div>
<div>发布公告<a onClick={openGithubUrl}>https://github.com/docmirror/dev-sidecar/releases</a></div>
<div>
发布公告
<a onClick={openGithubUrl}>https://github.com/docmirror/dev-sidecar/releases</a>
</div>
<div>更新内容</div>
<ol>{notes}</ol>
</div>
@ -200,7 +209,10 @@ function install (app, api) {
const releaseNotes = value.releaseNotes.replace(/\r\n/g, '\n')
return (
<div>
<div>发布公告<a onClick={openGithubUrl}>https://github.com/docmirror/dev-sidecar/releases</a></div>
<div>
发布公告
<a onClick={openGithubUrl}>https://github.com/docmirror/dev-sidecar/releases</a>
</div>
<hr />
<pre style="max-height:350px;font-family:auto">
{releaseNotes}
@ -213,7 +225,10 @@ function install (app, api) {
}
return (
<div>
<div>发布公告<a onClick={openGithubUrl}>https://github.com/docmirror/dev-sidecar/releases</a></div>
<div>
发布公告
<a onClick={openGithubUrl}>https://github.com/docmirror/dev-sidecar/releases</a>
</div>
<div>更新内容</div>
<ol>{notes}</ol>
</div>

4
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()) {

46
packages/gui/src/view/App.vue

@ -88,17 +88,17 @@ export default {
</template>
<style lang="scss">
body{
body {
height: 100%;
}
.mt10{
margin-top:10px;
.mt10 {
margin-top: 10px;
}
.mt5{
margin-top:5px;
.mt5 {
margin-top: 5px;
}
.mt20{
margin-top:20px;
.mt20 {
margin-top: 20px;
}
.ds_layout {
font-family: Avenir, Helvetica, Arial, sans-serif;
@ -106,31 +106,33 @@ body{
-moz-osx-font-smoothing: grayscale;
color: #2c3e50;
height: 100%;
.ant-layout-has-sider{
border:1px solid #eee;
.ant-layout-has-sider {
border: 1px solid #eee;
}
.ant-layout-sider-children{
border-right:1px solid #eee;
.ant-layout-sider-children {
border-right: 1px solid #eee;
}
.ant-layout{
height:100%
.ant-layout {
height: 100%;
}
.logo{
padding:5px;
.logo {
padding: 5px;
border-bottom: #eee solid 1px;
height:60px;
background-image: url("/logo/logo-lang.svg");
height: 60px;
background-image: url('/logo/logo-lang.svg');
background-size: auto 50px;
background-repeat: no-repeat;
background-position: 5px center;
}
.ant-layout-footer{
padding:10px;
.ant-layout-footer {
padding: 10px;
text-align: center;
border-top:#d6d4d4 solid 1px;
border-top: #d6d4d4 solid 1px;
}
.ant-menu-inline, .ant-menu-vertical, .ant-menu-vertical-left{
border:0;
.ant-menu-inline,
.ant-menu-vertical,
.ant-menu-vertical-left {
border: 0;
}
}
</style>

32
packages/gui/src/view/components/container.vue

@ -7,21 +7,27 @@ export default {
<template>
<div class="ds-container">
<div class="body-wrapper">
<div v-if="$slots.header" class="container-header"><slot name="header" /></div>
<div class="container-body"><slot /></div>
<div class="container-footer"><slot name="footer" /></div>
<div v-if="$slots.header" class="container-header">
<slot name="header" />
</div>
<div class="container-body">
<slot />
</div>
<div class="container-footer">
<slot name="footer" />
</div>
</div>
</div>
</template>
<style lang="scss">
.ds-container{
height:100%;
.ds-container {
height: 100%;
background: #fff;
display: flex;
position: relative;
.body-wrapper{
.body-wrapper {
position: absolute;
top: 0px;
right: 0px;
@ -32,21 +38,21 @@ export default {
overflow: hidden;
}
.container-header{
padding:15px;
border-bottom: 1px solid #EEE;
background: #FFF;
height:60px;
.container-header {
padding: 15px;
border-bottom: 1px solid #eee;
background: #fff;
height: 60px;
display: flex;
align-items: center;
justify-content: space-between;
}
.container-body{
.container-body {
flex: 1;
height: 0;
overflow: auto;
position: relative;
padding:15px;
padding: 15px;
}
}
</style>

2
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;
}

8
packages/gui/src/view/pages/plugin/git.vue

@ -115,8 +115,12 @@ export default {
</div>
<template slot="footer">
<div class="footer-bar">
<a-button :loading="resetDefaultLoading" class="md-mr-10" icon="sync" @click="resetDefault()">恢复默认</a-button>
<a-button :loading="applyLoading" icon="check" type="primary" @click="apply()">应用</a-button>
<a-button :loading="resetDefaultLoading" class="md-mr-10" icon="sync" @click="resetDefault()">
恢复默认
</a-button>
<a-button :loading="applyLoading" icon="check" type="primary" @click="apply()">
应用
</a-button>
</div>
</template>
</ds-container>

8
packages/gui/src/view/pages/plugin/node.vue

@ -136,8 +136,12 @@ export default {
</div>
<template slot="footer">
<div class="footer-bar">
<a-button :loading="resetDefaultLoading" class="md-mr-10" icon="sync" @click="resetDefault()">恢复默认</a-button>
<a-button :loading="applyLoading" icon="check" type="primary" @click="apply()">应用</a-button>
<a-button :loading="resetDefaultLoading" class="md-mr-10" icon="sync" @click="resetDefault()">
恢复默认
</a-button>
<a-button :loading="applyLoading" icon="check" type="primary" @click="apply()">
应用
</a-button>
</div>
</template>
</ds-container>

8
packages/gui/src/view/pages/plugin/overwall.vue

@ -213,8 +213,12 @@ export default {
</div>
<template slot="footer">
<div class="footer-bar">
<a-button :loading="resetDefaultLoading" class="md-mr-10" icon="sync" @click="resetDefault()">恢复默认</a-button>
<a-button :loading="applyLoading" icon="check" type="primary" @click="apply()">应用</a-button>
<a-button :loading="resetDefaultLoading" class="md-mr-10" icon="sync" @click="resetDefault()">
恢复默认
</a-button>
<a-button :loading="applyLoading" icon="check" type="primary" @click="apply()">
应用
</a-button>
</div>
</template>
</ds-container>

8
packages/gui/src/view/pages/plugin/pip.vue

@ -120,8 +120,12 @@ export default {
</div>
<template slot="footer">
<div class="footer-bar">
<a-button :loading="resetDefaultLoading" class="md-mr-10" icon="sync" @click="resetDefault()">恢复默认</a-button>
<a-button :loading="applyLoading" icon="check" type="primary" @click="apply()">应用</a-button>
<a-button :loading="resetDefaultLoading" class="md-mr-10" icon="sync" @click="resetDefault()">
恢复默认
</a-button>
<a-button :loading="applyLoading" icon="check" type="primary" @click="apply()">
应用
</a-button>
</div>
</template>
</ds-container>

16
packages/gui/src/view/pages/proxy.vue

@ -113,7 +113,9 @@ export default {
</div>
</a-form-item>
<a-form-item v-if="isWindows()" label="设置loopback" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-button @click="loopbackVisible = true">去设置</a-button>
<a-button @click="loopbackVisible = true">
去设置
</a-button>
<div class="form-help">
解决<code>OneNote</code><code>MicrosoftStore</code><code>Outlook</code><code>UWP应用</code>开启代理后无法访问网络的问题
</div>
@ -162,8 +164,12 @@ export default {
</div>
<template slot="footer">
<div class="footer-bar">
<a-button :loading="resetDefaultLoading" class="md-mr-10" icon="sync" @click="resetDefault()">恢复默认</a-button>
<a-button :loading="applyLoading" icon="check" type="primary" @click="apply()">应用</a-button>
<a-button :loading="resetDefaultLoading" class="md-mr-10" icon="sync" @click="resetDefault()">
恢复默认
</a-button>
<a-button :loading="applyLoading" icon="check" type="primary" @click="apply()">
应用
</a-button>
</div>
</template>
@ -179,7 +185,9 @@ export default {
>
<template slot="title">
设置Loopback
<a-button style="float:right;margin-right:10px;" @click="openEnableLoopback()">打开EnableLoopback</a-button>
<a-button style="float:right;margin-right:10px;" @click="openEnableLoopback()">
打开EnableLoopback
</a-button>
</template>
<div>
<div>1此设置用于解决OneNoteMicrosoftStoreOutlook等UWP应用无法访问网络的问题</div>

18
packages/gui/src/view/pages/server.vue

@ -407,8 +407,12 @@ export default {
<a-divider />
<a-row :gutter="10" class="mt10">
<a-col span="24">
<a-button type="primary" icon="plus" @click="reSpeedTest()">立即重新测速</a-button>
<a-button class="md-ml-10" type="primary" icon="reload" @click="reloadAllSpeedTester()">刷新</a-button>
<a-button type="primary" icon="plus" @click="reSpeedTest()">
立即重新测速
</a-button>
<a-button class="md-ml-10" type="primary" icon="reload" @click="reloadAllSpeedTester()">
刷新
</a-button>
</a-col>
</a-row>
@ -434,8 +438,12 @@ export default {
</div>
<template slot="footer">
<div class="footer-bar">
<a-button :loading="resetDefaultLoading" class="md-mr-10" icon="sync" @click="resetDefault()">恢复默认</a-button>
<a-button :loading="applyLoading" icon="check" type="primary" @click="apply()">应用</a-button>
<a-button :loading="resetDefaultLoading" class="md-mr-10" icon="sync" @click="resetDefault()">
恢复默认
</a-button>
<a-button :loading="applyLoading" icon="check" type="primary" @click="apply()">
应用
</a-button>
</div>
</template>
</ds-container>
@ -454,7 +462,7 @@ export default {
}
.jsoneditor-vue {
height: 100%
height: 100%;
}
.ant-tabs {

24
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. 找到备份文件路径
<span>~/.dev-sidecar/config.json..bak.json</span>
<br />
2. 将该备份文件重命名为<span>config.json</span>再重启软件即可恢复个性化配置
2. 将该备份文件重命名为
<span>config.json</span>
再重启软件即可恢复个性化配置
</div>
</p>
</div>
@ -316,7 +326,9 @@ export default {
<a-checkbox v-model="config.app.autoStart.enabled" @change="onAutoStartChange">
本应用开机自启
</a-checkbox>
<a-button class="md-mr-10" icon="profile" @click="openLog()">日志</a-button>
<a-button class="md-mr-10" icon="profile" @click="openLog()">
日志
</a-button>
<div class="form-help">
windows下建议开启开机自启<a @click="openExternal('https://github.com/docmirror/dev-sidecar/blob/master/doc/recover.md')">更多说明参考</a>
</div>

95
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{
.flex-l-r {
align-content: center;
display: flex;
justify-content: flex-end;
align-items: center;
&>a{
& > 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;
}

96
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;
}
/* 搜索结果 */

5
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: {

3
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
}

2
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')

2
packages/mitmproxy/src/lib/dns/ipaddress.js

@ -14,7 +14,7 @@ module.exports = class DNSOverIpAddress extends BaseDNS {
}
const ret = res.data
const regexp = /<tr><th>IP Address<\/th><td><ul class="comma-separated"><li>([^<]*)<\/li><\/ul><\/td><\/tr>/gm
const regexp = /<tr><th>IP Address<\/th><td><ul class="comma-separated"><li>([^<]*)<\/li><\/ul><\/td><\/tr>/g
const matched = regexp.exec(ret)
let ip = null

2
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')
// 替换占位符

4
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

2
packages/mitmproxy/src/lib/proxy/common/config.js

@ -1,4 +1,4 @@
const path = require('path')
const path = require('node:path')
const config = exports

2
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')

4
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')

2
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')

22
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')) {
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

4
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) {

4
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')

2
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')

4
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')

4
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')

2
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')

2
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')

11
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

4
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')

2
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')

8
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)
// }

2
packages/mitmproxy/test/proxyTest.js

@ -1,4 +1,4 @@
const http = require('http')
const http = require('node:http')
const options = {
headers: {

Loading…
Cancel
Save