-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Open
Description
Describe the feature request
static/#/proxies/tcp等页面下的端口号位置,增加点击端口号跳转到对应的页面。
比如:点击 http://a.com:10000/static/#/proxies/tcp下的10050端口,则新的窗口跳转到http://a.com:10050
此举可以简化打开网页反代的流程。目前是通过油猴脚本解决的。希望大佬点我。
`// ==UserScript==
// @name FRP Port Clickable Link
// @namespace frp-port-linker
// @Version 1.0
// @description Make FRP TCP port numbers clickable
// @match :///*
// @grant none
// ==/UserScript==
(function () {
'use strict';
const TARGET_PATH = '/static/#/proxies/tcp';
function isTargetPage() {
return location.pathname + location.hash === TARGET_PATH;
}
function makePortLinks() {
if (!isTargetPage()) return;
const host = location.hostname;
const protocol = location.protocol;
const nodes = document.querySelectorAll('td, div, span');
nodes.forEach(node => {
if (node.dataset.frpLinked) return;
const text = node.innerText?.trim();
if (!text) return;
// 匹配端口号(放宽到 1–65535 的合理长度)
if (!/^\d{1,5}$/.test(text)) return;
const port = Number(text);
if (port < 1 || port > 65535) return;
const a = document.createElement('a');
a.href = `${protocol}//${host}:${port}/`;
a.innerText = text;
a.target = '_blank';
a.style.color = '#409eff';
a.style.textDecoration = 'underline';
node.innerHTML = '';
node.appendChild(a);
node.dataset.frpLinked = '1';
});
}
// 初次执行
makePortLinks();
// 监听 SPA DOM 变化
const observer = new MutationObserver(() => {
makePortLinks();
});
observer.observe(document.body, {
childList: true,
subtree: true
});
})();
`
Describe alternatives you've considered
No response
Affected area
- Docs
- Installation
- Performance and Scalability
- Security
- User Experience
- Test and Release
- Developer Infrastructure
- Client Plugin
- Server Plugin
- Extensions
- Others
Metadata
Metadata
Assignees
Labels
No labels