mirror of
https://github.com/wuchangming/spy-debugger.git
synced 2026-01-18 14:29:45 +00:00
添加证书安装路径
This commit is contained in:
parent
5537b28ffc
commit
3cb4c19cb2
@ -44,6 +44,8 @@ Mac 下
|
||||
|
||||
第三步:设置手机的HTTP代理,代理IP地址设置为PC的IP地址,端口为`spy-debugger`的启动端口(默认端口:9888)。
|
||||
|
||||
第四步:手机浏览器访问:http://spydebugger.com/cert 安装证书。
|
||||
|
||||
第四步:用手机浏览器访问你要调试的页面即可。
|
||||
|
||||
## 自定义选项
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
var SPY_WEINRE_DOMAIN = 'spyweinrefortest.com';
|
||||
var SPY_DEBUGGER_DOMAIN = 'spydebugger.com';
|
||||
|
||||
var config = exports;
|
||||
config.SPY_WEINRE_DOMAIN = SPY_WEINRE_DOMAIN;
|
||||
config.SPY_WEINRE_DOMAIN = SPY_WEINRE_DOMAIN;
|
||||
config.SPY_DEBUGGER_DOMAIN = SPY_DEBUGGER_DOMAIN;
|
||||
@ -7,6 +7,8 @@ var zlib = require('zlib');
|
||||
var through = require('through2');
|
||||
var config = require('../config/config');
|
||||
var htmlUtil = require('../util/htmlUtil');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
|
||||
module.exports = {
|
||||
createProxy: function createProxy(_ref) {
|
||||
@ -31,6 +33,21 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
requestInterceptor: function requestInterceptor(rOptions, req, res, ssl, next) {
|
||||
|
||||
if (rOptions.hostname === config.SPY_DEBUGGER_DOMAIN && rOptions.path === '/cert') {
|
||||
var userHome = process.env.HOME || process.env.USERPROFILE;
|
||||
var certPath = path.resolve(userHome, './node-mitmproxy/node-mitmproxy.ca.crt');
|
||||
try {
|
||||
var fileString = fs.readFileSync(certPath);
|
||||
res.setHeader('Content-Type', 'application/x-x509-ca-cert');
|
||||
res.end(fileString.toString());
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
res.end('please create certificate first!!');
|
||||
}
|
||||
next();
|
||||
return;
|
||||
}
|
||||
if (rOptions.hostname === config.SPY_WEINRE_DOMAIN) {
|
||||
rOptions.protocol = 'http:';
|
||||
rOptions.hostname = '127.0.0.1';
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "spy-debugger",
|
||||
"version": "2.0.4",
|
||||
"version": "2.0.5",
|
||||
"description": "web page one-stop remote network debugger",
|
||||
"main": "lib/index.js",
|
||||
"scripts": {
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
const SPY_WEINRE_DOMAIN = 'spyweinrefortest.com';
|
||||
const SPY_DEBUGGER_DOMAIN = 'spydebugger.com';
|
||||
|
||||
var config = exports;
|
||||
config.SPY_WEINRE_DOMAIN = SPY_WEINRE_DOMAIN;
|
||||
config.SPY_DEBUGGER_DOMAIN = SPY_DEBUGGER_DOMAIN;
|
||||
|
||||
@ -5,6 +5,8 @@ const zlib = require('zlib');
|
||||
const through = require('through2');
|
||||
const config = require('../config/config');
|
||||
const htmlUtil = require('../util/htmlUtil');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
module.exports = {
|
||||
|
||||
@ -29,6 +31,21 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
requestInterceptor: (rOptions, req, res, ssl, next) => {
|
||||
|
||||
if (rOptions.hostname === config.SPY_DEBUGGER_DOMAIN && rOptions.path === '/cert'){
|
||||
var userHome = process.env.HOME || process.env.USERPROFILE;
|
||||
var certPath = path.resolve(userHome, './node-mitmproxy/node-mitmproxy.ca.crt');
|
||||
try {
|
||||
var fileString = fs.readFileSync(certPath);
|
||||
res.setHeader('Content-Type', 'application/x-x509-ca-cert');
|
||||
res.end(fileString.toString());
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
res.end('please create certificate first!!');
|
||||
}
|
||||
next();
|
||||
return;
|
||||
}
|
||||
if (rOptions.hostname === config.SPY_WEINRE_DOMAIN) {
|
||||
rOptions.protocol = 'http:'
|
||||
rOptions.hostname = '127.0.0.1'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user