Skip to content

Commit

Permalink
Merge branch 'master' into avoiding-anomalies
Browse files Browse the repository at this point in the history
  • Loading branch information
wangliang181230 authored Dec 3, 2024
2 parents 219ce3b + 2bcf865 commit 343b984
Show file tree
Hide file tree
Showing 13 changed files with 96 additions and 511 deletions.
2 changes: 1 addition & 1 deletion packages/gui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"dependencies": {
"@docmirror/dev-sidecar": "workspace:*",
"@docmirror/mitmproxy": "workspace:*",
"@natmri/platform-napi": "^0.0.7",
"@starknt/shutdown-handler-napi": "^0.0.2",
"@starknt/sysproxy": "^0.0.1",
"@vscode/sudo-prompt": "^9.3.1",
"adm-zip": "^0.5.16",
Expand Down
6 changes: 3 additions & 3 deletions packages/gui/src/background/powerMonitor.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { acquireShutdownBlock, insertWndProcHook, releaseShutdownBlock, removeWndProcHook, setMainWindowHandle } from '@natmri/platform-napi'
import { acquireShutdownBlock, insertWndProcHook, releaseShutdownBlock, removeWndProcHook, setMainWindowHandle } from '@starknt/shutdown-handler-napi'
import { powerMonitor as _powerMonitor } from 'electron'

class PowerMonitor {
Expand All @@ -9,11 +9,11 @@ class PowerMonitor {
}

/**
* @param {BrowserWindow} window
* @param {import('electron').BrowserWindow} window
*/
setupMainWindow (window) {
if (!this.setup) {
setMainWindowHandle(window.getNativeWindowHandle().readBigInt64LE())
setMainWindowHandle(window.getNativeWindowHandle())
this.setup = true
}
}
Expand Down
19 changes: 8 additions & 11 deletions packages/gui/vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,14 @@ module.exports = defineConfig({
'@starknt/sysproxy-linux-arm64-gnu',
'@starknt/sysproxy-darwin-x64',
'@starknt/sysproxy-darwin-arm64',
'@natmri/platform-napi',
'@natmri/platform-napi-win32-ia32-msvc',
'@natmri/platform-napi-win32-x64-msvc',
'@natmri/platform-napi-win32-arm64-msvc',
'@natmri/platform-napi-linux-x64-gnu',
'@natmri/platform-napi-linux-x64-musl',
'@natmri/platform-napi-linux-arm64-gnu',
'@natmri/platform-napi-linux-arm64-musl',
'@natmri/platform-napi-linux-arm-gnueabihf',
'@natmri/platform-napi-darwin-x64',
'@natmri/platform-napi-darwin-arm64',
'@starknt/shutdown-handler-napi',
'@starknt/shutdown-handler-napi-win32-ia32-msvc',
'@starknt/shutdown-handler-napi-win32-x64-msvc',
'@starknt/shutdown-handler-napi-win32-arm64-msvc',
'@starknt/shutdown-handler-napi-linux-x64-gnu',
'@starknt/shutdown-handler-napi-linux-arm64-gnu',
'@starknt/shutdown-handler-napi-darwin-x64',
'@starknt/shutdown-handler-napi-darwin-arm64',
],
nodeIntegration: true,
// Provide an array of files that, when changed, will recompile the main process and restart Electron
Expand Down
2 changes: 1 addition & 1 deletion packages/mitmproxy/src/lib/interceptor/impl/req/OPTIONS.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function readConfig (config, defaultConfig) {

module.exports = {
name: 'options',
priority: 1,
priority: 101,
requestIntercept (context, interceptOpt, req, res, ssl, next) {
const { rOptions, log } = context

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function getLastModifiedTimeFromIfModifiedSince (rOptions, log) {
}

module.exports = {
name: 'cacheReq',
name: 'cacheRequest',
priority: 104,
requestIntercept (context, interceptOpt, req, res, ssl, next) {
const { rOptions, log } = context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const proxyApi = require('./proxy')

module.exports = {
name: 'redirect',
priority: 102,
priority: 105,
requestIntercept (context, interceptOpt, req, res, ssl, next, matched) {
const { rOptions, log } = context

Expand Down
2 changes: 1 addition & 1 deletion packages/mitmproxy/src/lib/interceptor/impl/req/sni.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
name: 'sni',
priority: 122,
priority: 123,
requestIntercept (context, interceptOpt, req, res, ssl, next) {
const { rOptions, log } = context

Expand Down
2 changes: 1 addition & 1 deletion packages/mitmproxy/src/lib/interceptor/impl/req/success.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
name: 'success',
priority: 101,
priority: 102,
requestIntercept (context, interceptOpt, req, res, ssl, next) {
const { rOptions, log } = context

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
name: 'unVerifySsl',
priority: 123,
priority: 124,
requestIntercept (context, interceptOpt, req, res, ssl, next) {
const { rOptions, log } = context

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const cacheReq = require('../req/cacheReq')
const cacheReq = require('../req/cacheRequest')

module.exports = {
name: 'cacheRes',
name: 'cacheResponse',
priority: 202,
responseIntercept (context, interceptOpt, req, res, proxyReq, proxyRes, ssl, next) {
const { rOptions, log } = context
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const lodash = require('lodash')
const cacheReq = require('../req/cacheReq')
const cacheReq = require('../req/cacheRequest')

const REMOVE = '[remove]'

Expand Down
12 changes: 5 additions & 7 deletions packages/mitmproxy/src/lib/interceptor/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// request interceptor impls
const OPTIONS = require('./impl/req/OPTIONS.js')

const success = require('./impl/req/success')
const redirect = require('./impl/req/redirect')
const abort = require('./impl/req/abort')
const cacheReq = require('./impl/req/cacheReq')
const cacheRequest = require('./impl/req/cacheRequest')
const redirect = require('./impl/req/redirect')

const requestReplace = require('./impl/req/requestReplace')

Expand All @@ -16,20 +15,19 @@ const baiduOcr = require('./impl/req/baiduOcr')

// response interceptor impls
const AfterOPTIONSHeaders = require('./impl/res/AfterOPTIONSHeaders')
const cacheRes = require('./impl/res/cacheRes')
const cacheResponse = require('./impl/res/cacheResponse')
const responseReplace = require('./impl/res/responseReplace')

const script = require('./impl/res/script')

module.exports = [
// request interceptor impls
OPTIONS,
success, redirect, abort, cacheReq,
OPTIONS, success, abort, cacheRequest, redirect,
requestReplace,
proxy, sni, unVerifySsl,
baiduOcr,

// response interceptor impls
AfterOPTIONSHeaders, cacheRes, responseReplace,
AfterOPTIONSHeaders, cacheResponse, responseReplace,
script,
]
Loading

0 comments on commit 343b984

Please sign in to comment.