parent
3888285171
commit
b408fcd0d0
@ -0,0 +1 @@
|
|||||||
|
./src/test
|
@ -1,20 +1,20 @@
|
|||||||
const config = require('../src/config')
|
// const config = require('../src/config')
|
||||||
|
//
|
||||||
config.set({
|
// config.set({
|
||||||
server: {
|
// server: {
|
||||||
intercepts: {
|
// intercepts: {
|
||||||
'github1.githubassets.com': {
|
// 'github1.githubassets.com': {
|
||||||
'.*': {
|
// '.*': {
|
||||||
redirect: 'assets.fastgit.org',
|
// redirect: 'assets.fastgit.org',
|
||||||
test: 'https://github.githubassets.com/favicons/favicon.svg',
|
// test: 'https://github.githubassets.com/favicons/favicon.svg',
|
||||||
desc: '静态资源加速'
|
// desc: '静态资源加速'
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
'github.githubassets.com': null
|
// 'github.githubassets.com': null
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
|
//
|
||||||
console.log(config.get())
|
// console.log(config.get())
|
||||||
|
//
|
||||||
config.reload()
|
// config.reload()
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
const childProcess = require('child_process')
|
// const childProcess = require('child_process')
|
||||||
const util = require('util')
|
// const util = require('util')
|
||||||
const exec = util.promisify(childProcess.exec)
|
// const exec = util.promisify(childProcess.exec)
|
||||||
|
//
|
||||||
async function test () {
|
// async function test () {
|
||||||
const wifiAdaptor = (await exec('sh -c "networksetup -listnetworkserviceorder | grep `route -n get 0.0.0.0 | grep \'interface\' | cut -d \':\' -f2` -B 1 | head -n 1 | cut -d \' \' -f2"')).stdout.trim()
|
// const wifiAdaptor = (await exec('sh -c "networksetup -listnetworkserviceorder | grep `route -n get 0.0.0.0 | grep \'interface\' | cut -d \':\' -f2` -B 1 | head -n 1 | cut -d \' \' -f2"')).stdout.trim()
|
||||||
|
//
|
||||||
await exec(`networksetup -setwebproxystate '${wifiAdaptor}' off`)
|
// await exec(`networksetup -setwebproxystate '${wifiAdaptor}' off`)
|
||||||
return await exec(`networksetup -setsecurewebproxystate '${wifiAdaptor}' off`)
|
// return await exec(`networksetup -setsecurewebproxystate '${wifiAdaptor}' off`)
|
||||||
}
|
// }
|
||||||
test().then((ret) => {
|
// test().then((ret) => {
|
||||||
console.log('haha', ret)
|
// console.log('haha', ret)
|
||||||
})
|
// })
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
var expect = require('chai').expect
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
describe('test', function () {
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
it('regexp', function () {
|
||||||
|
const test = '^/[^/]+/[^/]+(/releases)?$'
|
||||||
|
const reg = new RegExp(test)
|
||||||
|
|
||||||
|
const ret = reg.test('/docmirror/dev-sidecar/releases')
|
||||||
|
// eslint-disable-next-line no-unused-expressions
|
||||||
|
expect(ret).be.ok
|
||||||
|
})
|
||||||
|
})
|
Loading…
Reference in new issue