xiaojunnuo
4 years ago
7 changed files with 95 additions and 35 deletions
@ -1,20 +1,20 @@
|
||||
const config = require('../src/config') |
||||
|
||||
config.set({ |
||||
server: { |
||||
intercepts: { |
||||
'github1.githubassets.com': { |
||||
'.*': { |
||||
redirect: 'assets.fastgit.org', |
||||
test: 'https://github.githubassets.com/favicons/favicon.svg', |
||||
desc: '静态资源加速' |
||||
} |
||||
}, |
||||
'github.githubassets.com': null |
||||
} |
||||
} |
||||
}) |
||||
|
||||
console.log(config.get()) |
||||
|
||||
config.reload() |
||||
// const config = require('../src/config')
|
||||
//
|
||||
// config.set({
|
||||
// server: {
|
||||
// intercepts: {
|
||||
// 'github1.githubassets.com': {
|
||||
// '.*': {
|
||||
// redirect: 'assets.fastgit.org',
|
||||
// test: 'https://github.githubassets.com/favicons/favicon.svg',
|
||||
// desc: '静态资源加速'
|
||||
// }
|
||||
// },
|
||||
// 'github.githubassets.com': null
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
//
|
||||
// console.log(config.get())
|
||||
//
|
||||
// config.reload()
|
||||
|
@ -1,13 +1,13 @@
|
||||
const childProcess = require('child_process') |
||||
const util = require('util') |
||||
const exec = util.promisify(childProcess.exec) |
||||
|
||||
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() |
||||
|
||||
await exec(`networksetup -setwebproxystate '${wifiAdaptor}' off`) |
||||
return await exec(`networksetup -setsecurewebproxystate '${wifiAdaptor}' off`) |
||||
} |
||||
test().then((ret) => { |
||||
console.log('haha', ret) |
||||
}) |
||||
// const childProcess = require('child_process')
|
||||
// const util = require('util')
|
||||
// const exec = util.promisify(childProcess.exec)
|
||||
//
|
||||
// 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()
|
||||
//
|
||||
// await exec(`networksetup -setwebproxystate '${wifiAdaptor}' off`)
|
||||
// return await exec(`networksetup -setsecurewebproxystate '${wifiAdaptor}' off`)
|
||||
// }
|
||||
// test().then((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