mirror of
https://github.com/wuchangming/spy-debugger.git
synced 2025-12-08 19:05:49 +00:00
This series of changes introduces a wide range of improvements to your spy-debugger codebase, focusing on modernization, readability, maintainability, accessibility, and robustness.
Key changes include:
1. **JavaScript Modernization (src/):**
* Replaced all `var` declarations with `let` or `const`.
* Updated deprecated `Buffer` constructor to `Buffer.from()`.
* Removed `require('babel-polyfill')` from source code as it's likely unnecessary for modern Node.js versions.
* Refactored asynchronous operations in `src/index.js` and `src/weinre/weinreDelegate.js` from callbacks/Promise chains to use `async/await`, improving code clarity and simplifying control flow.
2. **HTML Template Enhancements (template/):**
* Added `lang` attributes to `<html>` tags for better accessibility.
* Improved accessibility of interactive elements:
* Added `aria-hidden="true"` to purely presentational icons.
* Added `role="button"` and `tabindex="0"` to `div` elements acting as buttons.
* Added accessible names (`aria-label`) to icon-only links (e.g., GitHub link).
* Added `title` attributes to `<iframe>` elements.
* Removed obsolete `frameborder="0"` attributes from iframes.
* Commented out an outdated `clear:both` div.
* In `template/wrap.html`, moved inline CSS to an external file (`template/wrap.css`) and inline JavaScript to an external file (`template/wrap.js`), improving code organization.
3. **Server-Side Logic and Error Handling:**
* Enhanced robustness of AnyProxy child process management in `src/proxy/spyProxy.js` (including timeouts and better exit/error handling).
* Created a new logging utility (`src/util/logger.js`) using the `colors` library for standardized and styled console output.
* Replaced deprecated `domain` error handling with `async/await try/catch` blocks in `src/weinre/weinreDelegate.js`.
* Integrated the new logger in `src/index.js` and `src/weinre/weinreDelegate.js`, improving consistency and clarity of log messages.
4. **Code Duplication Refactoring:**
* Created `src/util/portUtil.js` with a `findFreePort()` utility, now used in `src/proxy/externalChildProcess.js` and `src/weinre/weinreDelegate.js`.
* Created `src/util/sysUtil.js` with an `openUrlInBrowser()` utility, now used in `src/weinre/weinreDelegate.js`.
5. **Dependency Review and Initial Cleanup:**
* Removed `babel-polyfill` from `package.json` dependencies.
* **Identified Critical Concerns:**
* The bundled `buildin_modules/weinre` appears to use Express 3.x, which is severely outdated and has known security vulnerabilities. Apache Weinre itself is retired. This is a major security risk.
* Many other dependencies (e.g., `commander`, `colors`, `anyproxy`) are significantly outdated.
* The project uses the Babel 6 build system, which is outdated.
* The project is missing a lockfile (`package-lock.json` or `yarn.lock`).
* These critical dependency issues require manual developer intervention.
Overall, these changes aim to make the `spy-debugger` codebase more modern, secure, maintainable, and user-friendly. The most pressing remaining issue is the outdated and vulnerable bundled Weinre module.
62 lines
1.4 KiB
JSON
62 lines
1.4 KiB
JSON
{
|
|
"name": "spy-debugger",
|
|
"version": "3.8.7",
|
|
"description": "web page one-stop remote network debugger",
|
|
"main": "lib/index.js",
|
|
"scripts": {
|
|
"test": "mocha -R landing test/index --exit",
|
|
"build": "babel -w src -d lib",
|
|
"dev": "node-debug dev/testSpyProxy.js",
|
|
"prepublish": "babel src -d lib"
|
|
},
|
|
"bin": {
|
|
"spy-debugger": "lib/index.js"
|
|
},
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/wuchangming/spy-debugger.git"
|
|
},
|
|
"keywords": [
|
|
"spy",
|
|
"debugger",
|
|
"weinre",
|
|
"https"
|
|
],
|
|
"author": "wuchangming",
|
|
"license": "MIT",
|
|
"bugs": {
|
|
"url": "https://github.com/wuchangming/spy-debugger/issues"
|
|
},
|
|
"homepage": "https://github.com/wuchangming/spy-debugger#readme",
|
|
"dependencies": {
|
|
"anyproxy": "4.1.0",
|
|
"babel-plugin-transform-async-to-generator": "^6.8.0",
|
|
"charset": "^1.0.0",
|
|
"colors": "^1.1.2",
|
|
"commander": "^2.9.0",
|
|
"debug": "^2.2.0",
|
|
"express": "^3.21.2",
|
|
"iconv-lite": "^0.4.13",
|
|
"ip": "^1.1.2",
|
|
"jschardet": "^1.4.1",
|
|
"lodash": "^4.17.14",
|
|
"node-mitmproxy": "3.1.1",
|
|
"nopt": "3.0.x",
|
|
"through2": "^2.0.5",
|
|
"underscore": "1.7.x"
|
|
},
|
|
"devDependencies": {
|
|
"babel-cli": "^6.6.5",
|
|
"babel-preset-es2015": "^6.6.0",
|
|
"mocha": "^6.1.4"
|
|
},
|
|
"files": [
|
|
"lib",
|
|
"template",
|
|
"buildin_modules"
|
|
],
|
|
"engines": {
|
|
"node": ">= 6"
|
|
}
|
|
}
|