删除域名时二次确认

This commit is contained in:
yinjun.chen1
2026-09-18 10:08:27 +08:00
parent 7e931a4372
commit 98ab5b5b7d
4 changed files with 51 additions and 0 deletions
+8
View File
@@ -523,6 +523,10 @@
"message": "Delete environment \"$1\"?", "message": "Delete environment \"$1\"?",
"description": "Confirm delete empty env, $1 env name" "description": "Confirm delete empty env, $1 env name"
}, },
"confirmDeleteConfig": {
"message": "Delete \"$1\"?",
"description": "Confirm delete domain config, $1 alias or domain"
},
"toastEnvDeleted": { "toastEnvDeleted": {
"message": "Environment deleted", "message": "Environment deleted",
"description": "Toast - env deleted" "description": "Toast - env deleted"
@@ -767,6 +771,10 @@
"message": "$1. Credentials filled. Complete the captcha and click login.", "message": "$1. Credentials filled. Complete the captcha and click login.",
"description": "Captcha toast body, $1 reason" "description": "Captcha toast body, $1 reason"
}, },
"fillToastMsg": {
"message": "Username and password filled",
"description": "Fill complete lightweight toast"
},
"logNoPasswordField": { "logNoPasswordField": {
"message": "Password input not found", "message": "Password input not found",
"description": "Log - no password field" "description": "Log - no password field"
+8
View File
@@ -523,6 +523,10 @@
"message": "确认删除环境「$1」?", "message": "确认删除环境「$1」?",
"description": "删除空环境确认,$1 为环境名" "description": "删除空环境确认,$1 为环境名"
}, },
"confirmDeleteConfig": {
"message": "确认删除「$1」?",
"description": "删除域名配置确认,$1 为别名或域名"
},
"toastEnvDeleted": { "toastEnvDeleted": {
"message": "已删除环境", "message": "已删除环境",
"description": "toast - 删除环境成功" "description": "toast - 删除环境成功"
@@ -755,6 +759,10 @@
"message": "$1,已为你填充账密,请完成验证码后点击登录", "message": "$1,已为你填充账密,请完成验证码后点击登录",
"description": "验证码浮窗内容,$1 为检测原因" "description": "验证码浮窗内容,$1 为检测原因"
}, },
"fillToastMsg": {
"message": "已填充用户名和密码",
"description": "填充完成轻量提示"
},
"logNoPasswordField": { "logNoPasswordField": {
"message": "未找到密码输入框", "message": "未找到密码输入框",
"description": "日志 - 未找到密码输入框" "description": "日志 - 未找到密码输入框"
+33
View File
@@ -340,6 +340,7 @@ function fillForm(config: Config, canSubmit = true, onSubmitted?: () => void): b
setNativeValue(passwordField, config.password); setNativeValue(passwordField, config.password);
debugLog(t("logFilledPassword")); debugLog(t("logFilledPassword"));
showFillToast();
// 检测到验证码则强制不自动提交,提示用户手动操作 // 检测到验证码则强制不自动提交,提示用户手动操作
const captcha = detectCaptcha(); const captcha = detectCaptcha();
@@ -425,6 +426,38 @@ function showCaptchaToast(reason: string): void {
showPageToast(t("captchaToastTitle"), t("captchaToastBody", reason)); showPageToast(t("captchaToastTitle"), t("captchaToastBody", reason));
} }
/** 填充完成轻量提示:右下角小浮条,2 秒自动消失 */
let fillToastEl: HTMLElement | null = null;
function showFillToast(): void {
if (!isTopFrame()) return;
if (fillToastEl && fillToastEl.parentNode) fillToastEl.parentNode.removeChild(fillToastEl);
const el = document.createElement("div");
el.style.cssText = `
position: fixed;
bottom: 16px;
right: 16px;
z-index: 2147483647;
background: #1a1a2e;
border: 1px solid #27ae60;
border-radius: 6px;
padding: 6px 12px;
color: #e0e0e0;
font-size: 12px;
font-family: "Segoe UI","Microsoft YaHei",sans-serif;
box-shadow: 0 2px 8px rgba(0,0,0,0.3);
opacity: 0;
transition: opacity 0.2s;
`;
el.textContent = t("fillToastMsg");
document.body.appendChild(el);
requestAnimationFrame(() => (el.style.opacity = "1"));
fillToastEl = el;
setTimeout(() => {
if (el && el.parentNode) el.parentNode.removeChild(el);
fillToastEl = null;
}, 2000);
}
/** /**
* 连续自动提交达到上限时的可见提示。 * 连续自动提交达到上限时的可见提示。
* 只写日志的话用户完全不知道"为什么只填不提交"(调试日志默认还是静默的)。 * 只写日志的话用户完全不知道"为什么只填不提交"(调试日志默认还是静默的)。
+2
View File
@@ -213,6 +213,8 @@ export function initConfigList(ctx: PopupCtx) {
delItem.addEventListener("click", async (e) => { delItem.addEventListener("click", async (e) => {
e.stopPropagation(); e.stopPropagation();
closeAllMenus(); closeAllMenus();
const label = cfg.alias || cfg.domain;
if (!confirm(t("confirmDeleteConfig", label))) return;
const updated = configs.filter((c) => c.id !== cfg.id); const updated = configs.filter((c) => c.id !== cfg.id);
await saveConfigs(updated); await saveConfigs(updated);
ctx.showToast(t("toastDeleted")); ctx.showToast(t("toastDeleted"));