ck 复制格式优化,修复错误

This commit is contained in:
yml2213
2026-06-25 09:16:23 +08:00
parent 4681136484
commit f21f82cbed
4 changed files with 12 additions and 10 deletions
-2
View File
@@ -69,7 +69,6 @@ class CookieEnricher:
self.CSRF_API,
headers=headers,
timeout=self.TIMEOUT,
max_retries=1,
)
response.raise_for_status()
@@ -120,7 +119,6 @@ class CookieEnricher:
self.ACF_CCN_API,
headers=headers,
timeout=self.TIMEOUT,
max_retries=1,
)
response.raise_for_status()
+3 -1
View File
@@ -63,14 +63,16 @@ def list_cookies(
"assigned_username": acc.assigned_user.username if acc and acc.assigned_user else None,
"created_at": _fmt_dt(t.finished_at),
}
# 只有有 cookie:view 权限才返回 cookie 内容
# 只有有 cookie:view 权限才返回 cookie 和密码(用于自定义格式复制)
if user_has_permission(current, "cookie:view"):
cookie = t.cookie or ""
item["cookie"] = cookie
item["cookie_preview"] = cookie[:50] + "..." if len(cookie) > 50 else cookie
item["account_password"] = acc.password if acc else ""
else:
item["cookie"] = ""
item["cookie_preview"] = "***"
item["account_password"] = ""
result.append(item)
return result
+1
View File
@@ -102,6 +102,7 @@ export interface CookieItem {
created_at: string | null;
cookie: string;
cookie_preview: string;
account_password: string;
}
// ==================== Proxy ====================
+8 -7
View File
@@ -83,13 +83,14 @@ export default function CookiePage() {
}
};
const handleCopyCookie = (cookie: string, username: string) => {
if (!cookie) {
const handleCopyCookie = (record: CookieItem) => {
if (!record.cookie) {
message.warning('Cookie 为空');
return;
}
copyToClipboard(cookie).then(() => {
message.success(`已复制 ${username} 的 Cookie`);
const text = `${record.account_username}----${record.account_password || ''}----${record.cookie}`;
copyToClipboard(text).then(() => {
message.success(`已复制 ${record.account_username} 的 Cookie`);
}).catch(() => {
message.error('复制失败');
});
@@ -102,8 +103,8 @@ export default function CookiePage() {
}
const selected = cookies.filter((c) => selectedRowKeys.includes(c.id));
const text = selected
.map((c) => `${c.account_username}: ${c.cookie || '(空)'}`)
.join('\n');
.map((c) => `${c.account_username}----${c.account_password || ''}----${c.cookie || ''}`)
.join('\r\n');
copyToClipboard(text).then(() => {
message.success(`已复制 ${selected.length} 条 Cookie`);
}).catch(() => {
@@ -190,7 +191,7 @@ export default function CookiePage() {
<Button
size="small"
icon={<CopyOutlined />}
onClick={() => handleCopyCookie(record.cookie, record.account_username)}
onClick={() => handleCopyCookie(record)}
>
</Button>