Compare commits
43 Commits
33f43aac56
...
v0.1.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
e041523dbd | ||
|
|
aac78b4b9c | ||
|
|
3e7bf3a7ce | ||
|
|
c3501d00af | ||
|
|
076b3a273f | ||
|
|
6cf4e6b56f | ||
|
|
c61b516410 | ||
|
|
c2fec5a960 | ||
|
|
761e4f3186 | ||
|
|
65b9401726 |
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" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Tauri + Vue + Typescript App</title>
|
||||
<title>Chrom Tool</title>
|
||||
</head>
|
||||
|
||||
<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"
|
||||
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]]
|
||||
name = "aho-corasick"
|
||||
version = "1.1.4"
|
||||
@@ -449,6 +461,7 @@ name = "chrom-tool"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"rusqlite",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tauri",
|
||||
@@ -938,6 +951,18 @@ dependencies = [
|
||||
"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]]
|
||||
name = "fastrand"
|
||||
version = "2.4.1"
|
||||
@@ -1446,6 +1471,15 @@ version = "0.12.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.14.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.15.5"
|
||||
@@ -1461,6 +1495,15 @@ version = "0.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
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]]
|
||||
name = "heck"
|
||||
version = "0.4.1"
|
||||
@@ -1990,6 +2033,17 @@ dependencies = [
|
||||
"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]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.12.1"
|
||||
@@ -3033,6 +3087,20 @@ dependencies = [
|
||||
"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]]
|
||||
name = "rustc-hash"
|
||||
version = "2.1.2"
|
||||
@@ -4421,6 +4489,12 @@ dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "vcpkg"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
|
||||
|
||||
[[package]]
|
||||
name = "version-compare"
|
||||
version = "0.2.1"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
[package]
|
||||
name = "chrom-tool"
|
||||
version = "0.1.0"
|
||||
description = "A Tauri App"
|
||||
authors = ["you"]
|
||||
description = "A local data management tool for Chromium-based browsers."
|
||||
authors = ["julianf4r"]
|
||||
edition = "2021"
|
||||
|
||||
# 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"
|
||||
base64 = "0.22"
|
||||
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;
|
||||
|
||||
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![
|
||||
BrowserDefinition {
|
||||
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")
|
||||
.map(PathBuf::from)
|
||||
.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]),
|
||||
ProgramFilesX86(&'static [&'static str]),
|
||||
LocalAppData(&'static [&'static str]),
|
||||
#[cfg(target_os = "macos")]
|
||||
Absolute(&'static str),
|
||||
}
|
||||
|
||||
@@ -1,11 +1,22 @@
|
||||
use std::{path::PathBuf, process::Command};
|
||||
use std::{
|
||||
fs,
|
||||
path::{Path, PathBuf},
|
||||
process::Command,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
config_store,
|
||||
models::{BrowserConfigListResponse, CreateCustomBrowserConfigInput, ScanResponse},
|
||||
models::{
|
||||
BookmarkRemovalRequest, BrowserConfigListResponse, CleanupHistoryInput,
|
||||
CleanupHistoryResponse, CleanupHistoryResult, CreateCustomBrowserConfigInput,
|
||||
ExtensionInstallSourceSummary, RemoveBookmarkResult, RemoveBookmarksInput,
|
||||
RemoveBookmarksResponse, RemoveExtensionResult, RemoveExtensionsInput,
|
||||
RemoveExtensionsResponse, ScanResponse,
|
||||
},
|
||||
scanner,
|
||||
};
|
||||
use tauri::AppHandle;
|
||||
use serde_json::Value;
|
||||
|
||||
#[tauri::command]
|
||||
pub fn scan_browsers(app: AppHandle) -> Result<ScanResponse, String> {
|
||||
@@ -61,6 +72,89 @@ pub fn open_browser_profile(
|
||||
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(
|
||||
executable_path: PathBuf,
|
||||
user_data_dir: PathBuf,
|
||||
@@ -79,3 +173,454 @@ 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 ["History", "Top Sites", "Visited Links"] {
|
||||
let file_path = profile_path.join(file_name);
|
||||
if !file_path.exists() {
|
||||
skipped_files.push(file_name.to_string());
|
||||
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.to_string());
|
||||
remove_sidecar_files(&file_path);
|
||||
}
|
||||
|
||||
let sessions_directory = profile_path.join("Sessions");
|
||||
match cleanup_sessions_directory(&sessions_directory) {
|
||||
Ok(session_deleted) => {
|
||||
if session_deleted {
|
||||
deleted_files.push("Sessions".to_string());
|
||||
} else {
|
||||
skipped_files.push("Sessions".to_string());
|
||||
}
|
||||
}
|
||||
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("Secure Preferences");
|
||||
let preferences_path = profile_path.join("Preferences");
|
||||
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("Secure Preferences".to_string());
|
||||
source
|
||||
}
|
||||
Ok(None) => {
|
||||
skipped_files.push("Secure Preferences".to_string());
|
||||
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("Preferences".to_string()),
|
||||
Ok(false) => skipped_files.push("Preferences".to_string()),
|
||||
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("Extensions").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("Extensions".to_string());
|
||||
} else {
|
||||
skipped_files.push("Extensions".to_string());
|
||||
}
|
||||
}
|
||||
|
||||
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("Bookmarks.bak".to_string());
|
||||
} else {
|
||||
skipped_files.push("Bookmarks.bak".to_string());
|
||||
}
|
||||
|
||||
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("Bookmarks".to_string());
|
||||
} else {
|
||||
skipped_files.push("Bookmarks".to_string());
|
||||
}
|
||||
|
||||
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_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 ["Bookmarks.bak", "Bookmark.bak"] {
|
||||
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> {
|
||||
["Bookmarks", "Bookmark"]
|
||||
.into_iter()
|
||||
.map(|name| profile_path.join(name))
|
||||
.find(|path| path.is_file())
|
||||
}
|
||||
|
||||
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,
|
||||
CreateCustomBrowserConfigInput, CustomBrowserConfigRecord, StoredBrowserConfigs,
|
||||
},
|
||||
utils::local_app_data_dir,
|
||||
utils::platform_user_data_root_dir,
|
||||
};
|
||||
|
||||
const CONFIG_FILE_NAME: &str = "browser-configs.json";
|
||||
@@ -34,7 +34,7 @@ pub fn resolve_browser_configs(app: &AppHandle) -> Result<Vec<BrowserConfigEntry
|
||||
.map(|config| BrowserConfigEntry {
|
||||
id: config.id,
|
||||
source: BrowserConfigSource::Custom,
|
||||
browser_family_id: None,
|
||||
browser_family_id: config.browser_family_id.or(config.icon_key.clone()),
|
||||
icon_key: config.icon_key,
|
||||
name: config.name,
|
||||
executable_path: config.executable_path,
|
||||
@@ -61,6 +61,7 @@ pub fn create_custom_browser_config(
|
||||
});
|
||||
let executable_path = input.executable_path.trim();
|
||||
let user_data_path = input.user_data_path.trim();
|
||||
let browser_family_id = infer_browser_family_id(icon_key.as_deref());
|
||||
|
||||
if name.is_empty() {
|
||||
return Err("Name is required.".to_string());
|
||||
@@ -77,6 +78,7 @@ pub fn create_custom_browser_config(
|
||||
id: generate_custom_config_id(),
|
||||
name: name.to_string(),
|
||||
icon_key,
|
||||
browser_family_id,
|
||||
executable_path: executable_path.to_string(),
|
||||
user_data_path: user_data_path.to_string(),
|
||||
});
|
||||
@@ -111,8 +113,8 @@ pub fn find_browser_config(app: &AppHandle, config_id: &str) -> Result<BrowserCo
|
||||
}
|
||||
|
||||
fn default_browser_configs() -> Result<Vec<BrowserConfigEntry>, String> {
|
||||
let local_app_data = local_app_data_dir().ok_or_else(|| {
|
||||
"Unable to resolve the LOCALAPPDATA directory for the current user.".to_string()
|
||||
let user_data_root = platform_user_data_root_dir().ok_or_else(|| {
|
||||
"Unable to resolve the default browser data directory for the current user.".to_string()
|
||||
})?;
|
||||
|
||||
Ok(browser_definitions()
|
||||
@@ -121,7 +123,7 @@ fn default_browser_configs() -> Result<Vec<BrowserConfigEntry>, String> {
|
||||
let user_data_path = definition
|
||||
.local_app_data_segments
|
||||
.iter()
|
||||
.fold(local_app_data.clone(), |path, segment| path.join(segment));
|
||||
.fold(user_data_root.clone(), |path, segment| path.join(segment));
|
||||
|
||||
BrowserConfigEntry {
|
||||
id: definition.id.to_string(),
|
||||
@@ -197,3 +199,15 @@ fn generate_custom_config_id() -> String {
|
||||
.unwrap_or(0);
|
||||
format!("custom-{timestamp}")
|
||||
}
|
||||
|
||||
fn infer_browser_family_id(icon_key: Option<&str>) -> Option<String> {
|
||||
match icon_key {
|
||||
Some("chrome") => Some("chrome".to_string()),
|
||||
Some("edge") => Some("edge".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,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,10 @@ pub fn run() {
|
||||
commands::list_browser_configs,
|
||||
commands::create_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!())
|
||||
.expect("error while running tauri application");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use std::collections::BTreeSet;
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -19,6 +19,7 @@ pub struct BrowserView {
|
||||
pub profiles: Vec<ProfileSummary>,
|
||||
pub extensions: Vec<ExtensionSummary>,
|
||||
pub bookmarks: Vec<BookmarkSummary>,
|
||||
pub password_sites: Vec<PasswordSiteSummary>,
|
||||
pub stats: BrowserStats,
|
||||
}
|
||||
|
||||
@@ -28,6 +29,8 @@ pub struct BrowserStats {
|
||||
pub profile_count: usize,
|
||||
pub extension_count: usize,
|
||||
pub bookmark_count: usize,
|
||||
pub password_site_count: usize,
|
||||
pub history_cleanup_profile_count: usize,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
@@ -37,8 +40,12 @@ pub struct ProfileSummary {
|
||||
pub name: String,
|
||||
pub email: Option<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 path: String,
|
||||
pub history_cleanup: HistoryCleanupSummary,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
@@ -49,6 +56,7 @@ pub struct ExtensionSummary {
|
||||
pub version: Option<String>,
|
||||
pub icon_data_url: Option<String>,
|
||||
pub profile_ids: Vec<String>,
|
||||
pub profiles: Vec<ExtensionAssociatedProfileSummary>,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
@@ -57,6 +65,160 @@ pub struct BookmarkSummary {
|
||||
pub url: String,
|
||||
pub title: String,
|
||||
pub profile_ids: Vec<String>,
|
||||
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 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)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct AssociatedProfileSummary {
|
||||
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,
|
||||
}
|
||||
|
||||
#[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)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct BookmarkAssociatedProfileSummary {
|
||||
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 bookmark_path: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
@@ -107,6 +269,8 @@ pub struct CustomBrowserConfigRecord {
|
||||
pub name: String,
|
||||
#[serde(default)]
|
||||
pub icon_key: Option<String>,
|
||||
#[serde(default)]
|
||||
pub browser_family_id: Option<String>,
|
||||
pub executable_path: String,
|
||||
pub user_data_path: String,
|
||||
}
|
||||
@@ -124,10 +288,19 @@ pub struct TempExtension {
|
||||
pub version: Option<String>,
|
||||
pub icon_data_url: Option<String>,
|
||||
pub profile_ids: BTreeSet<String>,
|
||||
pub profiles: BTreeMap<String, ExtensionAssociatedProfileSummary>,
|
||||
}
|
||||
|
||||
pub struct TempBookmark {
|
||||
pub url: String,
|
||||
pub title: String,
|
||||
pub profile_ids: BTreeSet<String>,
|
||||
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,19 +1,24 @@
|
||||
use std::{
|
||||
collections::{BTreeMap, BTreeSet},
|
||||
fs,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use rusqlite::{Connection, OpenFlags};
|
||||
use serde_json::Value;
|
||||
use tauri::AppHandle;
|
||||
|
||||
use crate::{
|
||||
config_store,
|
||||
models::{
|
||||
BookmarkSummary, BrowserConfigEntry, BrowserStats, BrowserView, ExtensionSummary,
|
||||
ProfileSummary, ScanResponse, TempBookmark, TempExtension,
|
||||
AssociatedProfileSummary, BookmarkAssociatedProfileSummary, BookmarkSummary,
|
||||
BrowserConfigEntry, BrowserStats, BrowserView, CleanupFileStatus, ExtensionSummary,
|
||||
ExtensionAssociatedProfileSummary, ExtensionInstallSourceSummary, HistoryCleanupSummary,
|
||||
PasswordSiteSummary, ProfileSummary, ScanResponse, TempBookmark, TempExtension,
|
||||
TempPasswordSite,
|
||||
},
|
||||
utils::{
|
||||
copy_sqlite_database_to_temp, 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> {
|
||||
@@ -38,17 +43,12 @@ fn scan_browser(config: BrowserConfigEntry) -> Option<BrowserView> {
|
||||
.and_then(|value| value.get("info_cache"))
|
||||
.and_then(Value::as_object);
|
||||
|
||||
let mut profile_ids = BTreeSet::new();
|
||||
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 profile_ids = collect_profile_ids_from_local_state(profile_cache);
|
||||
|
||||
let mut profiles = Vec::new();
|
||||
let mut extensions = BTreeMap::<String, TempExtension>::new();
|
||||
let mut bookmarks = BTreeMap::<String, TempBookmark>::new();
|
||||
let mut password_sites = BTreeMap::<String, TempPasswordSite>::new();
|
||||
|
||||
for profile_id in profile_ids {
|
||||
let profile_path = root.join(&profile_id);
|
||||
@@ -57,14 +57,12 @@ fn scan_browser(config: BrowserConfigEntry) -> Option<BrowserView> {
|
||||
}
|
||||
|
||||
let profile_info = profile_cache.and_then(|cache| cache.get(&profile_id));
|
||||
profiles.push(build_profile_summary(
|
||||
&root,
|
||||
&profile_path,
|
||||
&profile_id,
|
||||
profile_info,
|
||||
));
|
||||
scan_extensions_for_profile(&profile_path, &profile_id, &mut extensions);
|
||||
scan_bookmarks_for_profile(&profile_path, &profile_id, &mut bookmarks);
|
||||
let profile_summary =
|
||||
build_profile_summary(&root, &profile_path, &profile_id, profile_info);
|
||||
scan_extensions_for_profile(&profile_path, &profile_summary, &mut extensions);
|
||||
scan_bookmarks_for_profile(&profile_path, &profile_summary, &mut bookmarks);
|
||||
scan_password_sites_for_profile(&profile_path, &profile_summary, &mut password_sites);
|
||||
profiles.push(profile_summary);
|
||||
}
|
||||
|
||||
let profiles = sort_profiles(profiles);
|
||||
@@ -76,6 +74,7 @@ fn scan_browser(config: BrowserConfigEntry) -> Option<BrowserView> {
|
||||
version: entry.version,
|
||||
icon_data_url: entry.icon_data_url,
|
||||
profile_ids: entry.profile_ids.into_iter().collect(),
|
||||
profiles: entry.profiles.into_values().collect(),
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
let bookmarks = bookmarks
|
||||
@@ -84,8 +83,28 @@ fn scan_browser(config: BrowserConfigEntry) -> Option<BrowserView> {
|
||||
url: entry.url,
|
||||
title: entry.title,
|
||||
profile_ids: entry.profile_ids.into_iter().collect(),
|
||||
profiles: entry.profiles.into_values().collect(),
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
let 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::<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.sessions == CleanupFileStatus::Found
|
||||
})
|
||||
.count();
|
||||
|
||||
Some(BrowserView {
|
||||
browser_id: config.id,
|
||||
@@ -97,30 +116,22 @@ fn scan_browser(config: BrowserConfigEntry) -> Option<BrowserView> {
|
||||
profile_count: profiles.len(),
|
||||
extension_count: extensions.len(),
|
||||
bookmark_count: bookmarks.len(),
|
||||
password_site_count: password_sites.len(),
|
||||
history_cleanup_profile_count,
|
||||
},
|
||||
profiles,
|
||||
extensions: sort_extensions(extensions),
|
||||
bookmarks: sort_bookmarks(bookmarks),
|
||||
password_sites: sort_password_sites(password_sites),
|
||||
})
|
||||
}
|
||||
|
||||
fn collect_profile_ids_from_fs(root: &Path, profile_ids: &mut BTreeSet<String>) {
|
||||
let Ok(entries) = fs::read_dir(root) else {
|
||||
return;
|
||||
};
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
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(
|
||||
@@ -150,6 +161,17 @@ fn build_profile_summary(
|
||||
.map(str::to_string);
|
||||
|
||||
let avatar_data_url = resolve_profile_avatar(root, profile_path, profile_info);
|
||||
let avatar_icon = profile_info
|
||||
.and_then(|value| value.get("avatar_icon"))
|
||||
.and_then(Value::as_str)
|
||||
.filter(|value| !value.is_empty())
|
||||
.map(str::to_string);
|
||||
let default_avatar_fill_color = profile_info
|
||||
.and_then(|value| value.get("default_avatar_fill_color"))
|
||||
.and_then(Value::as_i64);
|
||||
let default_avatar_stroke_color = profile_info
|
||||
.and_then(|value| value.get("default_avatar_stroke_color"))
|
||||
.and_then(Value::as_i64);
|
||||
let avatar_label = name
|
||||
.chars()
|
||||
.find(|character| !character.is_whitespace())
|
||||
@@ -161,8 +183,41 @@ fn build_profile_summary(
|
||||
name,
|
||||
email,
|
||||
avatar_data_url,
|
||||
avatar_icon,
|
||||
default_avatar_fill_color,
|
||||
default_avatar_stroke_color,
|
||||
avatar_label,
|
||||
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("History")),
|
||||
top_sites: cleanup_file_status(&profile_path.join("Top Sites")),
|
||||
visited_links: cleanup_file_status(&profile_path.join("Visited Links")),
|
||||
sessions: cleanup_sessions_status(&profile_path.join("Sessions")),
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,40 +243,51 @@ fn resolve_profile_avatar(
|
||||
|
||||
fn scan_extensions_for_profile(
|
||||
profile_path: &Path,
|
||||
profile_id: &str,
|
||||
profile: &ProfileSummary,
|
||||
extensions: &mut BTreeMap<String, TempExtension>,
|
||||
) {
|
||||
let extensions_root = profile_path.join("Extensions");
|
||||
let Ok(entries) = fs::read_dir(&extensions_root) else {
|
||||
let secure_preferences_path = profile_path.join("Secure Preferences");
|
||||
let Some(secure_preferences) = read_json_file(&secure_preferences_path) else {
|
||||
return;
|
||||
};
|
||||
|
||||
for entry in entries.flatten() {
|
||||
let Ok(file_type) = entry.file_type() else {
|
||||
let Some(extension_settings) = secure_preferences
|
||||
.get("extensions")
|
||||
.and_then(|value| value.get("settings"))
|
||||
.and_then(Value::as_object)
|
||||
else {
|
||||
return;
|
||||
};
|
||||
|
||||
for (extension_id, extension_value) in extension_settings {
|
||||
let Some((install_dir, install_source)) =
|
||||
resolve_extension_install_dir(profile_path, extension_id, extension_value)
|
||||
else {
|
||||
continue;
|
||||
};
|
||||
if !file_type.is_dir() {
|
||||
continue;
|
||||
|
||||
let external_manifest = match install_source {
|
||||
ExtensionInstallSource::ExternalAbsolute => {
|
||||
read_json_file(&install_dir.join("manifest.json"))
|
||||
}
|
||||
|
||||
let extension_id = entry.file_name().to_string_lossy().to_string();
|
||||
let Some(version_path) = pick_latest_subdirectory(&entry.path()) else {
|
||||
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;
|
||||
};
|
||||
|
||||
let manifest_path = version_path.join("manifest.json");
|
||||
let Some(manifest) = read_json_file(&manifest_path) else {
|
||||
continue;
|
||||
};
|
||||
|
||||
let name = resolve_extension_name(&manifest, &version_path)
|
||||
let name = resolve_extension_name(manifest, &install_dir)
|
||||
.filter(|value| !value.is_empty())
|
||||
.unwrap_or_else(|| extension_id.clone());
|
||||
let version = manifest
|
||||
.get("version")
|
||||
.and_then(Value::as_str)
|
||||
.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
|
||||
.entry(extension_id.clone())
|
||||
@@ -231,9 +297,10 @@ fn scan_extensions_for_profile(
|
||||
version: version.clone(),
|
||||
icon_data_url: icon_data_url.clone(),
|
||||
profile_ids: BTreeSet::new(),
|
||||
profiles: BTreeMap::new(),
|
||||
});
|
||||
|
||||
if entry.name == entry.id && name != extension_id {
|
||||
if entry.name == entry.id && name != *extension_id {
|
||||
entry.name = name.clone();
|
||||
}
|
||||
if entry.version.is_none() {
|
||||
@@ -242,7 +309,64 @@ fn scan_extensions_for_profile(
|
||||
if entry.icon_data_url.is_none() {
|
||||
entry.icon_data_url = icon_data_url.clone();
|
||||
}
|
||||
entry.profile_ids.insert(profile_id.to_string());
|
||||
entry.profile_ids.insert(profile.id.clone());
|
||||
entry
|
||||
.profiles
|
||||
.entry(profile.id.clone())
|
||||
.or_insert_with(|| ExtensionAssociatedProfileSummary {
|
||||
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(),
|
||||
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 (resolved, source) = if normalized_path.starts_with(extension_id) {
|
||||
(
|
||||
profile_path.join("Extensions").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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -319,9 +443,10 @@ fn resolve_extension_icon(manifest: &Value, version_path: &Path) -> Option<Strin
|
||||
}
|
||||
|
||||
candidates.sort_by(|left, right| right.0.cmp(&left.0));
|
||||
candidates
|
||||
.into_iter()
|
||||
.find_map(|(_, relative_path)| load_image_as_data_url(&version_path.join(relative_path)))
|
||||
candidates.into_iter().find_map(|(_, relative_path)| {
|
||||
let normalized_path = relative_path.trim_start_matches('/');
|
||||
load_image_as_data_url(&version_path.join(normalized_path))
|
||||
})
|
||||
}
|
||||
|
||||
fn icon_candidates_from_object(map: &serde_json::Map<String, Value>) -> Vec<(u32, String)> {
|
||||
@@ -337,7 +462,7 @@ fn icon_candidates_from_object(map: &serde_json::Map<String, Value>) -> Vec<(u32
|
||||
|
||||
fn scan_bookmarks_for_profile(
|
||||
profile_path: &Path,
|
||||
profile_id: &str,
|
||||
profile: &ProfileSummary,
|
||||
bookmarks: &mut BTreeMap<String, TempBookmark>,
|
||||
) {
|
||||
let bookmarks_path = profile_path.join("Bookmarks");
|
||||
@@ -350,14 +475,15 @@ fn scan_bookmarks_for_profile(
|
||||
};
|
||||
|
||||
for root in roots.values() {
|
||||
collect_bookmarks(root, profile_id, bookmarks);
|
||||
collect_bookmarks(root, profile, bookmarks, &[]);
|
||||
}
|
||||
}
|
||||
|
||||
fn collect_bookmarks(
|
||||
node: &Value,
|
||||
profile_id: &str,
|
||||
profile: &ProfileSummary,
|
||||
bookmarks: &mut BTreeMap<String, TempBookmark>,
|
||||
ancestors: &[String],
|
||||
) {
|
||||
match node.get("type").and_then(Value::as_str) {
|
||||
Some("url") => {
|
||||
@@ -381,17 +507,46 @@ fn collect_bookmarks(
|
||||
url: url.to_string(),
|
||||
title: title.clone(),
|
||||
profile_ids: BTreeSet::new(),
|
||||
profiles: BTreeMap::new(),
|
||||
});
|
||||
|
||||
if entry.title == entry.url && title != url {
|
||||
entry.title = title;
|
||||
}
|
||||
entry.profile_ids.insert(profile_id.to_string());
|
||||
entry.profile_ids.insert(profile.id.clone());
|
||||
let bookmark_path = if ancestors.is_empty() {
|
||||
"Root".to_string()
|
||||
} else {
|
||||
ancestors.join(" > ")
|
||||
};
|
||||
entry.profiles.entry(profile.id.clone()).or_insert_with(|| {
|
||||
BookmarkAssociatedProfileSummary {
|
||||
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(),
|
||||
bookmark_path,
|
||||
}
|
||||
});
|
||||
}
|
||||
Some("folder") => {
|
||||
if let Some(children) = node.get("children").and_then(Value::as_array) {
|
||||
let folder_name = node
|
||||
.get("name")
|
||||
.and_then(Value::as_str)
|
||||
.filter(|value| !value.is_empty());
|
||||
let next_ancestors = if let Some(name) = folder_name {
|
||||
let mut path = ancestors.to_vec();
|
||||
path.push(name.to_string());
|
||||
path
|
||||
} else {
|
||||
ancestors.to_vec()
|
||||
};
|
||||
for child in children {
|
||||
collect_bookmarks(child, profile_id, bookmarks);
|
||||
collect_bookmarks(child, profile, bookmarks, &next_ancestors);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -438,3 +593,103 @@ fn sort_bookmarks(mut bookmarks: Vec<BookmarkSummary>) -> Vec<BookmarkSummary> {
|
||||
});
|
||||
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("Login Data");
|
||||
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 Ok(mut statement) = connection
|
||||
.prepare("SELECT origin_url, signon_realm FROM logins WHERE blacklisted_by_user = 0")
|
||||
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
|
||||
}
|
||||
|
||||
@@ -1,12 +1,21 @@
|
||||
use std::{
|
||||
env, fs,
|
||||
path::{Path, PathBuf},
|
||||
process,
|
||||
time::{SystemTime, UNIX_EPOCH},
|
||||
};
|
||||
|
||||
use base64::{engine::general_purpose::STANDARD, Engine as _};
|
||||
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("USERPROFILE")
|
||||
.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> {
|
||||
let bytes = fs::read(path).ok()?;
|
||||
let extension = path
|
||||
@@ -69,3 +55,48 @@ pub fn first_non_empty<'a>(values: impl IntoIterator<Item = Option<&'a str>>) ->
|
||||
.flatten()
|
||||
.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 file_name = path.file_name()?.to_str()?;
|
||||
let unique_id = SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.ok()?
|
||||
.as_nanos();
|
||||
let directory =
|
||||
env::temp_dir().join(format!("chrom-tool-scan-{}-{}", process::id(), unique_id));
|
||||
|
||||
fs::create_dir_all(&directory).ok()?;
|
||||
|
||||
let main_target = directory.join(file_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!("{file_name}{suffix}"));
|
||||
let _ = fs::copy(source, target);
|
||||
}
|
||||
}
|
||||
|
||||
Some(TempSqliteCopy {
|
||||
path: main_target,
|
||||
directory,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"app": {
|
||||
"windows": [
|
||||
{
|
||||
"title": "Browser Assistant",
|
||||
"title": "浏览器助手",
|
||||
"width": 1400,
|
||||
"height": 900,
|
||||
"minWidth": 1100,
|
||||
|
||||
164
src/App.vue
@@ -4,10 +4,20 @@ import ConfigurationView from "./components/config/ConfigurationView.vue";
|
||||
import AppSidebar from "./components/sidebar/AppSidebar.vue";
|
||||
import { useBrowserManager } from "./composables/useBrowserManager";
|
||||
|
||||
const appVersion = __APP_VERSION__;
|
||||
|
||||
const {
|
||||
activeSection,
|
||||
bookmarkProfilesExpanded,
|
||||
associatedProfilesModal,
|
||||
bookmarkSortKey,
|
||||
bookmarkDeleteBusy,
|
||||
bookmarkModalSelectedProfileIds,
|
||||
bookmarkRemovalConfirmBookmarkCount,
|
||||
bookmarkRemovalConfirmProfileCount,
|
||||
bookmarkRemovalError,
|
||||
bookmarkRemovalResultOpen,
|
||||
bookmarkRemovalResults,
|
||||
bookmarkSelectedUrls,
|
||||
browserConfigs,
|
||||
browserMonogram,
|
||||
browsers,
|
||||
@@ -16,13 +26,38 @@ const {
|
||||
configsLoading,
|
||||
createConfigForm,
|
||||
createCustomBrowserConfig,
|
||||
deleteBookmarkFromAllProfiles,
|
||||
deleteBookmarkFromProfile,
|
||||
cleanupHistoryError,
|
||||
cleanupHistoryForProfile,
|
||||
cleanupHistoryResults,
|
||||
cleanupHistorySelectedProfiles,
|
||||
cleanupSelectedHistoryProfiles,
|
||||
closeHistoryCleanupConfirm,
|
||||
closeHistoryCleanupResult,
|
||||
confirmHistoryCleanup,
|
||||
currentBrowser,
|
||||
deleteCustomBrowserConfig,
|
||||
domainFromUrl,
|
||||
deleteSelectedBookmarkProfiles,
|
||||
deleteSelectedBookmarks,
|
||||
deleteExtensionFromAllProfiles,
|
||||
deleteExtensionFromProfile,
|
||||
deleteSelectedExtensionProfiles,
|
||||
deleteSelectedExtensions,
|
||||
error,
|
||||
extensionMonogram,
|
||||
extensionProfilesExpanded,
|
||||
extensionDeleteBusy,
|
||||
extensionModalSelectedProfileIds,
|
||||
extensionRemovalConfirmExtensions,
|
||||
extensionRemovalConfirmProfiles,
|
||||
extensionRemovalError,
|
||||
extensionRemovalResultOpen,
|
||||
extensionRemovalResults,
|
||||
extensionSelectedIds,
|
||||
extensionSortKey,
|
||||
historyCleanupBusy,
|
||||
historyCleanupConfirmProfiles,
|
||||
historyCleanupResultOpen,
|
||||
isDeletingConfig,
|
||||
isOpeningProfile,
|
||||
loading,
|
||||
@@ -31,16 +66,36 @@ const {
|
||||
page,
|
||||
pickExecutablePath,
|
||||
pickUserDataPath,
|
||||
passwordSiteSortKey,
|
||||
profileSortKey,
|
||||
refreshAll,
|
||||
savingConfig,
|
||||
sectionCount,
|
||||
selectedBrowserId,
|
||||
closeBookmarkRemovalConfirm,
|
||||
closeBookmarkRemovalResult,
|
||||
showBookmarkProfilesModal,
|
||||
showExtensionProfilesModal,
|
||||
showPasswordSiteProfilesModal,
|
||||
sortedBookmarks,
|
||||
sortedExtensions,
|
||||
sortedPasswordSites,
|
||||
sortedProfiles,
|
||||
toggleBookmarkProfiles,
|
||||
toggleExtensionProfiles,
|
||||
confirmBookmarkRemoval,
|
||||
closeExtensionRemovalConfirm,
|
||||
closeExtensionRemovalResult,
|
||||
confirmExtensionRemoval,
|
||||
toggleAllBookmarks,
|
||||
toggleAllBookmarkModalProfiles,
|
||||
toggleAllExtensions,
|
||||
toggleBookmarkModalProfileSelection,
|
||||
toggleBookmarkSelection,
|
||||
toggleAllExtensionModalProfiles,
|
||||
toggleExtensionModalProfileSelection,
|
||||
toggleExtensionSelection,
|
||||
toggleAllHistoryProfiles,
|
||||
toggleHistoryProfile,
|
||||
closeAssociatedProfilesModal,
|
||||
} = useBrowserManager();
|
||||
</script>
|
||||
|
||||
@@ -53,6 +108,7 @@ const {
|
||||
:loading="loading"
|
||||
:configs-loading="configsLoading"
|
||||
:browser-monogram="browserMonogram"
|
||||
:app-version="appVersion"
|
||||
@select-browser="selectedBrowserId = $event; page = 'browserData'"
|
||||
@select-configuration="page = 'configuration'"
|
||||
@refresh="refreshAll"
|
||||
@@ -80,17 +136,33 @@ const {
|
||||
</template>
|
||||
|
||||
<template v-else-if="loading">
|
||||
<section class="state-panel">
|
||||
<p class="eyebrow">Scanning</p>
|
||||
<h2>Reading local browser data</h2>
|
||||
<p>Profiles, installed extensions, and bookmarks are being collected.</p>
|
||||
<section class="state-panel scanning-panel">
|
||||
<div class="scan-hero" aria-hidden="true">
|
||||
<div class="scan-orbit orbit-one"></div>
|
||||
<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>
|
||||
</template>
|
||||
|
||||
<template v-else-if="error">
|
||||
<section class="state-panel error">
|
||||
<p class="eyebrow">Error</p>
|
||||
<h2>Scan failed</h2>
|
||||
<p class="eyebrow">错误</p>
|
||||
<h2>扫描失败</h2>
|
||||
<p>{{ error }}</p>
|
||||
</section>
|
||||
</template>
|
||||
@@ -102,30 +174,84 @@ const {
|
||||
:profile-sort-key="profileSortKey"
|
||||
:extension-sort-key="extensionSortKey"
|
||||
:bookmark-sort-key="bookmarkSortKey"
|
||||
:password-site-sort-key="passwordSiteSortKey"
|
||||
:sorted-profiles="sortedProfiles"
|
||||
:sorted-extensions="sortedExtensions"
|
||||
: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"
|
||||
:section-count="sectionCount"
|
||||
:is-opening-profile="isOpeningProfile"
|
||||
:extension-monogram="extensionMonogram"
|
||||
:extension-profiles-expanded="extensionProfilesExpanded"
|
||||
:bookmark-profiles-expanded="bookmarkProfilesExpanded"
|
||||
:domain-from-url="domainFromUrl"
|
||||
:associated-profiles-modal="associatedProfilesModal"
|
||||
@update:active-section="activeSection = $event"
|
||||
@update:profile-sort-key="profileSortKey = $event"
|
||||
@update:extension-sort-key="extensionSortKey = $event"
|
||||
@update:bookmark-sort-key="bookmarkSortKey = $event"
|
||||
@update:password-site-sort-key="passwordSiteSortKey = $event"
|
||||
@open-profile="(browserId, profileId) => openBrowserProfile(browserId, profileId)"
|
||||
@toggle-extension-profiles="toggleExtensionProfiles"
|
||||
@toggle-bookmark-profiles="toggleBookmarkProfiles"
|
||||
@show-extension-profiles="showExtensionProfilesModal"
|
||||
@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"
|
||||
/>
|
||||
|
||||
<template v-else>
|
||||
<section class="state-panel">
|
||||
<p class="eyebrow">No Data</p>
|
||||
<h2>No supported browser was detected</h2>
|
||||
<p>Install or sign in to Chrome, Edge, or Brave and refresh the scan.</p>
|
||||
<p class="eyebrow">无数据</p>
|
||||
<h2>没有检测到受支持的浏览器</h2>
|
||||
<p>请安装或登录 Chrome、Edge、Brave 等浏览器后再刷新扫描。</p>
|
||||
</section>
|
||||
</template>
|
||||
</main>
|
||||
|
||||
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_26.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_56.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_57.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_58.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_59.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_60.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_61.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_62.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_63.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_64.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_65.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_66.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_67.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_68.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_69.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_70.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_71.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_72.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_73.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_74.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_75.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_76.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_77.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_78.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_79.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_80.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_81.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_82.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_83.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_84.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_85.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_86.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
src/assets/avatars/brave/IDR_PROFILE_AVATAR_87.png
Normal file
|
After Width: | Height: | Size: 13 KiB |