parent
d39379f4b6
commit
a7dd755b91
@ -0,0 +1,13 @@
|
|||||||
|
let JSON5 = require('json5')
|
||||||
|
if (JSON5.default) {
|
||||||
|
JSON5 = JSON5.default
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
parse (str) {
|
||||||
|
return JSON5.parse(str)
|
||||||
|
},
|
||||||
|
stringify (obj) {
|
||||||
|
return JSON.stringify(obj, null, '\t')
|
||||||
|
}
|
||||||
|
}
|
@ -1,14 +1,17 @@
|
|||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
const log = require('../utils/util.log')
|
||||||
const server = require('@docmirror/mitmproxy')
|
const server = require('@docmirror/mitmproxy')
|
||||||
const JSON5 = require('json5').default
|
const jsonApi = require('@docmirror/dev-sidecar/src/json.js')
|
||||||
const configPath = process.argv[2]
|
const configPath = process.argv[2]
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const configJson = fs.readFileSync(configPath)
|
const configJson = fs.readFileSync(configPath)
|
||||||
const config = JSON5.parse(configJson)
|
log.info('读取 running.json by gui bridge 成功:', configPath)
|
||||||
|
const config = jsonApi.parse(configJson.toString())
|
||||||
// const scriptDir = '../extra/scripts/'
|
// const scriptDir = '../extra/scripts/'
|
||||||
// config.setting.script.defaultDir = path.join(__dirname, scriptDir)
|
// config.setting.script.defaultDir = path.join(__dirname, scriptDir)
|
||||||
// const pacFilePath = '../extra/pac/pac.txt'
|
// const pacFilePath = '../extra/pac/pac.txt'
|
||||||
// config.plugin.overwall.pac.customPacFilePath = path.join(__dirname, pacFilePath)
|
// config.plugin.overwall.pac.customPacFilePath = path.join(__dirname, pacFilePath)
|
||||||
config.setting.rootDir = path.join(__dirname, '../')
|
config.setting.rootDir = path.join(__dirname, '../')
|
||||||
|
log.info(`start mitmproxy config by gui bridge: ${configPath}`)
|
||||||
server.start(config)
|
server.start(config)
|
||||||
|
Loading…
Reference in new issue