[错误报告]非HTTPS下无法使用rss链接复制功能
Author: afraidjpgCreated Jul 23, 2026Updated Jul 23, 2026
Labelsbug
确认
- 我的版本是最新版本,我的版本号与 version 相同。
- 我已经查阅了已知问题,并确认我的问题不在其中。
- 我已经 issue 中搜索过,确认我的问题没有被提出过。
- 我已经修改标题,将标题中的 描述 替换为我遇到的问题。
当前程序版本
3.3.4
问题类型
WebUI
问题描述
局域网,无IP,无域名,无内网穿透,单纯的家庭内局域网环境下,使用 IP:端口号 访问ab无法使用复制RSS链接,因为浏览器安全策略,非安全上下文下navigator.clipboard.writeText会被禁用,可以尝试使用fallback方案绕过此限制,具体而言将 await navigator.clipboard.writeText(text); 替换为包含fallback降级的复制方法:
async function copyTextWithFallback(text: string): Promise<boolean> {
try {
if (
// 确认剪切板对象存在且当前为安全上下文
navigator.clipboard &&
window.isSecureContext
) {
await navigator.clipboard.writeText(text);
return true;
}
} catch {
}
// fallback 方案:创建一个不可见的 textarea 元素,选中内容并执行复制命令
const textarea = document.createElement("textarea");
textarea.value = text;
textarea.style.position = "fixed";
textarea.style.left = "-9999px";
textarea.style.top = "-9999px";
textarea.setAttribute("readonly", "");
document.body.appendChild(textarea);
textarea.select();
textarea.setSelectionRange(0, textarea.value.length);
const success = document.execCommand("copy");
document.body.removeChild(textarea);
return success;
}发生问题时系统日志
Source: EstrellaXD/Auto_Bangumi