feat: icons moved to repo-managed PNG files

- Convert all brand icons (aliyun/baidu/quark/115/tianyi/123pan/uc/xunlei/pikpak) to 64x64 PNG

 - CLOUD_ICONS now references /icons/xxx.png instead of data URI

 - Backend cloud-types.service.ts synchronized

 - Added magnet/ed2k/others placeholder icons

 - .gitignore allows public/icons/
This commit is contained in:
2026-05-15 06:01:49 +08:00
parent d83225d736
commit e046514fee
15 changed files with 31 additions and 42 deletions

1
.gitignore vendored
View File

@@ -14,6 +14,7 @@ deploy.sh
backup.sh backup.sh
check.sh check.sh
icons/ icons/
!/packages/frontend/public/icons/
scripts/ scripts/
Dockerfile Dockerfile
Dockerfile.bak Dockerfile.bak

View File

@@ -12,27 +12,23 @@ export interface CloudTypeInfo {
* 图标存放在 /app/dist/frontend/icons/,通过 Express static 中间件对外提供 * 图标存放在 /app/dist/frontend/icons/,通过 Express static 中间件对外提供
*/ */
/** /**
* 网盘图标 — 内联 SVG data URI无需外部文件 /**
* 网盘图标 — 使用仓库中的 PNG 图标文件
* 图标存放在 /app/dist/frontend/icons/,通过 Express static 对外提供
*/ */
function makeSvgIcon(bg: string, letter: string): string {
const c = encodeURIComponent(bg);
const l = encodeURIComponent(letter);
return `data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2024%2024%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Crect%20width%3D%2224%22%20height%3D%2224%22%20rx%3D%224%22%20fill%3D%22${c}%22%2F%3E%3Ctext%20x%3D%2212%22%20y%3D%2217%22%20font-size%3D%2213%22%20font-weight%3D%22bold%22%20fill%3D%22%23fff%22%20text-anchor%3D%22middle%22%20font-family%3D%22Arial%2Csans-serif%22%3E${l}%3C%2Ftext%3E%3C%2Fsvg%3E`;
}
const ICONS: Record<string, string> = { const ICONS: Record<string, string> = {
baidu: makeSvgIcon('#4e6ef2', '百'), baidu: '/icons/baidu.png',
aliyun: makeSvgIcon('#ff6a00', '阿'), aliyun: '/icons/aliyun.png',
quark: makeSvgIcon('#07c160', '夸'), quark: '/icons/quark.png',
'115': makeSvgIcon('#9b59b6', '1'), '115': '/icons/115.png',
tianyi: makeSvgIcon('#00a1d6', '天'), tianyi: '/icons/tianyi.png',
'123pan': makeSvgIcon('#e74c3c', '1'), '123pan': '/icons/123pan.png',
uc: makeSvgIcon('#f39c12', 'U'), uc: '/icons/uc.png',
xunlei: makeSvgIcon('#2ecc71', '迅'), xunlei: '/icons/xunlei.png',
pikpak: makeSvgIcon('#8e44ad', 'P'), pikpak: '/icons/pikpak.png',
magnet: 'data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2024%2024%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Crect%20width%3D%2224%22%20height%3D%2224%22%20rx%3D%224%22%20fill%3D%22%236366F1%22%2F%3E%3Cpath%20d%3D%22M7%2016l5-5m-5%200l5%205m5-5l-5-5m5%200l-5%205%22%20stroke%3D%22%23fff%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20fill%3D%22none%22%2F%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2211%22%20r%3D%221%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E', magnet: '/icons/magnet.png',
ed2k: 'data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2024%2024%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Crect%20width%3D%2224%22%20height%3D%2224%22%20rx%3D%224%22%20fill%3D%22%238B4513%22%2F%3E%3Ctext%20x%3D%2212%22%20y%3D%2217%22%20font-size%3D%2211%22%20font-weight%3D%22bold%22%20fill%3D%22%23fff%22%20text-anchor%3D%22middle%22%20font-family%3D%22Arial%2Csans-serif%22%3EeD%3C%2Ftext%3E%3C%2Fsvg%3E', ed2k: '/icons/ed2k.png',
others: 'data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2024%2024%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Crect%20width%3D%2224%22%20height%3D%2224%22%20rx%3D%224%22%20fill%3D%22%239CA3AF%22%2F%3E%3Cpath%20d%3D%22M6%2013c0-2.8%202.2-5%205-5a5%205%200%200%201%204.5%202.7A4%204%200%200%201%2020%2014a4%204%200%200%201-3%203.9h-8A4%204%200%200%201%206%2013z%22%20fill%3D%22none%22%20stroke%3D%22%23fff%22%20stroke-width%3D%221.5%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E', others: '/icons/others.png',
}; };
const ALL_CLOUD_TYPES: { type: string; label: string; icon: string }[] = [ const ALL_CLOUD_TYPES: { type: string; label: string; icon: string }[] = [

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@@ -52,31 +52,23 @@ export const CLOUD_COLORS: Record<CloudType, string> = {
/** /**
* 网盘图标映射 — 全部使用内联 SVG data URI无需外部文件 * 网盘图标映射 — 全部使用内联 SVG data URI无需外部文件
* 每个网盘类型使用其品牌色圆角底 + 首字母/中文标识 /**
* 网盘图标映射 — 使用仓库中的 PNG 图标文件
* 图标存储在 public/icons/ 目录下Vite 构建时自动打包
*/ */
function makeSvgIcon(bg: string, letter: string): string {
const c = encodeURIComponent(bg)
const l = encodeURIComponent(letter)
return `data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2024%2024%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Crect%20width%3D%2224%22%20height%3D%2224%22%20rx%3D%224%22%20fill%3D%22${c}%22%2F%3E%3Ctext%20x%3D%2212%22%20y%3D%2217%22%20font-size%3D%2213%22%20font-weight%3D%22bold%22%20fill%3D%22%23fff%22%20text-anchor%3D%22middle%22%20font-family%3D%22Arial%2Csans-serif%22%3E${l}%3C%2Ftext%3E%3C%2Fsvg%3E`
}
const ICON_SVGS: Record<string, string> = {
magnet: 'data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2024%2024%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Crect%20width%3D%2224%22%20height%3D%2224%22%20rx%3D%224%22%20fill%3D%22%236366F1%22%2F%3E%3Cpath%20d%3D%22M7%2016l5-5m-5%200l5%205m5-5l-5-5m5%200l-5%205%22%20stroke%3D%22%23fff%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20fill%3D%22none%22%2F%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2211%22%20r%3D%221%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E',
ed2k: 'data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2024%2024%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Crect%20width%3D%2224%22%20height%3D%2224%22%20rx%3D%224%22%20fill%3D%22%238B4513%22%2F%3E%3Ctext%20x%3D%2212%22%20y%3D%2217%22%20font-size%3D%2211%22%20font-weight%3D%22bold%22%20fill%3D%22%23fff%22%20text-anchor%3D%22middle%22%20font-family%3D%22Arial%2Csans-serif%22%3EeD%3C%2Ftext%3E%3C%2Fsvg%3E',
others: 'data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2024%2024%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Crect%20width%3D%2224%22%20height%3D%2224%22%20rx%3D%224%22%20fill%3D%22%239CA3AF%22%2F%3E%3Cpath%20d%3D%22M6%2013c0-2.8%202.2-5%205-5a5%205%200%200%201%204.5%202.7A4%204%200%200%201%2020%2014a4%204%200%200%201-3%203.9h-8A4%204%200%200%201%206%2013z%22%20fill%3D%22none%22%20stroke%3D%22%23fff%22%20stroke-width%3D%221.5%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E',
}
export const CLOUD_ICONS: Record<string, string> = { export const CLOUD_ICONS: Record<string, string> = {
baidu: makeSvgIcon('#4e6ef2', '百'), baidu: '/icons/baidu.png',
aliyun: makeSvgIcon('#ff6a00', '阿'), aliyun: '/icons/aliyun.png',
quark: makeSvgIcon('#07c160', '夸'), quark: '/icons/quark.png',
'115': makeSvgIcon('#9b59b6', '1'), '115': '/icons/115.png',
tianyi: makeSvgIcon('#00a1d6', '天'), tianyi: '/icons/tianyi.png',
'123pan': makeSvgIcon('#e74c3c', '1'), '123pan': '/icons/123pan.png',
uc: makeSvgIcon('#f39c12', 'U'), uc: '/icons/uc.png',
xunlei: makeSvgIcon('#2ecc71', '迅'), xunlei: '/icons/xunlei.png',
pikpak: makeSvgIcon('#8e44ad', 'P'), pikpak: '/icons/pikpak.png',
magnet: ICON_SVGS.magnet, magnet: '/icons/magnet.png',
ed2k: ICON_SVGS.ed2k, ed2k: '/icons/ed2k.png',
others: ICON_SVGS.others, others: '/icons/others.png',
} }
/* ===== 视频解析类型 ===== */ /* ===== 视频解析类型 ===== */