From c86cf123ef2bcc70d435e6f83932577d35cfb693 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com> Date: Tue, 18 Feb 2025 15:01:06 +0800 Subject: [PATCH 1/5] =?UTF-8?q?github-actions:=20num-run-electron.yml=20?= =?UTF-8?q?=E4=B8=8D=E5=9C=A8tag=E5=88=9B=E5=BB=BA=E6=97=B6=E8=A7=A6?= =?UTF-8?q?=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/npm-run-electron.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/npm-run-electron.yml b/.github/workflows/npm-run-electron.yml index 8d71d6a..ae4c0d1 100644 --- a/.github/workflows/npm-run-electron.yml +++ b/.github/workflows/npm-run-electron.yml @@ -8,8 +8,6 @@ on: - release* - v1* - v2* - tags: - - '*' jobs: npm-run-electron: From f575e6bda97abba2048b9fe34be160470a77edaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com> Date: Tue, 18 Feb 2025 15:17:56 +0800 Subject: [PATCH 2/5] =?UTF-8?q?bugfix:=20=E5=BD=93=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=90=AF=E5=8A=A8=EF=BC=8C=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E4=BB=A3=E7=90=86=E5=85=B3=E9=97=AD=E6=97=B6=EF=BC=8C=E5=8A=A0?= =?UTF-8?q?=E9=80=9F=E6=9C=8D=E5=8A=A1=E9=A1=B5=E9=9D=A2=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=20`=E5=BD=93=E5=89=8D=E6=9C=AA=E5=90=AF=E5=8A=A8`=20=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/gui/src/view/pages/server.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/gui/src/view/pages/server.vue b/packages/gui/src/view/pages/server.vue index bcfb04d..25e1a43 100644 --- a/packages/gui/src/view/pages/server.vue +++ b/packages/gui/src/view/pages/server.vue @@ -192,7 +192,7 @@ export default { 随应用启动 - + 当前已启动 From a6d2685e38a1da34fac503539941c2402588c6cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com> Date: Wed, 26 Feb 2025 11:19:26 +0800 Subject: [PATCH 3/5] =?UTF-8?q?feature:=20=E5=9F=9F=E5=90=8D=E7=99=BD?= =?UTF-8?q?=E5=90=8D=E5=8D=95=EF=BC=8C=E6=94=AF=E6=8C=81=E5=8F=8D=E5=90=91?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=EF=BC=8C=E7=94=A8=E4=BA=8E=E5=A4=A7=E8=8C=83?= =?UTF-8?q?=E5=9B=B4=E8=AE=BE=E7=BD=AE=E4=B8=8D=E4=BB=A3=E7=90=86=EF=BC=8C?= =?UTF-8?q?=E4=B8=AA=E5=88=AB=E5=9F=9F=E5=90=8D=E8=AE=BE=E7=BD=AE=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E4=BB=A3=E7=90=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/gui/src/view/App.vue | 5 - packages/gui/src/view/api.js | 3 + .../gui/src/view/components/container.vue | 15 +- packages/gui/src/view/mixins/plugin.js | 12 ++ packages/gui/src/view/pages/help.vue | 8 +- packages/gui/src/view/pages/index.vue | 28 +-- packages/gui/src/view/pages/plugin/git.vue | 17 +- packages/gui/src/view/pages/plugin/node.vue | 14 +- .../gui/src/view/pages/plugin/overwall.vue | 34 ++-- packages/gui/src/view/pages/plugin/pip.vue | 2 + packages/gui/src/view/pages/proxy.vue | 5 +- packages/gui/src/view/pages/server.vue | 159 +++++++++++------- packages/gui/src/view/pages/setting.vue | 6 +- packages/gui/src/view/style/theme/dark.scss | 42 ++--- .../impl/res/AfterOPTIONSHeaders.js | 3 +- packages/mitmproxy/src/options.js | 2 +- 16 files changed, 209 insertions(+), 146 deletions(-) diff --git a/packages/gui/src/view/App.vue b/packages/gui/src/view/App.vue index 4ce294d..8b1bb95 100644 --- a/packages/gui/src/view/App.vue +++ b/packages/gui/src/view/App.vue @@ -5,8 +5,6 @@ import { colorTheme } from './composables/theme' export default { name: 'App', - components: { - }, data () { return { locale: zhCN, @@ -39,9 +37,6 @@ export default { }) }, methods: { - handleClick (e) { - console.log('click', e) - }, titleClick (item) { console.log('title click:', item) }, diff --git a/packages/gui/src/view/api.js b/packages/gui/src/view/api.js index 868c942..9ff814a 100644 --- a/packages/gui/src/view/api.js +++ b/packages/gui/src/view/api.js @@ -27,6 +27,9 @@ export function apiInit (app) { ipcRenderer.removeAllListeners(channel) }, invoke, + postMessage (channel, ...args) { + ipcRenderer.postMessage(channel, ...args) + }, send, async openExternal (href) { await shell.openExternal(href) diff --git a/packages/gui/src/view/components/container.vue b/packages/gui/src/view/components/container.vue index 8df89dd..e4ef141 100644 --- a/packages/gui/src/view/components/container.vue +++ b/packages/gui/src/view/components/container.vue @@ -8,7 +8,8 @@ export default {
- + +
@@ -23,16 +24,16 @@ export default { diff --git a/packages/gui/src/view/pages/setting.vue b/packages/gui/src/view/pages/setting.vue index 8e05ba6..2f0386d 100644 --- a/packages/gui/src/view/pages/setting.vue +++ b/packages/gui/src/view/pages/setting.vue @@ -338,9 +338,9 @@ export default { +
diff --git a/packages/gui/src/view/style/theme/dark.scss b/packages/gui/src/view/style/theme/dark.scss index c914dca..e11740f 100644 --- a/packages/gui/src/view/style/theme/dark.scss +++ b/packages/gui/src/view/style/theme/dark.scss @@ -17,7 +17,7 @@ $dark-input: #777; //输入框:背景色 .ds-container, .ds-container .container-header, .ant-layout-footer { - background: $dark-bg; + background-color: $dark-bg; color: $dark-text; } div, @@ -36,7 +36,7 @@ $dark-input: #777; //输入框:背景色 /* 高亮块:背景色和字体颜色 */ /* 警告类型 */ .ant-alert-warning { - background: $dark-bg-highlight; + background-color: $dark-bg-highlight; border-color: $dark-bg-highlight; color: $dark-text; /* 关闭图标颜色 */ @@ -46,7 +46,7 @@ $dark-input: #777; //输入框:背景色 } /* 消息类型 */ .ant-alert-info { - background: $dark-bg-highlight; + background-color: $dark-bg-highlight; border-color: $dark-bg-highlight; color: $dark-text; } @@ -66,7 +66,7 @@ $dark-input: #777; //输入框:背景色 background-color: #666; } .ant-divider { - background: $dark-bd; + background-color: $dark-bd; } .help-list .title1 { @@ -76,7 +76,7 @@ $dark-input: #777; //输入框:背景色 /* 左侧 */ /** 背景色 **/ .ant-layout-sider { - background: $dark-bg; + background-color: $dark-bg; } /** Logo **/ .logo { @@ -84,14 +84,14 @@ $dark-input: #777; //输入框:背景色 } /** 菜单 **/ .ant-menu { - background: $dark-bg; + background-color: $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 { - background: $dark-bg-highlight; + background-color: $dark-bg-highlight; color: #1890ff; span { color: #1890ff; @@ -104,7 +104,7 @@ $dark-input: #777; //输入框:背景色 .ant-input-number, .ant-select-selection, .ant-input-group-addon { - background: $dark-input; + background-color: $dark-input; border-color: #aaa; color: $dark-text; &:hover, @@ -115,7 +115,7 @@ $dark-input: #777; //输入框:背景色 /* 卡片消息:IP测速 */ .ant-card { - background: $dark-input; + background-color: $dark-input; border-color: $dark-input; .ant-card-head { border-bottom-color: #929292; @@ -124,26 +124,26 @@ $dark-input: #777; //输入框:背景色 /* 标签:未启用 */ .ant-tag-red { - background: #4f4749; + background-color: #4f4749; border-color: #4f4749; color: #bf8285; } /* 标签:已启用 */ .ant-tag-green { - background: #505f5f; + background-color: #505f5f; border-color: #505f5f; color: #90cb9f; } /* 标签:警告 */ .ant-tag-orange { - background: #5a5750; + background-color: #5a5750; border-color: #5a5750; color: #cfa572; } /* 按钮 */ .ant-btn:not(.ant-btn-danger, .ant-btn-primary) { - background: $dark-btn; + background-color: $dark-btn; border-color: $dark-btn; color: $dark-text; &:hover { @@ -153,7 +153,7 @@ $dark-input: #777; //输入框:背景色 /* 单选框:开关式 */ .ant-switch:not(.ant-switch-checked) { - background: $dark-btn; + background-color: $dark-btn; border-color: $dark-btn; &:hover { opacity: 0.8; @@ -161,7 +161,7 @@ $dark-input: #777; //输入框:背景色 } /* 单选框:按钮式 */ .ant-radio-button-wrapper { - background: $dark-btn; + background-color: $dark-btn; border-color: $dark-btn; color: $dark-text; &:hover { @@ -173,24 +173,24 @@ $dark-input: #777; //输入框:背景色 .jsoneditor-vue { /*整个编辑框:背景色和边框*/ div.jsoneditor { - background: $dark-bg-highlight; + background-color: $dark-bg-highlight; border: none; } /* 头部菜单栏:边框 */ div.jsoneditor-menu { - background: $dark-bg-highlight; + background-color: $dark-bg-highlight; border-color: $dark-bg-highlight; } /* 内容区域左边:行号 */ .ace_gutter { - background: #444; + background-color: #444; .ace_gutter-cell { color: #aaa; } } /* 内容区域右边:JSON内容 */ .ace_scroller { - background: #555; + background-color: #555; } /* key的颜色 */ .ace_variable, @@ -215,12 +215,12 @@ $dark-input: #777; //输入框:背景色 /* 当前行高亮样式 */ .ace_gutter-active-line, .ace_marker-layer .ace_active-line { - background: #838774; + background-color: #838774; } /* 选中行高亮样式 */ .ace-jsoneditor { .ace_marker-layer .ace_selection { - background: #8b2929; /* 同时应用于当前选中的搜索结果项的背景色,建议与搜索结果边框颜色保持一致 */ + background-color: #8b2929; /* 同时应用于当前选中的搜索结果项的背景色,建议与搜索结果边框颜色保持一致 */ } /* 光标颜色 */ diff --git a/packages/mitmproxy/src/lib/interceptor/impl/res/AfterOPTIONSHeaders.js b/packages/mitmproxy/src/lib/interceptor/impl/res/AfterOPTIONSHeaders.js index de72111..2008818 100644 --- a/packages/mitmproxy/src/lib/interceptor/impl/res/AfterOPTIONSHeaders.js +++ b/packages/mitmproxy/src/lib/interceptor/impl/res/AfterOPTIONSHeaders.js @@ -17,11 +17,10 @@ module.exports = { 'Cross-Origin-Resource-Policy': interceptOpt.optionsCrossPolicy || 'cross-origin', } - res.setHeader('DS-AfterOPTIONSHeaders-Interceptor', '1') - // 替换响应头 if (responseReplaceApi.replaceResponseHeaders({ ...headers }, res, proxyRes)) { log.info('AfterOPTIONSHeaders intercept:', JSON.stringify(headers)) + res.setHeader('DS-AfterOPTIONSHeaders-Interceptor', '1') } else { res.setHeader('DS-AfterOPTIONSHeaders-Interceptor', '0') } diff --git a/packages/mitmproxy/src/options.js b/packages/mitmproxy/src/options.js index e3b3b89..6504dee 100644 --- a/packages/mitmproxy/src/options.js +++ b/packages/mitmproxy/src/options.js @@ -108,7 +108,7 @@ module.exports = (serverConfig) => { const hostname = req.url.split(':')[0] // 配置了白名单的域名,将跳过代理 - const inWhiteList = matchUtil.matchHostname(whiteList, hostname, 'in whiteList') != null + const inWhiteList = !!matchUtil.matchHostname(whiteList, hostname, 'in whiteList') if (inWhiteList) { log.info(`为白名单域名,不拦截: ${hostname}, headers:`, jsonApi.stringify2(req.headers)) return false // 不拦截 From 67c7e39000a2a5c726f698dbe3fc7d59807fdd28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com> Date: Wed, 26 Feb 2025 11:22:00 +0800 Subject: [PATCH 4/5] =?UTF-8?q?feature:=20=E6=96=B0=E5=A2=9E=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E6=90=9C=E7=B4=A2=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=BF=AB?= =?UTF-8?q?=E6=8D=B7=E9=94=AE=EF=BC=9A`Ctrl=20+=20F`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/gui/package.json | 1 + packages/gui/src/background.js | 36 ++++--- packages/gui/src/main.js | 2 + packages/gui/src/view/App.vue | 103 +++++++++++++++++++- packages/gui/src/view/pages/setting.vue | 10 +- packages/gui/src/view/style/theme/dark.scss | 9 ++ pnpm-lock.yaml | 12 +++ 7 files changed, 156 insertions(+), 17 deletions(-) diff --git a/packages/gui/package.json b/packages/gui/package.json index e5fe7cd..24af998 100644 --- a/packages/gui/package.json +++ b/packages/gui/package.json @@ -34,6 +34,7 @@ "request-progress": "^3.0.0", "sass": "^1.81.0", "sass-loader": "^16.0.3", + "search-bar-vue2": "^1.0.0", "vue": "^2.7.16", "vue-json-editor-fix-cn": "^1.4.3", "vue-router": "^3.6.5" diff --git a/packages/gui/src/background.js b/packages/gui/src/background.js index 0b2763c..5be8601 100644 --- a/packages/gui/src/background.js +++ b/packages/gui/src/background.js @@ -298,28 +298,38 @@ function createWindow (startHideWindow, autoQuitIfError = true) { }) const shortcut = (event, input) => { - // 按 F12,打开/关闭 开发者工具 - if (input.key === 'F12') { - // 阻止默认的按键事件行为 + if (input.key === 'F12' && input.type === 'keyUp' && !input.control && !input.shift && !input.alt && !input.meta) { + // 按 F12,打开/关闭 开发者工具 event.preventDefault() - // 切换开发者工具显示状态 switchDevTools() - // eslint-disable-next-line style/brace-style - } - // 按 F5,刷新页面 - else if (input.key === 'F5') { - // 阻止默认的按键事件行为 + } else if (input.key === 'F5' && input.type === 'keyUp' && !input.control && !input.shift && !input.alt && !input.meta) { + // 按 F5,刷新页面 event.preventDefault() - // 刷新页面 win.webContents.reload() + } else { + // 全文检索框(SearchBar)相关快捷键 + if ((input.key === 'F' || input.key === 'f') && input.type === 'keyDown' && input.control && !input.shift && !input.alt && !input.meta) { + // 按 Ctrl + F,显示或隐藏全文检索框(SearchBar) + event.preventDefault() + win.webContents.send('search-bar', { key: 'show-hide' }) + } else if (input.key === 'Escape' && input.type === 'keyUp' && !input.control && !input.shift && !input.alt && !input.meta) { + // 按 ESC,隐藏全文检索框(SearchBar) + event.preventDefault() + win.webContents.send('search-bar', { key: 'hide' }) + } else if (input.key === 'F3' && input.type === 'keyDown' && !input.control && !input.shift && !input.alt && !input.meta) { + // 按 F3,全文检索框(SearchBar)定位到下一个 + event.preventDefault() + win.webContents.send('search-bar', { key: 'next' }) + } else if (input.key === 'F3' && input.type === 'keyDown' && !input.control && input.shift && !input.alt && !input.meta) { + // 按 Shift + F3,全文检索框(SearchBar)定位到上一个 + event.preventDefault() + win.webContents.send('search-bar', { key: 'previous' }) + } } } // 监听键盘事件 win.webContents.on('before-input-event', (event, input) => { - if (input.type !== 'keyUp' || input.control || input.alt || input.shift || input.meta) { - return - } win.webContents.executeJavaScript('config') .then((value) => { console.info('window.config:', value, ', key:', input.key) diff --git a/packages/gui/src/main.js b/packages/gui/src/main.js index 198abb9..e89daaa 100644 --- a/packages/gui/src/main.js +++ b/packages/gui/src/main.js @@ -1,6 +1,7 @@ import antd from 'ant-design-vue' import Vue from 'vue' import VueRouter from 'vue-router' +import SearchBar from 'search-bar-vue2' import { ipcRenderer } from 'electron' import view from './view' import App from './view/App.vue' @@ -25,6 +26,7 @@ try { Vue.config.productionTip = false Vue.use(antd) Vue.use(VueRouter) + Vue.use(SearchBar) Vue.component(DsContainer) // 3. 创建 router 实例,然后传 `routes` 配置 // 你还可以传别的配置参数, 不过先这么简单着吧。 diff --git a/packages/gui/src/view/App.vue b/packages/gui/src/view/App.vue index 8b1bb95..a47d7b9 100644 --- a/packages/gui/src/view/App.vue +++ b/packages/gui/src/view/App.vue @@ -1,4 +1,5 @@ + + + + diff --git a/packages/gui/src/view/pages/plugin/git.vue b/packages/gui/src/view/pages/plugin/git.vue index d0605a5..fcaad6a 100644 --- a/packages/gui/src/view/pages/plugin/git.vue +++ b/packages/gui/src/view/pages/plugin/git.vue @@ -1,8 +1,10 @@