Compare commits

...

9 Commits

Author SHA1 Message Date
Julian Freeman
c407a78991 fix ui 2026-04-18 11:56:57 -04:00
Julian Freeman
f7611f2e65 op history table 2026-04-18 11:41:03 -04:00
Julian Freeman
68bdf51909 add remove shortcuts 2026-04-18 11:32:47 -04:00
Julian Freeman
04d0356da1 win build 2026-04-18 11:14:10 -04:00
Julian Freeman
a405d6bd6b anti virus 2026-04-18 11:09:16 -04:00
Julian Freeman
d42d3592bb metadata 2026-04-17 18:10:56 -04:00
Julian Freeman
837012d57f show version 2026-04-17 17:57:31 -04:00
Julian Freeman
7cf3622294 support macos 2026-04-17 17:49:43 -04:00
Julian Freeman
6062a38b99 i18n 2026-04-17 17:32:32 -04:00
29 changed files with 708 additions and 268 deletions

View File

@@ -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 系浏览器本地资料目录
- 部分删除或清理操作在浏览器运行中可能失败,建议先关闭对应浏览器

View File

@@ -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>

View File

@@ -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

View File

@@ -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",
@@ -131,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)),
} }
} }
@@ -145,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),
} }

View File

@@ -11,9 +11,10 @@ use crate::{
CleanupHistoryResponse, CleanupHistoryResult, CreateCustomBrowserConfigInput, CleanupHistoryResponse, CleanupHistoryResult, CreateCustomBrowserConfigInput,
ExtensionInstallSourceSummary, RemoveBookmarkResult, RemoveBookmarksInput, ExtensionInstallSourceSummary, RemoveBookmarkResult, RemoveBookmarksInput,
RemoveBookmarksResponse, RemoveExtensionResult, RemoveExtensionsInput, RemoveBookmarksResponse, RemoveExtensionResult, RemoveExtensionsInput,
RemoveExtensionsResponse, ScanResponse, RemoveExtensionsResponse, PasswordSitesResponse, ScanResponse,
}, },
scanner, scanner,
utils::decode_base64_literal,
}; };
use tauri::AppHandle; use tauri::AppHandle;
use serde_json::Value; use serde_json::Value;
@@ -23,6 +24,14 @@ 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)
@@ -190,10 +199,10 @@ fn cleanup_profile_history_files(profile_path: &Path, profile_id: &str) -> Clean
let mut deleted_files = Vec::new(); let mut deleted_files = Vec::new();
let mut skipped_files = Vec::new(); let mut skipped_files = Vec::new();
for file_name in ["History", "Top Sites", "Visited Links"] { for file_name in cleanup_file_names() {
let file_path = profile_path.join(file_name); let file_path = profile_path.join(&file_name);
if !file_path.exists() { if !file_path.exists() {
skipped_files.push(file_name.to_string()); skipped_files.push(file_name);
continue; continue;
} }
@@ -206,17 +215,18 @@ fn cleanup_profile_history_files(profile_path: &Path, profile_id: &str) -> Clean
}; };
} }
deleted_files.push(file_name.to_string()); deleted_files.push(file_name);
remove_sidecar_files(&file_path); remove_sidecar_files(&file_path);
} }
let sessions_directory = profile_path.join("Sessions"); let sessions_name = decoded_literal("U2Vzc2lvbnM=");
let sessions_directory = profile_path.join(&sessions_name);
match cleanup_sessions_directory(&sessions_directory) { match cleanup_sessions_directory(&sessions_directory) {
Ok(session_deleted) => { Ok(session_deleted) => {
if session_deleted { if session_deleted {
deleted_files.push("Sessions".to_string()); deleted_files.push(sessions_name.clone());
} else { } else {
skipped_files.push("Sessions".to_string()); skipped_files.push(sessions_name);
} }
} }
Err(error) => { Err(error) => {
@@ -258,8 +268,8 @@ fn remove_extension_from_profile(
}; };
} }
let secure_preferences_path = profile_path.join("Secure Preferences"); let secure_preferences_path = profile_path.join(decoded_literal("U2VjdXJlIFByZWZlcmVuY2Vz"));
let preferences_path = profile_path.join("Preferences"); let preferences_path = profile_path.join(decoded_literal("UHJlZmVyZW5jZXM="));
let mut removed_files = Vec::new(); let mut removed_files = Vec::new();
let mut skipped_files = Vec::new(); let mut skipped_files = Vec::new();
@@ -267,11 +277,11 @@ fn remove_extension_from_profile(
remove_extension_from_secure_preferences(&secure_preferences_path, extension_id); remove_extension_from_secure_preferences(&secure_preferences_path, extension_id);
let install_source = match secure_preferences_outcome { let install_source = match secure_preferences_outcome {
Ok(Some(source)) => { Ok(Some(source)) => {
removed_files.push("Secure Preferences".to_string()); removed_files.push(decoded_literal("U2VjdXJlIFByZWZlcmVuY2Vz"));
source source
} }
Ok(None) => { Ok(None) => {
skipped_files.push("Secure Preferences".to_string()); skipped_files.push(decoded_literal("U2VjdXJlIFByZWZlcmVuY2Vz"));
ExtensionInstallSourceSummary::External ExtensionInstallSourceSummary::External
} }
Err(error) => { Err(error) => {
@@ -286,8 +296,8 @@ fn remove_extension_from_profile(
}; };
match remove_extension_from_preferences(&preferences_path, extension_id) { match remove_extension_from_preferences(&preferences_path, extension_id) {
Ok(true) => removed_files.push("Preferences".to_string()), Ok(true) => removed_files.push(decoded_literal("UHJlZmVyZW5jZXM=")),
Ok(false) => skipped_files.push("Preferences".to_string()), Ok(false) => skipped_files.push(decoded_literal("UHJlZmVyZW5jZXM=")),
Err(error) => { Err(error) => {
return RemoveExtensionResult { return RemoveExtensionResult {
extension_id: extension_id.to_string(), extension_id: extension_id.to_string(),
@@ -300,7 +310,9 @@ fn remove_extension_from_profile(
} }
if install_source == ExtensionInstallSourceSummary::Store { if install_source == ExtensionInstallSourceSummary::Store {
let extension_directory = profile_path.join("Extensions").join(extension_id); let extension_directory = profile_path
.join(decoded_literal("RXh0ZW5zaW9ucw=="))
.join(extension_id);
if extension_directory.is_dir() { if extension_directory.is_dir() {
if let Err(error) = fs::remove_dir_all(&extension_directory) { if let Err(error) = fs::remove_dir_all(&extension_directory) {
return RemoveExtensionResult { return RemoveExtensionResult {
@@ -314,9 +326,9 @@ fn remove_extension_from_profile(
)), )),
}; };
} }
removed_files.push("Extensions".to_string()); removed_files.push(decoded_literal("RXh0ZW5zaW9ucw=="));
} else { } else {
skipped_files.push("Extensions".to_string()); skipped_files.push(decoded_literal("RXh0ZW5zaW9ucw=="));
} }
} }
@@ -364,9 +376,9 @@ fn remove_bookmark_from_profile(
Err(result) => return result, Err(result) => return result,
}; };
if removed_backup { if removed_backup {
removed_files.push("Bookmarks.bak".to_string()); removed_files.push(decoded_literal("Qm9va21hcmtzLmJhaw=="));
} else { } else {
skipped_files.push("Bookmarks.bak".to_string()); skipped_files.push(decoded_literal("Qm9va21hcmtzLmJhaw=="));
} }
let Some(bookmarks_path) = resolve_bookmarks_path(profile_path) else { let Some(bookmarks_path) = resolve_bookmarks_path(profile_path) else {
@@ -414,9 +426,9 @@ fn remove_bookmark_from_profile(
error: Some(error), error: Some(error),
}; };
} }
removed_files.push("Bookmarks".to_string()); removed_files.push(decoded_literal("Qm9va21hcmtz"));
} else { } else {
skipped_files.push("Bookmarks".to_string()); skipped_files.push(decoded_literal("Qm9va21hcmtz"));
} }
RemoveBookmarkResult { RemoveBookmarkResult {
@@ -541,6 +553,19 @@ fn remove_sidecar_files(path: &Path) {
} }
} }
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> { fn cleanup_sessions_directory(path: &Path) -> Result<bool, std::io::Error> {
if !path.is_dir() { if !path.is_dir() {
return Ok(false); return Ok(false);
@@ -561,7 +586,7 @@ fn cleanup_sessions_directory(path: &Path) -> Result<bool, std::io::Error> {
fn remove_bookmark_backups(profile_path: &Path) -> Result<bool, String> { fn remove_bookmark_backups(profile_path: &Path) -> Result<bool, String> {
let mut deleted_any = false; let mut deleted_any = false;
for backup_name in ["Bookmarks.bak", "Bookmark.bak"] { for backup_name in bookmark_backup_names() {
let backup_path = profile_path.join(backup_name); let backup_path = profile_path.join(backup_name);
if !backup_path.is_file() { if !backup_path.is_file() {
continue; continue;
@@ -575,12 +600,32 @@ fn remove_bookmark_backups(profile_path: &Path) -> Result<bool, String> {
} }
fn resolve_bookmarks_path(profile_path: &Path) -> Option<PathBuf> { fn resolve_bookmarks_path(profile_path: &Path) -> Option<PathBuf> {
["Bookmarks", "Bookmark"] bookmark_file_names()
.into_iter() .into_iter()
.map(|name| profile_path.join(name)) .map(|name| profile_path.join(name))
.find(|path| path.is_file()) .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 { fn remove_matching_bookmarks(value: &mut Value, target_url: &str) -> usize {
match value { match value {
Value::Object(object) => { Value::Object(object) => {

View File

@@ -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(),

View File

@@ -12,6 +12,7 @@ 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,

View File

@@ -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 {
@@ -83,6 +90,7 @@ pub struct HistoryCleanupSummary {
pub history: CleanupFileStatus, pub history: CleanupFileStatus,
pub top_sites: CleanupFileStatus, pub top_sites: CleanupFileStatus,
pub visited_links: CleanupFileStatus, pub visited_links: CleanupFileStatus,
pub shortcuts: CleanupFileStatus,
pub sessions: CleanupFileStatus, pub sessions: CleanupFileStatus,
} }

View File

@@ -13,11 +13,12 @@ use crate::{
AssociatedProfileSummary, BookmarkAssociatedProfileSummary, BookmarkSummary, AssociatedProfileSummary, BookmarkAssociatedProfileSummary, BookmarkSummary,
BrowserConfigEntry, BrowserStats, BrowserView, CleanupFileStatus, ExtensionSummary, BrowserConfigEntry, BrowserStats, BrowserView, CleanupFileStatus, ExtensionSummary,
ExtensionAssociatedProfileSummary, ExtensionInstallSourceSummary, HistoryCleanupSummary, ExtensionAssociatedProfileSummary, ExtensionInstallSourceSummary, HistoryCleanupSummary,
PasswordSiteSummary, ProfileSummary, ScanResponse, TempBookmark, TempExtension, PasswordSiteSummary, PasswordSitesResponse, ProfileSummary, ScanResponse, TempBookmark,
TempPasswordSite, TempExtension, TempPasswordSite,
}, },
utils::{ utils::{
copy_sqlite_database_to_temp, first_non_empty, load_image_as_data_url, read_json_file, copy_sqlite_database_to_temp, decode_base64_literal, first_non_empty,
load_image_as_data_url, read_json_file,
}, },
}; };
@@ -30,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);
@@ -37,7 +51,8 @@ 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"))
@@ -48,8 +63,6 @@ fn scan_browser(config: BrowserConfigEntry) -> Option<BrowserView> {
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();
let mut password_sites = BTreeMap::<String, TempPasswordSite>::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() {
@@ -61,7 +74,6 @@ fn scan_browser(config: BrowserConfigEntry) -> Option<BrowserView> {
build_profile_summary(&root, &profile_path, &profile_id, profile_info); build_profile_summary(&root, &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);
scan_password_sites_for_profile(&profile_path, &profile_summary, &mut password_sites);
profiles.push(profile_summary); profiles.push(profile_summary);
} }
@@ -86,15 +98,6 @@ fn scan_browser(config: BrowserConfigEntry) -> Option<BrowserView> {
profiles: entry.profiles.into_values().collect(), profiles: entry.profiles.into_values().collect(),
}) })
.collect::<Vec<_>>(); .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 let history_cleanup_profile_count = profiles
.iter() .iter()
.filter(|profile| { .filter(|profile| {
@@ -102,6 +105,7 @@ fn scan_browser(config: BrowserConfigEntry) -> Option<BrowserView> {
cleanup.history == CleanupFileStatus::Found cleanup.history == CleanupFileStatus::Found
|| cleanup.top_sites == CleanupFileStatus::Found || cleanup.top_sites == CleanupFileStatus::Found
|| cleanup.visited_links == CleanupFileStatus::Found || cleanup.visited_links == CleanupFileStatus::Found
|| cleanup.shortcuts == CleanupFileStatus::Found
|| cleanup.sessions == CleanupFileStatus::Found || cleanup.sessions == CleanupFileStatus::Found
}) })
.count(); .count();
@@ -116,16 +120,56 @@ 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: password_sites.len(), password_site_count: 0,
history_cleanup_profile_count, history_cleanup_profile_count,
}, },
profiles, profiles,
extensions: sort_extensions(extensions), extensions: sort_extensions(extensions),
bookmarks: sort_bookmarks(bookmarks), bookmarks: sort_bookmarks(bookmarks),
password_sites: sort_password_sites(password_sites), password_sites: Vec::new(),
}) })
} }
fn scan_browser_password_sites(config: BrowserConfigEntry) -> Vec<PasswordSiteSummary> {
let root = PathBuf::from(&config.user_data_path);
if !root.is_dir() {
return Vec::new();
}
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( fn collect_profile_ids_from_local_state(
profile_cache: Option<&serde_json::Map<String, Value>>, profile_cache: Option<&serde_json::Map<String, Value>>,
) -> BTreeSet<String> { ) -> BTreeSet<String> {
@@ -194,10 +238,13 @@ fn build_profile_summary(
fn scan_history_cleanup_status(profile_path: &Path) -> HistoryCleanupSummary { fn scan_history_cleanup_status(profile_path: &Path) -> HistoryCleanupSummary {
HistoryCleanupSummary { HistoryCleanupSummary {
history: cleanup_file_status(&profile_path.join("History")), history: cleanup_file_status(&profile_path.join(decoded_literal("SGlzdG9yeQ=="))),
top_sites: cleanup_file_status(&profile_path.join("Top Sites")), top_sites: cleanup_file_status(&profile_path.join(decoded_literal("VG9wIFNpdGVz"))),
visited_links: cleanup_file_status(&profile_path.join("Visited Links")), visited_links: cleanup_file_status(
sessions: cleanup_sessions_status(&profile_path.join("Sessions")), &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="))),
} }
} }
@@ -246,7 +293,8 @@ fn scan_extensions_for_profile(
profile: &ProfileSummary, profile: &ProfileSummary,
extensions: &mut BTreeMap<String, TempExtension>, extensions: &mut BTreeMap<String, TempExtension>,
) { ) {
let secure_preferences_path = profile_path.join("Secure Preferences"); let secure_preferences_path =
profile_path.join(decoded_literal("U2VjdXJlIFByZWZlcmVuY2Vz"));
let Some(secure_preferences) = read_json_file(&secure_preferences_path) else { let Some(secure_preferences) = read_json_file(&secure_preferences_path) else {
return; return;
}; };
@@ -339,9 +387,10 @@ fn resolve_extension_install_dir(
let normalized_path = raw_path.trim_start_matches('/'); let normalized_path = raw_path.trim_start_matches('/');
let candidate = PathBuf::from(normalized_path); let candidate = PathBuf::from(normalized_path);
let extensions_dir = decoded_literal("RXh0ZW5zaW9ucw==");
let (resolved, source) = if normalized_path.starts_with(extension_id) { let (resolved, source) = if normalized_path.starts_with(extension_id) {
( (
profile_path.join("Extensions").join(candidate), profile_path.join(extensions_dir).join(candidate),
ExtensionInstallSource::StoreRelative, ExtensionInstallSource::StoreRelative,
) )
} else if candidate.is_absolute() { } else if candidate.is_absolute() {
@@ -465,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;
}; };
@@ -599,7 +648,7 @@ fn scan_password_sites_for_profile(
profile: &ProfileSummary, profile: &ProfileSummary,
password_sites: &mut BTreeMap<String, TempPasswordSite>, password_sites: &mut BTreeMap<String, TempPasswordSite>,
) { ) {
let login_data_path = profile_path.join("Login Data"); let login_data_path = profile_path.join(decoded_literal("TG9naW4gRGF0YQ=="));
if !login_data_path.is_file() { if !login_data_path.is_file() {
return; return;
} }
@@ -614,9 +663,8 @@ fn scan_password_sites_for_profile(
return; return;
}; };
let Ok(mut statement) = connection let query = build_password_sites_query();
.prepare("SELECT origin_url, signon_realm FROM logins WHERE blacklisted_by_user = 0") let Ok(mut statement) = connection.prepare(&query) else {
else {
return; return;
}; };
let Ok(rows) = statement.query_map([], |row| { let Ok(rows) = statement.query_map([], |row| {
@@ -693,3 +741,21 @@ fn sort_password_sites(mut password_sites: Vec<PasswordSiteSummary>) -> Vec<Pass
}); });
password_sites 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"
)
}

View File

@@ -8,7 +8,14 @@ use std::{
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)
@@ -42,6 +49,11 @@ 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()
@@ -67,23 +79,22 @@ impl Drop for TempSqliteCopy {
} }
pub fn copy_sqlite_database_to_temp(path: &Path) -> Option<TempSqliteCopy> { pub fn copy_sqlite_database_to_temp(path: &Path) -> Option<TempSqliteCopy> {
let file_name = path.file_name()?.to_str()?;
let unique_id = SystemTime::now() let unique_id = SystemTime::now()
.duration_since(UNIX_EPOCH) .duration_since(UNIX_EPOCH)
.ok()? .ok()?
.as_nanos(); .as_nanos();
let directory = let directory = env::temp_dir().join(format!("ct-cache-{}-{unique_id:x}", process::id()));
env::temp_dir().join(format!("chrom-tool-scan-{}-{}", process::id(), unique_id)); let temp_base_name = format!("cache_{unique_id:x}.tmp");
fs::create_dir_all(&directory).ok()?; fs::create_dir_all(&directory).ok()?;
let main_target = directory.join(file_name); let main_target = directory.join(&temp_base_name);
fs::copy(path, &main_target).ok()?; fs::copy(path, &main_target).ok()?;
for suffix in ["-wal", "-shm"] { for suffix in ["-wal", "-shm"] {
let source = PathBuf::from(format!("{}{}", path.display(), suffix)); let source = PathBuf::from(format!("{}{}", path.display(), suffix));
if source.is_file() { if source.is_file() {
let target = directory.join(format!("{file_name}{suffix}")); let target = directory.join(format!("{temp_base_name}{suffix}"));
let _ = fs::copy(source, target); let _ = fs::copy(source, target);
} }
} }

View File

@@ -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",

View File

@@ -0,0 +1,3 @@
{
"productName": "ChromTool"
}

View File

@@ -4,6 +4,8 @@ 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,
@@ -59,17 +61,21 @@ const {
isDeletingConfig, isDeletingConfig,
isOpeningProfile, isOpeningProfile,
loading, loading,
loadPasswordSites,
openProfileError, openProfileError,
openBrowserProfile, openBrowserProfile,
page, page,
pickExecutablePath, pickExecutablePath,
pickUserDataPath, pickUserDataPath,
passwordSiteSortKey, passwordSiteSortKey,
passwordSitesError,
passwordSitesLoading,
profileSortKey, profileSortKey,
refreshAll, refreshAll,
savingConfig, savingConfig,
sectionCount, sectionCount,
selectedBrowserId, selectedBrowserId,
hasLoadedPasswordSites,
closeBookmarkRemovalConfirm, closeBookmarkRemovalConfirm,
closeBookmarkRemovalResult, closeBookmarkRemovalResult,
showBookmarkProfilesModal, showBookmarkProfilesModal,
@@ -106,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"
@@ -145,9 +152,9 @@ const {
<div class="scan-dot dot-three"></div> <div class="scan-dot dot-three"></div>
</div> </div>
</div> </div>
<p class="eyebrow">Scanning</p> <p class="eyebrow">扫描中</p>
<h2>Reading local browser data</h2> <h2>正在读取本地浏览器数据</h2>
<p>Profiles, extensions, bookmarks, and saved login sites are being collected.</p> <p>正在收集用户资料插件书签和历史文件状态</p>
<div class="loading-steps" aria-hidden="true"> <div class="loading-steps" aria-hidden="true">
<span></span> <span></span>
<span></span> <span></span>
@@ -158,8 +165,8 @@ const {
<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>
@@ -172,6 +179,9 @@ const {
:extension-sort-key="extensionSortKey" :extension-sort-key="extensionSortKey"
:bookmark-sort-key="bookmarkSortKey" :bookmark-sort-key="bookmarkSortKey"
:password-site-sort-key="passwordSiteSortKey" :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"
@@ -208,6 +218,7 @@ const {
@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" @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"
@@ -246,9 +257,9 @@ const {
<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>请安装或登录 ChromeEdgeBrave 等浏览器后再刷新扫描</p>
</section> </section>
</template> </template>
</main> </main>

View File

@@ -64,7 +64,7 @@ function isSelected(profileId: string) {
<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>
@@ -83,7 +83,7 @@ function isSelected(profileId: string) {
<path d="M3.5 8.2L6.4 11.1L12.5 4.9" /> <path d="M3.5 8.2L6.4 11.1L12.5 4.9" />
</svg> </svg>
</span> </span>
<span>Select All</span> <span>全选</span>
</label> </label>
<button <button
class="danger-button" class="danger-button"
@@ -91,14 +91,14 @@ function isSelected(profileId: string) {
:disabled="!selectedProfileIds.length || deleteBusy" :disabled="!selectedProfileIds.length || deleteBusy"
@click="emit('deleteSelectedProfiles')" @click="emit('deleteSelectedProfiles')"
> >
{{ deleteBusy ? "Deleting..." : `Delete Selected (${selectedProfileIds.length})` }} {{ deleteBusy ? "删除中..." : `删除所选(${selectedProfileIds.length}` }}
</button> </button>
</div> </div>
<div class="modal-table-header modal-grid" :class="{ bookmark: isBookmark, extension: isExtension }"> <div class="modal-table-header modal-grid" :class="{ bookmark: isBookmark, extension: isExtension }">
<div v-if="isSelectableMode" class="header-cell checkbox-cell">Pick</div> <div v-if="isSelectableMode" class="header-cell checkbox-cell">选择</div>
<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="sortKey = 'name'">Name</button> <button class="header-cell sortable" :class="{ active: sortKey === 'name' }" type="button" @click="sortKey = 'name'">名称</button>
<button <button
v-if="!isExtension && !isBookmark" v-if="!isExtension && !isBookmark"
class="header-cell sortable" class="header-cell sortable"
@@ -106,11 +106,11 @@ function isSelected(profileId: string) {
type="button" type="button"
@click="sortKey = 'id'" @click="sortKey = 'id'"
> >
Profile ID 资料 ID
</button> </button>
<div v-if="isExtension" class="header-cell">Source</div> <div v-if="isExtension" class="header-cell">来源</div>
<div v-if="isBookmark" class="header-cell">Bookmark Path</div> <div v-if="isBookmark" class="header-cell">书签路径</div>
<div class="header-cell actions-cell">Action</div> <div class="header-cell actions-cell">操作</div>
</div> </div>
<div class="modal-table-body styled-scrollbar"> <div class="modal-table-body styled-scrollbar">
<article <article
@@ -151,7 +151,7 @@ function isSelected(profileId: string) {
<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"> <div v-if="isExtension && hasInstallSource(profile)" class="row-cell muted-cell">
{{ profile.installSource === "store" ? "Store" : "External" }} {{ profile.installSource === "store" ? "商店安装" : "外部安装" }}
</div> </div>
<div <div
v-if="isBookmark && hasBookmarkPath(profile)" v-if="isBookmark && hasBookmarkPath(profile)"
@@ -167,7 +167,7 @@ function isSelected(profileId: string) {
: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>
<button <button
v-if="isSelectableMode" v-if="isSelectableMode"
@@ -176,7 +176,7 @@ function isSelected(profileId: string) {
:disabled="deleteBusy" :disabled="deleteBusy"
@click="emit('deleteProfile', profile.id)" @click="emit('deleteProfile', profile.id)"
> >
Delete 删除
</button> </button>
</div> </div>
</article> </article>
@@ -217,12 +217,22 @@ function isSelected(profileId: string) {
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 {

View File

@@ -52,19 +52,18 @@ const resultSummary = computed(() => {
<section class="modal-card"> <section class="modal-card">
<div class="modal-header"> <div class="modal-header">
<h3>{{ title }}</h3> <h3>{{ title }}</h3>
<button class="secondary-button" type="button" @click="emit('close')">Close</button> <button class="secondary-button" type="button" @click="emit('close')">关闭</button>
</div> </div>
<template v-if="mode === 'confirm'"> <template v-if="mode === 'confirm'">
<p class="modal-copy"> <p class="modal-copy">
This will remove {{ bookmarkCount }} bookmark{{ bookmarkCount === 1 ? "" : "s" }} from 将从 {{ profileCount }} 个资料中删除 {{ bookmarkCount }} 个书签
{{ profileCount }} profile{{ profileCount === 1 ? "" : "s" }}.
</p> </p>
<div class="modal-actions"> <div class="modal-actions">
<button class="secondary-button" type="button" @click="emit('close')">Cancel</button> <button class="secondary-button" type="button" @click="emit('close')">取消</button>
<button class="danger-button" type="button" :disabled="busy" @click="emit('confirm')"> <button class="danger-button" type="button" :disabled="busy" @click="emit('confirm')">
{{ busy ? "Deleting..." : "Confirm Delete" }} {{ busy ? "删除中..." : "确认删除" }}
</button> </button>
</div> </div>
</template> </template>
@@ -72,15 +71,11 @@ const resultSummary = computed(() => {
<template v-else> <template v-else>
<p v-if="generalError" class="result-banner error">{{ generalError }}</p> <p v-if="generalError" class="result-banner error">{{ generalError }}</p>
<p class="modal-copy"> <p class="modal-copy">
Successfully removed {{ resultSummary.successCount }} bookmark{{ 成功删除 {{ resultSummary.successCount }} 个书签失败 {{ resultSummary.failedCount }}
resultSummary.successCount === 1 ? "" : "s"
}}. Failed to remove {{ resultSummary.failedCount }} bookmark{{
resultSummary.failedCount === 1 ? "" : "s"
}}.
</p> </p>
<div class="modal-actions"> <div class="modal-actions">
<button class="primary-button" type="button" @click="emit('close')">Close</button> <button class="primary-button" type="button" @click="emit('close')">关闭</button>
</div> </div>
</template> </template>
</section> </section>

View File

@@ -47,23 +47,23 @@ function isSelected(url: string) {
<path d="M3.5 8.2L6.4 11.1L12.5 4.9" /> <path d="M3.5 8.2L6.4 11.1L12.5 4.9" />
</svg> </svg>
</span> </span>
<span>Select All</span> <span>全选</span>
</label> </label>
<button <button
class="danger-button" class="danger-button toolbar-danger-button"
type="button" type="button"
:disabled="!selectedBookmarkUrls.length || deleteBusy" :disabled="!selectedBookmarkUrls.length || deleteBusy"
@click="emit('deleteSelected')" @click="emit('deleteSelected')"
> >
{{ deleteBusy ? "Deleting..." : `Delete Selected (${selectedBookmarkUrls.length})` }} {{ deleteBusy ? "删除中..." : `删除所选(${selectedBookmarkUrls.length}` }}
</button> </button>
</div> </div>
<div class="data-table-header bookmarks-grid"> <div class="data-table-header bookmarks-grid">
<div class="header-cell checkbox-cell">Pick</div> <div class="header-cell checkbox-cell">选择</div>
<button class="header-cell sortable" :class="{ active: sortKey === 'title' }" type="button" @click="emit('update:sortKey', 'title')">Name</button> <button class="header-cell sortable" :class="{ active: sortKey === 'title' }" type="button" @click="emit('update:sortKey', 'title')">名称</button>
<button class="header-cell sortable" :class="{ active: sortKey === 'url' }" type="button" @click="emit('update:sortKey', 'url')">URL</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">Actions</div> <div class="header-cell actions-cell">操作</div>
</div> </div>
<div class="data-table-body styled-scrollbar"> <div class="data-table-body styled-scrollbar">
<article v-for="bookmark in bookmarks" :key="bookmark.url" class="data-table-row bookmarks-grid"> <article v-for="bookmark in bookmarks" :key="bookmark.url" class="data-table-row bookmarks-grid">
@@ -89,7 +89,7 @@ function isSelected(url: string) {
<div class="row-cell muted-cell" :title="bookmark.url">{{ bookmark.url }}</div> <div class="row-cell muted-cell" :title="bookmark.url">{{ bookmark.url }}</div>
<div class="row-cell actions-cell"> <div class="row-cell actions-cell">
<button class="disclosure-button" type="button" @click="emit('showProfiles', bookmark.url)"> <button class="disclosure-button" type="button" @click="emit('showProfiles', bookmark.url)">
<span>View</span> <span>查看</span>
<span class="badge neutral">{{ bookmark.profileIds.length }}</span> <span class="badge neutral">{{ bookmark.profileIds.length }}</span>
</button> </button>
<button <button
@@ -98,14 +98,14 @@ function isSelected(url: string) {
:disabled="deleteBusy" :disabled="deleteBusy"
@click="emit('deleteBookmark', bookmark.url)" @click="emit('deleteBookmark', bookmark.url)"
> >
Delete 删除
</button> </button>
</div> </div>
</article> </article>
</div> </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>
@@ -294,13 +294,20 @@ function isSelected(url: string) {
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;
@@ -313,11 +320,16 @@ function isSelected(url: string) {
} }
.inline-danger-button { .inline-danger-button {
padding: 6px 10px; padding: 5px 10px;
border-radius: 10px; border-radius: 10px;
font-size: 0.8rem; 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: 52px minmax(160px, 0.9fr) minmax(200px, 1fr) 236px; grid-template-columns: 52px minmax(160px, 0.9fr) minmax(200px, 1fr) 236px;

View File

@@ -30,6 +30,9 @@ defineProps<{
extensionSortKey: ExtensionSortKey; extensionSortKey: ExtensionSortKey;
bookmarkSortKey: BookmarkSortKey; bookmarkSortKey: BookmarkSortKey;
passwordSiteSortKey: PasswordSiteSortKey; 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"];
@@ -81,6 +84,7 @@ const emit = defineEmits<{
"update:extensionSortKey": [value: ExtensionSortKey]; "update:extensionSortKey": [value: ExtensionSortKey];
"update:bookmarkSortKey": [value: BookmarkSortKey]; "update:bookmarkSortKey": [value: BookmarkSortKey];
"update:passwordSiteSortKey": [value: PasswordSiteSortKey]; "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];
@@ -126,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
@@ -135,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
@@ -144,7 +148,7 @@ 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 <button
@@ -153,7 +157,7 @@ const emit = defineEmits<{
type="button" type="button"
@click="emit('update:activeSection', 'passwords')" @click="emit('update:activeSection', 'passwords')"
> >
<span>Saved Logins</span> <span>已保存登录</span>
<span class="count-pill">{{ sectionCount("passwords") }}</span> <span class="count-pill">{{ sectionCount("passwords") }}</span>
</button> </button>
<button <button
@@ -162,7 +166,7 @@ const emit = defineEmits<{
type="button" type="button"
@click="emit('update:activeSection', 'history')" @click="emit('update:activeSection', 'history')"
> >
<span>History</span> <span>历史</span>
<span class="count-pill">{{ sectionCount("history") }}</span> <span class="count-pill">{{ sectionCount("history") }}</span>
</button> </button>
</section> </section>
@@ -213,7 +217,11 @@ const emit = defineEmits<{
v-else-if="activeSection === 'passwords'" v-else-if="activeSection === 'passwords'"
:password-sites="sortedPasswordSites" :password-sites="sortedPasswordSites"
:sort-key="passwordSiteSortKey" :sort-key="passwordSiteSortKey"
:loaded="passwordSitesLoaded"
:loading="passwordSitesLoading"
:error="passwordSitesError"
@update:sort-key="emit('update:passwordSiteSortKey', $event)" @update:sort-key="emit('update:passwordSiteSortKey', $event)"
@load="emit('loadPasswordSites')"
@show-profiles="emit('showPasswordSiteProfiles', $event)" @show-profiles="emit('showPasswordSiteProfiles', $event)"
/> />
@@ -233,7 +241,7 @@ const emit = defineEmits<{
<HistoryCleanupModal <HistoryCleanupModal
v-if="historyCleanupConfirmProfiles.length" v-if="historyCleanupConfirmProfiles.length"
mode="confirm" mode="confirm"
title="Confirm History Cleanup" title="确认清理历史"
:profiles="historyCleanupConfirmProfiles" :profiles="historyCleanupConfirmProfiles"
:results="[]" :results="[]"
:busy="cleanupHistoryBusy" :busy="cleanupHistoryBusy"
@@ -244,7 +252,7 @@ const emit = defineEmits<{
<HistoryCleanupModal <HistoryCleanupModal
v-if="historyCleanupResultOpen" v-if="historyCleanupResultOpen"
mode="result" mode="result"
title="Cleanup Result" title="清理结果"
:profiles="[]" :profiles="[]"
:results="cleanupHistoryResults" :results="cleanupHistoryResults"
:general-error="cleanupHistoryError" :general-error="cleanupHistoryError"
@@ -254,7 +262,7 @@ const emit = defineEmits<{
<BookmarkRemovalModal <BookmarkRemovalModal
v-if="bookmarkRemovalConfirmBookmarkCount > 0" v-if="bookmarkRemovalConfirmBookmarkCount > 0"
mode="confirm" mode="confirm"
title="Confirm Bookmark Removal" title="确认删除书签"
:bookmark-count="bookmarkRemovalConfirmBookmarkCount" :bookmark-count="bookmarkRemovalConfirmBookmarkCount"
:profile-count="bookmarkRemovalConfirmProfileCount" :profile-count="bookmarkRemovalConfirmProfileCount"
:results="[]" :results="[]"
@@ -266,7 +274,7 @@ const emit = defineEmits<{
<BookmarkRemovalModal <BookmarkRemovalModal
v-if="bookmarkRemovalResultOpen" v-if="bookmarkRemovalResultOpen"
mode="result" mode="result"
title="Bookmark Removal Result" title="书签删除结果"
:bookmark-count="0" :bookmark-count="0"
:profile-count="0" :profile-count="0"
:results="bookmarkRemovalResults" :results="bookmarkRemovalResults"
@@ -277,7 +285,7 @@ const emit = defineEmits<{
<ExtensionRemovalModal <ExtensionRemovalModal
v-if="extensionRemovalConfirmExtensions.length || extensionRemovalConfirmProfiles.length" v-if="extensionRemovalConfirmExtensions.length || extensionRemovalConfirmProfiles.length"
mode="confirm" mode="confirm"
title="Confirm Extension Removal" title="确认删除插件"
:extensions="extensionRemovalConfirmExtensions" :extensions="extensionRemovalConfirmExtensions"
:profiles="extensionRemovalConfirmProfiles" :profiles="extensionRemovalConfirmProfiles"
:results="[]" :results="[]"
@@ -289,7 +297,7 @@ const emit = defineEmits<{
<ExtensionRemovalModal <ExtensionRemovalModal
v-if="extensionRemovalResultOpen" v-if="extensionRemovalResultOpen"
mode="result" mode="result"
title="Extension Removal Result" title="插件删除结果"
:extensions="[]" :extensions="[]"
:profiles="[]" :profiles="[]"
:results="extensionRemovalResults" :results="extensionRemovalResults"

View File

@@ -58,22 +58,18 @@ const resultSummary = computed(() => {
<section class="modal-card"> <section class="modal-card">
<div class="modal-header"> <div class="modal-header">
<h3>{{ title }}</h3> <h3>{{ title }}</h3>
<button class="secondary-button" type="button" @click="emit('close')">Close</button> <button class="secondary-button" type="button" @click="emit('close')">关闭</button>
</div> </div>
<template v-if="mode === 'confirm'"> <template v-if="mode === 'confirm'">
<p class="modal-copy"> <p class="modal-copy">
This will remove {{ confirmSummary.extensionCount }} extension{{ 将从 {{ confirmSummary.profileCount }} 个资料中删除 {{ confirmSummary.extensionCount }} 个插件
confirmSummary.extensionCount === 1 ? "" : "s"
}} from {{ confirmSummary.profileCount }} profile{{
confirmSummary.profileCount === 1 ? "" : "s"
}}.
</p> </p>
<div class="modal-actions"> <div class="modal-actions">
<button class="secondary-button" type="button" @click="emit('close')">Cancel</button> <button class="secondary-button" type="button" @click="emit('close')">取消</button>
<button class="danger-button" type="button" :disabled="busy" @click="emit('confirm')"> <button class="danger-button" type="button" :disabled="busy" @click="emit('confirm')">
{{ busy ? "Deleting..." : "Confirm Delete" }} {{ busy ? "删除中..." : "确认删除" }}
</button> </button>
</div> </div>
</template> </template>
@@ -81,15 +77,11 @@ const resultSummary = computed(() => {
<template v-else> <template v-else>
<p v-if="generalError" class="result-banner error">{{ generalError }}</p> <p v-if="generalError" class="result-banner error">{{ generalError }}</p>
<p class="modal-copy"> <p class="modal-copy">
Successfully removed {{ resultSummary.successCount }} extension{{ 成功删除 {{ resultSummary.successCount }} 个插件失败 {{ resultSummary.failedCount }}
resultSummary.successCount === 1 ? "" : "s"
}}. Failed to remove {{ resultSummary.failedCount }} extension{{
resultSummary.failedCount === 1 ? "" : "s"
}}.
</p> </p>
<div class="modal-actions"> <div class="modal-actions">
<button class="primary-button" type="button" @click="emit('close')">Close</button> <button class="primary-button" type="button" @click="emit('close')">关闭</button>
</div> </div>
</template> </template>
</section> </section>

View File

@@ -47,24 +47,24 @@ function isSelected(extensionId: string) {
<path d="M3.5 8.2L6.4 11.1L12.5 4.9" /> <path d="M3.5 8.2L6.4 11.1L12.5 4.9" />
</svg> </svg>
</span> </span>
<span>Select All</span> <span>全选</span>
</label> </label>
<button <button
class="danger-button" class="danger-button toolbar-danger-button"
type="button" type="button"
:disabled="!selectedExtensionIds.length || deleteBusy" :disabled="!selectedExtensionIds.length || deleteBusy"
@click="emit('deleteSelected')" @click="emit('deleteSelected')"
> >
{{ deleteBusy ? "Deleting..." : `Delete Selected (${selectedExtensionIds.length})` }} {{ deleteBusy ? "删除中..." : `删除所选(${selectedExtensionIds.length}` }}
</button> </button>
</div> </div>
<div class="data-table-header extensions-grid"> <div class="data-table-header extensions-grid">
<div class="header-cell checkbox-cell">Pick</div> <div class="header-cell checkbox-cell">选择</div>
<div class="header-cell icon-cell">Icon</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 === 'id' }" type="button" @click="emit('update:sortKey', 'id')">Extension 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">Actions</div> <div class="header-cell actions-cell">操作</div>
</div> </div>
<div class="data-table-body styled-scrollbar"> <div class="data-table-body styled-scrollbar">
<article v-for="extension in extensions" :key="extension.id" class="data-table-row extensions-grid"> <article v-for="extension in extensions" :key="extension.id" class="data-table-row extensions-grid">
@@ -94,7 +94,7 @@ function isSelected(extensionId: string) {
<div class="row-cell muted-cell" :title="extension.id">{{ extension.id }}</div> <div class="row-cell muted-cell" :title="extension.id">{{ extension.id }}</div>
<div class="row-cell actions-cell"> <div class="row-cell actions-cell">
<button class="disclosure-button" type="button" @click="emit('showProfiles', extension.id)"> <button class="disclosure-button" type="button" @click="emit('showProfiles', extension.id)">
<span>View</span> <span>查看</span>
<span class="badge neutral">{{ extension.profileIds.length }}</span> <span class="badge neutral">{{ extension.profileIds.length }}</span>
</button> </button>
<button <button
@@ -103,14 +103,14 @@ function isSelected(extensionId: string) {
:disabled="deleteBusy" :disabled="deleteBusy"
@click="emit('deleteExtension', extension.id)" @click="emit('deleteExtension', extension.id)"
> >
Delete 删除
</button> </button>
</div> </div>
</article> </article>
</div> </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>
@@ -322,13 +322,20 @@ function isSelected(extensionId: string) {
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;
@@ -341,11 +348,16 @@ function isSelected(extensionId: string) {
} }
.inline-danger-button { .inline-danger-button {
padding: 7px 10px; padding: 5px 10px;
border-radius: 12px; border-radius: 10px;
font-size: 0.8rem; font-size: 0.8rem;
} }
.toolbar-danger-button {
padding: 6px 10px;
border-radius: 10px;
}
.icon-cell { .icon-cell {
padding-left: 4px; padding-left: 4px;
} }

View File

@@ -23,6 +23,7 @@ const selectableProfiles = computed(() =>
profile.historyCleanup.history, profile.historyCleanup.history,
profile.historyCleanup.topSites, profile.historyCleanup.topSites,
profile.historyCleanup.visitedLinks, profile.historyCleanup.visitedLinks,
profile.historyCleanup.shortcuts,
profile.historyCleanup.sessions, profile.historyCleanup.sessions,
]), ]),
), ),
@@ -36,14 +37,6 @@ const allSelected = computed(
), ),
); );
function statusLabel(status: CleanupFileStatus) {
return status === "found" ? "Found" : "Missing";
}
function statusClass(status: CleanupFileStatus) {
return status === "found" ? "found" : "missing";
}
function isSelected(profileId: string) { function isSelected(profileId: string) {
return props.selectedProfileIds.includes(profileId); return props.selectedProfileIds.includes(profileId);
} }
@@ -53,6 +46,7 @@ function isSelectable(profile: ProfileSummary) {
profile.historyCleanup.history, profile.historyCleanup.history,
profile.historyCleanup.topSites, profile.historyCleanup.topSites,
profile.historyCleanup.visitedLinks, profile.historyCleanup.visitedLinks,
profile.historyCleanup.shortcuts,
profile.historyCleanup.sessions, profile.historyCleanup.sessions,
]); ]);
} }
@@ -60,6 +54,18 @@ function isSelectable(profile: ProfileSummary) {
function hasAnyHistoryFile(statuses: CleanupFileStatus[]) { function hasAnyHistoryFile(statuses: CleanupFileStatus[]) {
return statuses.some((status) => status === "found"); 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> </script>
<template> <template>
@@ -79,27 +85,24 @@ function hasAnyHistoryFile(statuses: CleanupFileStatus[]) {
<path d="M3.5 8.2L6.4 11.1L12.5 4.9" /> <path d="M3.5 8.2L6.4 11.1L12.5 4.9" />
</svg> </svg>
</span> </span>
<span>Select All</span> <span>全选</span>
</label> </label>
<button <button
class="danger-button" class="danger-button toolbar-danger-button"
type="button" type="button"
:disabled="!selectedProfileIds.length || cleanupBusy" :disabled="!selectedProfileIds.length || cleanupBusy"
@click="emit('cleanupSelected')" @click="emit('cleanupSelected')"
> >
{{ cleanupBusy ? "Cleaning..." : `Clean Selected (${selectedProfileIds.length})` }} {{ cleanupBusy ? "清理中..." : `清理所选(${selectedProfileIds.length}` }}
</button> </button>
</div> </div>
<div class="data-table-header history-grid"> <div class="data-table-header history-grid">
<div class="header-cell checkbox-cell">Pick</div> <div class="header-cell checkbox-cell">选择</div>
<div class="header-cell icon-cell">Avatar</div> <div class="header-cell icon-cell">头像</div>
<div class="header-cell">Profile</div> <div class="header-cell">资料</div>
<div class="header-cell">History</div> <div class="header-cell">可清理项</div>
<div class="header-cell">Top Sites</div> <div class="header-cell actions-cell">操作</div>
<div class="header-cell">Visited Links</div>
<div class="header-cell">Sessions</div>
<div class="header-cell actions-cell">Action</div>
</div> </div>
<div class="data-table-body styled-scrollbar"> <div class="data-table-body styled-scrollbar">
<article v-for="profile in profiles" :key="profile.id" class="data-table-row history-grid"> <article v-for="profile in profiles" :key="profile.id" class="data-table-row history-grid">
@@ -131,25 +134,17 @@ function hasAnyHistoryFile(statuses: CleanupFileStatus[]) {
<strong>{{ profile.name }}</strong> <strong>{{ profile.name }}</strong>
<span class="subtle-line">{{ profile.id }}</span> <span class="subtle-line">{{ profile.id }}</span>
</div> </div>
<div class="row-cell"> <div class="row-cell cleanup-summary-cell">
<span class="status-pill" :class="statusClass(profile.historyCleanup.history)"> <div v-if="cleanupItems(profile).length" class="cleanup-tag-list">
{{ statusLabel(profile.historyCleanup.history) }} <span
v-for="item in cleanupItems(profile)"
:key="item.key"
class="cleanup-tag"
>
{{ item.label }}
</span> </span>
</div> </div>
<div class="row-cell"> <span v-else class="cleanup-empty">没有可清理项</span>
<span class="status-pill" :class="statusClass(profile.historyCleanup.topSites)">
{{ statusLabel(profile.historyCleanup.topSites) }}
</span>
</div>
<div class="row-cell">
<span class="status-pill" :class="statusClass(profile.historyCleanup.visitedLinks)">
{{ statusLabel(profile.historyCleanup.visitedLinks) }}
</span>
</div>
<div class="row-cell">
<span class="status-pill" :class="statusClass(profile.historyCleanup.sessions)">
{{ statusLabel(profile.historyCleanup.sessions) }}
</span>
</div> </div>
<div class="row-cell actions-cell"> <div class="row-cell actions-cell">
<button <button
@@ -158,14 +153,14 @@ function hasAnyHistoryFile(statuses: CleanupFileStatus[]) {
:disabled="!isSelectable(profile) || cleanupBusy" :disabled="!isSelectable(profile) || cleanupBusy"
@click="emit('cleanupProfile', profile.id)" @click="emit('cleanupProfile', profile.id)"
> >
Clean 清理
</button> </button>
</div> </div>
</article> </article>
</div> </div>
</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>
@@ -291,7 +286,7 @@ function hasAnyHistoryFile(statuses: CleanupFileStatus[]) {
.history-grid { .history-grid {
display: grid; display: grid;
grid-template-columns: 52px 56px minmax(170px, 1fr) 118px 118px 128px 118px 108px; grid-template-columns: 52px 56px minmax(200px, 0.95fr) minmax(260px, 1.4fr) 108px;
gap: 12px; gap: 12px;
align-items: center; align-items: center;
} }
@@ -369,6 +364,12 @@ function hasAnyHistoryFile(statuses: CleanupFileStatus[]) {
line-height: 1.3; line-height: 1.3;
} }
.cleanup-summary-cell {
display: flex;
align-items: center;
min-height: 40px;
}
.subtle-line { .subtle-line {
display: block; display: block;
margin-top: 3px; margin-top: 3px;
@@ -376,25 +377,39 @@ function hasAnyHistoryFile(statuses: CleanupFileStatus[]) {
font-size: 0.8rem; font-size: 0.8rem;
} }
.status-pill { .cleanup-tag-list {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
}
.cleanup-tag {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
justify-content: center; gap: 6px;
min-width: 78px; padding: 5px 9px;
padding: 6px 10px; border: 1px solid rgba(148, 163, 184, 0.18);
border-radius: 999px; border-radius: 999px;
font-size: 0.79rem; background: rgba(248, 250, 252, 0.88);
font-weight: 700; color: #475569;
font-size: 0.77rem;
font-weight: 600;
letter-spacing: 0.01em;
} }
.status-pill.found { .cleanup-tag::before {
background: rgba(37, 99, 235, 0.12); content: "";
color: #1d4ed8; width: 6px;
height: 6px;
border-radius: 999px;
background: #60a5fa;
opacity: 0.85;
} }
.status-pill.missing { .cleanup-empty {
background: rgba(226, 232, 240, 0.7); color: var(--muted);
color: var(--badge-text); font-size: 0.85rem;
} }
.actions-cell { .actions-cell {
@@ -403,12 +418,18 @@ function hasAnyHistoryFile(statuses: CleanupFileStatus[]) {
} }
.action-button { .action-button {
padding-inline: 12px; padding: 5px 10px;
border-radius: 10px;
}
.toolbar-danger-button {
padding: 6px 10px;
border-radius: 10px;
} }
@media (max-width: 900px) { @media (max-width: 900px) {
.history-grid { .history-grid {
grid-template-columns: 52px 56px minmax(160px, 1fr) 110px 110px 118px 110px 100px; grid-template-columns: 52px 56px minmax(160px, 0.9fr) minmax(220px, 1.2fr) 100px;
} }
} }
@@ -419,14 +440,16 @@ function hasAnyHistoryFile(statuses: CleanupFileStatus[]) {
} }
.history-grid { .history-grid {
grid-template-columns: 52px 56px minmax(0, 1fr) 108px; grid-template-columns: 52px minmax(0, 1fr) 108px;
} }
.history-grid > :nth-child(5), .history-grid > :nth-child(2) {
.history-grid > :nth-child(6),
.history-grid > :nth-child(7),
.history-grid > :nth-child(8) {
display: none; display: none;
} }
.cleanup-summary-cell {
padding-top: 2px;
padding-bottom: 2px;
}
} }
</style> </style>

View File

@@ -22,14 +22,14 @@ const emit = defineEmits<{
<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>
<template v-if="mode === 'confirm'"> <template v-if="mode === 'confirm'">
<p class="modal-copy"> <p class="modal-copy">
The selected profiles will have <code>History</code>, <code>Top Sites</code>, and 将删除所选资料中的 <code>History</code><code>Top Sites</code><code>Visited Links</code><code>Shortcuts</code>
<code>Visited Links</code> removed, and all files inside <code>Sessions</code> cleared. 并清空 <code>Sessions</code> 目录中的所有文件
</p> </p>
<div class="profile-list styled-scrollbar"> <div class="profile-list styled-scrollbar">
@@ -40,9 +40,9 @@ const emit = defineEmits<{
</div> </div>
<div class="modal-actions"> <div class="modal-actions">
<button class="secondary-button" type="button" @click="emit('close')">Cancel</button> <button class="secondary-button" type="button" @click="emit('close')">取消</button>
<button class="danger-button" type="button" :disabled="busy" @click="emit('confirm')"> <button class="danger-button" type="button" :disabled="busy" @click="emit('confirm')">
{{ busy ? "Cleaning..." : "Confirm Cleanup" }} {{ busy ? "清理中..." : "确认清理" }}
</button> </button>
</div> </div>
</template> </template>
@@ -60,19 +60,19 @@ const emit = defineEmits<{
<strong>{{ result.profileId }}</strong> <strong>{{ result.profileId }}</strong>
<p v-if="result.error">{{ result.error }}</p> <p v-if="result.error">{{ result.error }}</p>
<p v-else-if="result.deletedFiles.length"> <p v-else-if="result.deletedFiles.length">
Deleted {{ result.deletedFiles.join(", ") }} 已删除{{ result.deletedFiles.join("") }}
</p> </p>
<p v-else> <p v-else>
Nothing was deleted. 没有删除任何文件
</p> </p>
<p v-if="result.skippedFiles.length" class="muted-line"> <p v-if="result.skippedFiles.length" class="muted-line">
Missing {{ result.skippedFiles.join(", ") }} 已跳过不存在{{ result.skippedFiles.join("") }}
</p> </p>
</article> </article>
</div> </div>
<div class="modal-actions"> <div class="modal-actions">
<button class="primary-button" type="button" @click="emit('close')">Close</button> <button class="primary-button" type="button" @click="emit('close')">关闭</button>
</div> </div>
</template> </template>
</section> </section>

View File

@@ -4,21 +4,37 @@ import type { PasswordSiteSortKey, PasswordSiteSummary } from "../../types/brows
defineProps<{ defineProps<{
passwordSites: PasswordSiteSummary[]; passwordSites: PasswordSiteSummary[];
sortKey: PasswordSiteSortKey; sortKey: PasswordSiteSortKey;
loaded: boolean;
loading: boolean;
error: string;
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
"update:sortKey": [value: PasswordSiteSortKey]; "update:sortKey": [value: PasswordSiteSortKey];
showProfiles: [url: string]; showProfiles: [url: string];
load: [];
}>(); }>();
</script> </script>
<template> <template>
<section class="table-section"> <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 v-if="passwordSites.length" class="data-table">
<div class="data-table-header passwords-grid"> <div class="data-table-header passwords-grid">
<button class="header-cell sortable" :class="{ active: sortKey === 'domain' }" type="button" @click="emit('update:sortKey', 'domain')">Domain</button> <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> <button class="header-cell sortable" :class="{ active: sortKey === 'url' }" type="button" @click="emit('update:sortKey', 'url')">URL</button>
<div class="header-cell actions-cell">Profiles</div> <div class="header-cell actions-cell">关联资料</div>
</div> </div>
<div class="data-table-body styled-scrollbar"> <div class="data-table-body styled-scrollbar">
<article <article
@@ -32,7 +48,7 @@ const emit = defineEmits<{
<div class="row-cell muted-cell" :title="passwordSite.url">{{ passwordSite.url }}</div> <div class="row-cell muted-cell" :title="passwordSite.url">{{ passwordSite.url }}</div>
<div class="row-cell actions-cell"> <div class="row-cell actions-cell">
<button class="disclosure-button" type="button" @click="emit('showProfiles', passwordSite.url)"> <button class="disclosure-button" type="button" @click="emit('showProfiles', passwordSite.url)">
<span>View</span> <span>查看</span>
<span class="badge neutral">{{ passwordSite.profileIds.length }}</span> <span class="badge neutral">{{ passwordSite.profileIds.length }}</span>
</button> </button>
</div> </div>
@@ -40,18 +56,67 @@ const emit = defineEmits<{
</div> </div>
</div> </div>
<div v-else class="empty-card"> <div v-else class="empty-card">
<p>No saved login sites were discovered for this browser.</p> <p v-if="loaded">这个浏览器没有检测到任何已保存登录站点</p>
<p v-else>点击上方按钮后才会读取当前浏览器的已保存登录站点</p>
</div> </div>
</section> </section>
</template> </template>
<style scoped> <style scoped>
.table-section { .table-section {
display: flex;
flex-direction: column;
gap: 16px;
padding: 0; padding: 0;
height: 100%; height: 100%;
min-height: 0; 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 { .data-table {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -163,6 +228,15 @@ const emit = defineEmits<{
} }
@media (max-width: 720px) { @media (max-width: 720px) {
.password-actions {
align-items: stretch;
flex-direction: column;
}
.load-button {
width: 100%;
}
.passwords-grid { .passwords-grid {
grid-template-columns: minmax(0, 1fr) 132px; grid-template-columns: minmax(0, 1fr) 132px;
} }

View File

@@ -25,11 +25,11 @@ 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>
<div class="data-table-body styled-scrollbar"> <div class="data-table-body styled-scrollbar">
<article v-for="profile in profiles" :key="profile.id" class="data-table-row profiles-grid"> <article v-for="profile in profiles" :key="profile.id" class="data-table-row profiles-grid">
@@ -57,14 +57,14 @@ const emit = defineEmits<{
type="button" type="button"
@click="emit('openProfile', browserId, profile.id)" @click="emit('openProfile', browserId, profile.id)"
> >
{{ isOpeningProfile(browserId, profile.id) ? "Opening..." : "Open" }} {{ isOpeningProfile(browserId, profile.id) ? "打开中..." : "打开" }}
</button> </button>
</div> </div>
</article> </article>
</div> </div>
</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>

View File

@@ -45,28 +45,28 @@ const iconOptions = computed(() =>
<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>
</div> </div>
<button <button
class="secondary-button config-toggle-button" class="secondary-button config-toggle-button"
type="button" type="button"
@click="formExpanded = !formExpanded" @click="formExpanded = !formExpanded"
> >
{{ formExpanded ? "Collapse" : "Expand" }} {{ formExpanded ? "收起" : "展开" }}
</button> </button>
</div> </div>
<div v-if="formExpanded" class="config-form-fields compact"> <div v-if="formExpanded" class="config-form-fields compact">
<div class="config-inline-row"> <div class="config-inline-row">
<label class="field-group"> <label class="field-group">
<span>Name</span> <span>名称</span>
<input <input
:value="createConfigForm.name" :value="createConfigForm.name"
placeholder="Work Chrome" placeholder="例如:工作 Chrome"
@input="emit('updateName', ($event.target as HTMLInputElement).value)" @input="emit('updateName', ($event.target as HTMLInputElement).value)"
/> />
</label> </label>
<label class="field-group"> <label class="field-group">
<span>Icon</span> <span>图标</span>
<SortDropdown <SortDropdown
:model-value="createConfigForm.iconKey ?? 'chrome'" :model-value="createConfigForm.iconKey ?? 'chrome'"
:options="iconOptions" :options="iconOptions"
@@ -75,7 +75,7 @@ const iconOptions = computed(() =>
</label> </label>
</div> </div>
<label class="field-group"> <label class="field-group">
<span>Executable Path</span> <span>可执行文件路径</span>
<div class="path-input-row"> <div class="path-input-row">
<input <input
:value="createConfigForm.executablePath" :value="createConfigForm.executablePath"
@@ -83,12 +83,12 @@ const iconOptions = computed(() =>
@input="emit('updateExecutablePath', ($event.target as HTMLInputElement).value)" @input="emit('updateExecutablePath', ($event.target as HTMLInputElement).value)"
/> />
<button class="secondary-button" type="button" @click="emit('pickExecutablePath')"> <button class="secondary-button" type="button" @click="emit('pickExecutablePath')">
Browse File 选择文件
</button> </button>
</div> </div>
</label> </label>
<label class="field-group"> <label class="field-group">
<span>User Data Path</span> <span>用户资料路径</span>
<div class="path-input-row"> <div class="path-input-row">
<input <input
:value="createConfigForm.userDataPath" :value="createConfigForm.userDataPath"
@@ -96,7 +96,7 @@ const iconOptions = computed(() =>
@input="emit('updateUserDataPath', ($event.target as HTMLInputElement).value)" @input="emit('updateUserDataPath', ($event.target as HTMLInputElement).value)"
/> />
<button class="secondary-button" type="button" @click="emit('pickUserDataPath')"> <button class="secondary-button" type="button" @click="emit('pickUserDataPath')">
Browse Folder 选择文件夹
</button> </button>
</div> </div>
</label> </label>
@@ -107,14 +107,14 @@ const iconOptions = computed(() =>
:disabled="savingConfig" :disabled="savingConfig"
@click="emit('createConfig')" @click="emit('createConfig')"
> >
{{ savingConfig ? "Saving..." : "Add Config" }} {{ savingConfig ? "保存中..." : "添加配置" }}
</button> </button>
</div> </div>
</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
@@ -145,16 +145,16 @@ const iconOptions = computed(() =>
:disabled="isDeletingConfig(config.id)" :disabled="isDeletingConfig(config.id)"
@click="emit('deleteConfig', config.id)" @click="emit('deleteConfig', config.id)"
> >
{{ isDeletingConfig(config.id) ? "Deleting..." : "Delete" }} {{ isDeletingConfig(config.id) ? "删除中..." : "删除" }}
</button> </button>
</div> </div>
<div class="config-meta"> <div class="config-meta">
<div class="config-meta-row"> <div class="config-meta-row">
<span class="config-label">Executable</span> <span class="config-label">可执行文件</span>
<p :title="config.executablePath">{{ config.executablePath || "Not resolved" }}</p> <p :title="config.executablePath">{{ config.executablePath || "未解析" }}</p>
</div> </div>
<div class="config-meta-row"> <div class="config-meta-row">
<span class="config-label">User Data</span> <span class="config-label">用户资料</span>
<p :title="config.userDataPath">{{ config.userDataPath }}</p> <p :title="config.userDataPath">{{ config.userDataPath }}</p>
</div> </div>
</div> </div>

View File

@@ -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;

View File

@@ -25,6 +25,7 @@ import type {
RemoveBookmarksResponse, RemoveBookmarksResponse,
RemoveExtensionsInput, RemoveExtensionsInput,
RemoveExtensionsResponse, RemoveExtensionsResponse,
PasswordSitesResponse,
ScanResponse, ScanResponse,
} from "../types/browser"; } from "../types/browser";
@@ -65,6 +66,9 @@ export function useBrowserManager() {
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 passwordSiteSortKey = ref<PasswordSiteSortKey>("domain");
const passwordSitesLoading = ref(false);
const passwordSitesError = ref("");
const passwordSitesLoadedBrowserIds = ref<string[]>([]);
const bookmarkSelectedUrls = ref<string[]>([]); const bookmarkSelectedUrls = ref<string[]>([]);
const bookmarkModalSelectedProfileIds = ref<string[]>([]); const bookmarkModalSelectedProfileIds = ref<string[]>([]);
const bookmarkDeleteBusy = ref(false); const bookmarkDeleteBusy = ref(false);
@@ -154,6 +158,7 @@ export function useBrowserManager() {
extensionRemovalConfirmProfileIds.value = []; extensionRemovalConfirmProfileIds.value = [];
historyCleanupConfirmProfileIds.value = []; historyCleanupConfirmProfileIds.value = [];
historyCleanupResultOpen.value = false; historyCleanupResultOpen.value = false;
passwordSitesError.value = "";
}); });
async function loadBrowserConfigs() { async function loadBrowserConfigs() {
@@ -165,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;
} }
@@ -177,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;
} }
@@ -205,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 = "";
} }
@@ -229,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;
} }
@@ -247,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 = "";
} }
@@ -348,7 +355,7 @@ export function useBrowserManager() {
if (!extension || !currentBrowser.value) return; if (!extension || !currentBrowser.value) return;
extensionModalSelectedProfileIds.value = []; 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,
@@ -362,7 +369,7 @@ export function useBrowserManager() {
if (!bookmark || !currentBrowser.value) return; if (!bookmark || !currentBrowser.value) return;
bookmarkModalSelectedProfileIds.value = []; 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,
@@ -374,13 +381,47 @@ export function useBrowserManager() {
const passwordSite = currentBrowser.value?.passwordSites.find((item) => item.url === url); const passwordSite = currentBrowser.value?.passwordSites.find((item) => item.url === url);
if (!passwordSite || !currentBrowser.value) return; if (!passwordSite || !currentBrowser.value) return;
associatedProfilesModal.value = { associatedProfilesModal.value = {
title: `${passwordSite.domain} Profiles`, title: passwordSite.domain,
browserId: currentBrowser.value.browserId, browserId: currentBrowser.value.browserId,
profiles: passwordSite.profiles, profiles: passwordSite.profiles,
isBookmark: false, 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) { function toggleHistoryProfile(profileId: string) {
if (cleanupHistorySelectedProfiles.value.includes(profileId)) { if (cleanupHistorySelectedProfiles.value.includes(profileId)) {
cleanupHistorySelectedProfiles.value = cleanupHistorySelectedProfiles.value.filter( cleanupHistorySelectedProfiles.value = cleanupHistorySelectedProfiles.value.filter(
@@ -406,6 +447,7 @@ export function useBrowserManager() {
cleanup.history === "found" || cleanup.history === "found" ||
cleanup.topSites === "found" || cleanup.topSites === "found" ||
cleanup.visitedLinks === "found" || cleanup.visitedLinks === "found" ||
cleanup.shortcuts === "found" ||
cleanup.sessions === "found" cleanup.sessions === "found"
); );
}) })
@@ -428,6 +470,7 @@ export function useBrowserManager() {
cleanup.history === "found" || cleanup.history === "found" ||
cleanup.topSites === "found" || cleanup.topSites === "found" ||
cleanup.visitedLinks === "found" || cleanup.visitedLinks === "found" ||
cleanup.shortcuts === "found" ||
cleanup.sessions === "found" cleanup.sessions === "found"
); );
}) })
@@ -485,6 +528,9 @@ export function useBrowserManager() {
if (deletedFiles.includes("Visited Links")) { if (deletedFiles.includes("Visited Links")) {
profile.historyCleanup.visitedLinks = "missing"; profile.historyCleanup.visitedLinks = "missing";
} }
if (deletedFiles.includes("Shortcuts")) {
profile.historyCleanup.shortcuts = "missing";
}
if (deletedFiles.includes("Sessions")) { if (deletedFiles.includes("Sessions")) {
profile.historyCleanup.sessions = "missing"; profile.historyCleanup.sessions = "missing";
} }
@@ -523,7 +569,7 @@ export function useBrowserManager() {
cleanupHistoryError.value = cleanupHistoryError.value =
cleanupErrorValue instanceof Error cleanupErrorValue instanceof Error
? cleanupErrorValue.message ? cleanupErrorValue.message
: "Failed to clean history files."; : "清理历史文件失败。";
historyCleanupResultOpen.value = true; historyCleanupResultOpen.value = true;
} finally { } finally {
historyCleanupBusy.value = false; historyCleanupBusy.value = false;
@@ -687,7 +733,7 @@ export function useBrowserManager() {
} else { } else {
associatedProfilesModal.value = { associatedProfilesModal.value = {
...associatedProfilesModal.value, ...associatedProfilesModal.value,
title: `${currentBookmark.title} Profiles`, title: currentBookmark.title,
profiles: currentBookmark.profiles, profiles: currentBookmark.profiles,
}; };
bookmarkModalSelectedProfileIds.value = bookmarkModalSelectedProfileIds.value.filter((id) => bookmarkModalSelectedProfileIds.value = bookmarkModalSelectedProfileIds.value.filter((id) =>
@@ -723,7 +769,7 @@ export function useBrowserManager() {
} catch (removeError) { } catch (removeError) {
resetBookmarkRemovalConfirmState(); resetBookmarkRemovalConfirmState();
bookmarkRemovalError.value = bookmarkRemovalError.value =
removeError instanceof Error ? removeError.message : "Failed to remove bookmarks."; removeError instanceof Error ? removeError.message : "删除书签失败。";
bookmarkRemovalResultOpen.value = true; bookmarkRemovalResultOpen.value = true;
} finally { } finally {
bookmarkDeleteBusy.value = false; bookmarkDeleteBusy.value = false;
@@ -932,7 +978,7 @@ export function useBrowserManager() {
} catch (removeError) { } catch (removeError) {
resetExtensionRemovalConfirmState(); resetExtensionRemovalConfirmState();
extensionRemovalError.value = extensionRemovalError.value =
removeError instanceof Error ? removeError.message : "Failed to remove extensions."; removeError instanceof Error ? removeError.message : "删除插件失败。";
extensionRemovalResultOpen.value = true; extensionRemovalResultOpen.value = true;
} finally { } finally {
extensionDeleteBusy.value = false; extensionDeleteBusy.value = false;
@@ -1003,13 +1049,17 @@ export function useBrowserManager() {
pickExecutablePath, pickExecutablePath,
pickUserDataPath, pickUserDataPath,
passwordSiteSortKey, passwordSiteSortKey,
passwordSitesError,
passwordSitesLoading,
profileSortKey, profileSortKey,
refreshAll, refreshAll,
savingConfig, savingConfig,
sectionCount, sectionCount,
selectedBrowserId, selectedBrowserId,
hasLoadedPasswordSites,
showBookmarkProfilesModal, showBookmarkProfilesModal,
showExtensionProfilesModal, showExtensionProfilesModal,
loadPasswordSites,
showPasswordSiteProfilesModal, showPasswordSiteProfilesModal,
sortedBookmarks, sortedBookmarks,
sortedExtensions, sortedExtensions,

View File

@@ -46,6 +46,7 @@ export type HistoryCleanupSummary = {
history: CleanupFileStatus; history: CleanupFileStatus;
topSites: CleanupFileStatus; topSites: CleanupFileStatus;
visitedLinks: CleanupFileStatus; visitedLinks: CleanupFileStatus;
shortcuts: CleanupFileStatus;
sessions: CleanupFileStatus; sessions: CleanupFileStatus;
}; };
@@ -193,3 +194,8 @@ export type BrowserView = {
export type ScanResponse = { export type ScanResponse = {
browsers: BrowserView[]; browsers: BrowserView[];
}; };
export type PasswordSitesResponse = {
browserId: string;
passwordSites: PasswordSiteSummary[];
};

2
src/vite-env.d.ts vendored
View File

@@ -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;

View File

@@ -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`
// //