spy-debugger/template/anyproxy_index.html
google-labs-jules[bot] 3a7fc8fd40 Refactor: Comprehensive codebase optimizations and modernizations.
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.
2025-05-22 14:11:50 +00:00

59 lines
2.1 KiB
HTML

<!--
2016.12.17 by wuchangming
delete github link
-->
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<title>AnyProxy</title>
<meta charset="UTF-8" />
<link rel="stylesheet" href="/css/uikit.gradient.min.css" />
<link rel="stylesheet" href="/css/page.css" />
<link rel="stylesheet" type="text/css" href="/css/jstree_style/style.min.css">
<link rel="icon" type="image/png" href="/favico.png" />
</head>
<body>
<div class="topHead">
<div class="logoWrapper">
<h1>AnyProxy</h1>
<div id="J_indicatorEl"></div>
</div>
<div class="ctrlWrapper">
<a href="#" role="button"><span class="topBtn J_statusBtn"><i class="uk-icon-stop" aria-hidden="true"></i>Stop</span></a>
<a href="#" role="button"><span class="topBtn J_statusBtn btn_disable"><i class="uk-icon-play" aria-hidden="true"></i>Resume</span></a>
<a href="#" role="button"><span class="topBtn J_clearBtn"><i class="uk-icon-eraser" aria-hidden="true"></i>Clear(Ctrl+X)</span></a>
<span class="sep">|</span>
<a href="/fetchCrtFile" target="_blank" role="button"><span class="topBtn"><i class="uk-icon-download" aria-hidden="true"></i>Download rootCA.crt</span></a>
<a href="/qr_root" class="J_fetchRootQR" target="_blank" role="button"><span class="topBtn"><i class="uk-icon-qrcode" aria-hidden="true"></i>QRCode of rootCA.crt</span></a>
</div>
<div class="ctrlWrapper">
<span id="J_filterBtnContainer"></span>
<span id="J_filterContainer"></span>
<span class="sep">|</span>
{@if customMenu.length}
{@each customMenu as item}
<a href="#" role="button"><span class="topBtn J_customButton" iframeUrl="${item.url}"><i class="${item.icon}" aria-hidden="true"></i>${item.name}</span></a>
{@/each}
<span class="sep">|</span>
{@/if}
<span title="${rule}"><i class="uk-icon-chain" aria-hidden="true"></i>Rule : ${rule}</span>
</div>
<!-- <div style="clear:both"></div> -->
</div>
<div class="mainTableWrapper" id="J_content"></div>
<input type="hidden" id="socketPort" value="${wsPort}" />
<input type="hidden" id="baseUrl" value="${ipAddress}" />
<script src="./page.js"></script>
</body>
</html>