Compare commits
38 Commits
e041523dbd
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c407a78991 | ||
|
|
f7611f2e65 | ||
|
|
68bdf51909 | ||
|
|
04d0356da1 | ||
|
|
a405d6bd6b | ||
|
|
d42d3592bb | ||
|
|
837012d57f | ||
|
|
7cf3622294 | ||
|
|
6062a38b99 | ||
|
|
1c43a318c6 | ||
|
|
2d319b7f7a | ||
|
|
09a3465197 | ||
|
|
3478c44860 | ||
|
|
5f835731fc | ||
|
|
ac01e66d26 | ||
|
|
941e499c17 | ||
|
|
45662dc642 | ||
|
|
42905bf6d3 | ||
|
|
ee076fc9aa | ||
|
|
f9066d8e60 | ||
|
|
469b684876 | ||
|
|
d724db6f0f | ||
|
|
ad838086ed | ||
|
|
6d2b117200 | ||
|
|
b9f24e07cf | ||
|
|
9fe16cd334 | ||
|
|
a976dc3fc5 | ||
|
|
3931382f9d | ||
|
|
189d7c02f5 | ||
|
|
83f762435b | ||
|
|
ca649f700f | ||
|
|
81e16a184f | ||
|
|
d2ffdf2954 | ||
|
|
40a49da672 | ||
|
|
5d5d9c3c52 | ||
|
|
309e2219f5 | ||
|
|
16eb25d552 | ||
|
|
c8e1641896 |
36
README.md
@@ -1,7 +1,35 @@
|
|||||||
# Tauri + Vue + TypeScript
|
# Chrom Tool
|
||||||
|
|
||||||
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
|
一个 Chromium 系浏览器本地数据管理工具。
|
||||||
|
|
||||||
## Recommended IDE Setup
|
## 功能
|
||||||
|
|
||||||
- [VS Code](https://code.visualstudio.com/) + [Vue - Official](https://marketplace.visualstudio.com/items?itemName=Vue.volar) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer)
|
- 扫描浏览器用户资料
|
||||||
|
- 查看已安装插件,并支持删除插件
|
||||||
|
- 查看书签,并支持删除书签
|
||||||
|
- 查看已保存登录站点
|
||||||
|
- 清理历史相关文件
|
||||||
|
- `History`
|
||||||
|
- `Top Sites`
|
||||||
|
- `Visited Links`
|
||||||
|
- `Sessions` 目录中的文件
|
||||||
|
- 支持自定义浏览器路径配置
|
||||||
|
|
||||||
|
## 当前支持
|
||||||
|
|
||||||
|
- Windows
|
||||||
|
- macOS
|
||||||
|
|
||||||
|
已适配的浏览器:
|
||||||
|
|
||||||
|
- Google Chrome
|
||||||
|
- Microsoft Edge
|
||||||
|
- Brave
|
||||||
|
- Vivaldi
|
||||||
|
- Yandex Browser
|
||||||
|
- Chromium
|
||||||
|
|
||||||
|
## 说明
|
||||||
|
|
||||||
|
- 项目主要面向 Chromium 系浏览器本地资料目录
|
||||||
|
- 部分删除或清理操作在浏览器运行中可能失败,建议先关闭对应浏览器
|
||||||
|
|||||||
BIN
app-icon.png
Normal file
|
After Width: | Height: | Size: 61 KiB |
55
app-icon.svg
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<svg width="1024" height="1024" viewBox="0 0 1024 1024" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<defs>
|
||||||
|
<linearGradient id="bgGradient" x1="188" y1="132" x2="850" y2="896" gradientUnits="userSpaceOnUse">
|
||||||
|
<stop offset="0" stop-color="#F8FBFF"/>
|
||||||
|
<stop offset="0.52" stop-color="#EAF2FF"/>
|
||||||
|
<stop offset="1" stop-color="#DDECF3"/>
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient id="panelGradient" x1="246" y1="214" x2="778" y2="812" gradientUnits="userSpaceOnUse">
|
||||||
|
<stop offset="0" stop-color="#0F2242"/>
|
||||||
|
<stop offset="0.58" stop-color="#2454A6"/>
|
||||||
|
<stop offset="1" stop-color="#138A8F"/>
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient id="orbitGradient" x1="322" y1="346" x2="690" y2="702" gradientUnits="userSpaceOnUse">
|
||||||
|
<stop offset="0" stop-color="#8AD8FF"/>
|
||||||
|
<stop offset="0.55" stop-color="#E7F4FF"/>
|
||||||
|
<stop offset="1" stop-color="#79F0D5"/>
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient id="lineGradient" x1="370" y1="334" x2="654" y2="650" gradientUnits="userSpaceOnUse">
|
||||||
|
<stop offset="0" stop-color="#9DD7FF"/>
|
||||||
|
<stop offset="1" stop-color="#6DE4C7"/>
|
||||||
|
</linearGradient>
|
||||||
|
<filter id="shadow" x="128" y="112" width="768" height="800" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||||
|
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||||
|
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||||
|
<feOffset dy="28"/>
|
||||||
|
<feGaussianBlur stdDeviation="32"/>
|
||||||
|
<feColorMatrix type="matrix" values="0 0 0 0 0.0588235 0 0 0 0 0.117647 0 0 0 0 0.25098 0 0 0 0.16 0"/>
|
||||||
|
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1_1"/>
|
||||||
|
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1_1" result="shape"/>
|
||||||
|
</filter>
|
||||||
|
</defs>
|
||||||
|
|
||||||
|
<rect x="64" y="64" width="896" height="896" rx="220" fill="url(#bgGradient)"/>
|
||||||
|
<circle cx="268" cy="232" r="168" fill="#6C91FF" fill-opacity="0.14"/>
|
||||||
|
<circle cx="792" cy="250" r="126" fill="#10B981" fill-opacity="0.14"/>
|
||||||
|
<circle cx="796" cy="786" r="156" fill="#2F6FED" fill-opacity="0.08"/>
|
||||||
|
|
||||||
|
<g filter="url(#shadow)">
|
||||||
|
<rect x="192" y="184" width="640" height="656" rx="164" fill="url(#panelGradient)"/>
|
||||||
|
<path d="M192 324C192 292.519 217.519 267 249 267H775C806.481 267 832 292.519 832 324V366H192V324Z" fill="white" fill-opacity="0.1"/>
|
||||||
|
<circle cx="280" cy="316" r="16" fill="white" fill-opacity="0.85"/>
|
||||||
|
<circle cx="338" cy="316" r="16" fill="white" fill-opacity="0.5"/>
|
||||||
|
<circle cx="396" cy="316" r="16" fill="white" fill-opacity="0.28"/>
|
||||||
|
|
||||||
|
<rect x="286" y="406" width="452" height="330" rx="126" stroke="url(#orbitGradient)" stroke-width="44"/>
|
||||||
|
<path d="M398 616L476 536L558 586L648 446" stroke="url(#lineGradient)" stroke-width="36" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<circle cx="398" cy="616" r="32" fill="#EAF6FF"/>
|
||||||
|
<circle cx="476" cy="536" r="32" fill="#D8F7F0"/>
|
||||||
|
<circle cx="558" cy="586" r="32" fill="#EAF6FF"/>
|
||||||
|
<circle cx="648" cy="446" r="32" fill="#D8F7F0"/>
|
||||||
|
|
||||||
|
<path d="M716 650C716 687.555 685.555 718 648 718H376" stroke="white" stroke-opacity="0.22" stroke-width="18" stroke-linecap="round"/>
|
||||||
|
<path d="M308 708H598" stroke="white" stroke-opacity="0.18" stroke-width="18" stroke-linecap="round"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 3.3 KiB |
@@ -4,7 +4,7 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Tauri + Vue + Typescript App</title>
|
<title>Chrom Tool</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
74
src-tauri/Cargo.lock
generated
@@ -8,6 +8,18 @@ version = "2.0.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
|
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ahash"
|
||||||
|
version = "0.8.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"once_cell",
|
||||||
|
"version_check",
|
||||||
|
"zerocopy",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aho-corasick"
|
name = "aho-corasick"
|
||||||
version = "1.1.4"
|
version = "1.1.4"
|
||||||
@@ -449,6 +461,7 @@ name = "chrom-tool"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
|
"rusqlite",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"tauri",
|
"tauri",
|
||||||
@@ -938,6 +951,18 @@ dependencies = [
|
|||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fallible-iterator"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fallible-streaming-iterator"
|
||||||
|
version = "0.1.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fastrand"
|
name = "fastrand"
|
||||||
version = "2.4.1"
|
version = "2.4.1"
|
||||||
@@ -1446,6 +1471,15 @@ version = "0.12.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hashbrown"
|
||||||
|
version = "0.14.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
|
||||||
|
dependencies = [
|
||||||
|
"ahash",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hashbrown"
|
name = "hashbrown"
|
||||||
version = "0.15.5"
|
version = "0.15.5"
|
||||||
@@ -1461,6 +1495,15 @@ version = "0.17.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51"
|
checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hashlink"
|
||||||
|
version = "0.9.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af"
|
||||||
|
dependencies = [
|
||||||
|
"hashbrown 0.14.5",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "heck"
|
name = "heck"
|
||||||
version = "0.4.1"
|
version = "0.4.1"
|
||||||
@@ -1990,6 +2033,17 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libsqlite3-sys"
|
||||||
|
version = "0.30.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
"pkg-config",
|
||||||
|
"vcpkg",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "linux-raw-sys"
|
name = "linux-raw-sys"
|
||||||
version = "0.12.1"
|
version = "0.12.1"
|
||||||
@@ -3033,6 +3087,20 @@ dependencies = [
|
|||||||
"windows-sys 0.60.2",
|
"windows-sys 0.60.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rusqlite"
|
||||||
|
version = "0.32.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7753b721174eb8ff87a9a0e799e2d7bc3749323e773db92e0984debb00019d6e"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.11.1",
|
||||||
|
"fallible-iterator",
|
||||||
|
"fallible-streaming-iterator",
|
||||||
|
"hashlink",
|
||||||
|
"libsqlite3-sys",
|
||||||
|
"smallvec",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustc-hash"
|
name = "rustc-hash"
|
||||||
version = "2.1.2"
|
version = "2.1.2"
|
||||||
@@ -4421,6 +4489,12 @@ dependencies = [
|
|||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "vcpkg"
|
||||||
|
version = "0.2.15"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "version-compare"
|
name = "version-compare"
|
||||||
version = "0.2.1"
|
version = "0.2.1"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "chrom-tool"
|
name = "chrom-tool"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
description = "A Tauri App"
|
description = "A local data management tool for Chromium-based browsers."
|
||||||
authors = ["you"]
|
authors = ["julianf4r"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
@@ -24,4 +24,4 @@ serde = { version = "1", features = ["derive"] }
|
|||||||
serde_json = "1"
|
serde_json = "1"
|
||||||
base64 = "0.22"
|
base64 = "0.22"
|
||||||
tauri-plugin-dialog = "2.7.0"
|
tauri-plugin-dialog = "2.7.0"
|
||||||
|
rusqlite = { version = "0.32", features = ["bundled"] }
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 974 B After Width: | Height: | Size: 2.3 KiB |
BIN
src-tauri/icons/64x64.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 903 B After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 4.2 KiB |
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||||
|
<background android:drawable="@color/ic_launcher_background"/>
|
||||||
|
</adaptive-icon>
|
||||||
BIN
src-tauri/icons/android/mipmap-hdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
src-tauri/icons/android/mipmap-hdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
src-tauri/icons/android/mipmap-hdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
src-tauri/icons/android/mipmap-mdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
src-tauri/icons/android/mipmap-mdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
src-tauri/icons/android/mipmap-mdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
src-tauri/icons/android/mipmap-xhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 9.3 KiB |
BIN
src-tauri/icons/android/mipmap-xhdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
src-tauri/icons/android/mipmap-xhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 9.1 KiB |
BIN
src-tauri/icons/android/mipmap-xxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 65 KiB |
BIN
src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="ic_launcher_background">#fff</color>
|
||||||
|
</resources>
|
||||||
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 48 KiB |
BIN
src-tauri/icons/ios/AppIcon-20x20@1x.png
Normal file
|
After Width: | Height: | Size: 1014 B |
BIN
src-tauri/icons/ios/AppIcon-20x20@2x-1.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
src-tauri/icons/ios/AppIcon-20x20@2x.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
src-tauri/icons/ios/AppIcon-20x20@3x.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
BIN
src-tauri/icons/ios/AppIcon-29x29@1x.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
src-tauri/icons/ios/AppIcon-29x29@2x-1.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
src-tauri/icons/ios/AppIcon-29x29@2x.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
src-tauri/icons/ios/AppIcon-29x29@3x.png
Normal file
|
After Width: | Height: | Size: 8.5 KiB |
BIN
src-tauri/icons/ios/AppIcon-40x40@1x.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
src-tauri/icons/ios/AppIcon-40x40@2x-1.png
Normal file
|
After Width: | Height: | Size: 7.5 KiB |
BIN
src-tauri/icons/ios/AppIcon-40x40@2x.png
Normal file
|
After Width: | Height: | Size: 7.5 KiB |
BIN
src-tauri/icons/ios/AppIcon-40x40@3x.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
src-tauri/icons/ios/AppIcon-512@2x.png
Normal file
|
After Width: | Height: | Size: 186 KiB |
BIN
src-tauri/icons/ios/AppIcon-60x60@2x.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
src-tauri/icons/ios/AppIcon-60x60@3x.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
src-tauri/icons/ios/AppIcon-76x76@1x.png
Normal file
|
After Width: | Height: | Size: 7.0 KiB |
BIN
src-tauri/icons/ios/AppIcon-76x76@2x.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
src-tauri/icons/ios/AppIcon-83.5x83.5@2x.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
@@ -3,6 +3,60 @@ use std::{env, path::PathBuf};
|
|||||||
use crate::models::BrowserDefinition;
|
use crate::models::BrowserDefinition;
|
||||||
|
|
||||||
pub fn browser_definitions() -> Vec<BrowserDefinition> {
|
pub fn browser_definitions() -> Vec<BrowserDefinition> {
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
{
|
||||||
|
return vec![
|
||||||
|
BrowserDefinition {
|
||||||
|
id: "chrome",
|
||||||
|
name: "Google Chrome",
|
||||||
|
local_app_data_segments: &["Google", "Chrome"],
|
||||||
|
executable_candidates: &[ExecutableCandidate::Absolute(
|
||||||
|
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
|
||||||
|
)],
|
||||||
|
},
|
||||||
|
BrowserDefinition {
|
||||||
|
id: "edge",
|
||||||
|
name: "Microsoft Edge",
|
||||||
|
local_app_data_segments: &["Microsoft Edge"],
|
||||||
|
executable_candidates: &[ExecutableCandidate::Absolute(
|
||||||
|
"/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge",
|
||||||
|
)],
|
||||||
|
},
|
||||||
|
BrowserDefinition {
|
||||||
|
id: "brave",
|
||||||
|
name: "Brave",
|
||||||
|
local_app_data_segments: &["BraveSoftware", "Brave-Browser"],
|
||||||
|
executable_candidates: &[ExecutableCandidate::Absolute(
|
||||||
|
"/Applications/Brave Browser.app/Contents/MacOS/Brave Browser",
|
||||||
|
)],
|
||||||
|
},
|
||||||
|
BrowserDefinition {
|
||||||
|
id: "vivaldi",
|
||||||
|
name: "Vivaldi",
|
||||||
|
local_app_data_segments: &["Vivaldi"],
|
||||||
|
executable_candidates: &[ExecutableCandidate::Absolute(
|
||||||
|
"/Applications/Vivaldi.app/Contents/MacOS/Vivaldi",
|
||||||
|
)],
|
||||||
|
},
|
||||||
|
BrowserDefinition {
|
||||||
|
id: "yandex",
|
||||||
|
name: "Yandex Browser",
|
||||||
|
local_app_data_segments: &["Yandex", "YandexBrowser"],
|
||||||
|
executable_candidates: &[ExecutableCandidate::Absolute(
|
||||||
|
"/Applications/Yandex.app/Contents/MacOS/Yandex",
|
||||||
|
)],
|
||||||
|
},
|
||||||
|
BrowserDefinition {
|
||||||
|
id: "chromium",
|
||||||
|
name: "Chromium",
|
||||||
|
local_app_data_segments: &["Chromium"],
|
||||||
|
executable_candidates: &[ExecutableCandidate::Absolute(
|
||||||
|
"/Applications/Chromium.app/Contents/MacOS/Chromium",
|
||||||
|
)],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
vec![
|
vec![
|
||||||
BrowserDefinition {
|
BrowserDefinition {
|
||||||
id: "chrome",
|
id: "chrome",
|
||||||
@@ -73,6 +127,35 @@ pub fn browser_definitions() -> Vec<BrowserDefinition> {
|
|||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
BrowserDefinition {
|
||||||
|
id: "vivaldi",
|
||||||
|
name: "Vivaldi",
|
||||||
|
local_app_data_segments: &["Vivaldi", "User Data"],
|
||||||
|
executable_candidates: &[
|
||||||
|
ExecutableCandidate::LocalAppData(&["Vivaldi", "Application", "vivaldi.exe"]),
|
||||||
|
ExecutableCandidate::ProgramFiles(&["Vivaldi", "Application", "vivaldi.exe"]),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
BrowserDefinition {
|
||||||
|
id: "yandex",
|
||||||
|
name: "Yandex Browser",
|
||||||
|
local_app_data_segments: &["Yandex", "YandexBrowser", "User Data"],
|
||||||
|
executable_candidates: &[ExecutableCandidate::LocalAppData(&[
|
||||||
|
"Yandex",
|
||||||
|
"YandexBrowser",
|
||||||
|
"Application",
|
||||||
|
"browser.exe",
|
||||||
|
])],
|
||||||
|
},
|
||||||
|
BrowserDefinition {
|
||||||
|
id: "chromium",
|
||||||
|
name: "Chromium",
|
||||||
|
local_app_data_segments: &["Chromium", "User Data"],
|
||||||
|
executable_candidates: &[
|
||||||
|
ExecutableCandidate::LocalAppData(&["Chromium", "Application", "chrome.exe"]),
|
||||||
|
ExecutableCandidate::ProgramFiles(&["Chromium", "Application", "chrome.exe"]),
|
||||||
|
],
|
||||||
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,6 +185,8 @@ fn resolve_executable_candidate(candidate: &ExecutableCandidate) -> Option<PathB
|
|||||||
ExecutableCandidate::LocalAppData(segments) => env::var_os("LOCALAPPDATA")
|
ExecutableCandidate::LocalAppData(segments) => env::var_os("LOCALAPPDATA")
|
||||||
.map(PathBuf::from)
|
.map(PathBuf::from)
|
||||||
.map(|root| join_segments(root, segments)),
|
.map(|root| join_segments(root, segments)),
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
ExecutableCandidate::Absolute(path) => Some(PathBuf::from(path)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,4 +201,6 @@ pub enum ExecutableCandidate {
|
|||||||
ProgramFiles(&'static [&'static str]),
|
ProgramFiles(&'static [&'static str]),
|
||||||
ProgramFilesX86(&'static [&'static str]),
|
ProgramFilesX86(&'static [&'static str]),
|
||||||
LocalAppData(&'static [&'static str]),
|
LocalAppData(&'static [&'static str]),
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
Absolute(&'static str),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,37 @@
|
|||||||
use std::{path::PathBuf, process::Command};
|
use std::{
|
||||||
|
fs,
|
||||||
|
path::{Path, PathBuf},
|
||||||
|
process::Command,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
config_store,
|
config_store,
|
||||||
models::{BrowserConfigListResponse, CreateCustomBrowserConfigInput, ScanResponse},
|
models::{
|
||||||
|
BookmarkRemovalRequest, BrowserConfigListResponse, CleanupHistoryInput,
|
||||||
|
CleanupHistoryResponse, CleanupHistoryResult, CreateCustomBrowserConfigInput,
|
||||||
|
ExtensionInstallSourceSummary, RemoveBookmarkResult, RemoveBookmarksInput,
|
||||||
|
RemoveBookmarksResponse, RemoveExtensionResult, RemoveExtensionsInput,
|
||||||
|
RemoveExtensionsResponse, PasswordSitesResponse, ScanResponse,
|
||||||
|
},
|
||||||
scanner,
|
scanner,
|
||||||
|
utils::decode_base64_literal,
|
||||||
};
|
};
|
||||||
use tauri::AppHandle;
|
use tauri::AppHandle;
|
||||||
|
use serde_json::Value;
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub fn scan_browsers(app: AppHandle) -> Result<ScanResponse, String> {
|
pub fn scan_browsers(app: AppHandle) -> Result<ScanResponse, String> {
|
||||||
scanner::scan_browsers(&app)
|
scanner::scan_browsers(&app)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
pub fn scan_password_sites(
|
||||||
|
app: AppHandle,
|
||||||
|
browser_id: String,
|
||||||
|
) -> Result<PasswordSitesResponse, String> {
|
||||||
|
scanner::scan_password_sites(&app, &browser_id)
|
||||||
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub fn list_browser_configs(app: AppHandle) -> Result<BrowserConfigListResponse, String> {
|
pub fn list_browser_configs(app: AppHandle) -> Result<BrowserConfigListResponse, String> {
|
||||||
config_store::load_browser_config_list(&app)
|
config_store::load_browser_config_list(&app)
|
||||||
@@ -61,6 +81,89 @@ pub fn open_browser_profile(
|
|||||||
spawn_browser_process(executable_path, user_data_dir, profile_id)
|
spawn_browser_process(executable_path, user_data_dir, profile_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
pub fn cleanup_history_files(
|
||||||
|
app: AppHandle,
|
||||||
|
input: CleanupHistoryInput,
|
||||||
|
) -> Result<CleanupHistoryResponse, String> {
|
||||||
|
let config = config_store::find_browser_config(&app, &input.browser_id)?;
|
||||||
|
let user_data_dir = PathBuf::from(&config.user_data_path);
|
||||||
|
|
||||||
|
if !user_data_dir.is_dir() {
|
||||||
|
return Err(format!(
|
||||||
|
"User data directory does not exist: {}",
|
||||||
|
user_data_dir.display()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut results = Vec::new();
|
||||||
|
for profile_id in input.profile_ids {
|
||||||
|
let profile_path = user_data_dir.join(&profile_id);
|
||||||
|
let result = cleanup_profile_history_files(&profile_path, &profile_id);
|
||||||
|
results.push(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(CleanupHistoryResponse { results })
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
pub fn remove_extensions(
|
||||||
|
app: AppHandle,
|
||||||
|
input: RemoveExtensionsInput,
|
||||||
|
) -> Result<RemoveExtensionsResponse, String> {
|
||||||
|
let config = config_store::find_browser_config(&app, &input.browser_id)?;
|
||||||
|
let user_data_dir = PathBuf::from(&config.user_data_path);
|
||||||
|
|
||||||
|
if !user_data_dir.is_dir() {
|
||||||
|
return Err(format!(
|
||||||
|
"User data directory does not exist: {}",
|
||||||
|
user_data_dir.display()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut results = Vec::new();
|
||||||
|
for removal in input.removals {
|
||||||
|
for profile_id in removal.profile_ids {
|
||||||
|
results.push(remove_extension_from_profile(
|
||||||
|
&user_data_dir.join(&profile_id),
|
||||||
|
&removal.extension_id,
|
||||||
|
&profile_id,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(RemoveExtensionsResponse { results })
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
pub fn remove_bookmarks(
|
||||||
|
app: AppHandle,
|
||||||
|
input: RemoveBookmarksInput,
|
||||||
|
) -> Result<RemoveBookmarksResponse, String> {
|
||||||
|
let config = config_store::find_browser_config(&app, &input.browser_id)?;
|
||||||
|
let user_data_dir = PathBuf::from(&config.user_data_path);
|
||||||
|
|
||||||
|
if !user_data_dir.is_dir() {
|
||||||
|
return Err(format!(
|
||||||
|
"User data directory does not exist: {}",
|
||||||
|
user_data_dir.display()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut results = Vec::new();
|
||||||
|
for removal in input.removals {
|
||||||
|
for profile_id in &removal.profile_ids {
|
||||||
|
results.push(remove_bookmark_from_profile(
|
||||||
|
&user_data_dir.join(profile_id),
|
||||||
|
&removal,
|
||||||
|
profile_id,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(RemoveBookmarksResponse { results })
|
||||||
|
}
|
||||||
|
|
||||||
fn spawn_browser_process(
|
fn spawn_browser_process(
|
||||||
executable_path: PathBuf,
|
executable_path: PathBuf,
|
||||||
user_data_dir: PathBuf,
|
user_data_dir: PathBuf,
|
||||||
@@ -79,3 +182,490 @@ fn spawn_browser_process(
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn cleanup_profile_history_files(profile_path: &Path, profile_id: &str) -> CleanupHistoryResult {
|
||||||
|
if !profile_path.is_dir() {
|
||||||
|
return CleanupHistoryResult {
|
||||||
|
profile_id: profile_id.to_string(),
|
||||||
|
deleted_files: Vec::new(),
|
||||||
|
skipped_files: Vec::new(),
|
||||||
|
error: Some(format!(
|
||||||
|
"Profile directory does not exist: {}",
|
||||||
|
profile_path.display()
|
||||||
|
)),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut deleted_files = Vec::new();
|
||||||
|
let mut skipped_files = Vec::new();
|
||||||
|
|
||||||
|
for file_name in cleanup_file_names() {
|
||||||
|
let file_path = profile_path.join(&file_name);
|
||||||
|
if !file_path.exists() {
|
||||||
|
skipped_files.push(file_name);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Err(error) = fs::remove_file(&file_path) {
|
||||||
|
return CleanupHistoryResult {
|
||||||
|
profile_id: profile_id.to_string(),
|
||||||
|
deleted_files,
|
||||||
|
skipped_files,
|
||||||
|
error: Some(format!("Failed to delete {}: {error}", file_path.display())),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
deleted_files.push(file_name);
|
||||||
|
remove_sidecar_files(&file_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
let sessions_name = decoded_literal("U2Vzc2lvbnM=");
|
||||||
|
let sessions_directory = profile_path.join(&sessions_name);
|
||||||
|
match cleanup_sessions_directory(&sessions_directory) {
|
||||||
|
Ok(session_deleted) => {
|
||||||
|
if session_deleted {
|
||||||
|
deleted_files.push(sessions_name.clone());
|
||||||
|
} else {
|
||||||
|
skipped_files.push(sessions_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(error) => {
|
||||||
|
return CleanupHistoryResult {
|
||||||
|
profile_id: profile_id.to_string(),
|
||||||
|
deleted_files,
|
||||||
|
skipped_files,
|
||||||
|
error: Some(format!(
|
||||||
|
"Failed to clean {}: {error}",
|
||||||
|
sessions_directory.display()
|
||||||
|
)),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CleanupHistoryResult {
|
||||||
|
profile_id: profile_id.to_string(),
|
||||||
|
deleted_files,
|
||||||
|
skipped_files,
|
||||||
|
error: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn remove_extension_from_profile(
|
||||||
|
profile_path: &Path,
|
||||||
|
extension_id: &str,
|
||||||
|
profile_id: &str,
|
||||||
|
) -> RemoveExtensionResult {
|
||||||
|
if !profile_path.is_dir() {
|
||||||
|
return RemoveExtensionResult {
|
||||||
|
extension_id: extension_id.to_string(),
|
||||||
|
profile_id: profile_id.to_string(),
|
||||||
|
removed_files: Vec::new(),
|
||||||
|
skipped_files: Vec::new(),
|
||||||
|
error: Some(format!(
|
||||||
|
"Profile directory does not exist: {}",
|
||||||
|
profile_path.display()
|
||||||
|
)),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
let secure_preferences_path = profile_path.join(decoded_literal("U2VjdXJlIFByZWZlcmVuY2Vz"));
|
||||||
|
let preferences_path = profile_path.join(decoded_literal("UHJlZmVyZW5jZXM="));
|
||||||
|
let mut removed_files = Vec::new();
|
||||||
|
let mut skipped_files = Vec::new();
|
||||||
|
|
||||||
|
let secure_preferences_outcome =
|
||||||
|
remove_extension_from_secure_preferences(&secure_preferences_path, extension_id);
|
||||||
|
let install_source = match secure_preferences_outcome {
|
||||||
|
Ok(Some(source)) => {
|
||||||
|
removed_files.push(decoded_literal("U2VjdXJlIFByZWZlcmVuY2Vz"));
|
||||||
|
source
|
||||||
|
}
|
||||||
|
Ok(None) => {
|
||||||
|
skipped_files.push(decoded_literal("U2VjdXJlIFByZWZlcmVuY2Vz"));
|
||||||
|
ExtensionInstallSourceSummary::External
|
||||||
|
}
|
||||||
|
Err(error) => {
|
||||||
|
return RemoveExtensionResult {
|
||||||
|
extension_id: extension_id.to_string(),
|
||||||
|
profile_id: profile_id.to_string(),
|
||||||
|
removed_files,
|
||||||
|
skipped_files,
|
||||||
|
error: Some(error),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
match remove_extension_from_preferences(&preferences_path, extension_id) {
|
||||||
|
Ok(true) => removed_files.push(decoded_literal("UHJlZmVyZW5jZXM=")),
|
||||||
|
Ok(false) => skipped_files.push(decoded_literal("UHJlZmVyZW5jZXM=")),
|
||||||
|
Err(error) => {
|
||||||
|
return RemoveExtensionResult {
|
||||||
|
extension_id: extension_id.to_string(),
|
||||||
|
profile_id: profile_id.to_string(),
|
||||||
|
removed_files,
|
||||||
|
skipped_files,
|
||||||
|
error: Some(error),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if install_source == ExtensionInstallSourceSummary::Store {
|
||||||
|
let extension_directory = profile_path
|
||||||
|
.join(decoded_literal("RXh0ZW5zaW9ucw=="))
|
||||||
|
.join(extension_id);
|
||||||
|
if extension_directory.is_dir() {
|
||||||
|
if let Err(error) = fs::remove_dir_all(&extension_directory) {
|
||||||
|
return RemoveExtensionResult {
|
||||||
|
extension_id: extension_id.to_string(),
|
||||||
|
profile_id: profile_id.to_string(),
|
||||||
|
removed_files,
|
||||||
|
skipped_files,
|
||||||
|
error: Some(format!(
|
||||||
|
"Failed to delete {}: {error}",
|
||||||
|
extension_directory.display()
|
||||||
|
)),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
removed_files.push(decoded_literal("RXh0ZW5zaW9ucw=="));
|
||||||
|
} else {
|
||||||
|
skipped_files.push(decoded_literal("RXh0ZW5zaW9ucw=="));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RemoveExtensionResult {
|
||||||
|
extension_id: extension_id.to_string(),
|
||||||
|
profile_id: profile_id.to_string(),
|
||||||
|
removed_files,
|
||||||
|
skipped_files,
|
||||||
|
error: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn remove_bookmark_from_profile(
|
||||||
|
profile_path: &Path,
|
||||||
|
removal: &BookmarkRemovalRequest,
|
||||||
|
profile_id: &str,
|
||||||
|
) -> RemoveBookmarkResult {
|
||||||
|
if !profile_path.is_dir() {
|
||||||
|
return RemoveBookmarkResult {
|
||||||
|
url: removal.url.clone(),
|
||||||
|
profile_id: profile_id.to_string(),
|
||||||
|
removed_count: 0,
|
||||||
|
removed_files: Vec::new(),
|
||||||
|
skipped_files: Vec::new(),
|
||||||
|
error: Some(format!(
|
||||||
|
"Profile directory does not exist: {}",
|
||||||
|
profile_path.display()
|
||||||
|
)),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut removed_files = Vec::new();
|
||||||
|
let mut skipped_files = Vec::new();
|
||||||
|
|
||||||
|
let removed_backup = remove_bookmark_backups(profile_path).map_err(|error| RemoveBookmarkResult {
|
||||||
|
url: removal.url.clone(),
|
||||||
|
profile_id: profile_id.to_string(),
|
||||||
|
removed_count: 0,
|
||||||
|
removed_files: removed_files.clone(),
|
||||||
|
skipped_files: skipped_files.clone(),
|
||||||
|
error: Some(error),
|
||||||
|
});
|
||||||
|
let removed_backup = match removed_backup {
|
||||||
|
Ok(value) => value,
|
||||||
|
Err(result) => return result,
|
||||||
|
};
|
||||||
|
if removed_backup {
|
||||||
|
removed_files.push(decoded_literal("Qm9va21hcmtzLmJhaw=="));
|
||||||
|
} else {
|
||||||
|
skipped_files.push(decoded_literal("Qm9va21hcmtzLmJhaw=="));
|
||||||
|
}
|
||||||
|
|
||||||
|
let Some(bookmarks_path) = resolve_bookmarks_path(profile_path) else {
|
||||||
|
return RemoveBookmarkResult {
|
||||||
|
url: removal.url.clone(),
|
||||||
|
profile_id: profile_id.to_string(),
|
||||||
|
removed_count: 0,
|
||||||
|
removed_files,
|
||||||
|
skipped_files,
|
||||||
|
error: Some(format!(
|
||||||
|
"Bookmarks file does not exist in {}",
|
||||||
|
profile_path.display()
|
||||||
|
)),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut document = match read_json_document(&bookmarks_path) {
|
||||||
|
Ok(document) => document,
|
||||||
|
Err(error) => {
|
||||||
|
return RemoveBookmarkResult {
|
||||||
|
url: removal.url.clone(),
|
||||||
|
profile_id: profile_id.to_string(),
|
||||||
|
removed_count: 0,
|
||||||
|
removed_files,
|
||||||
|
skipped_files,
|
||||||
|
error: Some(error),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let checksum_removed = document
|
||||||
|
.as_object_mut()
|
||||||
|
.and_then(|object| object.remove("checksum"))
|
||||||
|
.is_some();
|
||||||
|
let removed_count = remove_matching_bookmarks(&mut document, &removal.url);
|
||||||
|
|
||||||
|
if checksum_removed || removed_count > 0 {
|
||||||
|
if let Err(error) = write_json_document(&bookmarks_path, &document) {
|
||||||
|
return RemoveBookmarkResult {
|
||||||
|
url: removal.url.clone(),
|
||||||
|
profile_id: profile_id.to_string(),
|
||||||
|
removed_count: 0,
|
||||||
|
removed_files,
|
||||||
|
skipped_files,
|
||||||
|
error: Some(error),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
removed_files.push(decoded_literal("Qm9va21hcmtz"));
|
||||||
|
} else {
|
||||||
|
skipped_files.push(decoded_literal("Qm9va21hcmtz"));
|
||||||
|
}
|
||||||
|
|
||||||
|
RemoveBookmarkResult {
|
||||||
|
url: removal.url.clone(),
|
||||||
|
profile_id: profile_id.to_string(),
|
||||||
|
removed_count,
|
||||||
|
removed_files,
|
||||||
|
skipped_files,
|
||||||
|
error: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn remove_extension_from_secure_preferences(
|
||||||
|
path: &Path,
|
||||||
|
extension_id: &str,
|
||||||
|
) -> Result<Option<ExtensionInstallSourceSummary>, String> {
|
||||||
|
let mut document = read_json_document(path)?;
|
||||||
|
let install_source = document
|
||||||
|
.get("extensions")
|
||||||
|
.and_then(|value| value.get("settings"))
|
||||||
|
.and_then(|value| value.get(extension_id))
|
||||||
|
.and_then(|value| value.get("path"))
|
||||||
|
.and_then(Value::as_str)
|
||||||
|
.map(detect_extension_install_source)
|
||||||
|
.unwrap_or(ExtensionInstallSourceSummary::External);
|
||||||
|
|
||||||
|
let mut changed = false;
|
||||||
|
changed |= remove_object_key(
|
||||||
|
&mut document,
|
||||||
|
&["extensions", "settings"],
|
||||||
|
extension_id,
|
||||||
|
);
|
||||||
|
changed |= remove_object_key(
|
||||||
|
&mut document,
|
||||||
|
&["protection", "macs", "extensions", "settings"],
|
||||||
|
extension_id,
|
||||||
|
);
|
||||||
|
changed |= remove_object_key(
|
||||||
|
&mut document,
|
||||||
|
&["protection", "macs", "extensions", "settings_encrypted_hash"],
|
||||||
|
extension_id,
|
||||||
|
);
|
||||||
|
|
||||||
|
if changed {
|
||||||
|
write_json_document(path, &document)?;
|
||||||
|
Ok(Some(install_source))
|
||||||
|
} else {
|
||||||
|
Ok(None)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn remove_extension_from_preferences(path: &Path, extension_id: &str) -> Result<bool, String> {
|
||||||
|
let mut document = read_json_document(path)?;
|
||||||
|
let mut changed = false;
|
||||||
|
|
||||||
|
if let Some(pinned_extensions) = get_value_mut(&mut document, &["extensions", "pinned_extensions"])
|
||||||
|
{
|
||||||
|
if let Some(array) = pinned_extensions.as_array_mut() {
|
||||||
|
let original_len = array.len();
|
||||||
|
array.retain(|value| value.as_str() != Some(extension_id));
|
||||||
|
changed |= array.len() != original_len;
|
||||||
|
} else if let Some(object) = pinned_extensions.as_object_mut() {
|
||||||
|
changed |= object.remove(extension_id).is_some();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if changed {
|
||||||
|
write_json_document(path, &document)?;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(changed)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn detect_extension_install_source(raw_path: &str) -> ExtensionInstallSourceSummary {
|
||||||
|
let normalized_path = raw_path.trim().trim_start_matches('/');
|
||||||
|
if normalized_path.is_empty() {
|
||||||
|
return ExtensionInstallSourceSummary::External;
|
||||||
|
}
|
||||||
|
|
||||||
|
let candidate = PathBuf::from(normalized_path);
|
||||||
|
if candidate.is_absolute() {
|
||||||
|
ExtensionInstallSourceSummary::External
|
||||||
|
} else {
|
||||||
|
ExtensionInstallSourceSummary::Store
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn read_json_document(path: &Path) -> Result<Value, String> {
|
||||||
|
let content = fs::read_to_string(path)
|
||||||
|
.map_err(|error| format!("Failed to read {}: {error}", path.display()))?;
|
||||||
|
serde_json::from_str(&content)
|
||||||
|
.map_err(|error| format!("Failed to parse {}: {error}", path.display()))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write_json_document(path: &Path, document: &Value) -> Result<(), String> {
|
||||||
|
let content = serde_json::to_string_pretty(document)
|
||||||
|
.map_err(|error| format!("Failed to serialize {}: {error}", path.display()))?;
|
||||||
|
fs::write(path, content).map_err(|error| format!("Failed to write {}: {error}", path.display()))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn remove_object_key(document: &mut Value, object_path: &[&str], key: &str) -> bool {
|
||||||
|
get_value_mut(document, object_path)
|
||||||
|
.and_then(Value::as_object_mut)
|
||||||
|
.and_then(|object| object.remove(key))
|
||||||
|
.is_some()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_value_mut<'a>(document: &'a mut Value, path: &[&str]) -> Option<&'a mut Value> {
|
||||||
|
let mut current = document;
|
||||||
|
for segment in path {
|
||||||
|
current = current.get_mut(*segment)?;
|
||||||
|
}
|
||||||
|
Some(current)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn remove_sidecar_files(path: &Path) {
|
||||||
|
for suffix in ["-journal", "-wal", "-shm"] {
|
||||||
|
let sidecar = PathBuf::from(format!("{}{}", path.display(), suffix));
|
||||||
|
if sidecar.is_file() {
|
||||||
|
let _ = fs::remove_file(sidecar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn cleanup_file_names() -> Vec<String> {
|
||||||
|
[
|
||||||
|
"SGlzdG9yeQ==",
|
||||||
|
"VG9wIFNpdGVz",
|
||||||
|
"VmlzaXRlZCBMaW5rcw==",
|
||||||
|
"U2hvcnRjdXRz",
|
||||||
|
]
|
||||||
|
.into_iter()
|
||||||
|
.map(decoded_literal)
|
||||||
|
.filter(|value| !value.is_empty())
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn cleanup_sessions_directory(path: &Path) -> Result<bool, std::io::Error> {
|
||||||
|
if !path.is_dir() {
|
||||||
|
return Ok(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut deleted_any = false;
|
||||||
|
for entry in path.read_dir()? {
|
||||||
|
let entry = entry?;
|
||||||
|
let entry_path = entry.path();
|
||||||
|
if entry_path.is_file() {
|
||||||
|
fs::remove_file(&entry_path)?;
|
||||||
|
deleted_any = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(deleted_any)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn remove_bookmark_backups(profile_path: &Path) -> Result<bool, String> {
|
||||||
|
let mut deleted_any = false;
|
||||||
|
for backup_name in bookmark_backup_names() {
|
||||||
|
let backup_path = profile_path.join(backup_name);
|
||||||
|
if !backup_path.is_file() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
fs::remove_file(&backup_path)
|
||||||
|
.map_err(|error| format!("Failed to delete {}: {error}", backup_path.display()))?;
|
||||||
|
deleted_any = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(deleted_any)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn resolve_bookmarks_path(profile_path: &Path) -> Option<PathBuf> {
|
||||||
|
bookmark_file_names()
|
||||||
|
.into_iter()
|
||||||
|
.map(|name| profile_path.join(name))
|
||||||
|
.find(|path| path.is_file())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn bookmark_backup_names() -> Vec<String> {
|
||||||
|
["Qm9va21hcmtzLmJhaw==", "Qm9va21hcmsuYmFr"]
|
||||||
|
.into_iter()
|
||||||
|
.map(decoded_literal)
|
||||||
|
.filter(|value| !value.is_empty())
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn bookmark_file_names() -> Vec<String> {
|
||||||
|
["Qm9va21hcmtz", "Qm9va21hcms="]
|
||||||
|
.into_iter()
|
||||||
|
.map(decoded_literal)
|
||||||
|
.filter(|value| !value.is_empty())
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn decoded_literal(encoded: &str) -> String {
|
||||||
|
decode_base64_literal(encoded).unwrap_or_default()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn remove_matching_bookmarks(value: &mut Value, target_url: &str) -> usize {
|
||||||
|
match value {
|
||||||
|
Value::Object(object) => {
|
||||||
|
let mut removed_count = 0;
|
||||||
|
|
||||||
|
if let Some(children) = object.get_mut("children").and_then(Value::as_array_mut) {
|
||||||
|
let mut index = 0;
|
||||||
|
while index < children.len() {
|
||||||
|
let matches_url = children[index]
|
||||||
|
.as_object()
|
||||||
|
.map(|child| {
|
||||||
|
child.get("type").and_then(Value::as_str) == Some("url")
|
||||||
|
&& child.get("url").and_then(Value::as_str) == Some(target_url)
|
||||||
|
})
|
||||||
|
.unwrap_or(false);
|
||||||
|
|
||||||
|
if matches_url {
|
||||||
|
children.remove(index);
|
||||||
|
removed_count += 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
removed_count += remove_matching_bookmarks(&mut children[index], target_url);
|
||||||
|
index += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (key, child) in object.iter_mut() {
|
||||||
|
if key == "children" {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
removed_count += remove_matching_bookmarks(child, target_url);
|
||||||
|
}
|
||||||
|
|
||||||
|
removed_count
|
||||||
|
}
|
||||||
|
Value::Array(array) => array
|
||||||
|
.iter_mut()
|
||||||
|
.map(|item| remove_matching_bookmarks(item, target_url))
|
||||||
|
.sum(),
|
||||||
|
_ => 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use crate::{
|
|||||||
BrowserConfigEntry, BrowserConfigListResponse, BrowserConfigSource,
|
BrowserConfigEntry, BrowserConfigListResponse, BrowserConfigSource,
|
||||||
CreateCustomBrowserConfigInput, CustomBrowserConfigRecord, StoredBrowserConfigs,
|
CreateCustomBrowserConfigInput, CustomBrowserConfigRecord, StoredBrowserConfigs,
|
||||||
},
|
},
|
||||||
utils::local_app_data_dir,
|
utils::platform_user_data_root_dir,
|
||||||
};
|
};
|
||||||
|
|
||||||
const CONFIG_FILE_NAME: &str = "browser-configs.json";
|
const CONFIG_FILE_NAME: &str = "browser-configs.json";
|
||||||
@@ -113,8 +113,8 @@ pub fn find_browser_config(app: &AppHandle, config_id: &str) -> Result<BrowserCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn default_browser_configs() -> Result<Vec<BrowserConfigEntry>, String> {
|
fn default_browser_configs() -> Result<Vec<BrowserConfigEntry>, String> {
|
||||||
let local_app_data = local_app_data_dir().ok_or_else(|| {
|
let user_data_root = platform_user_data_root_dir().ok_or_else(|| {
|
||||||
"Unable to resolve the LOCALAPPDATA directory for the current user.".to_string()
|
"Unable to resolve the default browser data directory for the current user.".to_string()
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
Ok(browser_definitions()
|
Ok(browser_definitions()
|
||||||
@@ -123,7 +123,7 @@ fn default_browser_configs() -> Result<Vec<BrowserConfigEntry>, String> {
|
|||||||
let user_data_path = definition
|
let user_data_path = definition
|
||||||
.local_app_data_segments
|
.local_app_data_segments
|
||||||
.iter()
|
.iter()
|
||||||
.fold(local_app_data.clone(), |path, segment| path.join(segment));
|
.fold(user_data_root.clone(), |path, segment| path.join(segment));
|
||||||
|
|
||||||
BrowserConfigEntry {
|
BrowserConfigEntry {
|
||||||
id: definition.id.to_string(),
|
id: definition.id.to_string(),
|
||||||
@@ -205,6 +205,9 @@ fn infer_browser_family_id(icon_key: Option<&str>) -> Option<String> {
|
|||||||
Some("chrome") => Some("chrome".to_string()),
|
Some("chrome") => Some("chrome".to_string()),
|
||||||
Some("edge") => Some("edge".to_string()),
|
Some("edge") => Some("edge".to_string()),
|
||||||
Some("brave") => Some("brave".to_string()),
|
Some("brave") => Some("brave".to_string()),
|
||||||
|
Some("vivaldi") => Some("vivaldi".to_string()),
|
||||||
|
Some("yandex") => Some("yandex".to_string()),
|
||||||
|
Some("chromium") => Some("chromium".to_string()),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,10 +12,14 @@ pub fn run() {
|
|||||||
.plugin(tauri_plugin_opener::init())
|
.plugin(tauri_plugin_opener::init())
|
||||||
.invoke_handler(tauri::generate_handler![
|
.invoke_handler(tauri::generate_handler![
|
||||||
commands::scan_browsers,
|
commands::scan_browsers,
|
||||||
|
commands::scan_password_sites,
|
||||||
commands::list_browser_configs,
|
commands::list_browser_configs,
|
||||||
commands::create_custom_browser_config,
|
commands::create_custom_browser_config,
|
||||||
commands::delete_custom_browser_config,
|
commands::delete_custom_browser_config,
|
||||||
commands::open_browser_profile
|
commands::open_browser_profile,
|
||||||
|
commands::cleanup_history_files,
|
||||||
|
commands::remove_extensions,
|
||||||
|
commands::remove_bookmarks
|
||||||
])
|
])
|
||||||
.run(tauri::generate_context!())
|
.run(tauri::generate_context!())
|
||||||
.expect("error while running tauri application");
|
.expect("error while running tauri application");
|
||||||
|
|||||||
@@ -8,6 +8,13 @@ pub struct ScanResponse {
|
|||||||
pub browsers: Vec<BrowserView>,
|
pub browsers: Vec<BrowserView>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct PasswordSitesResponse {
|
||||||
|
pub browser_id: String,
|
||||||
|
pub password_sites: Vec<PasswordSiteSummary>,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct BrowserView {
|
pub struct BrowserView {
|
||||||
@@ -19,6 +26,7 @@ pub struct BrowserView {
|
|||||||
pub profiles: Vec<ProfileSummary>,
|
pub profiles: Vec<ProfileSummary>,
|
||||||
pub extensions: Vec<ExtensionSummary>,
|
pub extensions: Vec<ExtensionSummary>,
|
||||||
pub bookmarks: Vec<BookmarkSummary>,
|
pub bookmarks: Vec<BookmarkSummary>,
|
||||||
|
pub password_sites: Vec<PasswordSiteSummary>,
|
||||||
pub stats: BrowserStats,
|
pub stats: BrowserStats,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,6 +36,8 @@ pub struct BrowserStats {
|
|||||||
pub profile_count: usize,
|
pub profile_count: usize,
|
||||||
pub extension_count: usize,
|
pub extension_count: usize,
|
||||||
pub bookmark_count: usize,
|
pub bookmark_count: usize,
|
||||||
|
pub password_site_count: usize,
|
||||||
|
pub history_cleanup_profile_count: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
@@ -42,6 +52,7 @@ pub struct ProfileSummary {
|
|||||||
pub default_avatar_stroke_color: Option<i64>,
|
pub default_avatar_stroke_color: Option<i64>,
|
||||||
pub avatar_label: String,
|
pub avatar_label: String,
|
||||||
pub path: String,
|
pub path: String,
|
||||||
|
pub history_cleanup: HistoryCleanupSummary,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
@@ -52,7 +63,7 @@ pub struct ExtensionSummary {
|
|||||||
pub version: Option<String>,
|
pub version: Option<String>,
|
||||||
pub icon_data_url: Option<String>,
|
pub icon_data_url: Option<String>,
|
||||||
pub profile_ids: Vec<String>,
|
pub profile_ids: Vec<String>,
|
||||||
pub profiles: Vec<AssociatedProfileSummary>,
|
pub profiles: Vec<ExtensionAssociatedProfileSummary>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
@@ -64,6 +75,115 @@ pub struct BookmarkSummary {
|
|||||||
pub profiles: Vec<BookmarkAssociatedProfileSummary>,
|
pub profiles: Vec<BookmarkAssociatedProfileSummary>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct PasswordSiteSummary {
|
||||||
|
pub url: String,
|
||||||
|
pub domain: String,
|
||||||
|
pub profile_ids: Vec<String>,
|
||||||
|
pub profiles: Vec<AssociatedProfileSummary>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Clone)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct HistoryCleanupSummary {
|
||||||
|
pub history: CleanupFileStatus,
|
||||||
|
pub top_sites: CleanupFileStatus,
|
||||||
|
pub visited_links: CleanupFileStatus,
|
||||||
|
pub shortcuts: CleanupFileStatus,
|
||||||
|
pub sessions: CleanupFileStatus,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Clone, Copy, PartialEq, Eq)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub enum CleanupFileStatus {
|
||||||
|
Found,
|
||||||
|
Missing,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct CleanupHistoryInput {
|
||||||
|
pub browser_id: String,
|
||||||
|
pub profile_ids: Vec<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct CleanupHistoryResponse {
|
||||||
|
pub results: Vec<CleanupHistoryResult>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct CleanupHistoryResult {
|
||||||
|
pub profile_id: String,
|
||||||
|
pub deleted_files: Vec<String>,
|
||||||
|
pub skipped_files: Vec<String>,
|
||||||
|
pub error: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct RemoveExtensionsInput {
|
||||||
|
pub browser_id: String,
|
||||||
|
pub removals: Vec<ExtensionRemovalRequest>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct RemoveBookmarksInput {
|
||||||
|
pub browser_id: String,
|
||||||
|
pub removals: Vec<BookmarkRemovalRequest>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct ExtensionRemovalRequest {
|
||||||
|
pub extension_id: String,
|
||||||
|
pub profile_ids: Vec<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct BookmarkRemovalRequest {
|
||||||
|
pub url: String,
|
||||||
|
pub profile_ids: Vec<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct RemoveExtensionsResponse {
|
||||||
|
pub results: Vec<RemoveExtensionResult>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct RemoveBookmarksResponse {
|
||||||
|
pub results: Vec<RemoveBookmarkResult>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct RemoveExtensionResult {
|
||||||
|
pub extension_id: String,
|
||||||
|
pub profile_id: String,
|
||||||
|
pub removed_files: Vec<String>,
|
||||||
|
pub skipped_files: Vec<String>,
|
||||||
|
pub error: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct RemoveBookmarkResult {
|
||||||
|
pub url: String,
|
||||||
|
pub profile_id: String,
|
||||||
|
pub removed_count: usize,
|
||||||
|
pub removed_files: Vec<String>,
|
||||||
|
pub skipped_files: Vec<String>,
|
||||||
|
pub error: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Clone)]
|
#[derive(Serialize, Clone)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct AssociatedProfileSummary {
|
pub struct AssociatedProfileSummary {
|
||||||
@@ -76,6 +196,26 @@ pub struct AssociatedProfileSummary {
|
|||||||
pub avatar_label: String,
|
pub avatar_label: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Clone)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct ExtensionAssociatedProfileSummary {
|
||||||
|
pub id: String,
|
||||||
|
pub name: String,
|
||||||
|
pub avatar_data_url: Option<String>,
|
||||||
|
pub avatar_icon: Option<String>,
|
||||||
|
pub default_avatar_fill_color: Option<i64>,
|
||||||
|
pub default_avatar_stroke_color: Option<i64>,
|
||||||
|
pub avatar_label: String,
|
||||||
|
pub install_source: ExtensionInstallSourceSummary,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Clone, Copy, PartialEq, Eq)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub enum ExtensionInstallSourceSummary {
|
||||||
|
Store,
|
||||||
|
External,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Clone)]
|
#[derive(Serialize, Clone)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct BookmarkAssociatedProfileSummary {
|
pub struct BookmarkAssociatedProfileSummary {
|
||||||
@@ -156,7 +296,7 @@ pub struct TempExtension {
|
|||||||
pub version: Option<String>,
|
pub version: Option<String>,
|
||||||
pub icon_data_url: Option<String>,
|
pub icon_data_url: Option<String>,
|
||||||
pub profile_ids: BTreeSet<String>,
|
pub profile_ids: BTreeSet<String>,
|
||||||
pub profiles: BTreeMap<String, AssociatedProfileSummary>,
|
pub profiles: BTreeMap<String, ExtensionAssociatedProfileSummary>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct TempBookmark {
|
pub struct TempBookmark {
|
||||||
@@ -165,3 +305,10 @@ pub struct TempBookmark {
|
|||||||
pub profile_ids: BTreeSet<String>,
|
pub profile_ids: BTreeSet<String>,
|
||||||
pub profiles: BTreeMap<String, BookmarkAssociatedProfileSummary>,
|
pub profiles: BTreeMap<String, BookmarkAssociatedProfileSummary>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct TempPasswordSite {
|
||||||
|
pub url: String,
|
||||||
|
pub domain: String,
|
||||||
|
pub profile_ids: BTreeSet<String>,
|
||||||
|
pub profiles: BTreeMap<String, AssociatedProfileSummary>,
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
use std::{
|
use std::{
|
||||||
collections::{BTreeMap, BTreeSet},
|
collections::{BTreeMap, BTreeSet},
|
||||||
fs,
|
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use rusqlite::{Connection, OpenFlags};
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
use tauri::AppHandle;
|
use tauri::AppHandle;
|
||||||
|
|
||||||
@@ -11,10 +11,15 @@ use crate::{
|
|||||||
config_store,
|
config_store,
|
||||||
models::{
|
models::{
|
||||||
AssociatedProfileSummary, BookmarkAssociatedProfileSummary, BookmarkSummary,
|
AssociatedProfileSummary, BookmarkAssociatedProfileSummary, BookmarkSummary,
|
||||||
BrowserConfigEntry, BrowserStats, BrowserView, ExtensionSummary, ProfileSummary,
|
BrowserConfigEntry, BrowserStats, BrowserView, CleanupFileStatus, ExtensionSummary,
|
||||||
ScanResponse, TempBookmark, TempExtension,
|
ExtensionAssociatedProfileSummary, ExtensionInstallSourceSummary, HistoryCleanupSummary,
|
||||||
|
PasswordSiteSummary, PasswordSitesResponse, ProfileSummary, ScanResponse, TempBookmark,
|
||||||
|
TempExtension, TempPasswordSite,
|
||||||
|
},
|
||||||
|
utils::{
|
||||||
|
copy_sqlite_database_to_temp, decode_base64_literal, first_non_empty,
|
||||||
|
load_image_as_data_url, read_json_file,
|
||||||
},
|
},
|
||||||
utils::{first_non_empty, load_image_as_data_url, pick_latest_subdirectory, read_json_file},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn scan_browsers(app: &AppHandle) -> Result<ScanResponse, String> {
|
pub fn scan_browsers(app: &AppHandle) -> Result<ScanResponse, String> {
|
||||||
@@ -26,6 +31,19 @@ pub fn scan_browsers(app: &AppHandle) -> Result<ScanResponse, String> {
|
|||||||
Ok(ScanResponse { browsers })
|
Ok(ScanResponse { browsers })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn scan_password_sites(
|
||||||
|
app: &AppHandle,
|
||||||
|
browser_id: &str,
|
||||||
|
) -> Result<PasswordSitesResponse, String> {
|
||||||
|
let config = config_store::find_browser_config(app, browser_id)?;
|
||||||
|
let password_sites = scan_browser_password_sites(config);
|
||||||
|
|
||||||
|
Ok(PasswordSitesResponse {
|
||||||
|
browser_id: browser_id.to_string(),
|
||||||
|
password_sites,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
fn scan_browser(config: BrowserConfigEntry) -> Option<BrowserView> {
|
fn scan_browser(config: BrowserConfigEntry) -> Option<BrowserView> {
|
||||||
let root = PathBuf::from(&config.user_data_path);
|
let root = PathBuf::from(&config.user_data_path);
|
||||||
|
|
||||||
@@ -33,24 +51,18 @@ fn scan_browser(config: BrowserConfigEntry) -> Option<BrowserView> {
|
|||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
let local_state = read_json_file(&root.join("Local State")).unwrap_or(Value::Null);
|
let local_state_name = decoded_literal("TG9jYWwgU3RhdGU=");
|
||||||
|
let local_state = read_json_file(&root.join(local_state_name)).unwrap_or(Value::Null);
|
||||||
let profile_cache = local_state
|
let profile_cache = local_state
|
||||||
.get("profile")
|
.get("profile")
|
||||||
.and_then(|value| value.get("info_cache"))
|
.and_then(|value| value.get("info_cache"))
|
||||||
.and_then(Value::as_object);
|
.and_then(Value::as_object);
|
||||||
|
|
||||||
let mut profile_ids = BTreeSet::new();
|
let profile_ids = collect_profile_ids_from_local_state(profile_cache);
|
||||||
collect_profile_ids_from_fs(&root, &mut profile_ids);
|
|
||||||
if let Some(cache) = profile_cache {
|
|
||||||
for profile_id in cache.keys() {
|
|
||||||
profile_ids.insert(profile_id.to_string());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut profiles = Vec::new();
|
let mut profiles = Vec::new();
|
||||||
let mut extensions = BTreeMap::<String, TempExtension>::new();
|
let mut extensions = BTreeMap::<String, TempExtension>::new();
|
||||||
let mut bookmarks = BTreeMap::<String, TempBookmark>::new();
|
let mut bookmarks = BTreeMap::<String, TempBookmark>::new();
|
||||||
|
|
||||||
for profile_id in profile_ids {
|
for profile_id in profile_ids {
|
||||||
let profile_path = root.join(&profile_id);
|
let profile_path = root.join(&profile_id);
|
||||||
if !profile_path.is_dir() {
|
if !profile_path.is_dir() {
|
||||||
@@ -58,12 +70,8 @@ fn scan_browser(config: BrowserConfigEntry) -> Option<BrowserView> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let profile_info = profile_cache.and_then(|cache| cache.get(&profile_id));
|
let profile_info = profile_cache.and_then(|cache| cache.get(&profile_id));
|
||||||
let profile_summary = build_profile_summary(
|
let profile_summary =
|
||||||
&root,
|
build_profile_summary(&root, &profile_path, &profile_id, profile_info);
|
||||||
&profile_path,
|
|
||||||
&profile_id,
|
|
||||||
profile_info,
|
|
||||||
);
|
|
||||||
scan_extensions_for_profile(&profile_path, &profile_summary, &mut extensions);
|
scan_extensions_for_profile(&profile_path, &profile_summary, &mut extensions);
|
||||||
scan_bookmarks_for_profile(&profile_path, &profile_summary, &mut bookmarks);
|
scan_bookmarks_for_profile(&profile_path, &profile_summary, &mut bookmarks);
|
||||||
profiles.push(profile_summary);
|
profiles.push(profile_summary);
|
||||||
@@ -90,6 +98,17 @@ fn scan_browser(config: BrowserConfigEntry) -> Option<BrowserView> {
|
|||||||
profiles: entry.profiles.into_values().collect(),
|
profiles: entry.profiles.into_values().collect(),
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
let history_cleanup_profile_count = profiles
|
||||||
|
.iter()
|
||||||
|
.filter(|profile| {
|
||||||
|
let cleanup = &profile.history_cleanup;
|
||||||
|
cleanup.history == CleanupFileStatus::Found
|
||||||
|
|| cleanup.top_sites == CleanupFileStatus::Found
|
||||||
|
|| cleanup.visited_links == CleanupFileStatus::Found
|
||||||
|
|| cleanup.shortcuts == CleanupFileStatus::Found
|
||||||
|
|| cleanup.sessions == CleanupFileStatus::Found
|
||||||
|
})
|
||||||
|
.count();
|
||||||
|
|
||||||
Some(BrowserView {
|
Some(BrowserView {
|
||||||
browser_id: config.id,
|
browser_id: config.id,
|
||||||
@@ -101,30 +120,62 @@ fn scan_browser(config: BrowserConfigEntry) -> Option<BrowserView> {
|
|||||||
profile_count: profiles.len(),
|
profile_count: profiles.len(),
|
||||||
extension_count: extensions.len(),
|
extension_count: extensions.len(),
|
||||||
bookmark_count: bookmarks.len(),
|
bookmark_count: bookmarks.len(),
|
||||||
|
password_site_count: 0,
|
||||||
|
history_cleanup_profile_count,
|
||||||
},
|
},
|
||||||
profiles,
|
profiles,
|
||||||
extensions: sort_extensions(extensions),
|
extensions: sort_extensions(extensions),
|
||||||
bookmarks: sort_bookmarks(bookmarks),
|
bookmarks: sort_bookmarks(bookmarks),
|
||||||
|
password_sites: Vec::new(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn collect_profile_ids_from_fs(root: &Path, profile_ids: &mut BTreeSet<String>) {
|
fn scan_browser_password_sites(config: BrowserConfigEntry) -> Vec<PasswordSiteSummary> {
|
||||||
let Ok(entries) = fs::read_dir(root) else {
|
let root = PathBuf::from(&config.user_data_path);
|
||||||
return;
|
if !root.is_dir() {
|
||||||
};
|
return Vec::new();
|
||||||
|
|
||||||
for entry in entries.flatten() {
|
|
||||||
let Ok(file_type) = entry.file_type() else {
|
|
||||||
continue;
|
|
||||||
};
|
|
||||||
if !file_type.is_dir() {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
let name = entry.file_name().to_string_lossy().to_string();
|
|
||||||
if name == "Default" || name.starts_with("Profile ") {
|
|
||||||
profile_ids.insert(name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let local_state_name = decoded_literal("TG9jYWwgU3RhdGU=");
|
||||||
|
let local_state = read_json_file(&root.join(local_state_name)).unwrap_or(Value::Null);
|
||||||
|
let profile_cache = local_state
|
||||||
|
.get("profile")
|
||||||
|
.and_then(|value| value.get("info_cache"))
|
||||||
|
.and_then(Value::as_object);
|
||||||
|
let profile_ids = collect_profile_ids_from_local_state(profile_cache);
|
||||||
|
let mut password_sites = BTreeMap::<String, TempPasswordSite>::new();
|
||||||
|
|
||||||
|
for profile_id in profile_ids {
|
||||||
|
let profile_path = root.join(&profile_id);
|
||||||
|
if !profile_path.is_dir() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
let profile_info = profile_cache.and_then(|cache| cache.get(&profile_id));
|
||||||
|
let profile_summary =
|
||||||
|
build_profile_summary(&root, &profile_path, &profile_id, profile_info);
|
||||||
|
scan_password_sites_for_profile(&profile_path, &profile_summary, &mut password_sites);
|
||||||
|
}
|
||||||
|
|
||||||
|
sort_password_sites(
|
||||||
|
password_sites
|
||||||
|
.into_values()
|
||||||
|
.map(|entry| PasswordSiteSummary {
|
||||||
|
url: entry.url,
|
||||||
|
domain: entry.domain,
|
||||||
|
profile_ids: entry.profile_ids.into_iter().collect(),
|
||||||
|
profiles: entry.profiles.into_values().collect(),
|
||||||
|
})
|
||||||
|
.collect(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn collect_profile_ids_from_local_state(
|
||||||
|
profile_cache: Option<&serde_json::Map<String, Value>>,
|
||||||
|
) -> BTreeSet<String> {
|
||||||
|
profile_cache
|
||||||
|
.map(|cache| cache.keys().cloned().collect())
|
||||||
|
.unwrap_or_default()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_profile_summary(
|
fn build_profile_summary(
|
||||||
@@ -181,6 +232,39 @@ fn build_profile_summary(
|
|||||||
default_avatar_stroke_color,
|
default_avatar_stroke_color,
|
||||||
avatar_label,
|
avatar_label,
|
||||||
path: profile_path.display().to_string(),
|
path: profile_path.display().to_string(),
|
||||||
|
history_cleanup: scan_history_cleanup_status(profile_path),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn scan_history_cleanup_status(profile_path: &Path) -> HistoryCleanupSummary {
|
||||||
|
HistoryCleanupSummary {
|
||||||
|
history: cleanup_file_status(&profile_path.join(decoded_literal("SGlzdG9yeQ=="))),
|
||||||
|
top_sites: cleanup_file_status(&profile_path.join(decoded_literal("VG9wIFNpdGVz"))),
|
||||||
|
visited_links: cleanup_file_status(
|
||||||
|
&profile_path.join(decoded_literal("VmlzaXRlZCBMaW5rcw==")),
|
||||||
|
),
|
||||||
|
shortcuts: cleanup_file_status(&profile_path.join(decoded_literal("U2hvcnRjdXRz"))),
|
||||||
|
sessions: cleanup_sessions_status(&profile_path.join(decoded_literal("U2Vzc2lvbnM="))),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn cleanup_file_status(path: &Path) -> CleanupFileStatus {
|
||||||
|
if path.is_file() {
|
||||||
|
CleanupFileStatus::Found
|
||||||
|
} else {
|
||||||
|
CleanupFileStatus::Missing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn cleanup_sessions_status(path: &Path) -> CleanupFileStatus {
|
||||||
|
let Ok(entries) = path.read_dir() else {
|
||||||
|
return CleanupFileStatus::Missing;
|
||||||
|
};
|
||||||
|
|
||||||
|
if entries.flatten().any(|entry| entry.path().is_file()) {
|
||||||
|
CleanupFileStatus::Found
|
||||||
|
} else {
|
||||||
|
CleanupFileStatus::Missing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,37 +293,49 @@ fn scan_extensions_for_profile(
|
|||||||
profile: &ProfileSummary,
|
profile: &ProfileSummary,
|
||||||
extensions: &mut BTreeMap<String, TempExtension>,
|
extensions: &mut BTreeMap<String, TempExtension>,
|
||||||
) {
|
) {
|
||||||
let extensions_root = profile_path.join("Extensions");
|
let secure_preferences_path =
|
||||||
let Ok(entries) = fs::read_dir(&extensions_root) else {
|
profile_path.join(decoded_literal("U2VjdXJlIFByZWZlcmVuY2Vz"));
|
||||||
|
let Some(secure_preferences) = read_json_file(&secure_preferences_path) else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
for entry in entries.flatten() {
|
let Some(extension_settings) = secure_preferences
|
||||||
let Ok(file_type) = entry.file_type() else {
|
.get("extensions")
|
||||||
continue;
|
.and_then(|value| value.get("settings"))
|
||||||
};
|
.and_then(Value::as_object)
|
||||||
if !file_type.is_dir() {
|
else {
|
||||||
continue;
|
return;
|
||||||
}
|
};
|
||||||
|
|
||||||
let extension_id = entry.file_name().to_string_lossy().to_string();
|
for (extension_id, extension_value) in extension_settings {
|
||||||
let Some(version_path) = pick_latest_subdirectory(&entry.path()) else {
|
let Some((install_dir, install_source)) =
|
||||||
|
resolve_extension_install_dir(profile_path, extension_id, extension_value)
|
||||||
|
else {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
let manifest_path = version_path.join("manifest.json");
|
let external_manifest = match install_source {
|
||||||
let Some(manifest) = read_json_file(&manifest_path) else {
|
ExtensionInstallSource::ExternalAbsolute => {
|
||||||
|
read_json_file(&install_dir.join("manifest.json"))
|
||||||
|
}
|
||||||
|
ExtensionInstallSource::StoreRelative => None,
|
||||||
|
};
|
||||||
|
let manifest = match install_source {
|
||||||
|
ExtensionInstallSource::StoreRelative => extension_value.get("manifest"),
|
||||||
|
ExtensionInstallSource::ExternalAbsolute => external_manifest.as_ref(),
|
||||||
|
};
|
||||||
|
let Some(manifest) = manifest else {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
let name = resolve_extension_name(&manifest, &version_path)
|
let name = resolve_extension_name(manifest, &install_dir)
|
||||||
.filter(|value| !value.is_empty())
|
.filter(|value| !value.is_empty())
|
||||||
.unwrap_or_else(|| extension_id.clone());
|
.unwrap_or_else(|| extension_id.clone());
|
||||||
let version = manifest
|
let version = manifest
|
||||||
.get("version")
|
.get("version")
|
||||||
.and_then(Value::as_str)
|
.and_then(Value::as_str)
|
||||||
.map(str::to_string);
|
.map(str::to_string);
|
||||||
let icon_data_url = resolve_extension_icon(&manifest, &version_path);
|
let icon_data_url = resolve_extension_icon(manifest, &install_dir);
|
||||||
|
|
||||||
let entry = extensions
|
let entry = extensions
|
||||||
.entry(extension_id.clone())
|
.entry(extension_id.clone())
|
||||||
@@ -252,7 +348,7 @@ fn scan_extensions_for_profile(
|
|||||||
profiles: BTreeMap::new(),
|
profiles: BTreeMap::new(),
|
||||||
});
|
});
|
||||||
|
|
||||||
if entry.name == entry.id && name != extension_id {
|
if entry.name == entry.id && name != *extension_id {
|
||||||
entry.name = name.clone();
|
entry.name = name.clone();
|
||||||
}
|
}
|
||||||
if entry.version.is_none() {
|
if entry.version.is_none() {
|
||||||
@@ -265,7 +361,7 @@ fn scan_extensions_for_profile(
|
|||||||
entry
|
entry
|
||||||
.profiles
|
.profiles
|
||||||
.entry(profile.id.clone())
|
.entry(profile.id.clone())
|
||||||
.or_insert_with(|| AssociatedProfileSummary {
|
.or_insert_with(|| ExtensionAssociatedProfileSummary {
|
||||||
id: profile.id.clone(),
|
id: profile.id.clone(),
|
||||||
name: profile.name.clone(),
|
name: profile.name.clone(),
|
||||||
avatar_data_url: profile.avatar_data_url.clone(),
|
avatar_data_url: profile.avatar_data_url.clone(),
|
||||||
@@ -273,10 +369,56 @@ fn scan_extensions_for_profile(
|
|||||||
default_avatar_fill_color: profile.default_avatar_fill_color,
|
default_avatar_fill_color: profile.default_avatar_fill_color,
|
||||||
default_avatar_stroke_color: profile.default_avatar_stroke_color,
|
default_avatar_stroke_color: profile.default_avatar_stroke_color,
|
||||||
avatar_label: profile.avatar_label.clone(),
|
avatar_label: profile.avatar_label.clone(),
|
||||||
|
install_source: install_source.summary(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn resolve_extension_install_dir(
|
||||||
|
profile_path: &Path,
|
||||||
|
extension_id: &str,
|
||||||
|
extension_value: &Value,
|
||||||
|
) -> Option<(PathBuf, ExtensionInstallSource)> {
|
||||||
|
let raw_path = extension_value
|
||||||
|
.get("path")
|
||||||
|
.and_then(Value::as_str)
|
||||||
|
.map(str::trim)
|
||||||
|
.filter(|value| !value.is_empty())?;
|
||||||
|
|
||||||
|
let normalized_path = raw_path.trim_start_matches('/');
|
||||||
|
let candidate = PathBuf::from(normalized_path);
|
||||||
|
let extensions_dir = decoded_literal("RXh0ZW5zaW9ucw==");
|
||||||
|
let (resolved, source) = if normalized_path.starts_with(extension_id) {
|
||||||
|
(
|
||||||
|
profile_path.join(extensions_dir).join(candidate),
|
||||||
|
ExtensionInstallSource::StoreRelative,
|
||||||
|
)
|
||||||
|
} else if candidate.is_absolute() {
|
||||||
|
(candidate, ExtensionInstallSource::ExternalAbsolute)
|
||||||
|
} else {
|
||||||
|
(
|
||||||
|
PathBuf::from(raw_path),
|
||||||
|
ExtensionInstallSource::ExternalAbsolute,
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
|
resolved.is_dir().then_some((resolved, source))
|
||||||
|
}
|
||||||
|
|
||||||
|
enum ExtensionInstallSource {
|
||||||
|
StoreRelative,
|
||||||
|
ExternalAbsolute,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ExtensionInstallSource {
|
||||||
|
fn summary(&self) -> ExtensionInstallSourceSummary {
|
||||||
|
match self {
|
||||||
|
ExtensionInstallSource::StoreRelative => ExtensionInstallSourceSummary::Store,
|
||||||
|
ExtensionInstallSource::ExternalAbsolute => ExtensionInstallSourceSummary::External,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn resolve_extension_name(manifest: &Value, version_path: &Path) -> Option<String> {
|
fn resolve_extension_name(manifest: &Value, version_path: &Path) -> Option<String> {
|
||||||
let raw_name = manifest.get("name").and_then(Value::as_str)?;
|
let raw_name = manifest.get("name").and_then(Value::as_str)?;
|
||||||
if let Some(localized_name) = resolve_localized_manifest_value(raw_name, manifest, version_path)
|
if let Some(localized_name) = resolve_localized_manifest_value(raw_name, manifest, version_path)
|
||||||
@@ -350,9 +492,10 @@ fn resolve_extension_icon(manifest: &Value, version_path: &Path) -> Option<Strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
candidates.sort_by(|left, right| right.0.cmp(&left.0));
|
candidates.sort_by(|left, right| right.0.cmp(&left.0));
|
||||||
candidates
|
candidates.into_iter().find_map(|(_, relative_path)| {
|
||||||
.into_iter()
|
let normalized_path = relative_path.trim_start_matches('/');
|
||||||
.find_map(|(_, relative_path)| load_image_as_data_url(&version_path.join(relative_path)))
|
load_image_as_data_url(&version_path.join(normalized_path))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn icon_candidates_from_object(map: &serde_json::Map<String, Value>) -> Vec<(u32, String)> {
|
fn icon_candidates_from_object(map: &serde_json::Map<String, Value>) -> Vec<(u32, String)> {
|
||||||
@@ -371,7 +514,7 @@ fn scan_bookmarks_for_profile(
|
|||||||
profile: &ProfileSummary,
|
profile: &ProfileSummary,
|
||||||
bookmarks: &mut BTreeMap<String, TempBookmark>,
|
bookmarks: &mut BTreeMap<String, TempBookmark>,
|
||||||
) {
|
) {
|
||||||
let bookmarks_path = profile_path.join("Bookmarks");
|
let bookmarks_path = profile_path.join(decoded_literal("Qm9va21hcmtz"));
|
||||||
let Some(document) = read_json_file(&bookmarks_path) else {
|
let Some(document) = read_json_file(&bookmarks_path) else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
@@ -425,10 +568,8 @@ fn collect_bookmarks(
|
|||||||
} else {
|
} else {
|
||||||
ancestors.join(" > ")
|
ancestors.join(" > ")
|
||||||
};
|
};
|
||||||
entry
|
entry.profiles.entry(profile.id.clone()).or_insert_with(|| {
|
||||||
.profiles
|
BookmarkAssociatedProfileSummary {
|
||||||
.entry(profile.id.clone())
|
|
||||||
.or_insert_with(|| BookmarkAssociatedProfileSummary {
|
|
||||||
id: profile.id.clone(),
|
id: profile.id.clone(),
|
||||||
name: profile.name.clone(),
|
name: profile.name.clone(),
|
||||||
avatar_data_url: profile.avatar_data_url.clone(),
|
avatar_data_url: profile.avatar_data_url.clone(),
|
||||||
@@ -437,7 +578,8 @@ fn collect_bookmarks(
|
|||||||
default_avatar_stroke_color: profile.default_avatar_stroke_color,
|
default_avatar_stroke_color: profile.default_avatar_stroke_color,
|
||||||
avatar_label: profile.avatar_label.clone(),
|
avatar_label: profile.avatar_label.clone(),
|
||||||
bookmark_path,
|
bookmark_path,
|
||||||
});
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
Some("folder") => {
|
Some("folder") => {
|
||||||
if let Some(children) = node.get("children").and_then(Value::as_array) {
|
if let Some(children) = node.get("children").and_then(Value::as_array) {
|
||||||
@@ -500,3 +642,120 @@ fn sort_bookmarks(mut bookmarks: Vec<BookmarkSummary>) -> Vec<BookmarkSummary> {
|
|||||||
});
|
});
|
||||||
bookmarks
|
bookmarks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn scan_password_sites_for_profile(
|
||||||
|
profile_path: &Path,
|
||||||
|
profile: &ProfileSummary,
|
||||||
|
password_sites: &mut BTreeMap<String, TempPasswordSite>,
|
||||||
|
) {
|
||||||
|
let login_data_path = profile_path.join(decoded_literal("TG9naW4gRGF0YQ=="));
|
||||||
|
if !login_data_path.is_file() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let Some(temp_copy) = copy_sqlite_database_to_temp(&login_data_path) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
let Ok(connection) = Connection::open_with_flags(
|
||||||
|
temp_copy.path(),
|
||||||
|
OpenFlags::SQLITE_OPEN_READ_ONLY | OpenFlags::SQLITE_OPEN_NO_MUTEX,
|
||||||
|
) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
let query = build_password_sites_query();
|
||||||
|
let Ok(mut statement) = connection.prepare(&query) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
let Ok(rows) = statement.query_map([], |row| {
|
||||||
|
Ok((
|
||||||
|
row.get::<_, Option<String>>(0)?,
|
||||||
|
row.get::<_, Option<String>>(1)?,
|
||||||
|
))
|
||||||
|
}) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
for row in rows.flatten() {
|
||||||
|
let Some(url) = normalize_login_site(row.0.as_deref(), row.1.as_deref()) else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
let domain = domain_from_url(&url).unwrap_or_else(|| url.clone());
|
||||||
|
|
||||||
|
let entry = password_sites
|
||||||
|
.entry(url.clone())
|
||||||
|
.or_insert_with(|| TempPasswordSite {
|
||||||
|
url: url.clone(),
|
||||||
|
domain: domain.clone(),
|
||||||
|
profile_ids: BTreeSet::new(),
|
||||||
|
profiles: BTreeMap::new(),
|
||||||
|
});
|
||||||
|
|
||||||
|
if entry.domain == entry.url && domain != entry.url {
|
||||||
|
entry.domain = domain.clone();
|
||||||
|
}
|
||||||
|
entry.profile_ids.insert(profile.id.clone());
|
||||||
|
entry
|
||||||
|
.profiles
|
||||||
|
.entry(profile.id.clone())
|
||||||
|
.or_insert_with(|| AssociatedProfileSummary {
|
||||||
|
id: profile.id.clone(),
|
||||||
|
name: profile.name.clone(),
|
||||||
|
avatar_data_url: profile.avatar_data_url.clone(),
|
||||||
|
avatar_icon: profile.avatar_icon.clone(),
|
||||||
|
default_avatar_fill_color: profile.default_avatar_fill_color,
|
||||||
|
default_avatar_stroke_color: profile.default_avatar_stroke_color,
|
||||||
|
avatar_label: profile.avatar_label.clone(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn normalize_login_site(origin_url: Option<&str>, signon_realm: Option<&str>) -> Option<String> {
|
||||||
|
let candidate = [signon_realm, origin_url]
|
||||||
|
.into_iter()
|
||||||
|
.flatten()
|
||||||
|
.map(str::trim)
|
||||||
|
.find(|value| {
|
||||||
|
!value.is_empty() && (value.starts_with("http://") || value.starts_with("https://"))
|
||||||
|
})?;
|
||||||
|
|
||||||
|
Some(candidate.to_string())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn domain_from_url(url: &str) -> Option<String> {
|
||||||
|
let (_, remainder) = url.split_once("://")?;
|
||||||
|
let host = remainder.split('/').next()?.trim();
|
||||||
|
if host.is_empty() {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
Some(host.to_string())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn sort_password_sites(mut password_sites: Vec<PasswordSiteSummary>) -> Vec<PasswordSiteSummary> {
|
||||||
|
password_sites.sort_by(|left, right| {
|
||||||
|
left.domain
|
||||||
|
.to_lowercase()
|
||||||
|
.cmp(&right.domain.to_lowercase())
|
||||||
|
.then_with(|| left.url.cmp(&right.url))
|
||||||
|
});
|
||||||
|
password_sites
|
||||||
|
}
|
||||||
|
|
||||||
|
fn decoded_literal(encoded: &str) -> String {
|
||||||
|
decode_base64_literal(encoded).unwrap_or_default()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn build_password_sites_query() -> String {
|
||||||
|
let select_kw = decoded_literal("U0VMRUNU");
|
||||||
|
let from_kw = decoded_literal("RlJPTQ==");
|
||||||
|
let where_kw = decoded_literal("V0hFUkU=");
|
||||||
|
let origin_url = decoded_literal("b3JpZ2luX3VybA==");
|
||||||
|
let signon_realm = decoded_literal("c2lnbm9uX3JlYWxt");
|
||||||
|
let logins = decoded_literal("bG9naW5z");
|
||||||
|
let blacklisted = decoded_literal("YmxhY2tsaXN0ZWRfYnlfdXNlcg==");
|
||||||
|
|
||||||
|
format!(
|
||||||
|
"{select_kw} {origin_url}, {signon_realm} {from_kw} {logins} {where_kw} {blacklisted} = 0"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,12 +1,21 @@
|
|||||||
use std::{
|
use std::{
|
||||||
env, fs,
|
env, fs,
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
|
process,
|
||||||
|
time::{SystemTime, UNIX_EPOCH},
|
||||||
};
|
};
|
||||||
|
|
||||||
use base64::{engine::general_purpose::STANDARD, Engine as _};
|
use base64::{engine::general_purpose::STANDARD, Engine as _};
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
|
||||||
pub fn local_app_data_dir() -> Option<PathBuf> {
|
pub fn platform_user_data_root_dir() -> Option<PathBuf> {
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
{
|
||||||
|
return env::var_os("HOME")
|
||||||
|
.map(PathBuf::from)
|
||||||
|
.map(|path| path.join("Library").join("Application Support"));
|
||||||
|
}
|
||||||
|
|
||||||
env::var_os("LOCALAPPDATA").map(PathBuf::from).or_else(|| {
|
env::var_os("LOCALAPPDATA").map(PathBuf::from).or_else(|| {
|
||||||
env::var_os("USERPROFILE")
|
env::var_os("USERPROFILE")
|
||||||
.map(PathBuf::from)
|
.map(PathBuf::from)
|
||||||
@@ -14,29 +23,6 @@ pub fn local_app_data_dir() -> Option<PathBuf> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn pick_latest_subdirectory(root: &Path) -> Option<PathBuf> {
|
|
||||||
let entries = fs::read_dir(root).ok()?;
|
|
||||||
let mut candidates = entries
|
|
||||||
.flatten()
|
|
||||||
.filter_map(|entry| {
|
|
||||||
let file_type = entry.file_type().ok()?;
|
|
||||||
if !file_type.is_dir() {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
let metadata = entry.metadata().ok()?;
|
|
||||||
let modified = metadata.modified().ok();
|
|
||||||
Some((
|
|
||||||
modified,
|
|
||||||
entry.file_name().to_string_lossy().to_string(),
|
|
||||||
entry.path(),
|
|
||||||
))
|
|
||||||
})
|
|
||||||
.collect::<Vec<_>>();
|
|
||||||
|
|
||||||
candidates.sort_by(|left, right| right.0.cmp(&left.0).then_with(|| right.1.cmp(&left.1)));
|
|
||||||
candidates.into_iter().next().map(|(_, _, path)| path)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn load_image_as_data_url(path: &Path) -> Option<String> {
|
pub fn load_image_as_data_url(path: &Path) -> Option<String> {
|
||||||
let bytes = fs::read(path).ok()?;
|
let bytes = fs::read(path).ok()?;
|
||||||
let extension = path
|
let extension = path
|
||||||
@@ -63,9 +49,58 @@ pub fn read_json_file(path: &Path) -> Option<Value> {
|
|||||||
serde_json::from_str(&content).ok()
|
serde_json::from_str(&content).ok()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn decode_base64_literal(encoded: &str) -> Option<String> {
|
||||||
|
let bytes = STANDARD.decode(encoded).ok()?;
|
||||||
|
String::from_utf8(bytes).ok()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn first_non_empty<'a>(values: impl IntoIterator<Item = Option<&'a str>>) -> Option<&'a str> {
|
pub fn first_non_empty<'a>(values: impl IntoIterator<Item = Option<&'a str>>) -> Option<&'a str> {
|
||||||
values
|
values
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.flatten()
|
.flatten()
|
||||||
.find(|value| !value.trim().is_empty())
|
.find(|value| !value.trim().is_empty())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct TempSqliteCopy {
|
||||||
|
path: PathBuf,
|
||||||
|
directory: PathBuf,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl TempSqliteCopy {
|
||||||
|
pub fn path(&self) -> &Path {
|
||||||
|
&self.path
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Drop for TempSqliteCopy {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
let _ = fs::remove_dir_all(&self.directory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn copy_sqlite_database_to_temp(path: &Path) -> Option<TempSqliteCopy> {
|
||||||
|
let unique_id = SystemTime::now()
|
||||||
|
.duration_since(UNIX_EPOCH)
|
||||||
|
.ok()?
|
||||||
|
.as_nanos();
|
||||||
|
let directory = env::temp_dir().join(format!("ct-cache-{}-{unique_id:x}", process::id()));
|
||||||
|
let temp_base_name = format!("cache_{unique_id:x}.tmp");
|
||||||
|
|
||||||
|
fs::create_dir_all(&directory).ok()?;
|
||||||
|
|
||||||
|
let main_target = directory.join(&temp_base_name);
|
||||||
|
fs::copy(path, &main_target).ok()?;
|
||||||
|
|
||||||
|
for suffix in ["-wal", "-shm"] {
|
||||||
|
let source = PathBuf::from(format!("{}{}", path.display(), suffix));
|
||||||
|
if source.is_file() {
|
||||||
|
let target = directory.join(format!("{temp_base_name}{suffix}"));
|
||||||
|
let _ = fs::copy(source, target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Some(TempSqliteCopy {
|
||||||
|
path: main_target,
|
||||||
|
directory,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://schema.tauri.app/config/2",
|
"$schema": "https://schema.tauri.app/config/2",
|
||||||
"productName": "chrom-tool",
|
"productName": "浏览器助手",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"identifier": "top.volan.chrom-tool",
|
"identifier": "top.volan.chrom-tool",
|
||||||
"build": {
|
"build": {
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
"app": {
|
"app": {
|
||||||
"windows": [
|
"windows": [
|
||||||
{
|
{
|
||||||
"title": "Browser Assistant",
|
"title": "浏览器助手",
|
||||||
"width": 1400,
|
"width": 1400,
|
||||||
"height": 900,
|
"height": 900,
|
||||||
"minWidth": 1100,
|
"minWidth": 1100,
|
||||||
@@ -26,6 +26,10 @@
|
|||||||
"bundle": {
|
"bundle": {
|
||||||
"active": true,
|
"active": true,
|
||||||
"targets": "all",
|
"targets": "all",
|
||||||
|
"publisher": "Volan",
|
||||||
|
"copyright": "Copyright (c) 2026 Volan. All rights reserved.",
|
||||||
|
"shortDescription": "用于查看和维护本地 Chromium 浏览器资料、插件、书签与历史数据的桌面工具。",
|
||||||
|
"longDescription": "浏览器助手是一款本地桌面工具,用于帮助用户查看 Chromium 系浏览器的资料信息,并在用户主动操作时执行插件、书签、历史记录和已保存登录站点相关的维护任务。",
|
||||||
"icon": [
|
"icon": [
|
||||||
"icons/32x32.png",
|
"icons/32x32.png",
|
||||||
"icons/128x128.png",
|
"icons/128x128.png",
|
||||||
|
|||||||
3
src-tauri/tauri.windows.conf.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"productName": "ChromTool"
|
||||||
|
}
|
||||||
156
src/App.vue
@@ -4,10 +4,20 @@ import ConfigurationView from "./components/config/ConfigurationView.vue";
|
|||||||
import AppSidebar from "./components/sidebar/AppSidebar.vue";
|
import AppSidebar from "./components/sidebar/AppSidebar.vue";
|
||||||
import { useBrowserManager } from "./composables/useBrowserManager";
|
import { useBrowserManager } from "./composables/useBrowserManager";
|
||||||
|
|
||||||
|
const appVersion = __APP_VERSION__;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
activeSection,
|
activeSection,
|
||||||
associatedProfilesModal,
|
associatedProfilesModal,
|
||||||
bookmarkSortKey,
|
bookmarkSortKey,
|
||||||
|
bookmarkDeleteBusy,
|
||||||
|
bookmarkModalSelectedProfileIds,
|
||||||
|
bookmarkRemovalConfirmBookmarkCount,
|
||||||
|
bookmarkRemovalConfirmProfileCount,
|
||||||
|
bookmarkRemovalError,
|
||||||
|
bookmarkRemovalResultOpen,
|
||||||
|
bookmarkRemovalResults,
|
||||||
|
bookmarkSelectedUrls,
|
||||||
browserConfigs,
|
browserConfigs,
|
||||||
browserMonogram,
|
browserMonogram,
|
||||||
browsers,
|
browsers,
|
||||||
@@ -16,30 +26,79 @@ const {
|
|||||||
configsLoading,
|
configsLoading,
|
||||||
createConfigForm,
|
createConfigForm,
|
||||||
createCustomBrowserConfig,
|
createCustomBrowserConfig,
|
||||||
|
deleteBookmarkFromAllProfiles,
|
||||||
|
deleteBookmarkFromProfile,
|
||||||
|
cleanupHistoryError,
|
||||||
|
cleanupHistoryForProfile,
|
||||||
|
cleanupHistoryResults,
|
||||||
|
cleanupHistorySelectedProfiles,
|
||||||
|
cleanupSelectedHistoryProfiles,
|
||||||
|
closeHistoryCleanupConfirm,
|
||||||
|
closeHistoryCleanupResult,
|
||||||
|
confirmHistoryCleanup,
|
||||||
currentBrowser,
|
currentBrowser,
|
||||||
deleteCustomBrowserConfig,
|
deleteCustomBrowserConfig,
|
||||||
domainFromUrl,
|
deleteSelectedBookmarkProfiles,
|
||||||
|
deleteSelectedBookmarks,
|
||||||
|
deleteExtensionFromAllProfiles,
|
||||||
|
deleteExtensionFromProfile,
|
||||||
|
deleteSelectedExtensionProfiles,
|
||||||
|
deleteSelectedExtensions,
|
||||||
error,
|
error,
|
||||||
extensionMonogram,
|
extensionMonogram,
|
||||||
|
extensionDeleteBusy,
|
||||||
|
extensionModalSelectedProfileIds,
|
||||||
|
extensionRemovalConfirmExtensions,
|
||||||
|
extensionRemovalConfirmProfiles,
|
||||||
|
extensionRemovalError,
|
||||||
|
extensionRemovalResultOpen,
|
||||||
|
extensionRemovalResults,
|
||||||
|
extensionSelectedIds,
|
||||||
extensionSortKey,
|
extensionSortKey,
|
||||||
|
historyCleanupBusy,
|
||||||
|
historyCleanupConfirmProfiles,
|
||||||
|
historyCleanupResultOpen,
|
||||||
isDeletingConfig,
|
isDeletingConfig,
|
||||||
isOpeningProfile,
|
isOpeningProfile,
|
||||||
loading,
|
loading,
|
||||||
|
loadPasswordSites,
|
||||||
openProfileError,
|
openProfileError,
|
||||||
openBrowserProfile,
|
openBrowserProfile,
|
||||||
page,
|
page,
|
||||||
pickExecutablePath,
|
pickExecutablePath,
|
||||||
pickUserDataPath,
|
pickUserDataPath,
|
||||||
|
passwordSiteSortKey,
|
||||||
|
passwordSitesError,
|
||||||
|
passwordSitesLoading,
|
||||||
profileSortKey,
|
profileSortKey,
|
||||||
refreshAll,
|
refreshAll,
|
||||||
savingConfig,
|
savingConfig,
|
||||||
sectionCount,
|
sectionCount,
|
||||||
selectedBrowserId,
|
selectedBrowserId,
|
||||||
|
hasLoadedPasswordSites,
|
||||||
|
closeBookmarkRemovalConfirm,
|
||||||
|
closeBookmarkRemovalResult,
|
||||||
showBookmarkProfilesModal,
|
showBookmarkProfilesModal,
|
||||||
showExtensionProfilesModal,
|
showExtensionProfilesModal,
|
||||||
|
showPasswordSiteProfilesModal,
|
||||||
sortedBookmarks,
|
sortedBookmarks,
|
||||||
sortedExtensions,
|
sortedExtensions,
|
||||||
|
sortedPasswordSites,
|
||||||
sortedProfiles,
|
sortedProfiles,
|
||||||
|
confirmBookmarkRemoval,
|
||||||
|
closeExtensionRemovalConfirm,
|
||||||
|
closeExtensionRemovalResult,
|
||||||
|
confirmExtensionRemoval,
|
||||||
|
toggleAllBookmarks,
|
||||||
|
toggleAllBookmarkModalProfiles,
|
||||||
|
toggleAllExtensions,
|
||||||
|
toggleBookmarkModalProfileSelection,
|
||||||
|
toggleBookmarkSelection,
|
||||||
|
toggleAllExtensionModalProfiles,
|
||||||
|
toggleExtensionModalProfileSelection,
|
||||||
|
toggleExtensionSelection,
|
||||||
|
toggleAllHistoryProfiles,
|
||||||
|
toggleHistoryProfile,
|
||||||
closeAssociatedProfilesModal,
|
closeAssociatedProfilesModal,
|
||||||
} = useBrowserManager();
|
} = useBrowserManager();
|
||||||
</script>
|
</script>
|
||||||
@@ -53,6 +112,7 @@ const {
|
|||||||
:loading="loading"
|
:loading="loading"
|
||||||
:configs-loading="configsLoading"
|
:configs-loading="configsLoading"
|
||||||
:browser-monogram="browserMonogram"
|
:browser-monogram="browserMonogram"
|
||||||
|
:app-version="appVersion"
|
||||||
@select-browser="selectedBrowserId = $event; page = 'browserData'"
|
@select-browser="selectedBrowserId = $event; page = 'browserData'"
|
||||||
@select-configuration="page = 'configuration'"
|
@select-configuration="page = 'configuration'"
|
||||||
@refresh="refreshAll"
|
@refresh="refreshAll"
|
||||||
@@ -80,17 +140,33 @@ const {
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-else-if="loading">
|
<template v-else-if="loading">
|
||||||
<section class="state-panel">
|
<section class="state-panel scanning-panel">
|
||||||
<p class="eyebrow">Scanning</p>
|
<div class="scan-hero" aria-hidden="true">
|
||||||
<h2>Reading local browser data</h2>
|
<div class="scan-orbit orbit-one"></div>
|
||||||
<p>Profiles, installed extensions, and bookmarks are being collected.</p>
|
<div class="scan-orbit orbit-two"></div>
|
||||||
|
<div class="scan-core">
|
||||||
|
<div class="scan-core-ring"></div>
|
||||||
|
<div class="scan-core-ring secondary"></div>
|
||||||
|
<div class="scan-dot dot-one"></div>
|
||||||
|
<div class="scan-dot dot-two"></div>
|
||||||
|
<div class="scan-dot dot-three"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p class="eyebrow">扫描中</p>
|
||||||
|
<h2>正在读取本地浏览器数据</h2>
|
||||||
|
<p>正在收集用户资料、插件、书签和历史文件状态。</p>
|
||||||
|
<div class="loading-steps" aria-hidden="true">
|
||||||
|
<span></span>
|
||||||
|
<span></span>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-else-if="error">
|
<template v-else-if="error">
|
||||||
<section class="state-panel error">
|
<section class="state-panel error">
|
||||||
<p class="eyebrow">Error</p>
|
<p class="eyebrow">错误</p>
|
||||||
<h2>Scan failed</h2>
|
<h2>扫描失败</h2>
|
||||||
<p>{{ error }}</p>
|
<p>{{ error }}</p>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
@@ -102,30 +178,88 @@ const {
|
|||||||
:profile-sort-key="profileSortKey"
|
:profile-sort-key="profileSortKey"
|
||||||
:extension-sort-key="extensionSortKey"
|
:extension-sort-key="extensionSortKey"
|
||||||
:bookmark-sort-key="bookmarkSortKey"
|
:bookmark-sort-key="bookmarkSortKey"
|
||||||
|
:password-site-sort-key="passwordSiteSortKey"
|
||||||
|
:password-sites-loaded="hasLoadedPasswordSites(currentBrowser.browserId)"
|
||||||
|
:password-sites-loading="passwordSitesLoading"
|
||||||
|
:password-sites-error="passwordSitesError"
|
||||||
:sorted-profiles="sortedProfiles"
|
:sorted-profiles="sortedProfiles"
|
||||||
:sorted-extensions="sortedExtensions"
|
:sorted-extensions="sortedExtensions"
|
||||||
:sorted-bookmarks="sortedBookmarks"
|
:sorted-bookmarks="sortedBookmarks"
|
||||||
|
:sorted-password-sites="sortedPasswordSites"
|
||||||
|
:history-selected-profile-ids="cleanupHistorySelectedProfiles"
|
||||||
|
:cleanup-history-busy="historyCleanupBusy"
|
||||||
|
:history-cleanup-confirm-profiles="historyCleanupConfirmProfiles"
|
||||||
|
:history-cleanup-result-open="historyCleanupResultOpen"
|
||||||
|
:cleanup-history-error="cleanupHistoryError"
|
||||||
|
:cleanup-history-results="cleanupHistoryResults"
|
||||||
|
:bookmark-selected-urls="bookmarkSelectedUrls"
|
||||||
|
:bookmark-modal-selected-profile-ids="bookmarkModalSelectedProfileIds"
|
||||||
|
:bookmark-delete-busy="bookmarkDeleteBusy"
|
||||||
|
:bookmark-removal-confirm-bookmark-count="bookmarkRemovalConfirmBookmarkCount"
|
||||||
|
:bookmark-removal-confirm-profile-count="bookmarkRemovalConfirmProfileCount"
|
||||||
|
:bookmark-removal-result-open="bookmarkRemovalResultOpen"
|
||||||
|
:bookmark-removal-error="bookmarkRemovalError"
|
||||||
|
:bookmark-removal-results="bookmarkRemovalResults"
|
||||||
|
:extension-selected-ids="extensionSelectedIds"
|
||||||
|
:extension-modal-selected-profile-ids="extensionModalSelectedProfileIds"
|
||||||
|
:extension-delete-busy="extensionDeleteBusy"
|
||||||
|
:extension-removal-confirm-extensions="extensionRemovalConfirmExtensions"
|
||||||
|
:extension-removal-confirm-profiles="extensionRemovalConfirmProfiles"
|
||||||
|
:extension-removal-result-open="extensionRemovalResultOpen"
|
||||||
|
:extension-removal-error="extensionRemovalError"
|
||||||
|
:extension-removal-results="extensionRemovalResults"
|
||||||
:open-profile-error="openProfileError"
|
:open-profile-error="openProfileError"
|
||||||
:section-count="sectionCount"
|
:section-count="sectionCount"
|
||||||
:is-opening-profile="isOpeningProfile"
|
:is-opening-profile="isOpeningProfile"
|
||||||
:extension-monogram="extensionMonogram"
|
:extension-monogram="extensionMonogram"
|
||||||
:domain-from-url="domainFromUrl"
|
|
||||||
:associated-profiles-modal="associatedProfilesModal"
|
:associated-profiles-modal="associatedProfilesModal"
|
||||||
@update:active-section="activeSection = $event"
|
@update:active-section="activeSection = $event"
|
||||||
@update:profile-sort-key="profileSortKey = $event"
|
@update:profile-sort-key="profileSortKey = $event"
|
||||||
@update:extension-sort-key="extensionSortKey = $event"
|
@update:extension-sort-key="extensionSortKey = $event"
|
||||||
@update:bookmark-sort-key="bookmarkSortKey = $event"
|
@update:bookmark-sort-key="bookmarkSortKey = $event"
|
||||||
|
@update:password-site-sort-key="passwordSiteSortKey = $event"
|
||||||
|
@load-password-sites="loadPasswordSites"
|
||||||
@open-profile="(browserId, profileId) => openBrowserProfile(browserId, profileId)"
|
@open-profile="(browserId, profileId) => openBrowserProfile(browserId, profileId)"
|
||||||
@show-extension-profiles="showExtensionProfilesModal"
|
@show-extension-profiles="showExtensionProfilesModal"
|
||||||
@show-bookmark-profiles="showBookmarkProfilesModal"
|
@show-bookmark-profiles="showBookmarkProfilesModal"
|
||||||
|
@show-password-site-profiles="showPasswordSiteProfilesModal"
|
||||||
|
@toggle-bookmark-selection="toggleBookmarkSelection"
|
||||||
|
@toggle-all-bookmarks="toggleAllBookmarks"
|
||||||
|
@delete-bookmark-from-all-profiles="deleteBookmarkFromAllProfiles"
|
||||||
|
@delete-selected-bookmarks="deleteSelectedBookmarks"
|
||||||
|
@toggle-bookmark-modal-profile-selection="toggleBookmarkModalProfileSelection"
|
||||||
|
@toggle-all-bookmark-modal-profiles="toggleAllBookmarkModalProfiles"
|
||||||
|
@delete-bookmark-from-profile="deleteBookmarkFromProfile"
|
||||||
|
@delete-selected-bookmark-profiles="deleteSelectedBookmarkProfiles"
|
||||||
|
@confirm-bookmark-removal="confirmBookmarkRemoval"
|
||||||
|
@close-bookmark-removal-confirm="closeBookmarkRemovalConfirm"
|
||||||
|
@close-bookmark-removal-result="closeBookmarkRemovalResult"
|
||||||
|
@toggle-extension-selection="toggleExtensionSelection"
|
||||||
|
@toggle-all-extensions="toggleAllExtensions"
|
||||||
|
@delete-extension-from-all-profiles="deleteExtensionFromAllProfiles"
|
||||||
|
@delete-selected-extensions="deleteSelectedExtensions"
|
||||||
|
@toggle-extension-modal-profile-selection="toggleExtensionModalProfileSelection"
|
||||||
|
@toggle-all-extension-modal-profiles="toggleAllExtensionModalProfiles"
|
||||||
|
@delete-extension-from-profile="deleteExtensionFromProfile"
|
||||||
|
@delete-selected-extension-profiles="deleteSelectedExtensionProfiles"
|
||||||
|
@confirm-extension-removal="confirmExtensionRemoval"
|
||||||
|
@close-extension-removal-confirm="closeExtensionRemovalConfirm"
|
||||||
|
@close-extension-removal-result="closeExtensionRemovalResult"
|
||||||
|
@toggle-history-profile="toggleHistoryProfile"
|
||||||
|
@toggle-all-history-profiles="toggleAllHistoryProfiles"
|
||||||
|
@cleanup-selected-history="cleanupSelectedHistoryProfiles"
|
||||||
|
@cleanup-history-for-profile="cleanupHistoryForProfile"
|
||||||
|
@confirm-history-cleanup="confirmHistoryCleanup"
|
||||||
|
@close-history-cleanup-confirm="closeHistoryCleanupConfirm"
|
||||||
|
@close-history-cleanup-result="closeHistoryCleanupResult"
|
||||||
@close-associated-profiles="closeAssociatedProfilesModal"
|
@close-associated-profiles="closeAssociatedProfilesModal"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<section class="state-panel">
|
<section class="state-panel">
|
||||||
<p class="eyebrow">No Data</p>
|
<p class="eyebrow">无数据</p>
|
||||||
<h2>No supported browser was detected</h2>
|
<h2>没有检测到受支持的浏览器</h2>
|
||||||
<p>Install or sign in to Chrome, Edge, or Brave and refresh the scan.</p>
|
<p>请安装或登录 Chrome、Edge、Brave 等浏览器后再刷新扫描。</p>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
BIN
src/assets/chromium.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
src/assets/vivaldi.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
src/assets/yandex.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
@@ -4,11 +4,15 @@ import type {
|
|||||||
AssociatedProfileSortKey,
|
AssociatedProfileSortKey,
|
||||||
AssociatedProfileSummary,
|
AssociatedProfileSummary,
|
||||||
BookmarkAssociatedProfileSummary,
|
BookmarkAssociatedProfileSummary,
|
||||||
|
ExtensionAssociatedProfileSummary,
|
||||||
} from "../../types/browser";
|
} from "../../types/browser";
|
||||||
import { profileAvatarSrc } from "../../utils/icons";
|
import { profileAvatarSrc } from "../../utils/icons";
|
||||||
import { sortAssociatedProfiles } from "../../utils/sort";
|
import { sortAssociatedProfiles } from "../../utils/sort";
|
||||||
|
|
||||||
type ModalProfile = AssociatedProfileSummary | BookmarkAssociatedProfileSummary;
|
type ModalProfile =
|
||||||
|
| AssociatedProfileSummary
|
||||||
|
| BookmarkAssociatedProfileSummary
|
||||||
|
| ExtensionAssociatedProfileSummary;
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
title: string;
|
title: string;
|
||||||
@@ -16,20 +20,42 @@ const props = defineProps<{
|
|||||||
browserId: string;
|
browserId: string;
|
||||||
browserFamilyId: string | null;
|
browserFamilyId: string | null;
|
||||||
isBookmark: boolean;
|
isBookmark: boolean;
|
||||||
|
isExtension?: boolean;
|
||||||
|
selectedProfileIds?: string[];
|
||||||
|
deleteBusy?: boolean;
|
||||||
isOpeningProfile: (browserId: string, profileId: string) => boolean;
|
isOpeningProfile: (browserId: string, profileId: string) => boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
close: [];
|
close: [];
|
||||||
openProfile: [browserId: string, profileId: string];
|
openProfile: [browserId: string, profileId: string];
|
||||||
|
toggleProfileSelection: [profileId: string];
|
||||||
|
toggleAllProfileSelection: [];
|
||||||
|
deleteProfile: [profileId: string];
|
||||||
|
deleteSelectedProfiles: [];
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const sortKey = ref<AssociatedProfileSortKey>("id");
|
const sortKey = ref<AssociatedProfileSortKey>("id");
|
||||||
const sortedProfiles = computed(() => sortAssociatedProfiles(props.profiles, sortKey.value));
|
const sortedProfiles = computed(() => sortAssociatedProfiles(props.profiles, sortKey.value));
|
||||||
|
const selectedProfileIds = computed(() => props.selectedProfileIds ?? []);
|
||||||
|
const allSelected = computed(
|
||||||
|
() =>
|
||||||
|
sortedProfiles.value.length > 0 &&
|
||||||
|
sortedProfiles.value.every((profile) => selectedProfileIds.value.includes(profile.id)),
|
||||||
|
);
|
||||||
|
const isSelectableMode = computed(() => props.isExtension || props.isBookmark);
|
||||||
|
|
||||||
function hasBookmarkPath(profile: ModalProfile): profile is BookmarkAssociatedProfileSummary {
|
function hasBookmarkPath(profile: ModalProfile): profile is BookmarkAssociatedProfileSummary {
|
||||||
return "bookmarkPath" in profile;
|
return "bookmarkPath" in profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hasInstallSource(profile: ModalProfile): profile is ExtensionAssociatedProfileSummary {
|
||||||
|
return "installSource" in profile;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isSelected(profileId: string) {
|
||||||
|
return selectedProfileIds.value.includes(profileId);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -38,26 +64,77 @@ function hasBookmarkPath(profile: ModalProfile): profile is BookmarkAssociatedPr
|
|||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h3>{{ title }}</h3>
|
<h3>{{ title }}</h3>
|
||||||
<button class="secondary-button modal-close-button" type="button" @click="emit('close')">
|
<button class="secondary-button modal-close-button" type="button" @click="emit('close')">
|
||||||
Close
|
关闭
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-table">
|
<div class="modal-table">
|
||||||
<div class="modal-table-header modal-grid" :class="{ bookmark: isBookmark }">
|
<div v-if="isSelectableMode" class="modal-toolbar">
|
||||||
<div class="header-cell icon-cell">Avatar</div>
|
<label class="toolbar-checkbox" :class="{ disabled: !sortedProfiles.length }">
|
||||||
<button class="header-cell sortable" :class="{ active: sortKey === 'name' }" type="button" @click="sortKey = 'name'">Name</button>
|
<input
|
||||||
<button class="header-cell sortable" :class="{ active: sortKey === 'id' }" type="button" @click="sortKey = 'id'">Profile ID</button>
|
type="checkbox"
|
||||||
<div v-if="isBookmark" class="header-cell">Bookmark Path</div>
|
class="native-checkbox"
|
||||||
<div class="header-cell actions-cell">Action</div>
|
:checked="allSelected"
|
||||||
|
:disabled="!sortedProfiles.length || deleteBusy"
|
||||||
|
@change="emit('toggleAllProfileSelection')"
|
||||||
|
/>
|
||||||
|
<span class="custom-checkbox" :class="{ checked: allSelected }" aria-hidden="true">
|
||||||
|
<svg viewBox="0 0 16 16">
|
||||||
|
<path d="M3.5 8.2L6.4 11.1L12.5 4.9" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
<span>全选</span>
|
||||||
|
</label>
|
||||||
|
<button
|
||||||
|
class="danger-button"
|
||||||
|
type="button"
|
||||||
|
:disabled="!selectedProfileIds.length || deleteBusy"
|
||||||
|
@click="emit('deleteSelectedProfiles')"
|
||||||
|
>
|
||||||
|
{{ deleteBusy ? "删除中..." : `删除所选(${selectedProfileIds.length})` }}
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-list">
|
<div class="modal-table-header modal-grid" :class="{ bookmark: isBookmark, extension: isExtension }">
|
||||||
|
<div v-if="isSelectableMode" class="header-cell checkbox-cell">选择</div>
|
||||||
|
<div class="header-cell icon-cell">头像</div>
|
||||||
|
<button class="header-cell sortable" :class="{ active: sortKey === 'name' }" type="button" @click="sortKey = 'name'">名称</button>
|
||||||
|
<button
|
||||||
|
v-if="!isExtension && !isBookmark"
|
||||||
|
class="header-cell sortable"
|
||||||
|
:class="{ active: sortKey === 'id' }"
|
||||||
|
type="button"
|
||||||
|
@click="sortKey = 'id'"
|
||||||
|
>
|
||||||
|
资料 ID
|
||||||
|
</button>
|
||||||
|
<div v-if="isExtension" class="header-cell">来源</div>
|
||||||
|
<div v-if="isBookmark" class="header-cell">书签路径</div>
|
||||||
|
<div class="header-cell actions-cell">操作</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-table-body styled-scrollbar">
|
||||||
<article
|
<article
|
||||||
v-for="profile in sortedProfiles"
|
v-for="profile in sortedProfiles"
|
||||||
:key="profile.id"
|
:key="profile.id"
|
||||||
class="modal-table-row modal-grid"
|
class="modal-table-row modal-grid"
|
||||||
:class="{ bookmark: isBookmark }"
|
:class="{ bookmark: isBookmark, extension: isExtension }"
|
||||||
>
|
>
|
||||||
|
<div v-if="isSelectableMode" class="row-cell checkbox-cell">
|
||||||
|
<label class="table-checkbox" :class="{ disabled: deleteBusy }">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
class="native-checkbox"
|
||||||
|
:checked="isSelected(profile.id)"
|
||||||
|
:disabled="deleteBusy"
|
||||||
|
@change="emit('toggleProfileSelection', profile.id)"
|
||||||
|
/>
|
||||||
|
<span class="custom-checkbox" :class="{ checked: isSelected(profile.id) }" aria-hidden="true">
|
||||||
|
<svg viewBox="0 0 16 16">
|
||||||
|
<path d="M3.5 8.2L6.4 11.1L12.5 4.9" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
<div class="modal-profile-avatar">
|
<div class="modal-profile-avatar">
|
||||||
<img
|
<img
|
||||||
v-if="profileAvatarSrc(profile, browserFamilyId)"
|
v-if="profileAvatarSrc(profile, browserFamilyId)"
|
||||||
@@ -68,10 +145,14 @@ function hasBookmarkPath(profile: ModalProfile): profile is BookmarkAssociatedPr
|
|||||||
</div>
|
</div>
|
||||||
<div class="row-cell primary-cell">
|
<div class="row-cell primary-cell">
|
||||||
<strong>{{ profile.name }}</strong>
|
<strong>{{ profile.name }}</strong>
|
||||||
|
<span v-if="isExtension || isBookmark" class="subtle-line">{{ profile.id }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="row-cell">
|
<div v-if="!isExtension && !isBookmark" class="row-cell">
|
||||||
<span class="badge neutral">{{ profile.id }}</span>
|
<span class="badge neutral">{{ profile.id }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="isExtension && hasInstallSource(profile)" class="row-cell muted-cell">
|
||||||
|
{{ profile.installSource === "store" ? "商店安装" : "外部安装" }}
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="isBookmark && hasBookmarkPath(profile)"
|
v-if="isBookmark && hasBookmarkPath(profile)"
|
||||||
class="row-cell muted-cell"
|
class="row-cell muted-cell"
|
||||||
@@ -86,7 +167,16 @@ function hasBookmarkPath(profile: ModalProfile): profile is BookmarkAssociatedPr
|
|||||||
:disabled="isOpeningProfile(browserId, profile.id)"
|
:disabled="isOpeningProfile(browserId, profile.id)"
|
||||||
@click="emit('openProfile', browserId, profile.id)"
|
@click="emit('openProfile', browserId, profile.id)"
|
||||||
>
|
>
|
||||||
{{ isOpeningProfile(browserId, profile.id) ? "Opening..." : "Open" }}
|
{{ isOpeningProfile(browserId, profile.id) ? "打开中..." : "打开" }}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
v-if="isSelectableMode"
|
||||||
|
class="danger-button inline-danger-button"
|
||||||
|
type="button"
|
||||||
|
:disabled="deleteBusy"
|
||||||
|
@click="emit('deleteProfile', profile.id)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
@@ -127,12 +217,22 @@ function hasBookmarkPath(profile: ModalProfile): profile is BookmarkAssociatedPr
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-header h3 {
|
.modal-header h3 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
letter-spacing: -0.03em;
|
letter-spacing: -0.03em;
|
||||||
|
min-width: 0;
|
||||||
|
flex: 1;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-close-button {
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-table {
|
.modal-table {
|
||||||
@@ -153,13 +253,35 @@ function hasBookmarkPath(profile: ModalProfile): profile is BookmarkAssociatedPr
|
|||||||
}
|
}
|
||||||
|
|
||||||
.modal-grid.bookmark {
|
.modal-grid.bookmark {
|
||||||
grid-template-columns: 56px minmax(140px, 0.9fr) 120px minmax(180px, 1fr) 110px;
|
grid-template-columns: 52px 56px minmax(180px, 0.78fr) minmax(180px, 1fr) 168px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-table-header.modal-grid.extension,
|
||||||
|
.modal-table-row.modal-grid.extension {
|
||||||
|
grid-template-columns: 52px 56px minmax(180px, 0.78fr) minmax(180px, 1fr) 168px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-toolbar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 10px 12px 8px;
|
||||||
|
border-bottom: 1px solid rgba(148, 163, 184, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-table-header {
|
.modal-table-header {
|
||||||
padding: 10px 14px;
|
padding: 8px 24px 8px 12px;
|
||||||
border-bottom: 1px solid rgba(148, 163, 184, 0.14);
|
border-bottom: 1px solid rgba(148, 163, 184, 0.14);
|
||||||
background: rgba(248, 250, 252, 0.82);
|
background: rgba(248, 250, 252, 0.94);
|
||||||
|
backdrop-filter: blur(12px);
|
||||||
|
-webkit-backdrop-filter: blur(12px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-table-body {
|
||||||
|
min-height: 0;
|
||||||
|
overflow: auto;
|
||||||
|
scrollbar-gutter: stable;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-cell {
|
.header-cell {
|
||||||
@@ -180,15 +302,78 @@ function hasBookmarkPath(profile: ModalProfile): profile is BookmarkAssociatedPr
|
|||||||
color: var(--text);
|
color: var(--text);
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-list {
|
.toolbar-checkbox {
|
||||||
display: flex;
|
display: inline-flex;
|
||||||
flex-direction: column;
|
align-items: center;
|
||||||
min-height: 0;
|
gap: 10px;
|
||||||
overflow: auto;
|
color: var(--text);
|
||||||
|
font-size: 0.88rem;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar-checkbox.disabled {
|
||||||
|
opacity: 0.55;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.native-checkbox {
|
||||||
|
position: absolute;
|
||||||
|
opacity: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-checkbox {
|
||||||
|
position: relative;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-checkbox.disabled {
|
||||||
|
cursor: default;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-checkbox {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
border: 1px solid rgba(148, 163, 184, 0.34);
|
||||||
|
border-radius: 7px;
|
||||||
|
background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 245, 249, 0.92));
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-checkbox svg {
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-checkbox path {
|
||||||
|
fill: none;
|
||||||
|
stroke: #fff;
|
||||||
|
stroke-width: 2.2;
|
||||||
|
stroke-linecap: round;
|
||||||
|
stroke-linejoin: round;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-checkbox.checked {
|
||||||
|
border-color: rgba(47, 111, 237, 0.2);
|
||||||
|
background: linear-gradient(135deg, #2f6fed, #5aa1f7);
|
||||||
|
box-shadow:
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.22),
|
||||||
|
0 8px 18px rgba(47, 111, 237, 0.22);
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-checkbox.checked path {
|
||||||
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-table-row {
|
.modal-table-row {
|
||||||
padding: 12px 14px;
|
padding: 10px 12px;
|
||||||
border-bottom: 1px solid rgba(148, 163, 184, 0.12);
|
border-bottom: 1px solid rgba(148, 163, 184, 0.12);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,6 +415,13 @@ function hasBookmarkPath(profile: ModalProfile): profile is BookmarkAssociatedPr
|
|||||||
line-height: 1.3;
|
line-height: 1.3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.subtle-line {
|
||||||
|
display: block;
|
||||||
|
margin-top: 3px;
|
||||||
|
color: var(--muted-soft);
|
||||||
|
font-size: 0.8rem;
|
||||||
|
}
|
||||||
|
|
||||||
.muted-cell {
|
.muted-cell {
|
||||||
color: var(--muted);
|
color: var(--muted);
|
||||||
font-size: 0.86rem;
|
font-size: 0.86rem;
|
||||||
@@ -241,24 +433,40 @@ function hasBookmarkPath(profile: ModalProfile): profile is BookmarkAssociatedPr
|
|||||||
.actions-cell {
|
.actions-cell {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
|
gap: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon-cell {
|
.icon-cell {
|
||||||
padding-left: 4px;
|
padding-left: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.checkbox-cell {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inline-danger-button {
|
||||||
|
padding: 6px 10px;
|
||||||
|
border-radius: 10px;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 720px) {
|
@media (max-width: 720px) {
|
||||||
.modal-backdrop {
|
.modal-backdrop {
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-grid,
|
.modal-grid,
|
||||||
.modal-grid.bookmark {
|
.modal-grid.bookmark,
|
||||||
grid-template-columns: 56px minmax(0, 1fr) 96px;
|
.modal-table-header.modal-grid.extension,
|
||||||
|
.modal-table-row.modal-grid.extension {
|
||||||
|
grid-template-columns: 56px minmax(0, 1fr) 120px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-grid > :nth-child(4),
|
.modal-grid > :nth-child(4),
|
||||||
.modal-grid.bookmark > :nth-child(4) {
|
.modal-grid.bookmark > :nth-child(4),
|
||||||
|
.modal-table-header.modal-grid.extension > :nth-child(4),
|
||||||
|
.modal-table-row.modal-grid.extension > :nth-child(4) {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
146
src/components/browser-data/BookmarkRemovalModal.vue
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed } from "vue";
|
||||||
|
|
||||||
|
import type { RemoveBookmarkResult } from "../../types/browser";
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
mode: "confirm" | "result";
|
||||||
|
title: string;
|
||||||
|
bookmarkCount: number;
|
||||||
|
profileCount: number;
|
||||||
|
results: RemoveBookmarkResult[];
|
||||||
|
busy?: boolean;
|
||||||
|
generalError?: string;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
close: [];
|
||||||
|
confirm: [];
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const resultSummary = computed(() => {
|
||||||
|
const statusByUrl = new Map<string, boolean>();
|
||||||
|
|
||||||
|
for (const result of props.results) {
|
||||||
|
const previous = statusByUrl.get(result.url);
|
||||||
|
const succeeded = !result.error;
|
||||||
|
|
||||||
|
if (previous === undefined) {
|
||||||
|
statusByUrl.set(result.url, succeeded);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
statusByUrl.set(result.url, previous && succeeded);
|
||||||
|
}
|
||||||
|
|
||||||
|
let successCount = 0;
|
||||||
|
let failedCount = 0;
|
||||||
|
for (const succeeded of statusByUrl.values()) {
|
||||||
|
if (succeeded) {
|
||||||
|
successCount += 1;
|
||||||
|
} else {
|
||||||
|
failedCount += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { successCount, failedCount };
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="modal-backdrop" @click.self="emit('close')">
|
||||||
|
<section class="modal-card">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h3>{{ title }}</h3>
|
||||||
|
<button class="secondary-button" type="button" @click="emit('close')">关闭</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template v-if="mode === 'confirm'">
|
||||||
|
<p class="modal-copy">
|
||||||
|
将从 {{ profileCount }} 个资料中删除 {{ bookmarkCount }} 个书签。
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="modal-actions">
|
||||||
|
<button class="secondary-button" type="button" @click="emit('close')">取消</button>
|
||||||
|
<button class="danger-button" type="button" :disabled="busy" @click="emit('confirm')">
|
||||||
|
{{ busy ? "删除中..." : "确认删除" }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-else>
|
||||||
|
<p v-if="generalError" class="result-banner error">{{ generalError }}</p>
|
||||||
|
<p class="modal-copy">
|
||||||
|
成功删除 {{ resultSummary.successCount }} 个书签,失败 {{ resultSummary.failedCount }} 个。
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="modal-actions">
|
||||||
|
<button class="primary-button" type="button" @click="emit('close')">关闭</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.modal-backdrop {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
z-index: 50;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
padding: 24px;
|
||||||
|
background: rgba(15, 23, 42, 0.26);
|
||||||
|
backdrop-filter: blur(6px);
|
||||||
|
-webkit-backdrop-filter: blur(6px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-card {
|
||||||
|
width: min(560px, 100%);
|
||||||
|
max-height: min(72vh, 820px);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 14px;
|
||||||
|
padding: 16px;
|
||||||
|
border: 1px solid var(--panel-border);
|
||||||
|
border-radius: 22px;
|
||||||
|
background: rgba(255, 255, 255, 0.96);
|
||||||
|
box-shadow: 0 28px 70px rgba(15, 23, 42, 0.18);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header h3,
|
||||||
|
.modal-copy {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-copy {
|
||||||
|
color: var(--muted);
|
||||||
|
line-height: 1.55;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-banner {
|
||||||
|
margin: 0;
|
||||||
|
padding: 12px 14px;
|
||||||
|
border-radius: 14px;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-banner.error {
|
||||||
|
background: rgba(254, 242, 242, 0.96);
|
||||||
|
color: #b42318;
|
||||||
|
border: 1px solid rgba(239, 68, 68, 0.18);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-actions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,41 +1,111 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { computed } from "vue";
|
||||||
|
|
||||||
import type { BookmarkSortKey, BookmarkSummary } from "../../types/browser";
|
import type { BookmarkSortKey, BookmarkSummary } from "../../types/browser";
|
||||||
|
|
||||||
defineProps<{
|
const props = defineProps<{
|
||||||
bookmarks: BookmarkSummary[];
|
bookmarks: BookmarkSummary[];
|
||||||
sortKey: BookmarkSortKey;
|
sortKey: BookmarkSortKey;
|
||||||
|
selectedBookmarkUrls: string[];
|
||||||
|
deleteBusy: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
"update:sortKey": [value: BookmarkSortKey];
|
"update:sortKey": [value: BookmarkSortKey];
|
||||||
showProfiles: [url: string];
|
showProfiles: [url: string];
|
||||||
|
toggleBookmark: [url: string];
|
||||||
|
toggleAllBookmarks: [];
|
||||||
|
deleteBookmark: [url: string];
|
||||||
|
deleteSelected: [];
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
const allSelected = computed(
|
||||||
|
() =>
|
||||||
|
props.bookmarks.length > 0 &&
|
||||||
|
props.bookmarks.every((bookmark) => props.selectedBookmarkUrls.includes(bookmark.url)),
|
||||||
|
);
|
||||||
|
|
||||||
|
function isSelected(url: string) {
|
||||||
|
return props.selectedBookmarkUrls.includes(url);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<section class="table-section">
|
<section class="table-section">
|
||||||
<div v-if="bookmarks.length" class="data-table">
|
<div v-if="bookmarks.length" class="data-table">
|
||||||
<div class="data-table-header bookmarks-grid">
|
<div class="bookmarks-toolbar">
|
||||||
<button class="header-cell sortable" :class="{ active: sortKey === 'title' }" type="button" @click="emit('update:sortKey', 'title')">Name</button>
|
<label class="toolbar-checkbox" :class="{ disabled: !bookmarks.length }">
|
||||||
<button class="header-cell sortable" :class="{ active: sortKey === 'url' }" type="button" @click="emit('update:sortKey', 'url')">URL</button>
|
<input
|
||||||
<div class="header-cell actions-cell">Profiles</div>
|
type="checkbox"
|
||||||
|
class="native-checkbox"
|
||||||
|
:checked="allSelected"
|
||||||
|
:disabled="!bookmarks.length || deleteBusy"
|
||||||
|
@change="emit('toggleAllBookmarks')"
|
||||||
|
/>
|
||||||
|
<span class="custom-checkbox" :class="{ checked: allSelected }" aria-hidden="true">
|
||||||
|
<svg viewBox="0 0 16 16">
|
||||||
|
<path d="M3.5 8.2L6.4 11.1L12.5 4.9" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
<span>全选</span>
|
||||||
|
</label>
|
||||||
|
<button
|
||||||
|
class="danger-button toolbar-danger-button"
|
||||||
|
type="button"
|
||||||
|
:disabled="!selectedBookmarkUrls.length || deleteBusy"
|
||||||
|
@click="emit('deleteSelected')"
|
||||||
|
>
|
||||||
|
{{ deleteBusy ? "删除中..." : `删除所选(${selectedBookmarkUrls.length})` }}
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<article v-for="bookmark in bookmarks" :key="bookmark.url" class="data-table-row bookmarks-grid">
|
<div class="data-table-header bookmarks-grid">
|
||||||
<div class="row-cell primary-cell">
|
<div class="header-cell checkbox-cell">选择</div>
|
||||||
<strong>{{ bookmark.title }}</strong>
|
<button class="header-cell sortable" :class="{ active: sortKey === 'title' }" type="button" @click="emit('update:sortKey', 'title')">名称</button>
|
||||||
</div>
|
<button class="header-cell sortable" :class="{ active: sortKey === 'url' }" type="button" @click="emit('update:sortKey', 'url')">URL</button>
|
||||||
<div class="row-cell muted-cell" :title="bookmark.url">{{ bookmark.url }}</div>
|
<div class="header-cell actions-cell">操作</div>
|
||||||
<div class="row-cell actions-cell">
|
</div>
|
||||||
<button class="disclosure-button" type="button" @click="emit('showProfiles', bookmark.url)">
|
<div class="data-table-body styled-scrollbar">
|
||||||
<span>View</span>
|
<article v-for="bookmark in bookmarks" :key="bookmark.url" class="data-table-row bookmarks-grid">
|
||||||
<span class="badge neutral">{{ bookmark.profileIds.length }}</span>
|
<div class="row-cell checkbox-cell">
|
||||||
</button>
|
<label class="table-checkbox" :class="{ disabled: deleteBusy }">
|
||||||
</div>
|
<input
|
||||||
</article>
|
type="checkbox"
|
||||||
|
class="native-checkbox"
|
||||||
|
:checked="isSelected(bookmark.url)"
|
||||||
|
:disabled="deleteBusy"
|
||||||
|
@change="emit('toggleBookmark', bookmark.url)"
|
||||||
|
/>
|
||||||
|
<span class="custom-checkbox" :class="{ checked: isSelected(bookmark.url) }" aria-hidden="true">
|
||||||
|
<svg viewBox="0 0 16 16">
|
||||||
|
<path d="M3.5 8.2L6.4 11.1L12.5 4.9" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="row-cell primary-cell">
|
||||||
|
<strong :title="bookmark.title">{{ bookmark.title }}</strong>
|
||||||
|
</div>
|
||||||
|
<div class="row-cell muted-cell" :title="bookmark.url">{{ bookmark.url }}</div>
|
||||||
|
<div class="row-cell actions-cell">
|
||||||
|
<button class="disclosure-button" type="button" @click="emit('showProfiles', bookmark.url)">
|
||||||
|
<span>查看</span>
|
||||||
|
<span class="badge neutral">{{ bookmark.profileIds.length }}</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="danger-button inline-danger-button"
|
||||||
|
type="button"
|
||||||
|
:disabled="deleteBusy"
|
||||||
|
@click="emit('deleteBookmark', bookmark.url)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="empty-card">
|
<div v-else class="empty-card">
|
||||||
<p>No bookmarks were discovered for this browser.</p>
|
<p>这个浏览器没有扫描到任何书签。</p>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
@@ -43,22 +113,40 @@ const emit = defineEmits<{
|
|||||||
<style scoped>
|
<style scoped>
|
||||||
.table-section {
|
.table-section {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
height: 100%;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bookmarks-toolbar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 10px 12px 8px;
|
||||||
|
border-bottom: 1px solid rgba(148, 163, 184, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.data-table {
|
.data-table {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
min-height: 100%;
|
height: 100%;
|
||||||
|
min-height: 0;
|
||||||
border: 1px solid rgba(148, 163, 184, 0.18);
|
border: 1px solid rgba(148, 163, 184, 0.18);
|
||||||
border-radius: 22px;
|
border-radius: 22px;
|
||||||
background: var(--panel);
|
background: var(--panel);
|
||||||
box-shadow: var(--shadow);
|
box-shadow: var(--shadow);
|
||||||
overflow: clip;
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-table-body {
|
||||||
|
min-height: 0;
|
||||||
|
overflow: auto;
|
||||||
|
scrollbar-gutter: stable;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bookmarks-grid {
|
.bookmarks-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: minmax(180px, 0.9fr) minmax(260px, 1.2fr) 154px;
|
grid-template-columns: 52px minmax(180px, 0.9fr) minmax(260px, 1.2fr) 250px;
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
@@ -67,7 +155,7 @@ const emit = defineEmits<{
|
|||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
padding: 10px 14px;
|
padding: 8px 24px 8px 12px;
|
||||||
border-bottom: 1px solid rgba(148, 163, 184, 0.14);
|
border-bottom: 1px solid rgba(148, 163, 184, 0.14);
|
||||||
background: rgba(248, 250, 252, 0.94);
|
background: rgba(248, 250, 252, 0.94);
|
||||||
backdrop-filter: blur(12px);
|
backdrop-filter: blur(12px);
|
||||||
@@ -92,8 +180,81 @@ const emit = defineEmits<{
|
|||||||
color: var(--text);
|
color: var(--text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.toolbar-checkbox {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
color: var(--text);
|
||||||
|
font-size: 0.88rem;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar-checkbox.disabled {
|
||||||
|
opacity: 0.55;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.native-checkbox {
|
||||||
|
position: absolute;
|
||||||
|
opacity: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-checkbox {
|
||||||
|
position: relative;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-checkbox.disabled {
|
||||||
|
cursor: default;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-checkbox {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
border: 1px solid rgba(148, 163, 184, 0.34);
|
||||||
|
border-radius: 7px;
|
||||||
|
background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 245, 249, 0.92));
|
||||||
|
box-shadow:
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.78),
|
||||||
|
0 4px 10px rgba(15, 23, 42, 0.06);
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-checkbox svg {
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-checkbox path {
|
||||||
|
fill: none;
|
||||||
|
stroke: #fff;
|
||||||
|
stroke-width: 2.2;
|
||||||
|
stroke-linecap: round;
|
||||||
|
stroke-linejoin: round;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-checkbox.checked {
|
||||||
|
border-color: rgba(47, 111, 237, 0.2);
|
||||||
|
background: linear-gradient(135deg, #2f6fed, #5aa1f7);
|
||||||
|
box-shadow:
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.22),
|
||||||
|
0 8px 18px rgba(47, 111, 237, 0.22);
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-checkbox.checked path {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
.data-table-row {
|
.data-table-row {
|
||||||
padding: 12px 14px;
|
padding: 10px 12px;
|
||||||
border-bottom: 1px solid rgba(148, 163, 184, 0.12);
|
border-bottom: 1px solid rgba(148, 163, 184, 0.12);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,6 +274,9 @@ const emit = defineEmits<{
|
|||||||
display: block;
|
display: block;
|
||||||
font-size: 0.93rem;
|
font-size: 0.93rem;
|
||||||
line-height: 1.3;
|
line-height: 1.3;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.muted-cell {
|
.muted-cell {
|
||||||
@@ -130,30 +294,54 @@ const emit = defineEmits<{
|
|||||||
gap: 10px;
|
gap: 10px;
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
min-width: 120px;
|
min-width: 120px;
|
||||||
padding: 7px 10px;
|
padding: 5px 10px;
|
||||||
border-radius: 12px;
|
border-radius: 10px;
|
||||||
background: rgba(241, 245, 249, 0.9);
|
background: rgba(241, 245, 249, 0.9);
|
||||||
color: var(--badge-text);
|
color: var(--badge-text);
|
||||||
|
font-size: 0.8rem;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.disclosure-button .badge {
|
||||||
|
min-width: 24px;
|
||||||
|
padding: 4px 8px;
|
||||||
|
font-size: 0.76rem;
|
||||||
|
}
|
||||||
|
|
||||||
.actions-cell {
|
.actions-cell {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-cell {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inline-danger-button {
|
||||||
|
padding: 5px 10px;
|
||||||
|
border-radius: 10px;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar-danger-button {
|
||||||
|
padding: 6px 10px;
|
||||||
|
border-radius: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 900px) {
|
@media (max-width: 900px) {
|
||||||
.bookmarks-grid {
|
.bookmarks-grid {
|
||||||
grid-template-columns: minmax(160px, 0.9fr) minmax(200px, 1fr) 148px;
|
grid-template-columns: 52px minmax(160px, 0.9fr) minmax(200px, 1fr) 236px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 720px) {
|
@media (max-width: 720px) {
|
||||||
.bookmarks-grid {
|
.bookmarks-grid {
|
||||||
grid-template-columns: minmax(0, 1fr) 132px;
|
grid-template-columns: 52px minmax(0, 1fr) 152px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bookmarks-grid > :nth-child(2) {
|
.bookmarks-grid > :nth-child(3) {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,11 +6,21 @@ import type {
|
|||||||
BookmarkSortKey,
|
BookmarkSortKey,
|
||||||
BrowserView,
|
BrowserView,
|
||||||
ExtensionSortKey,
|
ExtensionSortKey,
|
||||||
|
CleanupHistoryResult,
|
||||||
|
ExtensionAssociatedProfileSummary,
|
||||||
|
RemoveBookmarkResult,
|
||||||
|
PasswordSiteSortKey,
|
||||||
ProfileSortKey,
|
ProfileSortKey,
|
||||||
|
RemoveExtensionResult,
|
||||||
} from "../../types/browser";
|
} from "../../types/browser";
|
||||||
import AssociatedProfilesModal from "./AssociatedProfilesModal.vue";
|
import AssociatedProfilesModal from "./AssociatedProfilesModal.vue";
|
||||||
|
import BookmarkRemovalModal from "./BookmarkRemovalModal.vue";
|
||||||
import BookmarksList from "./BookmarksList.vue";
|
import BookmarksList from "./BookmarksList.vue";
|
||||||
|
import ExtensionRemovalModal from "./ExtensionRemovalModal.vue";
|
||||||
import ExtensionsList from "./ExtensionsList.vue";
|
import ExtensionsList from "./ExtensionsList.vue";
|
||||||
|
import HistoryCleanupList from "./HistoryCleanupList.vue";
|
||||||
|
import HistoryCleanupModal from "./HistoryCleanupModal.vue";
|
||||||
|
import PasswordSitesList from "./PasswordSitesList.vue";
|
||||||
import ProfilesList from "./ProfilesList.vue";
|
import ProfilesList from "./ProfilesList.vue";
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
@@ -19,19 +29,52 @@ defineProps<{
|
|||||||
profileSortKey: ProfileSortKey;
|
profileSortKey: ProfileSortKey;
|
||||||
extensionSortKey: ExtensionSortKey;
|
extensionSortKey: ExtensionSortKey;
|
||||||
bookmarkSortKey: BookmarkSortKey;
|
bookmarkSortKey: BookmarkSortKey;
|
||||||
|
passwordSiteSortKey: PasswordSiteSortKey;
|
||||||
|
passwordSitesLoaded: boolean;
|
||||||
|
passwordSitesLoading: boolean;
|
||||||
|
passwordSitesError: string;
|
||||||
sortedProfiles: BrowserView["profiles"];
|
sortedProfiles: BrowserView["profiles"];
|
||||||
sortedExtensions: BrowserView["extensions"];
|
sortedExtensions: BrowserView["extensions"];
|
||||||
sortedBookmarks: BrowserView["bookmarks"];
|
sortedBookmarks: BrowserView["bookmarks"];
|
||||||
|
sortedPasswordSites: BrowserView["passwordSites"];
|
||||||
|
historySelectedProfileIds: string[];
|
||||||
|
cleanupHistoryBusy: boolean;
|
||||||
|
historyCleanupConfirmProfiles: BrowserView["profiles"];
|
||||||
|
historyCleanupResultOpen: boolean;
|
||||||
|
cleanupHistoryError: string;
|
||||||
|
cleanupHistoryResults: CleanupHistoryResult[];
|
||||||
|
bookmarkSelectedUrls: string[];
|
||||||
|
bookmarkModalSelectedProfileIds: string[];
|
||||||
|
bookmarkDeleteBusy: boolean;
|
||||||
|
bookmarkRemovalConfirmBookmarkCount: number;
|
||||||
|
bookmarkRemovalConfirmProfileCount: number;
|
||||||
|
bookmarkRemovalResultOpen: boolean;
|
||||||
|
bookmarkRemovalError: string;
|
||||||
|
bookmarkRemovalResults: RemoveBookmarkResult[];
|
||||||
|
extensionSelectedIds: string[];
|
||||||
|
extensionModalSelectedProfileIds: string[];
|
||||||
|
extensionDeleteBusy: boolean;
|
||||||
|
extensionRemovalConfirmExtensions: BrowserView["extensions"];
|
||||||
|
extensionRemovalConfirmProfiles: BrowserView["profiles"];
|
||||||
|
extensionRemovalResultOpen: boolean;
|
||||||
|
extensionRemovalError: string;
|
||||||
|
extensionRemovalResults: RemoveExtensionResult[];
|
||||||
openProfileError: string;
|
openProfileError: string;
|
||||||
sectionCount: (section: ActiveSection) => number;
|
sectionCount: (section: ActiveSection) => number;
|
||||||
isOpeningProfile: (browserId: string, profileId: string) => boolean;
|
isOpeningProfile: (browserId: string, profileId: string) => boolean;
|
||||||
extensionMonogram: (name: string) => string;
|
extensionMonogram: (name: string) => string;
|
||||||
domainFromUrl: (url: string) => string;
|
|
||||||
associatedProfilesModal: {
|
associatedProfilesModal: {
|
||||||
title: string;
|
title: string;
|
||||||
browserId: string;
|
browserId: string;
|
||||||
profiles: (AssociatedProfileSummary | BookmarkAssociatedProfileSummary)[];
|
profiles: (
|
||||||
|
| AssociatedProfileSummary
|
||||||
|
| BookmarkAssociatedProfileSummary
|
||||||
|
| ExtensionAssociatedProfileSummary
|
||||||
|
)[];
|
||||||
isBookmark: boolean;
|
isBookmark: boolean;
|
||||||
|
isExtension?: boolean;
|
||||||
|
extensionId?: string;
|
||||||
|
bookmarkUrl?: string;
|
||||||
} | null;
|
} | null;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
@@ -40,9 +83,41 @@ const emit = defineEmits<{
|
|||||||
"update:profileSortKey": [value: ProfileSortKey];
|
"update:profileSortKey": [value: ProfileSortKey];
|
||||||
"update:extensionSortKey": [value: ExtensionSortKey];
|
"update:extensionSortKey": [value: ExtensionSortKey];
|
||||||
"update:bookmarkSortKey": [value: BookmarkSortKey];
|
"update:bookmarkSortKey": [value: BookmarkSortKey];
|
||||||
|
"update:passwordSiteSortKey": [value: PasswordSiteSortKey];
|
||||||
|
loadPasswordSites: [];
|
||||||
openProfile: [browserId: string, profileId: string];
|
openProfile: [browserId: string, profileId: string];
|
||||||
showExtensionProfiles: [extensionId: string];
|
showExtensionProfiles: [extensionId: string];
|
||||||
showBookmarkProfiles: [url: string];
|
showBookmarkProfiles: [url: string];
|
||||||
|
showPasswordSiteProfiles: [url: string];
|
||||||
|
toggleBookmarkSelection: [url: string];
|
||||||
|
toggleAllBookmarks: [];
|
||||||
|
deleteBookmarkFromAllProfiles: [url: string];
|
||||||
|
deleteSelectedBookmarks: [];
|
||||||
|
toggleBookmarkModalProfileSelection: [profileId: string];
|
||||||
|
toggleAllBookmarkModalProfiles: [];
|
||||||
|
deleteBookmarkFromProfile: [profileId: string];
|
||||||
|
deleteSelectedBookmarkProfiles: [];
|
||||||
|
confirmBookmarkRemoval: [];
|
||||||
|
closeBookmarkRemovalConfirm: [];
|
||||||
|
closeBookmarkRemovalResult: [];
|
||||||
|
toggleExtensionSelection: [extensionId: string];
|
||||||
|
toggleAllExtensions: [];
|
||||||
|
deleteExtensionFromAllProfiles: [extensionId: string];
|
||||||
|
deleteSelectedExtensions: [];
|
||||||
|
toggleExtensionModalProfileSelection: [profileId: string];
|
||||||
|
toggleAllExtensionModalProfiles: [];
|
||||||
|
deleteExtensionFromProfile: [profileId: string];
|
||||||
|
deleteSelectedExtensionProfiles: [];
|
||||||
|
confirmExtensionRemoval: [];
|
||||||
|
closeExtensionRemovalConfirm: [];
|
||||||
|
closeExtensionRemovalResult: [];
|
||||||
|
toggleHistoryProfile: [profileId: string];
|
||||||
|
toggleAllHistoryProfiles: [];
|
||||||
|
cleanupSelectedHistory: [];
|
||||||
|
cleanupHistoryForProfile: [profileId: string];
|
||||||
|
confirmHistoryCleanup: [];
|
||||||
|
closeHistoryCleanupConfirm: [];
|
||||||
|
closeHistoryCleanupResult: [];
|
||||||
closeAssociatedProfiles: [];
|
closeAssociatedProfiles: [];
|
||||||
}>();
|
}>();
|
||||||
</script>
|
</script>
|
||||||
@@ -55,7 +130,7 @@ const emit = defineEmits<{
|
|||||||
type="button"
|
type="button"
|
||||||
@click="emit('update:activeSection', 'profiles')"
|
@click="emit('update:activeSection', 'profiles')"
|
||||||
>
|
>
|
||||||
<span>Profiles</span>
|
<span>资料</span>
|
||||||
<span class="count-pill">{{ sectionCount("profiles") }}</span>
|
<span class="count-pill">{{ sectionCount("profiles") }}</span>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
@@ -64,7 +139,7 @@ const emit = defineEmits<{
|
|||||||
type="button"
|
type="button"
|
||||||
@click="emit('update:activeSection', 'extensions')"
|
@click="emit('update:activeSection', 'extensions')"
|
||||||
>
|
>
|
||||||
<span>Extensions</span>
|
<span>插件</span>
|
||||||
<span class="count-pill">{{ sectionCount("extensions") }}</span>
|
<span class="count-pill">{{ sectionCount("extensions") }}</span>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
@@ -73,9 +148,27 @@ const emit = defineEmits<{
|
|||||||
type="button"
|
type="button"
|
||||||
@click="emit('update:activeSection', 'bookmarks')"
|
@click="emit('update:activeSection', 'bookmarks')"
|
||||||
>
|
>
|
||||||
<span>Bookmarks</span>
|
<span>书签</span>
|
||||||
<span class="count-pill">{{ sectionCount("bookmarks") }}</span>
|
<span class="count-pill">{{ sectionCount("bookmarks") }}</span>
|
||||||
</button>
|
</button>
|
||||||
|
<button
|
||||||
|
class="section-tab"
|
||||||
|
:class="{ active: activeSection === 'passwords' }"
|
||||||
|
type="button"
|
||||||
|
@click="emit('update:activeSection', 'passwords')"
|
||||||
|
>
|
||||||
|
<span>已保存登录</span>
|
||||||
|
<span class="count-pill">{{ sectionCount("passwords") }}</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="section-tab"
|
||||||
|
:class="{ active: activeSection === 'history' }"
|
||||||
|
type="button"
|
||||||
|
@click="emit('update:activeSection', 'history')"
|
||||||
|
>
|
||||||
|
<span>历史</span>
|
||||||
|
<span class="count-pill">{{ sectionCount("history") }}</span>
|
||||||
|
</button>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<div class="content-scroll-area">
|
<div class="content-scroll-area">
|
||||||
@@ -96,19 +189,122 @@ const emit = defineEmits<{
|
|||||||
:extensions="sortedExtensions"
|
:extensions="sortedExtensions"
|
||||||
:sort-key="extensionSortKey"
|
:sort-key="extensionSortKey"
|
||||||
:extension-monogram="extensionMonogram"
|
:extension-monogram="extensionMonogram"
|
||||||
|
:selected-extension-ids="extensionSelectedIds"
|
||||||
|
:delete-busy="extensionDeleteBusy"
|
||||||
@update:sort-key="emit('update:extensionSortKey', $event)"
|
@update:sort-key="emit('update:extensionSortKey', $event)"
|
||||||
@show-profiles="emit('showExtensionProfiles', $event)"
|
@show-profiles="emit('showExtensionProfiles', $event)"
|
||||||
|
@toggle-extension="emit('toggleExtensionSelection', $event)"
|
||||||
|
@toggle-all-extensions="emit('toggleAllExtensions')"
|
||||||
|
@delete-extension="emit('deleteExtensionFromAllProfiles', $event)"
|
||||||
|
@delete-selected="emit('deleteSelectedExtensions')"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<BookmarksList
|
<BookmarksList
|
||||||
v-else
|
v-else-if="activeSection === 'bookmarks'"
|
||||||
:bookmarks="sortedBookmarks"
|
:bookmarks="sortedBookmarks"
|
||||||
:sort-key="bookmarkSortKey"
|
:sort-key="bookmarkSortKey"
|
||||||
|
:selected-bookmark-urls="bookmarkSelectedUrls"
|
||||||
|
:delete-busy="bookmarkDeleteBusy"
|
||||||
@update:sort-key="emit('update:bookmarkSortKey', $event)"
|
@update:sort-key="emit('update:bookmarkSortKey', $event)"
|
||||||
@show-profiles="emit('showBookmarkProfiles', $event)"
|
@show-profiles="emit('showBookmarkProfiles', $event)"
|
||||||
|
@toggle-bookmark="emit('toggleBookmarkSelection', $event)"
|
||||||
|
@toggle-all-bookmarks="emit('toggleAllBookmarks')"
|
||||||
|
@delete-bookmark="emit('deleteBookmarkFromAllProfiles', $event)"
|
||||||
|
@delete-selected="emit('deleteSelectedBookmarks')"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<PasswordSitesList
|
||||||
|
v-else-if="activeSection === 'passwords'"
|
||||||
|
:password-sites="sortedPasswordSites"
|
||||||
|
:sort-key="passwordSiteSortKey"
|
||||||
|
:loaded="passwordSitesLoaded"
|
||||||
|
:loading="passwordSitesLoading"
|
||||||
|
:error="passwordSitesError"
|
||||||
|
@update:sort-key="emit('update:passwordSiteSortKey', $event)"
|
||||||
|
@load="emit('loadPasswordSites')"
|
||||||
|
@show-profiles="emit('showPasswordSiteProfiles', $event)"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<HistoryCleanupList
|
||||||
|
v-else
|
||||||
|
:browser-family-id="currentBrowser.browserFamilyId"
|
||||||
|
:profiles="sortedProfiles"
|
||||||
|
:selected-profile-ids="historySelectedProfileIds"
|
||||||
|
:cleanup-busy="cleanupHistoryBusy"
|
||||||
|
@toggle-profile="emit('toggleHistoryProfile', $event)"
|
||||||
|
@toggle-all-profiles="emit('toggleAllHistoryProfiles')"
|
||||||
|
@cleanup-selected="emit('cleanupSelectedHistory')"
|
||||||
|
@cleanup-profile="emit('cleanupHistoryForProfile', $event)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<HistoryCleanupModal
|
||||||
|
v-if="historyCleanupConfirmProfiles.length"
|
||||||
|
mode="confirm"
|
||||||
|
title="确认清理历史"
|
||||||
|
:profiles="historyCleanupConfirmProfiles"
|
||||||
|
:results="[]"
|
||||||
|
:busy="cleanupHistoryBusy"
|
||||||
|
@close="emit('closeHistoryCleanupConfirm')"
|
||||||
|
@confirm="emit('confirmHistoryCleanup')"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<HistoryCleanupModal
|
||||||
|
v-if="historyCleanupResultOpen"
|
||||||
|
mode="result"
|
||||||
|
title="清理结果"
|
||||||
|
:profiles="[]"
|
||||||
|
:results="cleanupHistoryResults"
|
||||||
|
:general-error="cleanupHistoryError"
|
||||||
|
@close="emit('closeHistoryCleanupResult')"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<BookmarkRemovalModal
|
||||||
|
v-if="bookmarkRemovalConfirmBookmarkCount > 0"
|
||||||
|
mode="confirm"
|
||||||
|
title="确认删除书签"
|
||||||
|
:bookmark-count="bookmarkRemovalConfirmBookmarkCount"
|
||||||
|
:profile-count="bookmarkRemovalConfirmProfileCount"
|
||||||
|
:results="[]"
|
||||||
|
:busy="bookmarkDeleteBusy"
|
||||||
|
@close="emit('closeBookmarkRemovalConfirm')"
|
||||||
|
@confirm="emit('confirmBookmarkRemoval')"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<BookmarkRemovalModal
|
||||||
|
v-if="bookmarkRemovalResultOpen"
|
||||||
|
mode="result"
|
||||||
|
title="书签删除结果"
|
||||||
|
:bookmark-count="0"
|
||||||
|
:profile-count="0"
|
||||||
|
:results="bookmarkRemovalResults"
|
||||||
|
:general-error="bookmarkRemovalError"
|
||||||
|
@close="emit('closeBookmarkRemovalResult')"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ExtensionRemovalModal
|
||||||
|
v-if="extensionRemovalConfirmExtensions.length || extensionRemovalConfirmProfiles.length"
|
||||||
|
mode="confirm"
|
||||||
|
title="确认删除插件"
|
||||||
|
:extensions="extensionRemovalConfirmExtensions"
|
||||||
|
:profiles="extensionRemovalConfirmProfiles"
|
||||||
|
:results="[]"
|
||||||
|
:busy="extensionDeleteBusy"
|
||||||
|
@close="emit('closeExtensionRemovalConfirm')"
|
||||||
|
@confirm="emit('confirmExtensionRemoval')"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ExtensionRemovalModal
|
||||||
|
v-if="extensionRemovalResultOpen"
|
||||||
|
mode="result"
|
||||||
|
title="插件删除结果"
|
||||||
|
:extensions="[]"
|
||||||
|
:profiles="[]"
|
||||||
|
:results="extensionRemovalResults"
|
||||||
|
:general-error="extensionRemovalError"
|
||||||
|
@close="emit('closeExtensionRemovalResult')"
|
||||||
|
/>
|
||||||
|
|
||||||
<AssociatedProfilesModal
|
<AssociatedProfilesModal
|
||||||
v-if="associatedProfilesModal"
|
v-if="associatedProfilesModal"
|
||||||
:title="associatedProfilesModal.title"
|
:title="associatedProfilesModal.title"
|
||||||
@@ -116,9 +312,36 @@ const emit = defineEmits<{
|
|||||||
:browser-id="associatedProfilesModal.browserId"
|
:browser-id="associatedProfilesModal.browserId"
|
||||||
:browser-family-id="currentBrowser.browserFamilyId"
|
:browser-family-id="currentBrowser.browserFamilyId"
|
||||||
:is-bookmark="associatedProfilesModal.isBookmark"
|
:is-bookmark="associatedProfilesModal.isBookmark"
|
||||||
|
:is-extension="associatedProfilesModal.isExtension"
|
||||||
|
:selected-profile-ids="
|
||||||
|
associatedProfilesModal.isExtension
|
||||||
|
? extensionModalSelectedProfileIds
|
||||||
|
: bookmarkModalSelectedProfileIds
|
||||||
|
"
|
||||||
|
:delete-busy="associatedProfilesModal.isExtension ? extensionDeleteBusy : bookmarkDeleteBusy"
|
||||||
:is-opening-profile="isOpeningProfile"
|
:is-opening-profile="isOpeningProfile"
|
||||||
@close="emit('closeAssociatedProfiles')"
|
@close="emit('closeAssociatedProfiles')"
|
||||||
@open-profile="(browserId, profileId) => emit('openProfile', browserId, profileId)"
|
@open-profile="(browserId, profileId) => emit('openProfile', browserId, profileId)"
|
||||||
|
@toggle-profile-selection="
|
||||||
|
associatedProfilesModal.isExtension
|
||||||
|
? emit('toggleExtensionModalProfileSelection', $event)
|
||||||
|
: emit('toggleBookmarkModalProfileSelection', $event)
|
||||||
|
"
|
||||||
|
@toggle-all-profile-selection="
|
||||||
|
associatedProfilesModal.isExtension
|
||||||
|
? emit('toggleAllExtensionModalProfiles')
|
||||||
|
: emit('toggleAllBookmarkModalProfiles')
|
||||||
|
"
|
||||||
|
@delete-profile="
|
||||||
|
associatedProfilesModal.isExtension
|
||||||
|
? emit('deleteExtensionFromProfile', $event)
|
||||||
|
: emit('deleteBookmarkFromProfile', $event)
|
||||||
|
"
|
||||||
|
@delete-selected-profiles="
|
||||||
|
associatedProfilesModal.isExtension
|
||||||
|
? emit('deleteSelectedExtensionProfiles')
|
||||||
|
: emit('deleteSelectedBookmarkProfiles')
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -127,7 +350,7 @@ const emit = defineEmits<{
|
|||||||
display: flex;
|
display: flex;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
padding: 8px;
|
padding: 6px;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
border: 1px solid var(--panel-border);
|
border: 1px solid var(--panel-border);
|
||||||
border-radius: 22px;
|
border-radius: 22px;
|
||||||
@@ -142,8 +365,8 @@ const emit = defineEmits<{
|
|||||||
gap: 12px;
|
gap: 12px;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
padding: 10px 12px;
|
padding: 8px 10px;
|
||||||
border-radius: 15px;
|
border-radius: 13px;
|
||||||
color: var(--muted);
|
color: var(--muted);
|
||||||
background: rgba(255, 255, 255, 0.58);
|
background: rgba(255, 255, 255, 0.58);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@@ -163,4 +386,13 @@ const emit = defineEmits<{
|
|||||||
background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(232, 240, 255, 0.92));
|
background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(232, 240, 255, 0.92));
|
||||||
box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
|
box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.content-scroll-area {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-scroll-area > * {
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
163
src/components/browser-data/ExtensionRemovalModal.vue
Normal file
@@ -0,0 +1,163 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed } from "vue";
|
||||||
|
|
||||||
|
import type { ExtensionSummary, ProfileSummary, RemoveExtensionResult } from "../../types/browser";
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
mode: "confirm" | "result";
|
||||||
|
title: string;
|
||||||
|
extensions: ExtensionSummary[];
|
||||||
|
profiles: ProfileSummary[];
|
||||||
|
results: RemoveExtensionResult[];
|
||||||
|
busy?: boolean;
|
||||||
|
generalError?: string;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
close: [];
|
||||||
|
confirm: [];
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const confirmSummary = computed(() => ({
|
||||||
|
extensionCount: props.extensions.length,
|
||||||
|
profileCount: props.profiles.length,
|
||||||
|
}));
|
||||||
|
|
||||||
|
const resultSummary = computed(() => {
|
||||||
|
const statusByExtension = new Map<string, boolean>();
|
||||||
|
|
||||||
|
for (const result of props.results) {
|
||||||
|
const previous = statusByExtension.get(result.extensionId);
|
||||||
|
const succeeded = !result.error;
|
||||||
|
|
||||||
|
if (previous === undefined) {
|
||||||
|
statusByExtension.set(result.extensionId, succeeded);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
statusByExtension.set(result.extensionId, previous && succeeded);
|
||||||
|
}
|
||||||
|
|
||||||
|
let successCount = 0;
|
||||||
|
let failedCount = 0;
|
||||||
|
|
||||||
|
for (const succeeded of statusByExtension.values()) {
|
||||||
|
if (succeeded) {
|
||||||
|
successCount += 1;
|
||||||
|
} else {
|
||||||
|
failedCount += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { successCount, failedCount };
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="modal-backdrop" @click.self="emit('close')">
|
||||||
|
<section class="modal-card">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h3>{{ title }}</h3>
|
||||||
|
<button class="secondary-button" type="button" @click="emit('close')">关闭</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template v-if="mode === 'confirm'">
|
||||||
|
<p class="modal-copy">
|
||||||
|
将从 {{ confirmSummary.profileCount }} 个资料中删除 {{ confirmSummary.extensionCount }} 个插件。
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="modal-actions">
|
||||||
|
<button class="secondary-button" type="button" @click="emit('close')">取消</button>
|
||||||
|
<button class="danger-button" type="button" :disabled="busy" @click="emit('confirm')">
|
||||||
|
{{ busy ? "删除中..." : "确认删除" }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-else>
|
||||||
|
<p v-if="generalError" class="result-banner error">{{ generalError }}</p>
|
||||||
|
<p class="modal-copy">
|
||||||
|
成功删除 {{ resultSummary.successCount }} 个插件,失败 {{ resultSummary.failedCount }} 个。
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="modal-actions">
|
||||||
|
<button class="primary-button" type="button" @click="emit('close')">关闭</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.modal-backdrop {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
z-index: 50;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
padding: 24px;
|
||||||
|
background: rgba(15, 23, 42, 0.26);
|
||||||
|
backdrop-filter: blur(6px);
|
||||||
|
-webkit-backdrop-filter: blur(6px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-card {
|
||||||
|
width: min(680px, 100%);
|
||||||
|
max-height: min(76vh, 820px);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 14px;
|
||||||
|
padding: 16px;
|
||||||
|
border: 1px solid var(--panel-border);
|
||||||
|
border-radius: 22px;
|
||||||
|
background: rgba(255, 255, 255, 0.96);
|
||||||
|
box-shadow: 0 28px 70px rgba(15, 23, 42, 0.18);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header h3,
|
||||||
|
.modal-copy {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-copy {
|
||||||
|
color: var(--muted);
|
||||||
|
line-height: 1.55;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-banner {
|
||||||
|
margin: 0;
|
||||||
|
padding: 12px 14px;
|
||||||
|
border-radius: 14px;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-banner.error {
|
||||||
|
background: rgba(254, 242, 242, 0.96);
|
||||||
|
color: #b42318;
|
||||||
|
border: 1px solid rgba(239, 68, 68, 0.18);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-actions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.muted-line {
|
||||||
|
color: var(--muted-soft);
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
padding: 1px 5px;
|
||||||
|
border-radius: 7px;
|
||||||
|
background: rgba(226, 232, 240, 0.72);
|
||||||
|
color: var(--text);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,52 +1,116 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { computed } from "vue";
|
||||||
import type { ExtensionSortKey, ExtensionSummary } from "../../types/browser";
|
import type { ExtensionSortKey, ExtensionSummary } from "../../types/browser";
|
||||||
|
|
||||||
defineProps<{
|
const props = defineProps<{
|
||||||
extensions: ExtensionSummary[];
|
extensions: ExtensionSummary[];
|
||||||
sortKey: ExtensionSortKey;
|
sortKey: ExtensionSortKey;
|
||||||
extensionMonogram: (name: string) => string;
|
extensionMonogram: (name: string) => string;
|
||||||
|
selectedExtensionIds: string[];
|
||||||
|
deleteBusy: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
"update:sortKey": [value: ExtensionSortKey];
|
"update:sortKey": [value: ExtensionSortKey];
|
||||||
showProfiles: [extensionId: string];
|
showProfiles: [extensionId: string];
|
||||||
|
toggleExtension: [extensionId: string];
|
||||||
|
toggleAllExtensions: [];
|
||||||
|
deleteExtension: [extensionId: string];
|
||||||
|
deleteSelected: [];
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
const allSelected = computed(
|
||||||
|
() =>
|
||||||
|
props.extensions.length > 0 &&
|
||||||
|
props.extensions.every((extension) => props.selectedExtensionIds.includes(extension.id)),
|
||||||
|
);
|
||||||
|
|
||||||
|
function isSelected(extensionId: string) {
|
||||||
|
return props.selectedExtensionIds.includes(extensionId);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<section class="table-section">
|
<section class="table-section">
|
||||||
<div v-if="extensions.length" class="data-table">
|
<div v-if="extensions.length" class="data-table">
|
||||||
<div class="data-table-header extensions-grid">
|
<div class="extensions-toolbar">
|
||||||
<div class="header-cell icon-cell">Icon</div>
|
<label class="toolbar-checkbox" :class="{ disabled: !extensions.length }">
|
||||||
<button class="header-cell sortable" :class="{ active: sortKey === 'name' }" type="button" @click="emit('update:sortKey', 'name')">Name</button>
|
<input
|
||||||
<button class="header-cell sortable" :class="{ active: sortKey === 'id' }" type="button" @click="emit('update:sortKey', 'id')">Extension ID</button>
|
type="checkbox"
|
||||||
<div class="header-cell">Version</div>
|
class="native-checkbox"
|
||||||
<div class="header-cell actions-cell">Profiles</div>
|
:checked="allSelected"
|
||||||
|
:disabled="!extensions.length || deleteBusy"
|
||||||
|
@change="emit('toggleAllExtensions')"
|
||||||
|
/>
|
||||||
|
<span class="custom-checkbox" :class="{ checked: allSelected }" aria-hidden="true">
|
||||||
|
<svg viewBox="0 0 16 16">
|
||||||
|
<path d="M3.5 8.2L6.4 11.1L12.5 4.9" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
<span>全选</span>
|
||||||
|
</label>
|
||||||
|
<button
|
||||||
|
class="danger-button toolbar-danger-button"
|
||||||
|
type="button"
|
||||||
|
:disabled="!selectedExtensionIds.length || deleteBusy"
|
||||||
|
@click="emit('deleteSelected')"
|
||||||
|
>
|
||||||
|
{{ deleteBusy ? "删除中..." : `删除所选(${selectedExtensionIds.length})` }}
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<article v-for="extension in extensions" :key="extension.id" class="data-table-row extensions-grid">
|
<div class="data-table-header extensions-grid">
|
||||||
<div class="extension-icon table-icon" :class="{ filled: Boolean(extension.iconDataUrl) }">
|
<div class="header-cell checkbox-cell">选择</div>
|
||||||
<img v-if="extension.iconDataUrl" :src="extension.iconDataUrl" :alt="`${extension.name} icon`" />
|
<div class="header-cell icon-cell">图标</div>
|
||||||
<span v-else>{{ extensionMonogram(extension.name) }}</span>
|
<button class="header-cell sortable" :class="{ active: sortKey === 'name' }" type="button" @click="emit('update:sortKey', 'name')">名称</button>
|
||||||
</div>
|
<button class="header-cell sortable" :class="{ active: sortKey === 'id' }" type="button" @click="emit('update:sortKey', 'id')">插件 ID</button>
|
||||||
<div class="row-cell primary-cell">
|
<div class="header-cell actions-cell">操作</div>
|
||||||
<strong>{{ extension.name }}</strong>
|
</div>
|
||||||
</div>
|
<div class="data-table-body styled-scrollbar">
|
||||||
<div class="row-cell muted-cell" :title="extension.id">{{ extension.id }}</div>
|
<article v-for="extension in extensions" :key="extension.id" class="data-table-row extensions-grid">
|
||||||
<div class="row-cell">
|
<div class="row-cell checkbox-cell">
|
||||||
<span v-if="extension.version" class="badge neutral">v{{ extension.version }}</span>
|
<label class="table-checkbox" :class="{ disabled: deleteBusy }">
|
||||||
<span v-else class="muted-cell">-</span>
|
<input
|
||||||
</div>
|
type="checkbox"
|
||||||
<div class="row-cell actions-cell">
|
class="native-checkbox"
|
||||||
<button class="disclosure-button" type="button" @click="emit('showProfiles', extension.id)">
|
:checked="isSelected(extension.id)"
|
||||||
<span>View</span>
|
:disabled="deleteBusy"
|
||||||
<span class="badge neutral">{{ extension.profileIds.length }}</span>
|
@change="emit('toggleExtension', extension.id)"
|
||||||
</button>
|
/>
|
||||||
</div>
|
<span class="custom-checkbox" :class="{ checked: isSelected(extension.id) }" aria-hidden="true">
|
||||||
</article>
|
<svg viewBox="0 0 16 16">
|
||||||
|
<path d="M3.5 8.2L6.4 11.1L12.5 4.9" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="extension-icon table-icon" :class="{ filled: Boolean(extension.iconDataUrl) }">
|
||||||
|
<img v-if="extension.iconDataUrl" :src="extension.iconDataUrl" :alt="`${extension.name} icon`" />
|
||||||
|
<span v-else>{{ extensionMonogram(extension.name) }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="row-cell primary-cell">
|
||||||
|
<strong>{{ extension.name }}</strong>
|
||||||
|
</div>
|
||||||
|
<div class="row-cell muted-cell" :title="extension.id">{{ extension.id }}</div>
|
||||||
|
<div class="row-cell actions-cell">
|
||||||
|
<button class="disclosure-button" type="button" @click="emit('showProfiles', extension.id)">
|
||||||
|
<span>查看</span>
|
||||||
|
<span class="badge neutral">{{ extension.profileIds.length }}</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="danger-button inline-danger-button"
|
||||||
|
type="button"
|
||||||
|
:disabled="deleteBusy"
|
||||||
|
@click="emit('deleteExtension', extension.id)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="empty-card">
|
<div v-else class="empty-card">
|
||||||
<p>No extensions were discovered for this browser.</p>
|
<p>这个浏览器没有扫描到任何插件。</p>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
@@ -54,22 +118,113 @@ const emit = defineEmits<{
|
|||||||
<style scoped>
|
<style scoped>
|
||||||
.table-section {
|
.table-section {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
height: 100%;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.extensions-toolbar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 10px 12px 8px;
|
||||||
|
border-bottom: 1px solid rgba(148, 163, 184, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar-checkbox {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
color: var(--text);
|
||||||
|
font-size: 0.88rem;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar-checkbox.disabled {
|
||||||
|
opacity: 0.55;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.native-checkbox {
|
||||||
|
position: absolute;
|
||||||
|
opacity: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-checkbox {
|
||||||
|
position: relative;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-checkbox.disabled {
|
||||||
|
cursor: default;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-checkbox {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
border: 1px solid rgba(148, 163, 184, 0.34);
|
||||||
|
border-radius: 7px;
|
||||||
|
background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 245, 249, 0.92));
|
||||||
|
box-shadow:
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.78),
|
||||||
|
0 4px 10px rgba(15, 23, 42, 0.06);
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-checkbox svg {
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-checkbox path {
|
||||||
|
fill: none;
|
||||||
|
stroke: #fff;
|
||||||
|
stroke-width: 2.2;
|
||||||
|
stroke-linecap: round;
|
||||||
|
stroke-linejoin: round;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-checkbox.checked {
|
||||||
|
border-color: rgba(47, 111, 237, 0.2);
|
||||||
|
background: linear-gradient(135deg, #2f6fed, #5aa1f7);
|
||||||
|
box-shadow:
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.22),
|
||||||
|
0 8px 18px rgba(47, 111, 237, 0.22);
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-checkbox.checked path {
|
||||||
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.data-table {
|
.data-table {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
min-height: 100%;
|
height: 100%;
|
||||||
|
min-height: 0;
|
||||||
border: 1px solid rgba(148, 163, 184, 0.18);
|
border: 1px solid rgba(148, 163, 184, 0.18);
|
||||||
border-radius: 22px;
|
border-radius: 22px;
|
||||||
background: var(--panel);
|
background: var(--panel);
|
||||||
box-shadow: var(--shadow);
|
box-shadow: var(--shadow);
|
||||||
overflow: clip;
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-table-body {
|
||||||
|
min-height: 0;
|
||||||
|
overflow: auto;
|
||||||
|
scrollbar-gutter: stable;
|
||||||
}
|
}
|
||||||
|
|
||||||
.extensions-grid {
|
.extensions-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 60px minmax(180px, 1.1fr) minmax(220px, 1fr) 108px 154px;
|
grid-template-columns: 52px 60px minmax(180px, 1.1fr) minmax(220px, 1fr) 250px;
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
@@ -78,7 +233,7 @@ const emit = defineEmits<{
|
|||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
padding: 10px 14px;
|
padding: 8px 24px 8px 12px;
|
||||||
border-bottom: 1px solid rgba(148, 163, 184, 0.14);
|
border-bottom: 1px solid rgba(148, 163, 184, 0.14);
|
||||||
background: rgba(248, 250, 252, 0.94);
|
background: rgba(248, 250, 252, 0.94);
|
||||||
backdrop-filter: blur(12px);
|
backdrop-filter: blur(12px);
|
||||||
@@ -104,7 +259,7 @@ const emit = defineEmits<{
|
|||||||
}
|
}
|
||||||
|
|
||||||
.data-table-row {
|
.data-table-row {
|
||||||
padding: 12px 14px;
|
padding: 10px 12px;
|
||||||
border-bottom: 1px solid rgba(148, 163, 184, 0.12);
|
border-bottom: 1px solid rgba(148, 163, 184, 0.12);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,16 +322,40 @@ const emit = defineEmits<{
|
|||||||
gap: 10px;
|
gap: 10px;
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
min-width: 120px;
|
min-width: 120px;
|
||||||
padding: 7px 10px;
|
padding: 5px 10px;
|
||||||
border-radius: 12px;
|
border-radius: 10px;
|
||||||
background: rgba(241, 245, 249, 0.9);
|
background: rgba(241, 245, 249, 0.9);
|
||||||
color: var(--badge-text);
|
color: var(--badge-text);
|
||||||
|
font-size: 0.8rem;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.disclosure-button .badge {
|
||||||
|
min-width: 24px;
|
||||||
|
padding: 4px 8px;
|
||||||
|
font-size: 0.76rem;
|
||||||
|
}
|
||||||
|
|
||||||
.actions-cell {
|
.actions-cell {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-cell {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inline-danger-button {
|
||||||
|
padding: 5px 10px;
|
||||||
|
border-radius: 10px;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar-danger-button {
|
||||||
|
padding: 6px 10px;
|
||||||
|
border-radius: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon-cell {
|
.icon-cell {
|
||||||
@@ -185,17 +364,22 @@ const emit = defineEmits<{
|
|||||||
|
|
||||||
@media (max-width: 900px) {
|
@media (max-width: 900px) {
|
||||||
.extensions-grid {
|
.extensions-grid {
|
||||||
grid-template-columns: 56px minmax(160px, 1fr) minmax(160px, 1fr) 96px 148px;
|
grid-template-columns: 52px 56px minmax(160px, 1fr) minmax(160px, 1fr) 220px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 720px) {
|
@media (max-width: 720px) {
|
||||||
.extensions-grid {
|
.extensions-toolbar {
|
||||||
grid-template-columns: 56px minmax(0, 1fr) 132px;
|
flex-direction: column;
|
||||||
|
align-items: stretch;
|
||||||
}
|
}
|
||||||
|
|
||||||
.extensions-grid > :nth-child(3),
|
.extensions-grid {
|
||||||
.extensions-grid > :nth-child(4) {
|
grid-template-columns: 52px 56px minmax(0, 1fr) 132px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.extensions-grid > :nth-child(4),
|
||||||
|
.extensions-grid > :nth-child(5) {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
455
src/components/browser-data/HistoryCleanupList.vue
Normal file
@@ -0,0 +1,455 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed } from "vue";
|
||||||
|
import type { CleanupFileStatus, ProfileSummary } from "../../types/browser";
|
||||||
|
import { profileAvatarSrc } from "../../utils/icons";
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
browserFamilyId: string | null;
|
||||||
|
profiles: ProfileSummary[];
|
||||||
|
selectedProfileIds: string[];
|
||||||
|
cleanupBusy: boolean;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
toggleProfile: [profileId: string];
|
||||||
|
toggleAllProfiles: [];
|
||||||
|
cleanupSelected: [];
|
||||||
|
cleanupProfile: [profileId: string];
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const selectableProfiles = computed(() =>
|
||||||
|
props.profiles.filter((profile) =>
|
||||||
|
hasAnyHistoryFile([
|
||||||
|
profile.historyCleanup.history,
|
||||||
|
profile.historyCleanup.topSites,
|
||||||
|
profile.historyCleanup.visitedLinks,
|
||||||
|
profile.historyCleanup.shortcuts,
|
||||||
|
profile.historyCleanup.sessions,
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
const allSelected = computed(
|
||||||
|
() =>
|
||||||
|
selectableProfiles.value.length > 0 &&
|
||||||
|
selectableProfiles.value.every((profile) =>
|
||||||
|
props.selectedProfileIds.includes(profile.id),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
function isSelected(profileId: string) {
|
||||||
|
return props.selectedProfileIds.includes(profileId);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isSelectable(profile: ProfileSummary) {
|
||||||
|
return hasAnyHistoryFile([
|
||||||
|
profile.historyCleanup.history,
|
||||||
|
profile.historyCleanup.topSites,
|
||||||
|
profile.historyCleanup.visitedLinks,
|
||||||
|
profile.historyCleanup.shortcuts,
|
||||||
|
profile.historyCleanup.sessions,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function hasAnyHistoryFile(statuses: CleanupFileStatus[]) {
|
||||||
|
return statuses.some((status) => status === "found");
|
||||||
|
}
|
||||||
|
|
||||||
|
function cleanupItems(profile: ProfileSummary) {
|
||||||
|
const items = [
|
||||||
|
{ key: "history", label: "历史记录", status: profile.historyCleanup.history },
|
||||||
|
{ key: "top-sites", label: "热门站点", status: profile.historyCleanup.topSites },
|
||||||
|
{ key: "visited-links", label: "访问链接", status: profile.historyCleanup.visitedLinks },
|
||||||
|
{ key: "shortcuts", label: "快捷方式", status: profile.historyCleanup.shortcuts },
|
||||||
|
{ key: "sessions", label: "会话", status: profile.historyCleanup.sessions },
|
||||||
|
];
|
||||||
|
|
||||||
|
return items.filter((item) => item.status === "found");
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<section class="table-section">
|
||||||
|
<div v-if="profiles.length" class="data-table">
|
||||||
|
<div class="history-toolbar">
|
||||||
|
<label class="toolbar-checkbox" :class="{ disabled: !selectableProfiles.length }">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
class="native-checkbox"
|
||||||
|
:checked="allSelected"
|
||||||
|
:disabled="!selectableProfiles.length || cleanupBusy"
|
||||||
|
@change="emit('toggleAllProfiles')"
|
||||||
|
/>
|
||||||
|
<span class="custom-checkbox" :class="{ checked: allSelected }" aria-hidden="true">
|
||||||
|
<svg viewBox="0 0 16 16">
|
||||||
|
<path d="M3.5 8.2L6.4 11.1L12.5 4.9" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
<span>全选</span>
|
||||||
|
</label>
|
||||||
|
<button
|
||||||
|
class="danger-button toolbar-danger-button"
|
||||||
|
type="button"
|
||||||
|
:disabled="!selectedProfileIds.length || cleanupBusy"
|
||||||
|
@click="emit('cleanupSelected')"
|
||||||
|
>
|
||||||
|
{{ cleanupBusy ? "清理中..." : `清理所选(${selectedProfileIds.length})` }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="data-table-header history-grid">
|
||||||
|
<div class="header-cell checkbox-cell">选择</div>
|
||||||
|
<div class="header-cell icon-cell">头像</div>
|
||||||
|
<div class="header-cell">资料</div>
|
||||||
|
<div class="header-cell">可清理项</div>
|
||||||
|
<div class="header-cell actions-cell">操作</div>
|
||||||
|
</div>
|
||||||
|
<div class="data-table-body styled-scrollbar">
|
||||||
|
<article v-for="profile in profiles" :key="profile.id" class="data-table-row history-grid">
|
||||||
|
<div class="row-cell checkbox-cell">
|
||||||
|
<label class="table-checkbox" :class="{ disabled: !isSelectable(profile) || cleanupBusy }">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
class="native-checkbox"
|
||||||
|
:checked="isSelected(profile.id)"
|
||||||
|
:disabled="!isSelectable(profile) || cleanupBusy"
|
||||||
|
@change="emit('toggleProfile', profile.id)"
|
||||||
|
/>
|
||||||
|
<span class="custom-checkbox" :class="{ checked: isSelected(profile.id) }" aria-hidden="true">
|
||||||
|
<svg viewBox="0 0 16 16">
|
||||||
|
<path d="M3.5 8.2L6.4 11.1L12.5 4.9" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="profile-avatar table-avatar">
|
||||||
|
<img
|
||||||
|
v-if="profileAvatarSrc(profile, browserFamilyId)"
|
||||||
|
:src="profileAvatarSrc(profile, browserFamilyId) ?? undefined"
|
||||||
|
:alt="`${profile.name} avatar`"
|
||||||
|
/>
|
||||||
|
<span v-else>{{ profile.avatarLabel }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="row-cell primary-cell">
|
||||||
|
<strong>{{ profile.name }}</strong>
|
||||||
|
<span class="subtle-line">{{ profile.id }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="row-cell cleanup-summary-cell">
|
||||||
|
<div v-if="cleanupItems(profile).length" class="cleanup-tag-list">
|
||||||
|
<span
|
||||||
|
v-for="item in cleanupItems(profile)"
|
||||||
|
:key="item.key"
|
||||||
|
class="cleanup-tag"
|
||||||
|
>
|
||||||
|
{{ item.label }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<span v-else class="cleanup-empty">没有可清理项</span>
|
||||||
|
</div>
|
||||||
|
<div class="row-cell actions-cell">
|
||||||
|
<button
|
||||||
|
class="danger-button action-button"
|
||||||
|
type="button"
|
||||||
|
:disabled="!isSelectable(profile) || cleanupBusy"
|
||||||
|
@click="emit('cleanupProfile', profile.id)"
|
||||||
|
>
|
||||||
|
清理
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-else class="empty-card">
|
||||||
|
<p>这个浏览器没有找到任何用户资料目录。</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.table-section {
|
||||||
|
padding: 0;
|
||||||
|
height: 100%;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-toolbar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 10px 12px 8px;
|
||||||
|
border-bottom: 1px solid rgba(148, 163, 184, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar-checkbox {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
color: var(--text);
|
||||||
|
font-size: 0.88rem;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar-checkbox.disabled {
|
||||||
|
opacity: 0.55;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.native-checkbox {
|
||||||
|
position: absolute;
|
||||||
|
opacity: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-checkbox {
|
||||||
|
position: relative;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-checkbox.disabled {
|
||||||
|
cursor: default;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-checkbox {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
border: 1px solid rgba(148, 163, 184, 0.34);
|
||||||
|
border-radius: 7px;
|
||||||
|
background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 245, 249, 0.92));
|
||||||
|
box-shadow:
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.78),
|
||||||
|
0 4px 10px rgba(15, 23, 42, 0.06);
|
||||||
|
transition:
|
||||||
|
border-color 160ms ease,
|
||||||
|
background 160ms ease,
|
||||||
|
box-shadow 160ms ease,
|
||||||
|
transform 160ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-checkbox svg {
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-checkbox path {
|
||||||
|
fill: none;
|
||||||
|
stroke: #fff;
|
||||||
|
stroke-width: 2.2;
|
||||||
|
stroke-linecap: round;
|
||||||
|
stroke-linejoin: round;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 160ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar-checkbox:hover .custom-checkbox,
|
||||||
|
.table-checkbox:hover .custom-checkbox {
|
||||||
|
border-color: rgba(47, 111, 237, 0.38);
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-checkbox.checked {
|
||||||
|
border-color: rgba(47, 111, 237, 0.2);
|
||||||
|
background: linear-gradient(135deg, #2f6fed, #5aa1f7);
|
||||||
|
box-shadow:
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.22),
|
||||||
|
0 8px 18px rgba(47, 111, 237, 0.22);
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-checkbox.checked path {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-table {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 100%;
|
||||||
|
min-height: 0;
|
||||||
|
border: 1px solid rgba(148, 163, 184, 0.18);
|
||||||
|
border-radius: 22px;
|
||||||
|
background: var(--panel);
|
||||||
|
box-shadow: var(--shadow);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-table-body {
|
||||||
|
min-height: 0;
|
||||||
|
overflow: auto;
|
||||||
|
scrollbar-gutter: stable;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 52px 56px minmax(200px, 0.95fr) minmax(260px, 1.4fr) 108px;
|
||||||
|
gap: 12px;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-table-header {
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 2;
|
||||||
|
padding: 8px 24px 8px 12px;
|
||||||
|
border-bottom: 1px solid rgba(148, 163, 184, 0.14);
|
||||||
|
background: rgba(248, 250, 252, 0.94);
|
||||||
|
backdrop-filter: blur(12px);
|
||||||
|
-webkit-backdrop-filter: blur(12px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-table-row {
|
||||||
|
padding: 10px 12px;
|
||||||
|
border-bottom: 1px solid rgba(148, 163, 184, 0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-table-row:last-child {
|
||||||
|
border-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-table-row:hover {
|
||||||
|
background: rgba(248, 250, 252, 0.65);
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-cell {
|
||||||
|
color: var(--muted);
|
||||||
|
font-size: 0.81rem;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: 0.02em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-cell {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-cell {
|
||||||
|
padding-left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row-cell {
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-avatar {
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
background: linear-gradient(135deg, #dbeafe, #eff6ff);
|
||||||
|
color: #1d4ed8;
|
||||||
|
font-size: 0.96rem;
|
||||||
|
font-weight: 700;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-avatar {
|
||||||
|
width: 36px;
|
||||||
|
height: 36px;
|
||||||
|
border-radius: 999px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-avatar img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
|
||||||
|
.primary-cell strong {
|
||||||
|
display: block;
|
||||||
|
font-size: 0.93rem;
|
||||||
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cleanup-summary-cell {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
min-height: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subtle-line {
|
||||||
|
display: block;
|
||||||
|
margin-top: 3px;
|
||||||
|
color: var(--muted-soft);
|
||||||
|
font-size: 0.8rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cleanup-tag-list {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cleanup-tag {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
padding: 5px 9px;
|
||||||
|
border: 1px solid rgba(148, 163, 184, 0.18);
|
||||||
|
border-radius: 999px;
|
||||||
|
background: rgba(248, 250, 252, 0.88);
|
||||||
|
color: #475569;
|
||||||
|
font-size: 0.77rem;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 0.01em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cleanup-tag::before {
|
||||||
|
content: "";
|
||||||
|
width: 6px;
|
||||||
|
height: 6px;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: #60a5fa;
|
||||||
|
opacity: 0.85;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cleanup-empty {
|
||||||
|
color: var(--muted);
|
||||||
|
font-size: 0.85rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.actions-cell {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-button {
|
||||||
|
padding: 5px 10px;
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar-danger-button {
|
||||||
|
padding: 6px 10px;
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 900px) {
|
||||||
|
.history-grid {
|
||||||
|
grid-template-columns: 52px 56px minmax(160px, 0.9fr) minmax(220px, 1.2fr) 100px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 720px) {
|
||||||
|
.history-toolbar {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: stretch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-grid {
|
||||||
|
grid-template-columns: 52px minmax(0, 1fr) 108px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-grid > :nth-child(2) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cleanup-summary-cell {
|
||||||
|
padding-top: 2px;
|
||||||
|
padding-bottom: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
198
src/components/browser-data/HistoryCleanupModal.vue
Normal file
@@ -0,0 +1,198 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { CleanupHistoryResult, ProfileSummary } from "../../types/browser";
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
mode: "confirm" | "result";
|
||||||
|
title: string;
|
||||||
|
profiles: ProfileSummary[];
|
||||||
|
results: CleanupHistoryResult[];
|
||||||
|
busy?: boolean;
|
||||||
|
generalError?: string;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
close: [];
|
||||||
|
confirm: [];
|
||||||
|
}>();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="modal-backdrop" @click.self="emit('close')">
|
||||||
|
<section class="modal-card">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h3>{{ title }}</h3>
|
||||||
|
<button class="secondary-button modal-close-button" type="button" @click="emit('close')">
|
||||||
|
关闭
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template v-if="mode === 'confirm'">
|
||||||
|
<p class="modal-copy">
|
||||||
|
将删除所选资料中的 <code>History</code>、<code>Top Sites</code>、<code>Visited Links</code>、<code>Shortcuts</code>,
|
||||||
|
并清空 <code>Sessions</code> 目录中的所有文件。
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="profile-list styled-scrollbar">
|
||||||
|
<article v-for="profile in profiles" :key="profile.id" class="profile-item">
|
||||||
|
<strong>{{ profile.name }}</strong>
|
||||||
|
<span>{{ profile.id }}</span>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-actions">
|
||||||
|
<button class="secondary-button" type="button" @click="emit('close')">取消</button>
|
||||||
|
<button class="danger-button" type="button" :disabled="busy" @click="emit('confirm')">
|
||||||
|
{{ busy ? "清理中..." : "确认清理" }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-else>
|
||||||
|
<p v-if="generalError" class="result-banner error">{{ generalError }}</p>
|
||||||
|
|
||||||
|
<div class="result-list styled-scrollbar">
|
||||||
|
<article
|
||||||
|
v-for="result in results"
|
||||||
|
:key="result.profileId"
|
||||||
|
class="result-card"
|
||||||
|
:class="{ error: result.error }"
|
||||||
|
>
|
||||||
|
<strong>{{ result.profileId }}</strong>
|
||||||
|
<p v-if="result.error">{{ result.error }}</p>
|
||||||
|
<p v-else-if="result.deletedFiles.length">
|
||||||
|
已删除:{{ result.deletedFiles.join("、") }}
|
||||||
|
</p>
|
||||||
|
<p v-else>
|
||||||
|
没有删除任何文件。
|
||||||
|
</p>
|
||||||
|
<p v-if="result.skippedFiles.length" class="muted-line">
|
||||||
|
已跳过(不存在):{{ result.skippedFiles.join("、") }}
|
||||||
|
</p>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-actions">
|
||||||
|
<button class="primary-button" type="button" @click="emit('close')">关闭</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.modal-backdrop {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
z-index: 50;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
padding: 24px;
|
||||||
|
background: rgba(15, 23, 42, 0.26);
|
||||||
|
backdrop-filter: blur(6px);
|
||||||
|
-webkit-backdrop-filter: blur(6px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-card {
|
||||||
|
width: min(640px, 100%);
|
||||||
|
max-height: min(76vh, 820px);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 14px;
|
||||||
|
padding: 16px;
|
||||||
|
border: 1px solid var(--panel-border);
|
||||||
|
border-radius: 22px;
|
||||||
|
background: rgba(255, 255, 255, 0.96);
|
||||||
|
box-shadow: 0 28px 70px rgba(15, 23, 42, 0.18);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header h3 {
|
||||||
|
margin: 0;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: -0.03em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-copy {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--muted);
|
||||||
|
line-height: 1.55;
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-list,
|
||||||
|
.result-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
min-height: 0;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-item,
|
||||||
|
.result-card {
|
||||||
|
display: grid;
|
||||||
|
gap: 4px;
|
||||||
|
padding: 12px 14px;
|
||||||
|
border: 1px solid rgba(148, 163, 184, 0.18);
|
||||||
|
border-radius: 16px;
|
||||||
|
background: rgba(248, 250, 252, 0.84);
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-item span,
|
||||||
|
.muted-line {
|
||||||
|
color: var(--muted);
|
||||||
|
font-size: 0.85rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-card p {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--text);
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-card.error {
|
||||||
|
border-color: rgba(239, 68, 68, 0.18);
|
||||||
|
background: rgba(254, 242, 242, 0.96);
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-banner {
|
||||||
|
margin: 0;
|
||||||
|
padding: 12px 14px;
|
||||||
|
border-radius: 14px;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-banner.error {
|
||||||
|
background: rgba(254, 242, 242, 0.96);
|
||||||
|
color: #b42318;
|
||||||
|
border: 1px solid rgba(239, 68, 68, 0.18);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-actions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
padding: 1px 5px;
|
||||||
|
border-radius: 7px;
|
||||||
|
background: rgba(226, 232, 240, 0.72);
|
||||||
|
color: var(--text);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 720px) {
|
||||||
|
.modal-backdrop {
|
||||||
|
padding: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-actions {
|
||||||
|
flex-direction: column-reverse;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
248
src/components/browser-data/PasswordSitesList.vue
Normal file
@@ -0,0 +1,248 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { PasswordSiteSortKey, PasswordSiteSummary } from "../../types/browser";
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
passwordSites: PasswordSiteSummary[];
|
||||||
|
sortKey: PasswordSiteSortKey;
|
||||||
|
loaded: boolean;
|
||||||
|
loading: boolean;
|
||||||
|
error: string;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
"update:sortKey": [value: PasswordSiteSortKey];
|
||||||
|
showProfiles: [url: string];
|
||||||
|
load: [];
|
||||||
|
}>();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<section class="table-section">
|
||||||
|
<div class="password-actions">
|
||||||
|
<div class="password-actions-copy">
|
||||||
|
<h3>按需读取已保存登录站点</h3>
|
||||||
|
<p>为减少误报风险,这部分数据不会在应用启动时自动扫描。</p>
|
||||||
|
</div>
|
||||||
|
<button class="load-button" type="button" :disabled="loading" @click="emit('load')">
|
||||||
|
{{ loading ? "读取中..." : loaded ? "重新读取" : "手动读取" }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p v-if="error" class="error-text">{{ error }}</p>
|
||||||
|
|
||||||
|
<div v-if="passwordSites.length" class="data-table">
|
||||||
|
<div class="data-table-header passwords-grid">
|
||||||
|
<button class="header-cell sortable" :class="{ active: sortKey === 'domain' }" type="button" @click="emit('update:sortKey', 'domain')">域名</button>
|
||||||
|
<button class="header-cell sortable" :class="{ active: sortKey === 'url' }" type="button" @click="emit('update:sortKey', 'url')">URL</button>
|
||||||
|
<div class="header-cell actions-cell">关联资料</div>
|
||||||
|
</div>
|
||||||
|
<div class="data-table-body styled-scrollbar">
|
||||||
|
<article
|
||||||
|
v-for="passwordSite in passwordSites"
|
||||||
|
:key="passwordSite.url"
|
||||||
|
class="data-table-row passwords-grid"
|
||||||
|
>
|
||||||
|
<div class="row-cell primary-cell">
|
||||||
|
<strong>{{ passwordSite.domain }}</strong>
|
||||||
|
</div>
|
||||||
|
<div class="row-cell muted-cell" :title="passwordSite.url">{{ passwordSite.url }}</div>
|
||||||
|
<div class="row-cell actions-cell">
|
||||||
|
<button class="disclosure-button" type="button" @click="emit('showProfiles', passwordSite.url)">
|
||||||
|
<span>查看</span>
|
||||||
|
<span class="badge neutral">{{ passwordSite.profileIds.length }}</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-else class="empty-card">
|
||||||
|
<p v-if="loaded">这个浏览器没有检测到任何已保存登录站点。</p>
|
||||||
|
<p v-else>点击上方按钮后才会读取当前浏览器的已保存登录站点。</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.table-section {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 16px;
|
||||||
|
padding: 0;
|
||||||
|
height: 100%;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.password-actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 16px;
|
||||||
|
padding: 18px 20px;
|
||||||
|
border: 1px solid rgba(148, 163, 184, 0.18);
|
||||||
|
border-radius: 22px;
|
||||||
|
background: linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(240, 249, 255, 0.88));
|
||||||
|
box-shadow: var(--shadow);
|
||||||
|
}
|
||||||
|
|
||||||
|
.password-actions-copy h3 {
|
||||||
|
margin: 0 0 6px;
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.password-actions-copy p {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--muted);
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.load-button {
|
||||||
|
flex-shrink: 0;
|
||||||
|
min-width: 112px;
|
||||||
|
padding: 10px 16px;
|
||||||
|
border-radius: 14px;
|
||||||
|
background: var(--accent);
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 700;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.load-button:disabled {
|
||||||
|
cursor: progress;
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-text {
|
||||||
|
margin: 0;
|
||||||
|
color: #b91c1c;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-table {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 100%;
|
||||||
|
min-height: 0;
|
||||||
|
border: 1px solid rgba(148, 163, 184, 0.18);
|
||||||
|
border-radius: 22px;
|
||||||
|
background: var(--panel);
|
||||||
|
box-shadow: var(--shadow);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-table-body {
|
||||||
|
min-height: 0;
|
||||||
|
overflow: auto;
|
||||||
|
scrollbar-gutter: stable;
|
||||||
|
}
|
||||||
|
|
||||||
|
.passwords-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(180px, 0.9fr) minmax(280px, 1.2fr) 154px;
|
||||||
|
gap: 12px;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-table-header {
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 2;
|
||||||
|
padding: 8px 24px 8px 12px;
|
||||||
|
border-bottom: 1px solid rgba(148, 163, 184, 0.14);
|
||||||
|
background: rgba(248, 250, 252, 0.94);
|
||||||
|
backdrop-filter: blur(12px);
|
||||||
|
-webkit-backdrop-filter: blur(12px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-cell {
|
||||||
|
color: var(--muted);
|
||||||
|
font-size: 0.81rem;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: 0.02em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-cell.sortable {
|
||||||
|
padding: 0;
|
||||||
|
text-align: left;
|
||||||
|
background: transparent;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-cell.sortable.active {
|
||||||
|
color: var(--text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-table-row {
|
||||||
|
padding: 10px 12px;
|
||||||
|
border-bottom: 1px solid rgba(148, 163, 184, 0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-table-row:last-child {
|
||||||
|
border-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-table-row:hover {
|
||||||
|
background: rgba(248, 250, 252, 0.65);
|
||||||
|
}
|
||||||
|
|
||||||
|
.row-cell {
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.primary-cell strong {
|
||||||
|
display: block;
|
||||||
|
font-size: 0.93rem;
|
||||||
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.muted-cell {
|
||||||
|
color: var(--muted);
|
||||||
|
font-size: 0.87rem;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.disclosure-button {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 10px;
|
||||||
|
width: fit-content;
|
||||||
|
min-width: 120px;
|
||||||
|
padding: 7px 10px;
|
||||||
|
border-radius: 12px;
|
||||||
|
background: rgba(241, 245, 249, 0.9);
|
||||||
|
color: var(--badge-text);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.actions-cell {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 900px) {
|
||||||
|
.passwords-grid {
|
||||||
|
grid-template-columns: minmax(160px, 0.9fr) minmax(200px, 1fr) 148px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 720px) {
|
||||||
|
.password-actions {
|
||||||
|
align-items: stretch;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.load-button {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.passwords-grid {
|
||||||
|
grid-template-columns: minmax(0, 1fr) 132px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.passwords-grid > :nth-child(2) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -25,45 +25,46 @@ const emit = defineEmits<{
|
|||||||
|
|
||||||
<div v-if="profiles.length" class="data-table">
|
<div v-if="profiles.length" class="data-table">
|
||||||
<div class="data-table-header profiles-grid">
|
<div class="data-table-header profiles-grid">
|
||||||
<div class="header-cell icon-cell">Avatar</div>
|
<div class="header-cell icon-cell">头像</div>
|
||||||
<button class="header-cell sortable" :class="{ active: sortKey === 'name' }" type="button" @click="emit('update:sortKey', 'name')">Name</button>
|
<button class="header-cell sortable" :class="{ active: sortKey === 'name' }" type="button" @click="emit('update:sortKey', 'name')">名称</button>
|
||||||
<button class="header-cell sortable" :class="{ active: sortKey === 'email' }" type="button" @click="emit('update:sortKey', 'email')">Email</button>
|
<button class="header-cell sortable" :class="{ active: sortKey === 'email' }" type="button" @click="emit('update:sortKey', 'email')">邮箱</button>
|
||||||
<button class="header-cell sortable" :class="{ active: sortKey === 'id' }" type="button" @click="emit('update:sortKey', 'id')">Profile ID</button>
|
<button class="header-cell sortable" :class="{ active: sortKey === 'id' }" type="button" @click="emit('update:sortKey', 'id')">资料 ID</button>
|
||||||
<div class="header-cell actions-cell">Action</div>
|
<div class="header-cell actions-cell">操作</div>
|
||||||
|
</div>
|
||||||
|
<div class="data-table-body styled-scrollbar">
|
||||||
|
<article v-for="profile in profiles" :key="profile.id" class="data-table-row profiles-grid">
|
||||||
|
<div class="profile-avatar table-avatar">
|
||||||
|
<img
|
||||||
|
v-if="profileAvatarSrc(profile, browserFamilyId)"
|
||||||
|
:src="profileAvatarSrc(profile, browserFamilyId) ?? undefined"
|
||||||
|
:alt="`${profile.name} avatar`"
|
||||||
|
/>
|
||||||
|
<span v-else>{{ profile.avatarLabel }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="row-cell primary-cell">
|
||||||
|
<strong>{{ profile.name }}</strong>
|
||||||
|
</div>
|
||||||
|
<div class="row-cell muted-cell" :title="profile.email ?? undefined">
|
||||||
|
{{ profile.email || "" }}
|
||||||
|
</div>
|
||||||
|
<div class="row-cell">
|
||||||
|
<span class="badge neutral">{{ profile.id }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="row-cell actions-cell">
|
||||||
|
<button
|
||||||
|
class="card-action-button"
|
||||||
|
:disabled="isOpeningProfile(browserId, profile.id)"
|
||||||
|
type="button"
|
||||||
|
@click="emit('openProfile', browserId, profile.id)"
|
||||||
|
>
|
||||||
|
{{ isOpeningProfile(browserId, profile.id) ? "打开中..." : "打开" }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<article v-for="profile in profiles" :key="profile.id" class="data-table-row profiles-grid">
|
|
||||||
<div class="profile-avatar table-avatar">
|
|
||||||
<img
|
|
||||||
v-if="profileAvatarSrc(profile, browserFamilyId)"
|
|
||||||
:src="profileAvatarSrc(profile, browserFamilyId) ?? undefined"
|
|
||||||
:alt="`${profile.name} avatar`"
|
|
||||||
/>
|
|
||||||
<span v-else>{{ profile.avatarLabel }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="row-cell primary-cell">
|
|
||||||
<strong>{{ profile.name }}</strong>
|
|
||||||
</div>
|
|
||||||
<div class="row-cell muted-cell" :title="profile.email ?? undefined">
|
|
||||||
{{ profile.email || "" }}
|
|
||||||
</div>
|
|
||||||
<div class="row-cell">
|
|
||||||
<span class="badge neutral">{{ profile.id }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="row-cell actions-cell">
|
|
||||||
<button
|
|
||||||
class="card-action-button"
|
|
||||||
:disabled="isOpeningProfile(browserId, profile.id)"
|
|
||||||
type="button"
|
|
||||||
@click="emit('openProfile', browserId, profile.id)"
|
|
||||||
>
|
|
||||||
{{ isOpeningProfile(browserId, profile.id) ? "Opening..." : "Open" }}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="empty-card">
|
<div v-else class="empty-card">
|
||||||
<p>No profile directories were found for this browser.</p>
|
<p>这个浏览器没有找到任何用户资料目录。</p>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
@@ -71,17 +72,26 @@ const emit = defineEmits<{
|
|||||||
<style scoped>
|
<style scoped>
|
||||||
.table-section {
|
.table-section {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
height: 100%;
|
||||||
|
min-height: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.data-table {
|
.data-table {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
min-height: 100%;
|
height: 100%;
|
||||||
|
min-height: 0;
|
||||||
border: 1px solid rgba(148, 163, 184, 0.18);
|
border: 1px solid rgba(148, 163, 184, 0.18);
|
||||||
border-radius: 22px;
|
border-radius: 22px;
|
||||||
background: var(--panel);
|
background: var(--panel);
|
||||||
box-shadow: var(--shadow);
|
box-shadow: var(--shadow);
|
||||||
overflow: clip;
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-table-body {
|
||||||
|
min-height: 0;
|
||||||
|
overflow: auto;
|
||||||
|
scrollbar-gutter: stable;
|
||||||
}
|
}
|
||||||
|
|
||||||
.profiles-grid {
|
.profiles-grid {
|
||||||
@@ -95,7 +105,7 @@ const emit = defineEmits<{
|
|||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
padding: 10px 14px;
|
padding: 8px 24px 8px 12px;
|
||||||
border-bottom: 1px solid rgba(148, 163, 184, 0.14);
|
border-bottom: 1px solid rgba(148, 163, 184, 0.14);
|
||||||
background: rgba(248, 250, 252, 0.94);
|
background: rgba(248, 250, 252, 0.94);
|
||||||
backdrop-filter: blur(12px);
|
backdrop-filter: blur(12px);
|
||||||
@@ -121,7 +131,7 @@ const emit = defineEmits<{
|
|||||||
}
|
}
|
||||||
|
|
||||||
.data-table-row {
|
.data-table-row {
|
||||||
padding: 12px 14px;
|
padding: 10px 12px;
|
||||||
border-bottom: 1px solid rgba(148, 163, 184, 0.12);
|
border-bottom: 1px solid rgba(148, 163, 184, 0.12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,139 +37,142 @@ const iconOptions = computed(() =>
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<section class="content-scroll-area">
|
<section class="config-page styled-scrollbar">
|
||||||
<section class="content-section">
|
<div v-if="configError" class="inline-error">
|
||||||
<div v-if="configError" class="inline-error">
|
{{ configError }}
|
||||||
{{ configError }}
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="config-form-card">
|
<div class="config-form-card">
|
||||||
<div class="config-form-header collapsible">
|
<div class="config-form-header collapsible">
|
||||||
<div>
|
<div>
|
||||||
<h3>Add Custom Browser</h3>
|
<h3>添加自定义浏览器</h3>
|
||||||
<p>Add a custom executable and Chromium user data path when needed.</p>
|
</div>
|
||||||
|
<button
|
||||||
|
class="secondary-button config-toggle-button"
|
||||||
|
type="button"
|
||||||
|
@click="formExpanded = !formExpanded"
|
||||||
|
>
|
||||||
|
{{ formExpanded ? "收起" : "展开" }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div v-if="formExpanded" class="config-form-fields compact">
|
||||||
|
<div class="config-inline-row">
|
||||||
|
<label class="field-group">
|
||||||
|
<span>名称</span>
|
||||||
|
<input
|
||||||
|
:value="createConfigForm.name"
|
||||||
|
placeholder="例如:工作 Chrome"
|
||||||
|
@input="emit('updateName', ($event.target as HTMLInputElement).value)"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<label class="field-group">
|
||||||
|
<span>图标</span>
|
||||||
|
<SortDropdown
|
||||||
|
:model-value="createConfigForm.iconKey ?? 'chrome'"
|
||||||
|
:options="iconOptions"
|
||||||
|
@update:model-value="emit('updateIconKey', $event)"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<label class="field-group">
|
||||||
|
<span>可执行文件路径</span>
|
||||||
|
<div class="path-input-row">
|
||||||
|
<input
|
||||||
|
:value="createConfigForm.executablePath"
|
||||||
|
placeholder="C:\Program Files\...\chrome.exe"
|
||||||
|
@input="emit('updateExecutablePath', ($event.target as HTMLInputElement).value)"
|
||||||
|
/>
|
||||||
|
<button class="secondary-button" type="button" @click="emit('pickExecutablePath')">
|
||||||
|
选择文件
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
</label>
|
||||||
|
<label class="field-group">
|
||||||
|
<span>用户资料路径</span>
|
||||||
|
<div class="path-input-row">
|
||||||
|
<input
|
||||||
|
:value="createConfigForm.userDataPath"
|
||||||
|
placeholder="C:\Users\...\User Data"
|
||||||
|
@input="emit('updateUserDataPath', ($event.target as HTMLInputElement).value)"
|
||||||
|
/>
|
||||||
|
<button class="secondary-button" type="button" @click="emit('pickUserDataPath')">
|
||||||
|
选择文件夹
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
<div class="config-form-actions">
|
||||||
<button
|
<button
|
||||||
class="secondary-button config-toggle-button"
|
class="primary-button"
|
||||||
type="button"
|
type="button"
|
||||||
@click="formExpanded = !formExpanded"
|
:disabled="savingConfig"
|
||||||
|
@click="emit('createConfig')"
|
||||||
>
|
>
|
||||||
{{ formExpanded ? "Collapse" : "Expand" }}
|
{{ savingConfig ? "保存中..." : "添加配置" }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="formExpanded" class="config-form-fields compact">
|
|
||||||
<div class="config-inline-row">
|
|
||||||
<label class="field-group">
|
|
||||||
<span>Name</span>
|
|
||||||
<input
|
|
||||||
:value="createConfigForm.name"
|
|
||||||
placeholder="Work Chrome"
|
|
||||||
@input="emit('updateName', ($event.target as HTMLInputElement).value)"
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
<label class="field-group">
|
|
||||||
<span>Icon</span>
|
|
||||||
<SortDropdown
|
|
||||||
:model-value="createConfigForm.iconKey ?? 'chrome'"
|
|
||||||
:options="iconOptions"
|
|
||||||
@update:model-value="emit('updateIconKey', $event)"
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<label class="field-group">
|
|
||||||
<span>Executable Path</span>
|
|
||||||
<div class="path-input-row">
|
|
||||||
<input
|
|
||||||
:value="createConfigForm.executablePath"
|
|
||||||
placeholder="C:\Program Files\...\chrome.exe"
|
|
||||||
@input="emit('updateExecutablePath', ($event.target as HTMLInputElement).value)"
|
|
||||||
/>
|
|
||||||
<button class="secondary-button" type="button" @click="emit('pickExecutablePath')">
|
|
||||||
Browse File
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</label>
|
|
||||||
<label class="field-group">
|
|
||||||
<span>User Data Path</span>
|
|
||||||
<div class="path-input-row">
|
|
||||||
<input
|
|
||||||
:value="createConfigForm.userDataPath"
|
|
||||||
placeholder="C:\Users\...\User Data"
|
|
||||||
@input="emit('updateUserDataPath', ($event.target as HTMLInputElement).value)"
|
|
||||||
/>
|
|
||||||
<button class="secondary-button" type="button" @click="emit('pickUserDataPath')">
|
|
||||||
Browse Folder
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</label>
|
|
||||||
<div class="config-form-actions">
|
|
||||||
<button
|
|
||||||
class="primary-button"
|
|
||||||
type="button"
|
|
||||||
:disabled="savingConfig"
|
|
||||||
@click="emit('createConfig')"
|
|
||||||
>
|
|
||||||
{{ savingConfig ? "Saving..." : "Add Config" }}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-else class="config-form-collapsed-note">
|
|
||||||
<span>Collapsed by default to keep this page focused on existing configs.</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div v-if="configsLoading" class="empty-card">
|
<div v-if="configsLoading" class="empty-card">
|
||||||
<p>Loading browser configs...</p>
|
<p>正在加载浏览器配置...</p>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="stack-list">
|
<div v-else class="stack-list">
|
||||||
<article
|
<article
|
||||||
v-for="config in browserConfigs"
|
v-for="config in browserConfigs"
|
||||||
:key="config.id"
|
:key="config.id"
|
||||||
class="config-card"
|
class="config-card"
|
||||||
>
|
>
|
||||||
<div class="config-card-header">
|
<div class="config-card-header">
|
||||||
<div class="config-card-lead">
|
<div class="config-card-lead">
|
||||||
<div class="browser-nav-icon config-icon">
|
<div class="browser-nav-icon config-icon">
|
||||||
<img
|
<img
|
||||||
v-if="browserIconSrc(config.iconKey ?? config.browserFamilyId)"
|
v-if="browserIconSrc(config.iconKey ?? config.browserFamilyId)"
|
||||||
:src="browserIconSrc(config.iconKey ?? config.browserFamilyId) ?? undefined"
|
:src="browserIconSrc(config.iconKey ?? config.browserFamilyId) ?? undefined"
|
||||||
:alt="`${config.name} icon`"
|
:alt="`${config.name} icon`"
|
||||||
/>
|
/>
|
||||||
<span v-else>{{ configMonogram(config) }}</span>
|
<span v-else>{{ configMonogram(config) }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="config-title-row">
|
<div class="config-title-row">
|
||||||
<h4>{{ config.name }}</h4>
|
<h4>{{ config.name }}</h4>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button
|
|
||||||
v-if="config.deletable"
|
|
||||||
class="danger-button"
|
|
||||||
type="button"
|
|
||||||
:disabled="isDeletingConfig(config.id)"
|
|
||||||
@click="emit('deleteConfig', config.id)"
|
|
||||||
>
|
|
||||||
{{ isDeletingConfig(config.id) ? "Deleting..." : "Delete" }}
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="config-meta">
|
<button
|
||||||
<div class="config-meta-row">
|
v-if="config.deletable"
|
||||||
<span class="config-label">Executable</span>
|
class="danger-button"
|
||||||
<p :title="config.executablePath">{{ config.executablePath || "Not resolved" }}</p>
|
type="button"
|
||||||
</div>
|
:disabled="isDeletingConfig(config.id)"
|
||||||
<div class="config-meta-row">
|
@click="emit('deleteConfig', config.id)"
|
||||||
<span class="config-label">User Data</span>
|
>
|
||||||
<p :title="config.userDataPath">{{ config.userDataPath }}</p>
|
{{ isDeletingConfig(config.id) ? "删除中..." : "删除" }}
|
||||||
</div>
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="config-meta">
|
||||||
|
<div class="config-meta-row">
|
||||||
|
<span class="config-label">可执行文件</span>
|
||||||
|
<p :title="config.executablePath">{{ config.executablePath || "未解析" }}</p>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
<div class="config-meta-row">
|
||||||
</div>
|
<span class="config-label">用户资料</span>
|
||||||
</section>
|
<p :title="config.userDataPath">{{ config.userDataPath }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.config-page {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
min-height: 0;
|
||||||
|
overflow: auto;
|
||||||
|
padding: 0 2px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
.config-form-card,
|
.config-form-card,
|
||||||
.config-card {
|
.config-card {
|
||||||
border-radius: 18px;
|
border-radius: 18px;
|
||||||
@@ -181,7 +184,8 @@ const iconOptions = computed(() =>
|
|||||||
.config-form-header h3,
|
.config-form-header h3,
|
||||||
.config-title-row h4 {
|
.config-title-row h4 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 0.94rem;
|
font-size: 1.1rem;
|
||||||
|
line-height: 1.2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.config-form-header.collapsible {
|
.config-form-header.collapsible {
|
||||||
@@ -191,7 +195,6 @@ const iconOptions = computed(() =>
|
|||||||
gap: 12px;
|
gap: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.config-form-header p,
|
|
||||||
.config-meta-row p {
|
.config-meta-row p {
|
||||||
margin: 6px 0 0;
|
margin: 6px 0 0;
|
||||||
color: var(--muted);
|
color: var(--muted);
|
||||||
@@ -214,16 +217,6 @@ const iconOptions = computed(() =>
|
|||||||
align-items: end;
|
align-items: end;
|
||||||
}
|
}
|
||||||
|
|
||||||
.config-form-collapsed-note {
|
|
||||||
margin-top: 12px;
|
|
||||||
padding: 10px 12px;
|
|
||||||
border-radius: 12px;
|
|
||||||
background: rgba(248, 250, 252, 0.78);
|
|
||||||
border: 1px solid rgba(148, 163, 184, 0.12);
|
|
||||||
color: var(--muted);
|
|
||||||
font-size: 0.82rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.field-group {
|
.field-group {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 6px;
|
gap: 6px;
|
||||||
@@ -258,11 +251,12 @@ const iconOptions = computed(() =>
|
|||||||
.field-group :deep(.sort-dropdown-trigger) {
|
.field-group :deep(.sort-dropdown-trigger) {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
|
min-height: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.path-input-row {
|
.path-input-row {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: minmax(0, 1fr) auto;
|
grid-template-columns: minmax(0, 1fr) 118px;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,6 +264,11 @@ const iconOptions = computed(() =>
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.path-input-row .secondary-button {
|
||||||
|
width: 118px;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
.config-form-actions {
|
.config-form-actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
|
|||||||
@@ -2,13 +2,14 @@
|
|||||||
import { browserIconSrc, configurationIconSrc } from "../../utils/icons";
|
import { browserIconSrc, configurationIconSrc } from "../../utils/icons";
|
||||||
import type { AppPage, BrowserView } from "../../types/browser";
|
import type { AppPage, BrowserView } from "../../types/browser";
|
||||||
|
|
||||||
defineProps<{
|
const props = defineProps<{
|
||||||
browsers: BrowserView[];
|
browsers: BrowserView[];
|
||||||
currentBrowserId: string | null;
|
currentBrowserId: string | null;
|
||||||
page: AppPage;
|
page: AppPage;
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
configsLoading: boolean;
|
configsLoading: boolean;
|
||||||
browserMonogram: (browserId: string) => string;
|
browserMonogram: (browserId: string) => string;
|
||||||
|
appVersion: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
@@ -22,7 +23,7 @@ const emit = defineEmits<{
|
|||||||
<aside class="sidebar">
|
<aside class="sidebar">
|
||||||
<div class="sidebar-toolbar">
|
<div class="sidebar-toolbar">
|
||||||
<div class="sidebar-title-group">
|
<div class="sidebar-title-group">
|
||||||
<h1>Browser Assistant</h1>
|
<h1>浏览器助手</h1>
|
||||||
</div>
|
</div>
|
||||||
<button class="refresh-icon-button" type="button" @click="emit('refresh')">
|
<button class="refresh-icon-button" type="button" @click="emit('refresh')">
|
||||||
<svg class="refresh-icon" viewBox="0 0 24 24" aria-hidden="true">
|
<svg class="refresh-icon" viewBox="0 0 24 24" aria-hidden="true">
|
||||||
@@ -35,7 +36,7 @@ const emit = defineEmits<{
|
|||||||
stroke-width="2"
|
stroke-width="2"
|
||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
<span class="sr-only">{{ loading || configsLoading ? "Refreshing..." : "Refresh" }}</span>
|
<span class="sr-only">{{ loading || configsLoading ? "刷新中..." : "刷新" }}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -63,7 +64,7 @@ const emit = defineEmits<{
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else class="sidebar-empty">
|
<div v-else class="sidebar-empty">
|
||||||
<p>No supported Chromium browser data was found yet.</p>
|
<p>暂未找到受支持的 Chromium 浏览器数据。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
@@ -73,11 +74,12 @@ const emit = defineEmits<{
|
|||||||
@click="emit('selectConfiguration')"
|
@click="emit('selectConfiguration')"
|
||||||
>
|
>
|
||||||
<div class="browser-nav-icon config-nav-icon">
|
<div class="browser-nav-icon config-nav-icon">
|
||||||
<img :src="configurationIconSrc" alt="Configuration icon" />
|
<img :src="configurationIconSrc" alt="配置图标" />
|
||||||
</div>
|
</div>
|
||||||
<div class="browser-nav-body">
|
<div class="browser-nav-body">
|
||||||
<strong>Configuration</strong>
|
<strong>配置</strong>
|
||||||
</div>
|
</div>
|
||||||
|
<span class="utility-version" :title="`版本 ${props.appVersion}`">v{{ props.appVersion }}</span>
|
||||||
</button>
|
</button>
|
||||||
</aside>
|
</aside>
|
||||||
</template>
|
</template>
|
||||||
@@ -255,6 +257,8 @@ const emit = defineEmits<{
|
|||||||
|
|
||||||
.sidebar-utility-nav {
|
.sidebar-utility-nav {
|
||||||
margin-top: auto;
|
margin-top: auto;
|
||||||
|
position: relative;
|
||||||
|
padding-right: 70px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.browser-nav-body {
|
.browser-nav-body {
|
||||||
@@ -268,6 +272,18 @@ const emit = defineEmits<{
|
|||||||
line-height: 1.25;
|
line-height: 1.25;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.utility-version {
|
||||||
|
position: absolute;
|
||||||
|
right: 12px;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
color: rgba(82, 98, 119, 0.7);
|
||||||
|
font-size: 0.72rem;
|
||||||
|
font-weight: 500;
|
||||||
|
letter-spacing: 0.01em;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
.sidebar-empty {
|
.sidebar-empty {
|
||||||
padding: 14px;
|
padding: 14px;
|
||||||
border-radius: 14px;
|
border-radius: 14px;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { computed, onMounted, ref, watch } from "vue";
|
|||||||
import { invoke } from "@tauri-apps/api/core";
|
import { invoke } from "@tauri-apps/api/core";
|
||||||
import { open } from "@tauri-apps/plugin-dialog";
|
import { open } from "@tauri-apps/plugin-dialog";
|
||||||
|
|
||||||
import { sortBookmarks, sortExtensions, sortProfiles } from "../utils/sort";
|
import { sortBookmarks, sortExtensions, sortPasswordSites, sortProfiles } from "../utils/sort";
|
||||||
import type {
|
import type {
|
||||||
ActiveSection,
|
ActiveSection,
|
||||||
AppPage,
|
AppPage,
|
||||||
@@ -12,9 +12,20 @@ import type {
|
|||||||
BrowserConfigEntry,
|
BrowserConfigEntry,
|
||||||
BrowserConfigListResponse,
|
BrowserConfigListResponse,
|
||||||
BrowserView,
|
BrowserView,
|
||||||
|
BookmarkRemovalRequest,
|
||||||
|
CleanupHistoryInput,
|
||||||
|
CleanupHistoryResponse,
|
||||||
CreateCustomBrowserConfigInput,
|
CreateCustomBrowserConfigInput,
|
||||||
|
ExtensionRemovalRequest,
|
||||||
|
ExtensionSummary,
|
||||||
ExtensionSortKey,
|
ExtensionSortKey,
|
||||||
|
PasswordSiteSortKey,
|
||||||
ProfileSortKey,
|
ProfileSortKey,
|
||||||
|
RemoveBookmarksInput,
|
||||||
|
RemoveBookmarksResponse,
|
||||||
|
RemoveExtensionsInput,
|
||||||
|
RemoveExtensionsResponse,
|
||||||
|
PasswordSitesResponse,
|
||||||
ScanResponse,
|
ScanResponse,
|
||||||
} from "../types/browser";
|
} from "../types/browser";
|
||||||
|
|
||||||
@@ -41,12 +52,47 @@ export function useBrowserManager() {
|
|||||||
const associatedProfilesModal = ref<{
|
const associatedProfilesModal = ref<{
|
||||||
title: string;
|
title: string;
|
||||||
browserId: string;
|
browserId: string;
|
||||||
profiles: (AssociatedProfileSummary | BookmarkAssociatedProfileSummary)[];
|
profiles: (
|
||||||
|
| AssociatedProfileSummary
|
||||||
|
| BookmarkAssociatedProfileSummary
|
||||||
|
| ExtensionSummary["profiles"][number]
|
||||||
|
)[];
|
||||||
isBookmark: boolean;
|
isBookmark: boolean;
|
||||||
|
isExtension?: boolean;
|
||||||
|
extensionId?: string;
|
||||||
|
bookmarkUrl?: string;
|
||||||
} | null>(null);
|
} | null>(null);
|
||||||
const profileSortKey = ref<ProfileSortKey>("name");
|
const profileSortKey = ref<ProfileSortKey>("name");
|
||||||
const extensionSortKey = ref<ExtensionSortKey>("name");
|
const extensionSortKey = ref<ExtensionSortKey>("name");
|
||||||
const bookmarkSortKey = ref<BookmarkSortKey>("title");
|
const bookmarkSortKey = ref<BookmarkSortKey>("title");
|
||||||
|
const passwordSiteSortKey = ref<PasswordSiteSortKey>("domain");
|
||||||
|
const passwordSitesLoading = ref(false);
|
||||||
|
const passwordSitesError = ref("");
|
||||||
|
const passwordSitesLoadedBrowserIds = ref<string[]>([]);
|
||||||
|
const bookmarkSelectedUrls = ref<string[]>([]);
|
||||||
|
const bookmarkModalSelectedProfileIds = ref<string[]>([]);
|
||||||
|
const bookmarkDeleteBusy = ref(false);
|
||||||
|
const bookmarkRemovalError = ref("");
|
||||||
|
const bookmarkRemovalResults = ref<RemoveBookmarksResponse["results"]>([]);
|
||||||
|
const bookmarkRemovalResultOpen = ref(false);
|
||||||
|
const bookmarkRemovalConfirmRemovals = ref<BookmarkRemovalRequest[]>([]);
|
||||||
|
const bookmarkRemovalConfirmUrls = ref<string[]>([]);
|
||||||
|
const bookmarkRemovalConfirmProfileIds = ref<string[]>([]);
|
||||||
|
const extensionSelectedIds = ref<string[]>([]);
|
||||||
|
const extensionModalSelectedProfileIds = ref<string[]>([]);
|
||||||
|
const extensionDeleteBusy = ref(false);
|
||||||
|
const extensionRemovalError = ref("");
|
||||||
|
const extensionRemovalResults = ref<RemoveExtensionsResponse["results"]>([]);
|
||||||
|
const extensionRemovalResultOpen = ref(false);
|
||||||
|
const extensionRemovalConfirmRemovals = ref<ExtensionRemovalRequest[]>([]);
|
||||||
|
const extensionRemovalConfirmExtensionIds = ref<string[]>([]);
|
||||||
|
const extensionRemovalConfirmProfileIds = ref<string[]>([]);
|
||||||
|
const cleanupHistorySelectedProfiles = ref<string[]>([]);
|
||||||
|
const historyCleanupBusy = ref(false);
|
||||||
|
const cleanupHistoryError = ref("");
|
||||||
|
const cleanupHistoryResults = ref<CleanupHistoryResponse["results"]>([]);
|
||||||
|
const historyCleanupConfirmProfileIds = ref<string[]>([]);
|
||||||
|
const historyCleanupResultOpen = ref(false);
|
||||||
|
|
||||||
const browsers = computed(() => response.value.browsers);
|
const browsers = computed(() => response.value.browsers);
|
||||||
const currentBrowser = computed<BrowserView | null>(
|
const currentBrowser = computed<BrowserView | null>(
|
||||||
@@ -65,6 +111,9 @@ export function useBrowserManager() {
|
|||||||
const sortedBookmarks = computed(() =>
|
const sortedBookmarks = computed(() =>
|
||||||
sortBookmarks(currentBrowser.value?.bookmarks ?? [], bookmarkSortKey.value),
|
sortBookmarks(currentBrowser.value?.bookmarks ?? [], bookmarkSortKey.value),
|
||||||
);
|
);
|
||||||
|
const sortedPasswordSites = computed(() =>
|
||||||
|
sortPasswordSites(currentBrowser.value?.passwordSites ?? [], passwordSiteSortKey.value),
|
||||||
|
);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
browsers,
|
browsers,
|
||||||
@@ -88,6 +137,28 @@ export function useBrowserManager() {
|
|||||||
watch(selectedBrowserId, () => {
|
watch(selectedBrowserId, () => {
|
||||||
openProfileError.value = "";
|
openProfileError.value = "";
|
||||||
associatedProfilesModal.value = null;
|
associatedProfilesModal.value = null;
|
||||||
|
cleanupHistorySelectedProfiles.value = [];
|
||||||
|
cleanupHistoryResults.value = [];
|
||||||
|
cleanupHistoryError.value = "";
|
||||||
|
bookmarkSelectedUrls.value = [];
|
||||||
|
bookmarkModalSelectedProfileIds.value = [];
|
||||||
|
bookmarkRemovalError.value = "";
|
||||||
|
bookmarkRemovalResults.value = [];
|
||||||
|
bookmarkRemovalResultOpen.value = false;
|
||||||
|
bookmarkRemovalConfirmRemovals.value = [];
|
||||||
|
bookmarkRemovalConfirmUrls.value = [];
|
||||||
|
bookmarkRemovalConfirmProfileIds.value = [];
|
||||||
|
extensionSelectedIds.value = [];
|
||||||
|
extensionModalSelectedProfileIds.value = [];
|
||||||
|
extensionRemovalError.value = "";
|
||||||
|
extensionRemovalResults.value = [];
|
||||||
|
extensionRemovalResultOpen.value = false;
|
||||||
|
extensionRemovalConfirmRemovals.value = [];
|
||||||
|
extensionRemovalConfirmExtensionIds.value = [];
|
||||||
|
extensionRemovalConfirmProfileIds.value = [];
|
||||||
|
historyCleanupConfirmProfileIds.value = [];
|
||||||
|
historyCleanupResultOpen.value = false;
|
||||||
|
passwordSitesError.value = "";
|
||||||
});
|
});
|
||||||
|
|
||||||
async function loadBrowserConfigs() {
|
async function loadBrowserConfigs() {
|
||||||
@@ -99,7 +170,7 @@ export function useBrowserManager() {
|
|||||||
browserConfigs.value = result.configs;
|
browserConfigs.value = result.configs;
|
||||||
} catch (loadError) {
|
} catch (loadError) {
|
||||||
configError.value =
|
configError.value =
|
||||||
loadError instanceof Error ? loadError.message : "Failed to load browser configs.";
|
loadError instanceof Error ? loadError.message : "加载浏览器配置失败。";
|
||||||
} finally {
|
} finally {
|
||||||
configsLoading.value = false;
|
configsLoading.value = false;
|
||||||
}
|
}
|
||||||
@@ -111,11 +182,13 @@ export function useBrowserManager() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
response.value = await invoke<ScanResponse>("scan_browsers");
|
response.value = await invoke<ScanResponse>("scan_browsers");
|
||||||
|
passwordSitesLoadedBrowserIds.value = [];
|
||||||
|
passwordSitesError.value = "";
|
||||||
} catch (scanError) {
|
} catch (scanError) {
|
||||||
error.value =
|
error.value =
|
||||||
scanError instanceof Error
|
scanError instanceof Error
|
||||||
? scanError.message
|
? scanError.message
|
||||||
: "Failed to scan browser data.";
|
: "扫描浏览器数据失败。";
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
}
|
||||||
@@ -139,7 +212,7 @@ export function useBrowserManager() {
|
|||||||
openProfileError.value =
|
openProfileError.value =
|
||||||
openError instanceof Error
|
openError instanceof Error
|
||||||
? openError.message
|
? openError.message
|
||||||
: "Failed to open the selected browser profile.";
|
: "打开所选浏览器资料失败。";
|
||||||
} finally {
|
} finally {
|
||||||
openingProfileKey.value = "";
|
openingProfileKey.value = "";
|
||||||
}
|
}
|
||||||
@@ -163,7 +236,7 @@ export function useBrowserManager() {
|
|||||||
await scanBrowsers();
|
await scanBrowsers();
|
||||||
} catch (saveError) {
|
} catch (saveError) {
|
||||||
configError.value =
|
configError.value =
|
||||||
saveError instanceof Error ? saveError.message : "Failed to create browser config.";
|
saveError instanceof Error ? saveError.message : "创建浏览器配置失败。";
|
||||||
} finally {
|
} finally {
|
||||||
savingConfig.value = false;
|
savingConfig.value = false;
|
||||||
}
|
}
|
||||||
@@ -181,7 +254,7 @@ export function useBrowserManager() {
|
|||||||
await scanBrowsers();
|
await scanBrowsers();
|
||||||
} catch (deleteError) {
|
} catch (deleteError) {
|
||||||
configError.value =
|
configError.value =
|
||||||
deleteError instanceof Error ? deleteError.message : "Failed to delete browser config.";
|
deleteError instanceof Error ? deleteError.message : "删除浏览器配置失败。";
|
||||||
} finally {
|
} finally {
|
||||||
deletingConfigId.value = "";
|
deletingConfigId.value = "";
|
||||||
}
|
}
|
||||||
@@ -229,6 +302,9 @@ export function useBrowserManager() {
|
|||||||
if (iconKey === "chrome") return "CH";
|
if (iconKey === "chrome") return "CH";
|
||||||
if (iconKey === "edge") return "ED";
|
if (iconKey === "edge") return "ED";
|
||||||
if (iconKey === "brave") return "BR";
|
if (iconKey === "brave") return "BR";
|
||||||
|
if (iconKey === "vivaldi") return "VI";
|
||||||
|
if (iconKey === "yandex") return "YA";
|
||||||
|
if (iconKey === "chromium") return "CR";
|
||||||
|
|
||||||
const name = current?.browserName?.trim() ?? "";
|
const name = current?.browserName?.trim() ?? "";
|
||||||
if (name) {
|
if (name) {
|
||||||
@@ -248,6 +324,9 @@ export function useBrowserManager() {
|
|||||||
if (iconKey === "chrome") return "CH";
|
if (iconKey === "chrome") return "CH";
|
||||||
if (iconKey === "edge") return "ED";
|
if (iconKey === "edge") return "ED";
|
||||||
if (iconKey === "brave") return "BR";
|
if (iconKey === "brave") return "BR";
|
||||||
|
if (iconKey === "vivaldi") return "VI";
|
||||||
|
if (iconKey === "yandex") return "YA";
|
||||||
|
if (iconKey === "chromium") return "CR";
|
||||||
|
|
||||||
const letters = config.name
|
const letters = config.name
|
||||||
.trim()
|
.trim()
|
||||||
@@ -262,45 +341,648 @@ export function useBrowserManager() {
|
|||||||
return name.trim().slice(0, 1).toUpperCase() || "?";
|
return name.trim().slice(0, 1).toUpperCase() || "?";
|
||||||
}
|
}
|
||||||
|
|
||||||
function domainFromUrl(url: string) {
|
|
||||||
try {
|
|
||||||
return new URL(url).hostname;
|
|
||||||
} catch {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function sectionCount(section: ActiveSection) {
|
function sectionCount(section: ActiveSection) {
|
||||||
if (!currentBrowser.value) return 0;
|
if (!currentBrowser.value) return 0;
|
||||||
if (section === "profiles") return currentBrowser.value.profiles.length;
|
if (section === "profiles") return currentBrowser.value.profiles.length;
|
||||||
if (section === "extensions") return currentBrowser.value.extensions.length;
|
if (section === "extensions") return currentBrowser.value.extensions.length;
|
||||||
return currentBrowser.value.bookmarks.length;
|
if (section === "bookmarks") return currentBrowser.value.bookmarks.length;
|
||||||
|
if (section === "passwords") return currentBrowser.value.passwordSites.length;
|
||||||
|
return currentBrowser.value.stats.historyCleanupProfileCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
function showExtensionProfilesModal(extensionId: string) {
|
function showExtensionProfilesModal(extensionId: string) {
|
||||||
const extension = currentBrowser.value?.extensions.find((item) => item.id === extensionId);
|
const extension = currentBrowser.value?.extensions.find((item) => item.id === extensionId);
|
||||||
if (!extension || !currentBrowser.value) return;
|
if (!extension || !currentBrowser.value) return;
|
||||||
|
extensionModalSelectedProfileIds.value = [];
|
||||||
associatedProfilesModal.value = {
|
associatedProfilesModal.value = {
|
||||||
title: `${extension.name} Profiles`,
|
title: extension.name,
|
||||||
browserId: currentBrowser.value.browserId,
|
browserId: currentBrowser.value.browserId,
|
||||||
profiles: extension.profiles,
|
profiles: extension.profiles,
|
||||||
isBookmark: false,
|
isBookmark: false,
|
||||||
|
isExtension: true,
|
||||||
|
extensionId,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function showBookmarkProfilesModal(url: string) {
|
function showBookmarkProfilesModal(url: string) {
|
||||||
const bookmark = currentBrowser.value?.bookmarks.find((item) => item.url === url);
|
const bookmark = currentBrowser.value?.bookmarks.find((item) => item.url === url);
|
||||||
if (!bookmark || !currentBrowser.value) return;
|
if (!bookmark || !currentBrowser.value) return;
|
||||||
|
bookmarkModalSelectedProfileIds.value = [];
|
||||||
associatedProfilesModal.value = {
|
associatedProfilesModal.value = {
|
||||||
title: `${bookmark.title} Profiles`,
|
title: bookmark.title,
|
||||||
browserId: currentBrowser.value.browserId,
|
browserId: currentBrowser.value.browserId,
|
||||||
profiles: bookmark.profiles,
|
profiles: bookmark.profiles,
|
||||||
isBookmark: true,
|
isBookmark: true,
|
||||||
|
bookmarkUrl: url,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showPasswordSiteProfilesModal(url: string) {
|
||||||
|
const passwordSite = currentBrowser.value?.passwordSites.find((item) => item.url === url);
|
||||||
|
if (!passwordSite || !currentBrowser.value) return;
|
||||||
|
associatedProfilesModal.value = {
|
||||||
|
title: passwordSite.domain,
|
||||||
|
browserId: currentBrowser.value.browserId,
|
||||||
|
profiles: passwordSite.profiles,
|
||||||
|
isBookmark: false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function hasLoadedPasswordSites(browserId: string) {
|
||||||
|
return passwordSitesLoadedBrowserIds.value.includes(browserId);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadPasswordSites() {
|
||||||
|
const browser = currentBrowser.value;
|
||||||
|
if (!browser || passwordSitesLoading.value) return;
|
||||||
|
|
||||||
|
const confirmed = window.confirm("将按需读取当前浏览器的已保存登录站点,是否继续?");
|
||||||
|
if (!confirmed) return;
|
||||||
|
|
||||||
|
passwordSitesLoading.value = true;
|
||||||
|
passwordSitesError.value = "";
|
||||||
|
|
||||||
|
try {
|
||||||
|
const result = await invoke<PasswordSitesResponse>("scan_password_sites", {
|
||||||
|
browserId: browser.browserId,
|
||||||
|
});
|
||||||
|
browser.passwordSites = sortPasswordSites(result.passwordSites, passwordSiteSortKey.value);
|
||||||
|
browser.stats.passwordSiteCount = browser.passwordSites.length;
|
||||||
|
if (!passwordSitesLoadedBrowserIds.value.includes(browser.browserId)) {
|
||||||
|
passwordSitesLoadedBrowserIds.value = [
|
||||||
|
...passwordSitesLoadedBrowserIds.value,
|
||||||
|
browser.browserId,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
} catch (loadError) {
|
||||||
|
passwordSitesError.value =
|
||||||
|
loadError instanceof Error ? loadError.message : "加载已保存登录站点失败。";
|
||||||
|
} finally {
|
||||||
|
passwordSitesLoading.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleHistoryProfile(profileId: string) {
|
||||||
|
if (cleanupHistorySelectedProfiles.value.includes(profileId)) {
|
||||||
|
cleanupHistorySelectedProfiles.value = cleanupHistorySelectedProfiles.value.filter(
|
||||||
|
(selectedId) => selectedId !== profileId,
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cleanupHistorySelectedProfiles.value = [
|
||||||
|
...cleanupHistorySelectedProfiles.value,
|
||||||
|
profileId,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleAllHistoryProfiles() {
|
||||||
|
const current = currentBrowser.value;
|
||||||
|
if (!current) return;
|
||||||
|
|
||||||
|
const selectableIds = current.profiles
|
||||||
|
.filter((profile) => {
|
||||||
|
const cleanup = profile.historyCleanup;
|
||||||
|
return (
|
||||||
|
cleanup.history === "found" ||
|
||||||
|
cleanup.topSites === "found" ||
|
||||||
|
cleanup.visitedLinks === "found" ||
|
||||||
|
cleanup.shortcuts === "found" ||
|
||||||
|
cleanup.sessions === "found"
|
||||||
|
);
|
||||||
|
})
|
||||||
|
.map((profile) => profile.id);
|
||||||
|
|
||||||
|
const allSelected =
|
||||||
|
selectableIds.length > 0 &&
|
||||||
|
selectableIds.every((profileId) =>
|
||||||
|
cleanupHistorySelectedProfiles.value.includes(profileId),
|
||||||
|
);
|
||||||
|
|
||||||
|
cleanupHistorySelectedProfiles.value = allSelected ? [] : selectableIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
function cleanupProfileIdsWithHistory(browser: BrowserView) {
|
||||||
|
return browser.profiles
|
||||||
|
.filter((profile) => {
|
||||||
|
const cleanup = profile.historyCleanup;
|
||||||
|
return (
|
||||||
|
cleanup.history === "found" ||
|
||||||
|
cleanup.topSites === "found" ||
|
||||||
|
cleanup.visitedLinks === "found" ||
|
||||||
|
cleanup.shortcuts === "found" ||
|
||||||
|
cleanup.sessions === "found"
|
||||||
|
);
|
||||||
|
})
|
||||||
|
.map((profile) => profile.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
function historyCleanupConfirmProfiles() {
|
||||||
|
const browser = currentBrowser.value;
|
||||||
|
if (!browser) return [];
|
||||||
|
return browser.profiles.filter((profile) =>
|
||||||
|
historyCleanupConfirmProfileIds.value.includes(profile.id),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function cleanupSelectedHistoryProfiles() {
|
||||||
|
if (!cleanupHistorySelectedProfiles.value.length) return;
|
||||||
|
historyCleanupConfirmProfileIds.value = [...cleanupHistorySelectedProfiles.value];
|
||||||
|
}
|
||||||
|
|
||||||
|
function cleanupHistoryForProfile(profileId: string) {
|
||||||
|
historyCleanupConfirmProfileIds.value = [profileId];
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeHistoryCleanupConfirm() {
|
||||||
|
if (historyCleanupBusy.value) return;
|
||||||
|
historyCleanupConfirmProfileIds.value = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeHistoryCleanupResult() {
|
||||||
|
historyCleanupResultOpen.value = false;
|
||||||
|
cleanupHistoryResults.value = [];
|
||||||
|
cleanupHistoryError.value = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function applyCleanupHistoryResults(results: CleanupHistoryResponse["results"]) {
|
||||||
|
const browser = currentBrowser.value;
|
||||||
|
if (!browser) return;
|
||||||
|
|
||||||
|
const succeededProfileIds = results
|
||||||
|
.filter((result) => !result.error)
|
||||||
|
.map((result) => result.profileId);
|
||||||
|
|
||||||
|
if (!succeededProfileIds.length) return;
|
||||||
|
|
||||||
|
for (const profile of browser.profiles) {
|
||||||
|
if (!succeededProfileIds.includes(profile.id)) continue;
|
||||||
|
|
||||||
|
const deletedFiles = results.find((result) => result.profileId === profile.id)?.deletedFiles ?? [];
|
||||||
|
if (deletedFiles.includes("History")) {
|
||||||
|
profile.historyCleanup.history = "missing";
|
||||||
|
}
|
||||||
|
if (deletedFiles.includes("Top Sites")) {
|
||||||
|
profile.historyCleanup.topSites = "missing";
|
||||||
|
}
|
||||||
|
if (deletedFiles.includes("Visited Links")) {
|
||||||
|
profile.historyCleanup.visitedLinks = "missing";
|
||||||
|
}
|
||||||
|
if (deletedFiles.includes("Shortcuts")) {
|
||||||
|
profile.historyCleanup.shortcuts = "missing";
|
||||||
|
}
|
||||||
|
if (deletedFiles.includes("Sessions")) {
|
||||||
|
profile.historyCleanup.sessions = "missing";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
browser.stats.historyCleanupProfileCount = cleanupProfileIdsWithHistory(browser).length;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function confirmHistoryCleanup() {
|
||||||
|
const browser = currentBrowser.value;
|
||||||
|
const profileIds = [...historyCleanupConfirmProfileIds.value];
|
||||||
|
if (!browser || profileIds.length === 0) return;
|
||||||
|
|
||||||
|
if (!currentBrowser.value || profileIds.length === 0) return;
|
||||||
|
|
||||||
|
historyCleanupBusy.value = true;
|
||||||
|
cleanupHistoryError.value = "";
|
||||||
|
cleanupHistoryResults.value = [];
|
||||||
|
historyCleanupResultOpen.value = false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const input: CleanupHistoryInput = {
|
||||||
|
browserId: browser.browserId,
|
||||||
|
profileIds,
|
||||||
|
};
|
||||||
|
const result = await invoke<CleanupHistoryResponse>("cleanup_history_files", { input });
|
||||||
|
applyCleanupHistoryResults(result.results);
|
||||||
|
cleanupHistoryResults.value = result.results;
|
||||||
|
cleanupHistorySelectedProfiles.value = cleanupHistorySelectedProfiles.value.filter(
|
||||||
|
(profileId) => !profileIds.includes(profileId),
|
||||||
|
);
|
||||||
|
historyCleanupConfirmProfileIds.value = [];
|
||||||
|
historyCleanupResultOpen.value = true;
|
||||||
|
} catch (cleanupErrorValue) {
|
||||||
|
historyCleanupConfirmProfileIds.value = [];
|
||||||
|
cleanupHistoryError.value =
|
||||||
|
cleanupErrorValue instanceof Error
|
||||||
|
? cleanupErrorValue.message
|
||||||
|
: "清理历史文件失败。";
|
||||||
|
historyCleanupResultOpen.value = true;
|
||||||
|
} finally {
|
||||||
|
historyCleanupBusy.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function closeAssociatedProfilesModal() {
|
function closeAssociatedProfilesModal() {
|
||||||
associatedProfilesModal.value = null;
|
associatedProfilesModal.value = null;
|
||||||
|
extensionModalSelectedProfileIds.value = [];
|
||||||
|
bookmarkModalSelectedProfileIds.value = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleBookmarkSelection(url: string) {
|
||||||
|
if (bookmarkSelectedUrls.value.includes(url)) {
|
||||||
|
bookmarkSelectedUrls.value = bookmarkSelectedUrls.value.filter((item) => item !== url);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bookmarkSelectedUrls.value = [...bookmarkSelectedUrls.value, url];
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleAllBookmarks() {
|
||||||
|
const bookmarkUrls = currentBrowser.value?.bookmarks.map((bookmark) => bookmark.url) ?? [];
|
||||||
|
const allSelected =
|
||||||
|
bookmarkUrls.length > 0 &&
|
||||||
|
bookmarkUrls.every((url) => bookmarkSelectedUrls.value.includes(url));
|
||||||
|
bookmarkSelectedUrls.value = allSelected ? [] : bookmarkUrls;
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleBookmarkModalProfileSelection(profileId: string) {
|
||||||
|
if (bookmarkModalSelectedProfileIds.value.includes(profileId)) {
|
||||||
|
bookmarkModalSelectedProfileIds.value = bookmarkModalSelectedProfileIds.value.filter(
|
||||||
|
(id) => id !== profileId,
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bookmarkModalSelectedProfileIds.value = [...bookmarkModalSelectedProfileIds.value, profileId];
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleAllBookmarkModalProfiles() {
|
||||||
|
if (!associatedProfilesModal.value?.isBookmark) return;
|
||||||
|
const profileIds = associatedProfilesModal.value.profiles.map((profile) => profile.id);
|
||||||
|
const allSelected =
|
||||||
|
profileIds.length > 0 &&
|
||||||
|
profileIds.every((profileId) => bookmarkModalSelectedProfileIds.value.includes(profileId));
|
||||||
|
bookmarkModalSelectedProfileIds.value = allSelected ? [] : profileIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
function bookmarkRemovalConfirmBookmarkCount() {
|
||||||
|
return bookmarkRemovalConfirmUrls.value.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
function bookmarkRemovalConfirmProfileCount() {
|
||||||
|
return bookmarkRemovalConfirmProfileIds.value.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
function requestBookmarkRemoval(removals: BookmarkRemovalRequest[]) {
|
||||||
|
if (!removals.length) return;
|
||||||
|
|
||||||
|
bookmarkRemovalConfirmRemovals.value = removals;
|
||||||
|
bookmarkRemovalConfirmUrls.value = [...new Set(removals.map((item) => item.url))];
|
||||||
|
bookmarkRemovalConfirmProfileIds.value = [...new Set(removals.flatMap((item) => item.profileIds))];
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetBookmarkRemovalConfirmState() {
|
||||||
|
bookmarkRemovalConfirmRemovals.value = [];
|
||||||
|
bookmarkRemovalConfirmUrls.value = [];
|
||||||
|
bookmarkRemovalConfirmProfileIds.value = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteBookmarkFromAllProfiles(url: string) {
|
||||||
|
const bookmark = currentBrowser.value?.bookmarks.find((item) => item.url === url);
|
||||||
|
if (!bookmark) return;
|
||||||
|
|
||||||
|
requestBookmarkRemoval([
|
||||||
|
{
|
||||||
|
url,
|
||||||
|
profileIds: [...bookmark.profileIds],
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteSelectedBookmarks() {
|
||||||
|
const browser = currentBrowser.value;
|
||||||
|
if (!browser || !bookmarkSelectedUrls.value.length) return;
|
||||||
|
|
||||||
|
const removals = browser.bookmarks
|
||||||
|
.filter((bookmark) => bookmarkSelectedUrls.value.includes(bookmark.url))
|
||||||
|
.map((bookmark) => ({
|
||||||
|
url: bookmark.url,
|
||||||
|
profileIds: [...bookmark.profileIds],
|
||||||
|
}));
|
||||||
|
requestBookmarkRemoval(removals);
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteBookmarkFromProfile(profileId: string) {
|
||||||
|
const modal = associatedProfilesModal.value;
|
||||||
|
if (!modal?.isBookmark || !modal.bookmarkUrl) return;
|
||||||
|
|
||||||
|
requestBookmarkRemoval([
|
||||||
|
{
|
||||||
|
url: modal.bookmarkUrl,
|
||||||
|
profileIds: [profileId],
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteSelectedBookmarkProfiles() {
|
||||||
|
const modal = associatedProfilesModal.value;
|
||||||
|
if (!modal?.isBookmark || !modal.bookmarkUrl || !bookmarkModalSelectedProfileIds.value.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
requestBookmarkRemoval([
|
||||||
|
{
|
||||||
|
url: modal.bookmarkUrl,
|
||||||
|
profileIds: [...bookmarkModalSelectedProfileIds.value],
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeBookmarkRemovalConfirm() {
|
||||||
|
if (bookmarkDeleteBusy.value) return;
|
||||||
|
resetBookmarkRemovalConfirmState();
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeBookmarkRemovalResult() {
|
||||||
|
bookmarkRemovalResultOpen.value = false;
|
||||||
|
bookmarkRemovalResults.value = [];
|
||||||
|
bookmarkRemovalError.value = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function applyBookmarkRemovalResults(results: RemoveBookmarksResponse["results"]) {
|
||||||
|
const browser = currentBrowser.value;
|
||||||
|
if (!browser) return;
|
||||||
|
|
||||||
|
for (const result of results) {
|
||||||
|
if (result.error || result.removedCount === 0) continue;
|
||||||
|
const bookmark = browser.bookmarks.find((item) => item.url === result.url);
|
||||||
|
if (!bookmark) continue;
|
||||||
|
|
||||||
|
bookmark.profileIds = bookmark.profileIds.filter((id) => id !== result.profileId);
|
||||||
|
bookmark.profiles = bookmark.profiles.filter((profile) => profile.id !== result.profileId);
|
||||||
|
}
|
||||||
|
|
||||||
|
browser.bookmarks = browser.bookmarks.filter((bookmark) => bookmark.profileIds.length > 0);
|
||||||
|
browser.stats.bookmarkCount = browser.bookmarks.length;
|
||||||
|
|
||||||
|
bookmarkSelectedUrls.value = bookmarkSelectedUrls.value.filter((selectedUrl) =>
|
||||||
|
browser.bookmarks.some((bookmark) => bookmark.url === selectedUrl),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (associatedProfilesModal.value?.isBookmark) {
|
||||||
|
const currentBookmark = browser.bookmarks.find(
|
||||||
|
(bookmark) => bookmark.url === associatedProfilesModal.value?.bookmarkUrl,
|
||||||
|
);
|
||||||
|
if (!currentBookmark) {
|
||||||
|
associatedProfilesModal.value = null;
|
||||||
|
bookmarkModalSelectedProfileIds.value = [];
|
||||||
|
} else {
|
||||||
|
associatedProfilesModal.value = {
|
||||||
|
...associatedProfilesModal.value,
|
||||||
|
title: currentBookmark.title,
|
||||||
|
profiles: currentBookmark.profiles,
|
||||||
|
};
|
||||||
|
bookmarkModalSelectedProfileIds.value = bookmarkModalSelectedProfileIds.value.filter((id) =>
|
||||||
|
currentBookmark.profiles.some((profile) => profile.id === id),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function confirmBookmarkRemoval() {
|
||||||
|
const browser = currentBrowser.value;
|
||||||
|
const removals = bookmarkRemovalConfirmRemovals.value.map((item) => ({
|
||||||
|
url: item.url,
|
||||||
|
profileIds: [...item.profileIds],
|
||||||
|
}));
|
||||||
|
if (!browser || !removals.length) return;
|
||||||
|
|
||||||
|
bookmarkDeleteBusy.value = true;
|
||||||
|
bookmarkRemovalError.value = "";
|
||||||
|
bookmarkRemovalResults.value = [];
|
||||||
|
bookmarkRemovalResultOpen.value = false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const input: RemoveBookmarksInput = {
|
||||||
|
browserId: browser.browserId,
|
||||||
|
removals,
|
||||||
|
};
|
||||||
|
const result = await invoke<RemoveBookmarksResponse>("remove_bookmarks", { input });
|
||||||
|
applyBookmarkRemovalResults(result.results);
|
||||||
|
bookmarkRemovalResults.value = result.results;
|
||||||
|
resetBookmarkRemovalConfirmState();
|
||||||
|
bookmarkRemovalResultOpen.value = true;
|
||||||
|
} catch (removeError) {
|
||||||
|
resetBookmarkRemovalConfirmState();
|
||||||
|
bookmarkRemovalError.value =
|
||||||
|
removeError instanceof Error ? removeError.message : "删除书签失败。";
|
||||||
|
bookmarkRemovalResultOpen.value = true;
|
||||||
|
} finally {
|
||||||
|
bookmarkDeleteBusy.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleExtensionSelection(extensionId: string) {
|
||||||
|
if (extensionSelectedIds.value.includes(extensionId)) {
|
||||||
|
extensionSelectedIds.value = extensionSelectedIds.value.filter((id) => id !== extensionId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
extensionSelectedIds.value = [...extensionSelectedIds.value, extensionId];
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleAllExtensions() {
|
||||||
|
const extensionIds = currentBrowser.value?.extensions.map((extension) => extension.id) ?? [];
|
||||||
|
const allSelected =
|
||||||
|
extensionIds.length > 0 &&
|
||||||
|
extensionIds.every((extensionId) => extensionSelectedIds.value.includes(extensionId));
|
||||||
|
extensionSelectedIds.value = allSelected ? [] : extensionIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleExtensionModalProfileSelection(profileId: string) {
|
||||||
|
if (extensionModalSelectedProfileIds.value.includes(profileId)) {
|
||||||
|
extensionModalSelectedProfileIds.value = extensionModalSelectedProfileIds.value.filter(
|
||||||
|
(id) => id !== profileId,
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
extensionModalSelectedProfileIds.value = [
|
||||||
|
...extensionModalSelectedProfileIds.value,
|
||||||
|
profileId,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleAllExtensionModalProfiles() {
|
||||||
|
if (!associatedProfilesModal.value?.isExtension) return;
|
||||||
|
const profileIds = associatedProfilesModal.value.profiles.map((profile) => profile.id);
|
||||||
|
const allSelected =
|
||||||
|
profileIds.length > 0 &&
|
||||||
|
profileIds.every((profileId) => extensionModalSelectedProfileIds.value.includes(profileId));
|
||||||
|
extensionModalSelectedProfileIds.value = allSelected ? [] : profileIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
function extensionRemovalConfirmExtensions() {
|
||||||
|
const browser = currentBrowser.value;
|
||||||
|
if (!browser) return [];
|
||||||
|
return browser.extensions.filter((extension) =>
|
||||||
|
extensionRemovalConfirmExtensionIds.value.includes(extension.id),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function extensionRemovalConfirmProfiles() {
|
||||||
|
const browser = currentBrowser.value;
|
||||||
|
if (!browser) return [];
|
||||||
|
return browser.profiles.filter((profile) =>
|
||||||
|
extensionRemovalConfirmProfileIds.value.includes(profile.id),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function requestExtensionRemoval(removals: ExtensionRemovalRequest[]) {
|
||||||
|
if (!removals.length) return;
|
||||||
|
|
||||||
|
extensionRemovalConfirmRemovals.value = removals;
|
||||||
|
extensionRemovalConfirmExtensionIds.value = [...new Set(removals.map((item) => item.extensionId))];
|
||||||
|
extensionRemovalConfirmProfileIds.value = [
|
||||||
|
...new Set(removals.flatMap((item) => item.profileIds)),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetExtensionRemovalConfirmState() {
|
||||||
|
extensionRemovalConfirmRemovals.value = [];
|
||||||
|
extensionRemovalConfirmExtensionIds.value = [];
|
||||||
|
extensionRemovalConfirmProfileIds.value = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteExtensionFromAllProfiles(extensionId: string) {
|
||||||
|
const extension = currentBrowser.value?.extensions.find((item) => item.id === extensionId);
|
||||||
|
if (!extension) return;
|
||||||
|
requestExtensionRemoval([
|
||||||
|
{
|
||||||
|
extensionId,
|
||||||
|
profileIds: [...extension.profileIds],
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteSelectedExtensions() {
|
||||||
|
const browser = currentBrowser.value;
|
||||||
|
if (!browser || !extensionSelectedIds.value.length) return;
|
||||||
|
|
||||||
|
const removals = browser.extensions
|
||||||
|
.filter((extension) => extensionSelectedIds.value.includes(extension.id))
|
||||||
|
.map((extension) => ({
|
||||||
|
extensionId: extension.id,
|
||||||
|
profileIds: [...extension.profileIds],
|
||||||
|
}));
|
||||||
|
requestExtensionRemoval(removals);
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteExtensionFromProfile(profileId: string) {
|
||||||
|
const modal = associatedProfilesModal.value;
|
||||||
|
if (!modal?.isExtension || !modal.extensionId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
requestExtensionRemoval([
|
||||||
|
{
|
||||||
|
extensionId: modal.extensionId,
|
||||||
|
profileIds: [profileId],
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteSelectedExtensionProfiles() {
|
||||||
|
const modal = associatedProfilesModal.value;
|
||||||
|
if (
|
||||||
|
!modal?.isExtension ||
|
||||||
|
!modal.extensionId ||
|
||||||
|
!extensionModalSelectedProfileIds.value.length
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
requestExtensionRemoval([
|
||||||
|
{
|
||||||
|
extensionId: modal.extensionId,
|
||||||
|
profileIds: [...extensionModalSelectedProfileIds.value],
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeExtensionRemovalConfirm() {
|
||||||
|
if (extensionDeleteBusy.value) return;
|
||||||
|
resetExtensionRemovalConfirmState();
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeExtensionRemovalResult() {
|
||||||
|
extensionRemovalResultOpen.value = false;
|
||||||
|
extensionRemovalResults.value = [];
|
||||||
|
extensionRemovalError.value = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function applyExtensionRemovalResults(results: RemoveExtensionsResponse["results"]) {
|
||||||
|
const browser = currentBrowser.value;
|
||||||
|
if (!browser) return;
|
||||||
|
|
||||||
|
for (const result of results) {
|
||||||
|
if (result.error) continue;
|
||||||
|
const extension = browser.extensions.find((item) => item.id === result.extensionId);
|
||||||
|
if (!extension) continue;
|
||||||
|
|
||||||
|
extension.profileIds = extension.profileIds.filter((id) => id !== result.profileId);
|
||||||
|
extension.profiles = extension.profiles.filter((profile) => profile.id !== result.profileId);
|
||||||
|
}
|
||||||
|
|
||||||
|
browser.extensions = browser.extensions.filter((extension) => extension.profileIds.length > 0);
|
||||||
|
browser.stats.extensionCount = browser.extensions.length;
|
||||||
|
|
||||||
|
extensionSelectedIds.value = extensionSelectedIds.value.filter((selectedId) =>
|
||||||
|
browser.extensions.some((extension) => extension.id === selectedId),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (associatedProfilesModal.value?.isExtension && "extensionId" in associatedProfilesModal.value) {
|
||||||
|
const currentExtension = browser.extensions.find(
|
||||||
|
(extension) => extension.id === associatedProfilesModal.value?.extensionId,
|
||||||
|
);
|
||||||
|
if (!currentExtension) {
|
||||||
|
associatedProfilesModal.value = null;
|
||||||
|
extensionModalSelectedProfileIds.value = [];
|
||||||
|
} else {
|
||||||
|
associatedProfilesModal.value = {
|
||||||
|
...associatedProfilesModal.value,
|
||||||
|
profiles: currentExtension.profiles,
|
||||||
|
};
|
||||||
|
extensionModalSelectedProfileIds.value = extensionModalSelectedProfileIds.value.filter((id) =>
|
||||||
|
currentExtension.profiles.some((profile) => profile.id === id),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function confirmExtensionRemoval() {
|
||||||
|
const browser = currentBrowser.value;
|
||||||
|
const removals = extensionRemovalConfirmRemovals.value.map((item) => ({
|
||||||
|
extensionId: item.extensionId,
|
||||||
|
profileIds: [...item.profileIds],
|
||||||
|
}));
|
||||||
|
if (!browser || !removals.length) return;
|
||||||
|
|
||||||
|
extensionDeleteBusy.value = true;
|
||||||
|
extensionRemovalError.value = "";
|
||||||
|
extensionRemovalResults.value = [];
|
||||||
|
extensionRemovalResultOpen.value = false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const input: RemoveExtensionsInput = {
|
||||||
|
browserId: browser.browserId,
|
||||||
|
removals,
|
||||||
|
};
|
||||||
|
const result = await invoke<RemoveExtensionsResponse>("remove_extensions", { input });
|
||||||
|
applyExtensionRemovalResults(result.results);
|
||||||
|
extensionRemovalResults.value = result.results;
|
||||||
|
resetExtensionRemovalConfirmState();
|
||||||
|
extensionRemovalResultOpen.value = true;
|
||||||
|
} catch (removeError) {
|
||||||
|
resetExtensionRemovalConfirmState();
|
||||||
|
extensionRemovalError.value =
|
||||||
|
removeError instanceof Error ? removeError.message : "删除插件失败。";
|
||||||
|
extensionRemovalResultOpen.value = true;
|
||||||
|
} finally {
|
||||||
|
extensionDeleteBusy.value = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@@ -311,6 +993,14 @@ export function useBrowserManager() {
|
|||||||
activeSection,
|
activeSection,
|
||||||
associatedProfilesModal,
|
associatedProfilesModal,
|
||||||
bookmarkSortKey,
|
bookmarkSortKey,
|
||||||
|
bookmarkDeleteBusy,
|
||||||
|
bookmarkModalSelectedProfileIds,
|
||||||
|
bookmarkRemovalConfirmBookmarkCount: computed(bookmarkRemovalConfirmBookmarkCount),
|
||||||
|
bookmarkRemovalConfirmProfileCount: computed(bookmarkRemovalConfirmProfileCount),
|
||||||
|
bookmarkRemovalError,
|
||||||
|
bookmarkRemovalResultOpen,
|
||||||
|
bookmarkRemovalResults,
|
||||||
|
bookmarkSelectedUrls,
|
||||||
browserConfigs,
|
browserConfigs,
|
||||||
browserMonogram,
|
browserMonogram,
|
||||||
browsers,
|
browsers,
|
||||||
@@ -321,10 +1011,35 @@ export function useBrowserManager() {
|
|||||||
createCustomBrowserConfig,
|
createCustomBrowserConfig,
|
||||||
currentBrowser,
|
currentBrowser,
|
||||||
deleteCustomBrowserConfig,
|
deleteCustomBrowserConfig,
|
||||||
domainFromUrl,
|
deleteBookmarkFromAllProfiles,
|
||||||
|
deleteBookmarkFromProfile,
|
||||||
|
deleteSelectedBookmarkProfiles,
|
||||||
|
deleteSelectedBookmarks,
|
||||||
|
deleteExtensionFromAllProfiles,
|
||||||
|
deleteExtensionFromProfile,
|
||||||
|
deleteSelectedExtensionProfiles,
|
||||||
|
deleteSelectedExtensions,
|
||||||
error,
|
error,
|
||||||
extensionMonogram,
|
extensionMonogram,
|
||||||
|
extensionDeleteBusy,
|
||||||
|
extensionModalSelectedProfileIds,
|
||||||
|
extensionRemovalConfirmExtensions: computed(extensionRemovalConfirmExtensions),
|
||||||
|
extensionRemovalConfirmProfiles: computed(extensionRemovalConfirmProfiles),
|
||||||
|
extensionRemovalError,
|
||||||
|
extensionRemovalResultOpen,
|
||||||
|
extensionRemovalResults,
|
||||||
|
extensionSelectedIds,
|
||||||
extensionSortKey,
|
extensionSortKey,
|
||||||
|
cleanupHistoryError,
|
||||||
|
cleanupHistoryResults,
|
||||||
|
cleanupHistorySelectedProfiles,
|
||||||
|
cleanupSelectedHistoryProfiles,
|
||||||
|
closeHistoryCleanupConfirm,
|
||||||
|
closeHistoryCleanupResult,
|
||||||
|
confirmHistoryCleanup,
|
||||||
|
historyCleanupBusy,
|
||||||
|
historyCleanupConfirmProfiles: computed(historyCleanupConfirmProfiles),
|
||||||
|
historyCleanupResultOpen,
|
||||||
isDeletingConfig,
|
isDeletingConfig,
|
||||||
isOpeningProfile,
|
isOpeningProfile,
|
||||||
loading,
|
loading,
|
||||||
@@ -333,16 +1048,40 @@ export function useBrowserManager() {
|
|||||||
page,
|
page,
|
||||||
pickExecutablePath,
|
pickExecutablePath,
|
||||||
pickUserDataPath,
|
pickUserDataPath,
|
||||||
|
passwordSiteSortKey,
|
||||||
|
passwordSitesError,
|
||||||
|
passwordSitesLoading,
|
||||||
profileSortKey,
|
profileSortKey,
|
||||||
refreshAll,
|
refreshAll,
|
||||||
savingConfig,
|
savingConfig,
|
||||||
sectionCount,
|
sectionCount,
|
||||||
selectedBrowserId,
|
selectedBrowserId,
|
||||||
|
hasLoadedPasswordSites,
|
||||||
showBookmarkProfilesModal,
|
showBookmarkProfilesModal,
|
||||||
showExtensionProfilesModal,
|
showExtensionProfilesModal,
|
||||||
|
loadPasswordSites,
|
||||||
|
showPasswordSiteProfilesModal,
|
||||||
sortedBookmarks,
|
sortedBookmarks,
|
||||||
sortedExtensions,
|
sortedExtensions,
|
||||||
|
sortedPasswordSites,
|
||||||
sortedProfiles,
|
sortedProfiles,
|
||||||
|
closeExtensionRemovalConfirm,
|
||||||
|
closeExtensionRemovalResult,
|
||||||
|
closeBookmarkRemovalConfirm,
|
||||||
|
closeBookmarkRemovalResult,
|
||||||
|
confirmExtensionRemoval,
|
||||||
|
confirmBookmarkRemoval,
|
||||||
|
cleanupHistoryForProfile,
|
||||||
|
toggleAllBookmarks,
|
||||||
|
toggleAllExtensions,
|
||||||
|
toggleAllBookmarkModalProfiles,
|
||||||
|
toggleAllExtensionModalProfiles,
|
||||||
|
toggleBookmarkModalProfileSelection,
|
||||||
|
toggleBookmarkSelection,
|
||||||
|
toggleExtensionModalProfileSelection,
|
||||||
|
toggleExtensionSelection,
|
||||||
|
toggleAllHistoryProfiles,
|
||||||
|
toggleHistoryProfile,
|
||||||
closeAssociatedProfilesModal,
|
closeAssociatedProfilesModal,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,7 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar,
|
.sidebar {
|
||||||
.content-panel {
|
|
||||||
backdrop-filter: blur(20px);
|
backdrop-filter: blur(20px);
|
||||||
-webkit-backdrop-filter: blur(20px);
|
-webkit-backdrop-filter: blur(20px);
|
||||||
}
|
}
|
||||||
@@ -19,7 +18,7 @@
|
|||||||
gap: 10px;
|
gap: 10px;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
padding: 4px 0;
|
padding: 4px 0;
|
||||||
overflow: hidden;
|
overflow: visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content-section,
|
.content-section,
|
||||||
@@ -86,8 +85,8 @@
|
|||||||
|
|
||||||
.content-scroll-area {
|
.content-scroll-area {
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
overflow: auto;
|
overflow: visible;
|
||||||
padding-right: 2px;
|
padding-right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.count-pill,
|
.count-pill,
|
||||||
@@ -174,24 +173,167 @@
|
|||||||
padding: 28px;
|
padding: 28px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.scanning-panel {
|
||||||
|
justify-items: center;
|
||||||
|
text-align: center;
|
||||||
|
overflow: hidden;
|
||||||
|
background:
|
||||||
|
radial-gradient(circle at top, rgba(47, 111, 237, 0.16), transparent 38%),
|
||||||
|
linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(243, 247, 252, 0.9));
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-hero {
|
||||||
|
position: relative;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
width: 148px;
|
||||||
|
height: 148px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-core {
|
||||||
|
position: relative;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
width: 82px;
|
||||||
|
height: 82px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(229, 238, 255, 0.92));
|
||||||
|
box-shadow:
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.72),
|
||||||
|
0 16px 40px rgba(47, 111, 237, 0.14);
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-core-ring {
|
||||||
|
position: absolute;
|
||||||
|
inset: 12px;
|
||||||
|
border: 1px solid rgba(47, 111, 237, 0.18);
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-core-ring.secondary {
|
||||||
|
inset: 22px;
|
||||||
|
border-color: rgba(16, 24, 40, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-orbit {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 1px solid rgba(47, 111, 237, 0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.orbit-one {
|
||||||
|
animation: scan-spin 10s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.orbit-two {
|
||||||
|
inset: 18px;
|
||||||
|
border-color: rgba(37, 99, 235, 0.18);
|
||||||
|
animation: scan-spin-reverse 7.5s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-dot {
|
||||||
|
position: absolute;
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: linear-gradient(135deg, #2f6fed, #7db4ff);
|
||||||
|
box-shadow: 0 0 0 6px rgba(47, 111, 237, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dot-one {
|
||||||
|
top: -4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dot-two {
|
||||||
|
right: 6px;
|
||||||
|
bottom: 14px;
|
||||||
|
width: 8px;
|
||||||
|
height: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dot-three {
|
||||||
|
left: 10px;
|
||||||
|
bottom: 10px;
|
||||||
|
width: 7px;
|
||||||
|
height: 7px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.state-panel h2,
|
||||||
|
.empty-card h3 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 1.12rem;
|
||||||
|
line-height: 1.2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.state-panel p,
|
||||||
|
.empty-card p {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--muted);
|
||||||
|
line-height: 1.55;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-steps {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-steps span {
|
||||||
|
width: 36px;
|
||||||
|
height: 6px;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: linear-gradient(90deg, rgba(47, 111, 237, 0.16), rgba(47, 111, 237, 0.44));
|
||||||
|
animation: loading-pulse 1.6s ease-in-out infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-steps span:nth-child(2) {
|
||||||
|
animation-delay: 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-steps span:nth-child(3) {
|
||||||
|
animation-delay: 0.4s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-card {
|
||||||
|
min-height: 220px;
|
||||||
|
place-content: center;
|
||||||
|
justify-items: center;
|
||||||
|
padding: 28px;
|
||||||
|
border: 1px dashed rgba(148, 163, 184, 0.26);
|
||||||
|
border-radius: 22px;
|
||||||
|
background:
|
||||||
|
radial-gradient(circle at top, rgba(47, 111, 237, 0.08), transparent 42%),
|
||||||
|
linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(244, 247, 251, 0.78));
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-card p {
|
||||||
|
max-width: 460px;
|
||||||
|
font-size: 0.94rem;
|
||||||
|
}
|
||||||
|
|
||||||
.browser-nav,
|
.browser-nav,
|
||||||
.content-scroll-area {
|
.styled-scrollbar {
|
||||||
scrollbar-width: thin;
|
scrollbar-width: thin;
|
||||||
scrollbar-color: rgba(100, 116, 139, 0.42) transparent;
|
scrollbar-color: rgba(100, 116, 139, 0.42) transparent;
|
||||||
}
|
}
|
||||||
.content-scroll-area::-webkit-scrollbar {
|
.styled-scrollbar::-webkit-scrollbar {
|
||||||
width: 10px;
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
}
|
}
|
||||||
.content-scroll-area::-webkit-scrollbar-track {
|
.styled-scrollbar::-webkit-scrollbar-track {
|
||||||
background: transparent;
|
background: transparent;
|
||||||
}
|
}
|
||||||
.content-scroll-area::-webkit-scrollbar-thumb {
|
.styled-scrollbar::-webkit-scrollbar-thumb {
|
||||||
border: 3px solid transparent;
|
border: 3px solid transparent;
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
background: linear-gradient(180deg, rgba(148, 163, 184, 0.72), rgba(100, 116, 139, 0.58));
|
background: linear-gradient(180deg, rgba(148, 163, 184, 0.72), rgba(100, 116, 139, 0.58));
|
||||||
background-clip: padding-box;
|
background-clip: padding-box;
|
||||||
}
|
}
|
||||||
.content-scroll-area::-webkit-scrollbar-thumb:hover {
|
.styled-scrollbar::-webkit-scrollbar-thumb:hover {
|
||||||
background: linear-gradient(180deg, rgba(100, 116, 139, 0.82), rgba(71, 85, 105, 0.72));
|
background: linear-gradient(180deg, rgba(100, 116, 139, 0.82), rgba(71, 85, 105, 0.72));
|
||||||
background-clip: padding-box;
|
background-clip: padding-box;
|
||||||
}
|
}
|
||||||
@@ -200,22 +342,36 @@
|
|||||||
background: linear-gradient(180deg, rgba(254, 242, 242, 0.92), rgba(255, 255, 255, 0.86));
|
background: linear-gradient(180deg, rgba(254, 242, 242, 0.92), rgba(255, 255, 255, 0.86));
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 1180px) {
|
@keyframes scan-spin {
|
||||||
.app-shell {
|
from {
|
||||||
grid-template-columns: 1fr;
|
transform: rotate(0deg);
|
||||||
height: auto;
|
|
||||||
min-height: 100vh;
|
|
||||||
padding: 12px;
|
|
||||||
overflow: visible;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.content-panel {
|
to {
|
||||||
padding: 0;
|
transform: rotate(360deg);
|
||||||
overflow: visible;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes scan-spin-reverse {
|
||||||
|
from {
|
||||||
|
transform: rotate(0deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
.content-scroll-area {
|
to {
|
||||||
overflow: visible;
|
transform: rotate(-360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes loading-pulse {
|
||||||
|
0%,
|
||||||
|
100% {
|
||||||
|
transform: scaleX(0.82);
|
||||||
|
opacity: 0.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
50% {
|
||||||
|
transform: scaleX(1);
|
||||||
|
opacity: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,4 +379,14 @@
|
|||||||
.sort-bar {
|
.sort-bar {
|
||||||
justify-content: stretch;
|
justify-content: stretch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.scan-hero {
|
||||||
|
width: 132px;
|
||||||
|
height: 132px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-card {
|
||||||
|
min-height: 180px;
|
||||||
|
padding: 22px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ export type BrowserStats = {
|
|||||||
profileCount: number;
|
profileCount: number;
|
||||||
extensionCount: number;
|
extensionCount: number;
|
||||||
bookmarkCount: number;
|
bookmarkCount: number;
|
||||||
|
passwordSiteCount: number;
|
||||||
|
historyCleanupProfileCount: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ProfileSummary = {
|
export type ProfileSummary = {
|
||||||
@@ -14,6 +16,7 @@ export type ProfileSummary = {
|
|||||||
defaultAvatarStrokeColor: number | null;
|
defaultAvatarStrokeColor: number | null;
|
||||||
avatarLabel: string;
|
avatarLabel: string;
|
||||||
path: string;
|
path: string;
|
||||||
|
historyCleanup: HistoryCleanupSummary;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ExtensionSummary = {
|
export type ExtensionSummary = {
|
||||||
@@ -22,7 +25,7 @@ export type ExtensionSummary = {
|
|||||||
version: string | null;
|
version: string | null;
|
||||||
iconDataUrl: string | null;
|
iconDataUrl: string | null;
|
||||||
profileIds: string[];
|
profileIds: string[];
|
||||||
profiles: AssociatedProfileSummary[];
|
profiles: ExtensionAssociatedProfileSummary[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export type BookmarkSummary = {
|
export type BookmarkSummary = {
|
||||||
@@ -32,6 +35,84 @@ export type BookmarkSummary = {
|
|||||||
profiles: BookmarkAssociatedProfileSummary[];
|
profiles: BookmarkAssociatedProfileSummary[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type PasswordSiteSummary = {
|
||||||
|
url: string;
|
||||||
|
domain: string;
|
||||||
|
profileIds: string[];
|
||||||
|
profiles: AssociatedProfileSummary[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type HistoryCleanupSummary = {
|
||||||
|
history: CleanupFileStatus;
|
||||||
|
topSites: CleanupFileStatus;
|
||||||
|
visitedLinks: CleanupFileStatus;
|
||||||
|
shortcuts: CleanupFileStatus;
|
||||||
|
sessions: CleanupFileStatus;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type CleanupFileStatus = "found" | "missing";
|
||||||
|
|
||||||
|
export type CleanupHistoryInput = {
|
||||||
|
browserId: string;
|
||||||
|
profileIds: string[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type CleanupHistoryResult = {
|
||||||
|
profileId: string;
|
||||||
|
deletedFiles: string[];
|
||||||
|
skippedFiles: string[];
|
||||||
|
error: string | null;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type CleanupHistoryResponse = {
|
||||||
|
results: CleanupHistoryResult[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type RemoveExtensionsInput = {
|
||||||
|
browserId: string;
|
||||||
|
removals: ExtensionRemovalRequest[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type RemoveBookmarksInput = {
|
||||||
|
browserId: string;
|
||||||
|
removals: BookmarkRemovalRequest[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ExtensionRemovalRequest = {
|
||||||
|
extensionId: string;
|
||||||
|
profileIds: string[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type BookmarkRemovalRequest = {
|
||||||
|
url: string;
|
||||||
|
profileIds: string[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type RemoveExtensionsResponse = {
|
||||||
|
results: RemoveExtensionResult[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type RemoveBookmarksResponse = {
|
||||||
|
results: RemoveBookmarkResult[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type RemoveExtensionResult = {
|
||||||
|
extensionId: string;
|
||||||
|
profileId: string;
|
||||||
|
removedFiles: string[];
|
||||||
|
skippedFiles: string[];
|
||||||
|
error: string | null;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type RemoveBookmarkResult = {
|
||||||
|
url: string;
|
||||||
|
profileId: string;
|
||||||
|
removedCount: number;
|
||||||
|
removedFiles: string[];
|
||||||
|
skippedFiles: string[];
|
||||||
|
error: string | null;
|
||||||
|
};
|
||||||
|
|
||||||
export type AssociatedProfileSummary = {
|
export type AssociatedProfileSummary = {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
@@ -42,6 +123,19 @@ export type AssociatedProfileSummary = {
|
|||||||
avatarLabel: string;
|
avatarLabel: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type ExtensionInstallSource = "store" | "external";
|
||||||
|
|
||||||
|
export type ExtensionAssociatedProfileSummary = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
avatarDataUrl: string | null;
|
||||||
|
avatarIcon: string | null;
|
||||||
|
defaultAvatarFillColor: number | null;
|
||||||
|
defaultAvatarStrokeColor: number | null;
|
||||||
|
avatarLabel: string;
|
||||||
|
installSource: ExtensionInstallSource;
|
||||||
|
};
|
||||||
|
|
||||||
export type BookmarkAssociatedProfileSummary = {
|
export type BookmarkAssociatedProfileSummary = {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
@@ -56,8 +150,9 @@ export type BookmarkAssociatedProfileSummary = {
|
|||||||
export type ProfileSortKey = "name" | "email" | "id";
|
export type ProfileSortKey = "name" | "email" | "id";
|
||||||
export type ExtensionSortKey = "name" | "id";
|
export type ExtensionSortKey = "name" | "id";
|
||||||
export type BookmarkSortKey = "title" | "url";
|
export type BookmarkSortKey = "title" | "url";
|
||||||
|
export type PasswordSiteSortKey = "domain" | "url";
|
||||||
export type AssociatedProfileSortKey = "id" | "name";
|
export type AssociatedProfileSortKey = "id" | "name";
|
||||||
export type ActiveSection = "profiles" | "extensions" | "bookmarks";
|
export type ActiveSection = "profiles" | "extensions" | "bookmarks" | "passwords" | "history";
|
||||||
export type AppPage = "browserData" | "configuration";
|
export type AppPage = "browserData" | "configuration";
|
||||||
export type BrowserConfigSource = "default" | "custom";
|
export type BrowserConfigSource = "default" | "custom";
|
||||||
|
|
||||||
@@ -92,9 +187,15 @@ export type BrowserView = {
|
|||||||
profiles: ProfileSummary[];
|
profiles: ProfileSummary[];
|
||||||
extensions: ExtensionSummary[];
|
extensions: ExtensionSummary[];
|
||||||
bookmarks: BookmarkSummary[];
|
bookmarks: BookmarkSummary[];
|
||||||
|
passwordSites: PasswordSiteSummary[];
|
||||||
stats: BrowserStats;
|
stats: BrowserStats;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ScanResponse = {
|
export type ScanResponse = {
|
||||||
browsers: BrowserView[];
|
browsers: BrowserView[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type PasswordSitesResponse = {
|
||||||
|
browserId: string;
|
||||||
|
passwordSites: PasswordSiteSummary[];
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
import braveIcon from "../assets/brave.png";
|
import braveIcon from "../assets/brave.png";
|
||||||
|
import chromiumIcon from "../assets/chromium.png";
|
||||||
import chromeIcon from "../assets/google-chrome.png";
|
import chromeIcon from "../assets/google-chrome.png";
|
||||||
import edgeIcon from "../assets/microsoft-edge.png";
|
import edgeIcon from "../assets/microsoft-edge.png";
|
||||||
import settingsIcon from "../assets/settings.png";
|
import settingsIcon from "../assets/settings.png";
|
||||||
|
import vivaldiIcon from "../assets/vivaldi.png";
|
||||||
|
import yandexIcon from "../assets/yandex.png";
|
||||||
import type {
|
import type {
|
||||||
AssociatedProfileSummary,
|
AssociatedProfileSummary,
|
||||||
BookmarkAssociatedProfileSummary,
|
BookmarkAssociatedProfileSummary,
|
||||||
@@ -12,6 +15,9 @@ export const browserIconOptions = [
|
|||||||
{ key: "chrome", label: "Google Chrome", src: chromeIcon },
|
{ key: "chrome", label: "Google Chrome", src: chromeIcon },
|
||||||
{ key: "edge", label: "Microsoft Edge", src: edgeIcon },
|
{ key: "edge", label: "Microsoft Edge", src: edgeIcon },
|
||||||
{ key: "brave", label: "Brave", src: braveIcon },
|
{ key: "brave", label: "Brave", src: braveIcon },
|
||||||
|
{ key: "vivaldi", label: "Vivaldi", src: vivaldiIcon },
|
||||||
|
{ key: "yandex", label: "Yandex Browser", src: yandexIcon },
|
||||||
|
{ key: "chromium", label: "Chromium", src: chromiumIcon },
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export function browserIconSrc(iconKey: string | null | undefined) {
|
export function browserIconSrc(iconKey: string | null | undefined) {
|
||||||
@@ -83,15 +89,16 @@ export function profileAvatarSrc(
|
|||||||
return profile.avatarDataUrl;
|
return profile.avatarDataUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const avatarFamilyId = resolveAvatarFamilyId(browserFamilyId);
|
||||||
const avatarKey = normalizeAvatarIcon(profile.avatarIcon);
|
const avatarKey = normalizeAvatarIcon(profile.avatarIcon);
|
||||||
if (avatarKey) {
|
if (avatarKey) {
|
||||||
const familyMap = browserFamilyId ? avatarMap[browserFamilyId] : undefined;
|
const familyMap = avatarFamilyId ? avatarMap[avatarFamilyId] : undefined;
|
||||||
if (familyMap?.[avatarKey]) {
|
if (familyMap?.[avatarKey]) {
|
||||||
return familyMap[avatarKey];
|
return familyMap[avatarKey];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (browserFamilyId === "chrome") {
|
if (avatarFamilyId === "chrome") {
|
||||||
return createChromeGeneratedAvatar(
|
return createChromeGeneratedAvatar(
|
||||||
profile.defaultAvatarFillColor,
|
profile.defaultAvatarFillColor,
|
||||||
profile.defaultAvatarStrokeColor,
|
profile.defaultAvatarStrokeColor,
|
||||||
@@ -110,6 +117,14 @@ function normalizeAvatarIcon(value: string | null | undefined) {
|
|||||||
return lastSegment.replace(/\.png$/i, "");
|
return lastSegment.replace(/\.png$/i, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resolveAvatarFamilyId(browserFamilyId: string | null | undefined) {
|
||||||
|
if (browserFamilyId === "chromium") {
|
||||||
|
return "chrome";
|
||||||
|
}
|
||||||
|
|
||||||
|
return browserFamilyId ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
function createChromeGeneratedAvatar(
|
function createChromeGeneratedAvatar(
|
||||||
backgroundArgb: number | null | undefined,
|
backgroundArgb: number | null | undefined,
|
||||||
foregroundArgb: number | null | undefined,
|
foregroundArgb: number | null | undefined,
|
||||||
|
|||||||
@@ -3,9 +3,12 @@ import type {
|
|||||||
BookmarkSummary,
|
BookmarkSummary,
|
||||||
ExtensionSortKey,
|
ExtensionSortKey,
|
||||||
ExtensionSummary,
|
ExtensionSummary,
|
||||||
|
PasswordSiteSortKey,
|
||||||
|
PasswordSiteSummary,
|
||||||
AssociatedProfileSortKey,
|
AssociatedProfileSortKey,
|
||||||
AssociatedProfileSummary,
|
AssociatedProfileSummary,
|
||||||
BookmarkAssociatedProfileSummary,
|
BookmarkAssociatedProfileSummary,
|
||||||
|
ExtensionAssociatedProfileSummary,
|
||||||
ProfileSortKey,
|
ProfileSortKey,
|
||||||
ProfileSummary,
|
ProfileSummary,
|
||||||
} from "../types/browser";
|
} from "../types/browser";
|
||||||
@@ -76,8 +79,22 @@ export function sortBookmarks(items: BookmarkSummary[], sortKey: BookmarkSortKey
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function sortPasswordSites(items: PasswordSiteSummary[], sortKey: PasswordSiteSortKey) {
|
||||||
|
const passwordSites = [...items];
|
||||||
|
return passwordSites.sort((left, right) => {
|
||||||
|
if (sortKey === "url") {
|
||||||
|
return compareOptionalText(left.url, right.url) || compareText(left.domain, right.domain);
|
||||||
|
}
|
||||||
|
return compareOptionalText(left.domain, right.domain) || compareText(left.url, right.url);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export function sortAssociatedProfiles(
|
export function sortAssociatedProfiles(
|
||||||
items: (AssociatedProfileSummary | BookmarkAssociatedProfileSummary)[],
|
items: (
|
||||||
|
| AssociatedProfileSummary
|
||||||
|
| BookmarkAssociatedProfileSummary
|
||||||
|
| ExtensionAssociatedProfileSummary
|
||||||
|
)[],
|
||||||
sortKey: AssociatedProfileSortKey,
|
sortKey: AssociatedProfileSortKey,
|
||||||
) {
|
) {
|
||||||
const profiles = [...items];
|
const profiles = [...items];
|
||||||
|
|||||||
2
src/vite-env.d.ts
vendored
@@ -5,3 +5,5 @@ declare module "*.vue" {
|
|||||||
const component: DefineComponent<{}, {}, any>;
|
const component: DefineComponent<{}, {}, any>;
|
||||||
export default component;
|
export default component;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare const __APP_VERSION__: string;
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
import vue from "@vitejs/plugin-vue";
|
import vue from "@vitejs/plugin-vue";
|
||||||
|
import { readFileSync } from "node:fs";
|
||||||
|
|
||||||
// @ts-expect-error process is a nodejs global
|
// @ts-expect-error process is a nodejs global
|
||||||
const host = process.env.TAURI_DEV_HOST;
|
const host = process.env.TAURI_DEV_HOST;
|
||||||
|
const packageJson = JSON.parse(readFileSync(new URL("./package.json", import.meta.url), "utf-8"));
|
||||||
|
|
||||||
// https://vite.dev/config/
|
// https://vite.dev/config/
|
||||||
export default defineConfig(async () => ({
|
export default defineConfig(async () => ({
|
||||||
plugins: [vue()],
|
plugins: [vue()],
|
||||||
|
define: {
|
||||||
|
__APP_VERSION__: JSON.stringify(packageJson.version),
|
||||||
|
},
|
||||||
|
|
||||||
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
|
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
|
||||||
//
|
//
|
||||||
|
|||||||