Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ yarn.lock

# VSCode settings
.vscode/

android/
dev-docs/
4 changes: 4 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ npx wrangler deploy

当你完成一项完整的修改后,运行构建命令,确认构建正确后便于我测试。

## Git 提交规则

**所有 commit 必须经过用户确认方可提交。** 完成修改后主动询问用户:"是否需要提交 commit?",用户同意后我才执行 `git commit`。如果用户有其他需求,一并提出后再提交。

## 项目架构

### 浏览器扩展结构
Expand Down
142 changes: 108 additions & 34 deletions src/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,67 @@ <h3>B站广告检测设置</h3>
</div>

<style>
:root {
--bg-body: #f4f4f4;
--bg-card: #ffffff;
--bg-scroll-track: #f7f9fc;
--bg-scroll-thumb: linear-gradient(180deg, #fff, #ff6699b5);
--bg-scroll-thumb-hover: linear-gradient(180deg, #E84B85, #ff6699);
--bg-info-icon: linear-gradient(135deg, #ff6699, #E84B85);
--bg-info-icon-hover: linear-gradient(135deg, #E84B85, #cc5580);
--bg-btn: #ff6699;
--bg-btn-hover: #E84B85;
--bg-btn-remove: #e72236;
--bg-success: #d4edda;
--bg-error: #f8d7da;
--bg-dropdown-item-hover: #f8f9fa;
--bg-input: #ffffff;
--border-light: #eee;
--border-input: #ccc;
--text-primary: #333;
--text-secondary: #666;
--text-success: #155724;
--border-success: #c3e6cb;
--text-error: #721c24;
--border-error: #f5c6cb;
--scrollbar-shadow: rgba(0,0,0,0.1);
}

@media (prefers-color-scheme: dark) {
:root {
--bg-body: #1e1e1e;
--bg-card: #2a2a2a;
--bg-scroll-track: #2a2a2a;
--bg-scroll-thumb: linear-gradient(180deg, #444, #ff6699b5);
--bg-scroll-thumb-hover: linear-gradient(180deg, #E84B85, #ff6699);
--bg-info-icon: linear-gradient(135deg, #ff6699, #E84B85);
--bg-info-icon-hover: linear-gradient(135deg, #E84B85, #cc5580);
--bg-btn: #ff6699;
--bg-btn-hover: #E84B85;
--bg-btn-remove: #c41e30;
--bg-success: #1a3d2b;
--bg-error: #3d1a1a;
--bg-dropdown-item-hover: #3a3a3a;
--bg-input: #333;
--border-light: #3a3a3a;
--border-input: #555;
--text-primary: #e0e0e0;
--text-secondary: #aaa;
--text-success: #7dd89a;
--border-success: #2d5a3d;
--text-error: #f5a9a9;
--border-error: #5a2d2d;
--scrollbar-shadow: rgba(0,0,0,0.3);
}
}

body {
width: 320px;
padding: 5px;
font-family: sans-serif;
font-size: 14px;
background-color: #f4f4f4;
background-color: var(--bg-body);
color: var(--text-primary);
overflow: auto;
}

Expand All @@ -122,24 +177,24 @@ <h3>B站广告检测设置</h3>
}

::-webkit-scrollbar-track {
background: #f7f9fc;
background: var(--bg-scroll-track);
}

::-webkit-scrollbar-thumb {
background: linear-gradient(180deg, #fff, #ff6699b5);
background: var(--bg-scroll-thumb);
border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
background: linear-gradient(180deg, #E84B85, #ff6699);
background: var(--bg-scroll-thumb-hover);
}

.card {
background-color: white;
background-color: var(--bg-card);
border-radius: 8px;
padding: 10px;
margin-bottom: 10px;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
box-shadow: 0 1px 3px var(--scrollbar-shadow);
}

.checkbox-card {
Expand All @@ -161,7 +216,7 @@ <h3>B站广告检测设置</h3>
.checkbox-card .form-group {
justify-content: space-between;
padding: 8px 0;
border-bottom: 1px solid #eee;
border-bottom: 1px solid var(--border-light);
margin-bottom: 0;
}

Expand All @@ -177,6 +232,7 @@ <h3>B站广告检测设置</h3>
font-weight: normal;
order: 1;
white-space: nowrap;
color: var(--text-primary);
}

input[type="checkbox"] {
Expand All @@ -186,7 +242,7 @@ <h3>B站广告检测设置</h3>
height: 20px;
cursor: pointer;
position: relative;
background-color: white;
background-color: var(--bg-input);
transition: all 0.2s ease;
appearance: none;
border: 2px solid #ff6699;
Expand Down Expand Up @@ -226,7 +282,7 @@ <h3>B站广告检测设置</h3>
width: 16px;
height: 16px;
border-radius: 50%;
background: linear-gradient(135deg, #ff6699, #E84B85);
background: var(--bg-info-icon);
color: white;
font-size: 12px;
font-style: italic;
Expand All @@ -235,7 +291,7 @@ <h3>B站广告检测设置</h3>
}

.info-icon:hover .info-icon-inner {
background: linear-gradient(135deg, #E84B85, #cc5580);
background: var(--bg-info-icon-hover);
}

.api-settings-card label {
Expand All @@ -245,6 +301,7 @@ <h3>B站广告检测设置</h3>
margin-right: 10px;
word-break: keep-all;
font-weight: normal;
color: var(--text-primary);
}

.enableAudioTranscription-field .groq-register-link {
Expand All @@ -265,8 +322,10 @@ <h3>B站广告检测设置</h3>
width: 100%;
padding: 8px 35px 8px 8px;
box-sizing: border-box;
border: 1px solid #ccc;
border: 1px solid var(--border-input);
border-radius: 4px;
background-color: var(--bg-input);
color: var(--text-primary);
}

.dropdown-toggle {
Expand All @@ -278,7 +337,7 @@ <h3>B站广告检测设置</h3>
border: none;
cursor: pointer;
font-size: 12px;
color: #666;
color: var(--text-secondary);
padding: 0;
width: 20px;
display: flex;
Expand All @@ -297,10 +356,10 @@ <h3>B站广告检测设置</h3>
top: 100%;
left: 0;
right: 0;
background: white;
border: 1px solid #ccc;
background: var(--bg-card);
border: 1px solid var(--border-input);
border-radius: 4px;
box-shadow: 0 2px 8px rgba(0,0,0,0.15);
box-shadow: 0 2px 8px var(--scrollbar-shadow);
max-height: 200px;
overflow-y: auto;
z-index: 1000;
Expand All @@ -314,16 +373,17 @@ <h3>B站广告检测设置</h3>
.dropdown-item {
padding: 10px;
cursor: pointer;
border-bottom: 1px solid #eee;
border-bottom: 1px solid var(--border-light);
transition: background-color 0.2s;
color: var(--text-primary);
}

.dropdown-item:last-child {
border-bottom: none;
}

.dropdown-item:hover {
background-color: #f8f9fa;
background-color: var(--bg-dropdown-item-hover);
}

.provider-info {
Expand All @@ -335,7 +395,7 @@ <h3>B站广告检测设置</h3>

.provider-name {
font-weight: 500;
color: #333;
color: var(--text-primary);
font-size: 13px;
}

Expand All @@ -356,7 +416,7 @@ <h3>B站广告检测设置</h3>

.api-url {
font-size: 11px;
color: #666;
color: var(--text-secondary);
font-family: monospace;
word-break: break-all;
line-height: 1.3;
Expand All @@ -366,9 +426,11 @@ <h3>B站广告检测设置</h3>
flex-grow: 1;
padding: 8px;
box-sizing: border-box;
border: 1px solid #ccc;
border: 1px solid var(--border-input);
border-radius: 4px;
width: calc(100% - 90px);
background-color: var(--bg-input);
color: var(--text-primary);
}

.input-with-icon {
Expand All @@ -382,8 +444,10 @@ <h3>B站广告检测设置</h3>
padding: 8px;
padding-right: 35px;
box-sizing: border-box;
border: 1px solid #ccc;
border: 1px solid var(--border-input);
border-radius: 4px;
background-color: var(--bg-input);
color: var(--text-primary);
}

.toggle-password {
Expand All @@ -397,7 +461,7 @@ <h3>B站广告检测设置</h3>
justify-content: center;
width: 20px;
height: 20px;
color: #666;
color: var(--text-secondary);
opacity: 0.7;
z-index: 2;
}
Expand Down Expand Up @@ -432,13 +496,13 @@ <h3>B站广告检测设置</h3>
margin-top: 0;
text-align: center;
margin-bottom: 15px;
color: #333;
color: var(--text-primary);
}

button {
width: 100%;
padding: 10px;
background-color: #ff6699;
background-color: var(--bg-btn);
color: white;
border: none;
border-radius: 6px;
Expand All @@ -448,7 +512,14 @@ <h3>B站广告检测设置</h3>
}

button:hover {
background-color: #E84B85;
background-color: var(--bg-btn-hover);
}

#result {
padding: 8px;
font-size: 13px;
text-align: left;
color: var(--text-primary);
}

#message {
Expand All @@ -461,15 +532,15 @@ <h3>B站广告检测设置</h3>
}

.success {
background-color: #d4edda;
color: #155724;
border: 1px solid #c3e6cb;
background-color: var(--bg-success);
color: var(--text-success);
border: 1px solid var(--border-success);
}

.error {
background-color: #f8d7da;
color: #721c24;
border: 1px solid #f5c6cb;
background-color: var(--bg-error);
color: var(--text-error);
border: 1px solid var(--border-error);
}

.whitelist-card {
Expand All @@ -494,8 +565,10 @@ <h3>B站广告检测设置</h3>
.whitelist-add input {
flex: 1;
padding: 8px;
border: 1px solid #ccc;
border: 1px solid var(--border-input);
border-radius: 4px;
background-color: var(--bg-input);
color: var(--text-primary);
}

.whitelist-add button {
Expand All @@ -513,7 +586,8 @@ <h3>B站广告检测设置</h3>
justify-content: space-between;
align-items: center;
padding: 8px;
border-bottom: 1px solid #eee;
border-bottom: 1px solid var(--border-light);
color: var(--text-primary);
}

.whitelist-item:last-child {
Expand All @@ -523,7 +597,7 @@ <h3>B站广告检测设置</h3>
.whitelist-item button {
padding: 2px 2px;
margin: 0;
background-color: #e72236;
background-color: var(--bg-btn-remove);
font-size: 12px;
width: 40px;
height: 24px;
Expand Down
1 change: 1 addition & 0 deletions src/popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const SDK_PRESETS: Record<LLMProvider, BaseUrlPreset[]> = {
{ name: 'MiniMax', baseUrl: 'https://api.minimaxi.com/v1', actionLabel: '注册', actionUrl: 'https://platform.minimaxi.com/subscribe/token-plan?code=FapfOonxo7&source=link' },
{ name: 'Kimi', baseUrl: 'https://api.moonshot.ai/v1', actionLabel: '注册', actionUrl: 'https://platform.moonshot.cn/' },
{ name: 'DeepSeek', baseUrl: 'https://api.deepseek.com', actionLabel: '注册', actionUrl: 'https://platform.deepseek.com/api_keys' },
{ name: 'Xiaomi MiMo', baseUrl: 'https://api.xiaomimimo.com/v1', actionLabel: '注册', actionUrl: 'https://platform.xiaomimimo.com?ref=HFFE2V' },
{ name: '硅基流动', baseUrl: 'https://api.siliconflow.com/v1', actionLabel: '注册', actionUrl: 'https://cloud.siliconflow.cn/i/VWOdVvvM' },
{ name: 'OpenRouter', baseUrl: 'https://openrouter.ai/api/v1', actionLabel: '注册', actionUrl: 'https://openrouter.ai/' },
{ name: 'Groq', baseUrl: 'https://api.groq.com/openai/v1', actionLabel: '注册', actionUrl: 'https://console.groq.com/keys' },
Expand Down
Loading