init
24
.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
7
.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"Vue.volar",
|
||||
"tauri-apps.tauri-vscode",
|
||||
"rust-lang.rust-analyzer"
|
||||
]
|
||||
}
|
||||
7
README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Tauri + Vue + TypeScript
|
||||
|
||||
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.
|
||||
|
||||
## 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)
|
||||
14
index.html
Normal file
@@ -0,0 +1,14 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Tauri + Vue + Typescript App</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
24
package.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "chrom-tool",
|
||||
"private": true,
|
||||
"version": "0.1.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vue-tsc --noEmit && vite build",
|
||||
"preview": "vite preview",
|
||||
"tauri": "tauri"
|
||||
},
|
||||
"dependencies": {
|
||||
"vue": "^3.5.13",
|
||||
"@tauri-apps/api": "^2",
|
||||
"@tauri-apps/plugin-opener": "^2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitejs/plugin-vue": "^5.2.1",
|
||||
"typescript": "~5.6.2",
|
||||
"vite": "^6.0.3",
|
||||
"vue-tsc": "^2.1.10",
|
||||
"@tauri-apps/cli": "^2"
|
||||
}
|
||||
}
|
||||
1102
pnpm-lock.yaml
generated
Normal file
6
public/tauri.svg
Normal file
@@ -0,0 +1,6 @@
|
||||
<svg width="206" height="231" viewBox="0 0 206 231" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M143.143 84C143.143 96.1503 133.293 106 121.143 106C108.992 106 99.1426 96.1503 99.1426 84C99.1426 71.8497 108.992 62 121.143 62C133.293 62 143.143 71.8497 143.143 84Z" fill="#FFC131"/>
|
||||
<ellipse cx="84.1426" cy="147" rx="22" ry="22" transform="rotate(180 84.1426 147)" fill="#24C8DB"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M166.738 154.548C157.86 160.286 148.023 164.269 137.757 166.341C139.858 160.282 141 153.774 141 147C141 144.543 140.85 142.121 140.558 139.743C144.975 138.204 149.215 136.139 153.183 133.575C162.73 127.404 170.292 118.608 174.961 108.244C179.63 97.8797 181.207 86.3876 179.502 75.1487C177.798 63.9098 172.884 53.4021 165.352 44.8883C157.82 36.3744 147.99 30.2165 137.042 27.1546C126.095 24.0926 114.496 24.2568 103.64 27.6274C92.7839 30.998 83.1319 37.4317 75.8437 46.1553C74.9102 47.2727 74.0206 48.4216 73.176 49.5993C61.9292 50.8488 51.0363 54.0318 40.9629 58.9556C44.2417 48.4586 49.5653 38.6591 56.679 30.1442C67.0505 17.7298 80.7861 8.57426 96.2354 3.77762C111.685 -1.01901 128.19 -1.25267 143.769 3.10474C159.348 7.46215 173.337 16.2252 184.056 28.3411C194.775 40.457 201.767 55.4101 204.193 71.404C206.619 87.3978 204.374 103.752 197.73 118.501C191.086 133.25 180.324 145.767 166.738 154.548ZM41.9631 74.275L62.5557 76.8042C63.0459 72.813 63.9401 68.9018 65.2138 65.1274C57.0465 67.0016 49.2088 70.087 41.9631 74.275Z" fill="#FFC131"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M38.4045 76.4519C47.3493 70.6709 57.2677 66.6712 67.6171 64.6132C65.2774 70.9669 64 77.8343 64 85.0001C64 87.1434 64.1143 89.26 64.3371 91.3442C60.0093 92.8732 55.8533 94.9092 51.9599 97.4256C42.4128 103.596 34.8505 112.392 30.1816 122.756C25.5126 133.12 23.9357 144.612 25.6403 155.851C27.3449 167.09 32.2584 177.598 39.7906 186.112C47.3227 194.626 57.153 200.784 68.1003 203.846C79.0476 206.907 90.6462 206.743 101.502 203.373C112.359 200.002 122.011 193.568 129.299 184.845C130.237 183.722 131.131 182.567 131.979 181.383C143.235 180.114 154.132 176.91 164.205 171.962C160.929 182.49 155.596 192.319 148.464 200.856C138.092 213.27 124.357 222.426 108.907 227.222C93.458 232.019 76.9524 232.253 61.3736 227.895C45.7948 223.538 31.8055 214.775 21.0867 202.659C10.3679 190.543 3.37557 175.59 0.949823 159.596C-1.47592 143.602 0.768139 127.248 7.41237 112.499C14.0566 97.7497 24.8183 85.2327 38.4045 76.4519ZM163.062 156.711L163.062 156.711C162.954 156.773 162.846 156.835 162.738 156.897C162.846 156.835 162.954 156.773 163.062 156.711Z" fill="#24C8DB"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.5 KiB |
1
public/vite.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
8
src-tauri/.gitignore
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
/target*/
|
||||
|
||||
# Generated by Tauri
|
||||
# will have schema files for capabilities auto-completion
|
||||
/gen/schemas
|
||||
5464
src-tauri/Cargo.lock
generated
Normal file
26
src-tauri/Cargo.toml
Normal file
@@ -0,0 +1,26 @@
|
||||
[package]
|
||||
name = "chrom-tool"
|
||||
version = "0.1.0"
|
||||
description = "A Tauri App"
|
||||
authors = ["you"]
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[lib]
|
||||
# The `_lib` suffix may seem redundant but it is necessary
|
||||
# to make the lib name unique and wouldn't conflict with the bin name.
|
||||
# This seems to be only an issue on Windows, see https://github.com/rust-lang/cargo/issues/8519
|
||||
name = "chrom_tool_lib"
|
||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "2", features = [] }
|
||||
|
||||
[dependencies]
|
||||
tauri = { version = "2", features = [] }
|
||||
tauri-plugin-opener = "2"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
base64 = "0.22"
|
||||
|
||||
3
src-tauri/build.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
tauri_build::build()
|
||||
}
|
||||
10
src-tauri/capabilities/default.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"$schema": "../gen/schemas/desktop-schema.json",
|
||||
"identifier": "default",
|
||||
"description": "Capability for the main window",
|
||||
"windows": ["main"],
|
||||
"permissions": [
|
||||
"core:default",
|
||||
"opener:default"
|
||||
]
|
||||
}
|
||||
BIN
src-tauri/icons/128x128.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
src-tauri/icons/128x128@2x.png
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
BIN
src-tauri/icons/32x32.png
Normal file
|
After Width: | Height: | Size: 974 B |
BIN
src-tauri/icons/Square107x107Logo.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
src-tauri/icons/Square142x142Logo.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
src-tauri/icons/Square150x150Logo.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
src-tauri/icons/Square284x284Logo.png
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
BIN
src-tauri/icons/Square30x30Logo.png
Normal file
|
After Width: | Height: | Size: 903 B |
BIN
src-tauri/icons/Square310x310Logo.png
Normal file
|
After Width: | Height: | Size: 8.4 KiB |
BIN
src-tauri/icons/Square44x44Logo.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
src-tauri/icons/Square71x71Logo.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
src-tauri/icons/Square89x89Logo.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
src-tauri/icons/StoreLogo.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
src-tauri/icons/icon.icns
Normal file
BIN
src-tauri/icons/icon.ico
Normal file
|
After Width: | Height: | Size: 85 KiB |
BIN
src-tauri/icons/icon.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
608
src-tauri/src/lib.rs
Normal file
@@ -0,0 +1,608 @@
|
||||
use std::{
|
||||
collections::{BTreeMap, BTreeSet},
|
||||
env, fs,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use base64::{engine::general_purpose::STANDARD, Engine as _};
|
||||
use serde::Serialize;
|
||||
use serde_json::Value;
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct ScanResponse {
|
||||
browsers: Vec<BrowserView>,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct BrowserView {
|
||||
browser_id: String,
|
||||
browser_name: String,
|
||||
data_root: String,
|
||||
profiles: Vec<ProfileSummary>,
|
||||
extensions: Vec<ExtensionSummary>,
|
||||
bookmarks: Vec<BookmarkSummary>,
|
||||
stats: BrowserStats,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct BrowserStats {
|
||||
profile_count: usize,
|
||||
extension_count: usize,
|
||||
bookmark_count: usize,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct ProfileSummary {
|
||||
id: String,
|
||||
name: String,
|
||||
email: Option<String>,
|
||||
avatar_data_url: Option<String>,
|
||||
avatar_label: String,
|
||||
path: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct ExtensionSummary {
|
||||
id: String,
|
||||
name: String,
|
||||
version: Option<String>,
|
||||
icon_data_url: Option<String>,
|
||||
profile_ids: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct BookmarkSummary {
|
||||
url: String,
|
||||
title: String,
|
||||
profile_ids: Vec<String>,
|
||||
}
|
||||
|
||||
struct BrowserDefinition {
|
||||
id: &'static str,
|
||||
name: &'static str,
|
||||
local_app_data_segments: &'static [&'static str],
|
||||
}
|
||||
|
||||
struct TempExtension {
|
||||
id: String,
|
||||
name: String,
|
||||
version: Option<String>,
|
||||
icon_data_url: Option<String>,
|
||||
profile_ids: BTreeSet<String>,
|
||||
}
|
||||
|
||||
struct TempBookmark {
|
||||
url: String,
|
||||
title: String,
|
||||
profile_ids: BTreeSet<String>,
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn scan_browsers() -> Result<ScanResponse, String> {
|
||||
let local_app_data = local_app_data_dir().ok_or_else(|| {
|
||||
"Unable to resolve the LOCALAPPDATA directory for the current user.".to_string()
|
||||
})?;
|
||||
|
||||
let browsers = browser_definitions()
|
||||
.into_iter()
|
||||
.filter_map(|definition| scan_browser(&local_app_data, definition))
|
||||
.collect();
|
||||
|
||||
Ok(ScanResponse { browsers })
|
||||
}
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_opener::init())
|
||||
.invoke_handler(tauri::generate_handler![scan_browsers])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
||||
fn browser_definitions() -> Vec<BrowserDefinition> {
|
||||
vec![
|
||||
BrowserDefinition {
|
||||
id: "chrome",
|
||||
name: "Google Chrome",
|
||||
local_app_data_segments: &["Google", "Chrome", "User Data"],
|
||||
},
|
||||
BrowserDefinition {
|
||||
id: "edge",
|
||||
name: "Microsoft Edge",
|
||||
local_app_data_segments: &["Microsoft", "Edge", "User Data"],
|
||||
},
|
||||
BrowserDefinition {
|
||||
id: "brave",
|
||||
name: "Brave",
|
||||
local_app_data_segments: &["BraveSoftware", "Brave-Browser", "User Data"],
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
fn local_app_data_dir() -> Option<PathBuf> {
|
||||
env::var_os("LOCALAPPDATA").map(PathBuf::from).or_else(|| {
|
||||
env::var_os("USERPROFILE")
|
||||
.map(PathBuf::from)
|
||||
.map(|path| path.join("AppData").join("Local"))
|
||||
})
|
||||
}
|
||||
|
||||
fn scan_browser(local_app_data: &Path, definition: BrowserDefinition) -> Option<BrowserView> {
|
||||
let root = definition
|
||||
.local_app_data_segments
|
||||
.iter()
|
||||
.fold(local_app_data.to_path_buf(), |path, segment| {
|
||||
path.join(segment)
|
||||
});
|
||||
|
||||
if !root.is_dir() {
|
||||
return None;
|
||||
}
|
||||
|
||||
let local_state = read_json_file(&root.join("Local State")).unwrap_or(Value::Null);
|
||||
let profile_cache = local_state
|
||||
.get("profile")
|
||||
.and_then(|value| value.get("info_cache"))
|
||||
.and_then(Value::as_object);
|
||||
|
||||
let mut profile_ids = BTreeSet::new();
|
||||
collect_profile_ids_from_fs(&root, &mut profile_ids);
|
||||
if let Some(cache) = profile_cache {
|
||||
for profile_id in cache.keys() {
|
||||
profile_ids.insert(profile_id.to_string());
|
||||
}
|
||||
}
|
||||
|
||||
let mut profiles = Vec::new();
|
||||
let mut extensions = BTreeMap::<String, TempExtension>::new();
|
||||
let mut bookmarks = BTreeMap::<String, TempBookmark>::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));
|
||||
profiles.push(build_profile_summary(
|
||||
&root,
|
||||
&profile_path,
|
||||
&profile_id,
|
||||
profile_info,
|
||||
));
|
||||
scan_extensions_for_profile(&profile_path, &profile_id, &mut extensions);
|
||||
scan_bookmarks_for_profile(&profile_path, &profile_id, &mut bookmarks);
|
||||
}
|
||||
|
||||
let profiles = sort_profiles(profiles);
|
||||
let extensions = extensions
|
||||
.into_values()
|
||||
.map(|entry| ExtensionSummary {
|
||||
id: entry.id,
|
||||
name: entry.name,
|
||||
version: entry.version,
|
||||
icon_data_url: entry.icon_data_url,
|
||||
profile_ids: entry.profile_ids.into_iter().collect(),
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
let bookmarks = bookmarks
|
||||
.into_values()
|
||||
.map(|entry| BookmarkSummary {
|
||||
url: entry.url,
|
||||
title: entry.title,
|
||||
profile_ids: entry.profile_ids.into_iter().collect(),
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
Some(BrowserView {
|
||||
browser_id: definition.id.to_string(),
|
||||
browser_name: definition.name.to_string(),
|
||||
data_root: root.display().to_string(),
|
||||
stats: BrowserStats {
|
||||
profile_count: profiles.len(),
|
||||
extension_count: extensions.len(),
|
||||
bookmark_count: bookmarks.len(),
|
||||
},
|
||||
profiles,
|
||||
extensions: sort_extensions(extensions),
|
||||
bookmarks: sort_bookmarks(bookmarks),
|
||||
})
|
||||
}
|
||||
|
||||
fn collect_profile_ids_from_fs(root: &Path, profile_ids: &mut BTreeSet<String>) {
|
||||
let Ok(entries) = fs::read_dir(root) else {
|
||||
return;
|
||||
};
|
||||
|
||||
for entry in entries.flatten() {
|
||||
let Ok(file_type) = entry.file_type() else {
|
||||
continue;
|
||||
};
|
||||
if !file_type.is_dir() {
|
||||
continue;
|
||||
}
|
||||
let name = entry.file_name().to_string_lossy().to_string();
|
||||
if name == "Default" || name.starts_with("Profile ") {
|
||||
profile_ids.insert(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn build_profile_summary(
|
||||
root: &Path,
|
||||
profile_path: &Path,
|
||||
profile_id: &str,
|
||||
profile_info: Option<&Value>,
|
||||
) -> ProfileSummary {
|
||||
let name = first_non_empty([
|
||||
profile_info
|
||||
.and_then(|value| value.get("name"))
|
||||
.and_then(Value::as_str),
|
||||
profile_info
|
||||
.and_then(|value| value.get("gaia_name"))
|
||||
.and_then(Value::as_str),
|
||||
Some(profile_id),
|
||||
])
|
||||
.unwrap_or(profile_id)
|
||||
.to_string();
|
||||
|
||||
let email = first_non_empty([
|
||||
profile_info
|
||||
.and_then(|value| value.get("user_name"))
|
||||
.and_then(Value::as_str),
|
||||
None,
|
||||
])
|
||||
.map(str::to_string);
|
||||
|
||||
let avatar_data_url = resolve_profile_avatar(root, profile_path, profile_info);
|
||||
let avatar_label = name
|
||||
.chars()
|
||||
.find(|character| !character.is_whitespace())
|
||||
.map(|character| character.to_uppercase().collect::<String>())
|
||||
.unwrap_or_else(|| "?".to_string());
|
||||
|
||||
ProfileSummary {
|
||||
id: profile_id.to_string(),
|
||||
name,
|
||||
email,
|
||||
avatar_data_url,
|
||||
avatar_label,
|
||||
path: profile_path.display().to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
fn resolve_profile_avatar(
|
||||
_root: &Path,
|
||||
profile_path: &Path,
|
||||
profile_info: Option<&Value>,
|
||||
) -> Option<String> {
|
||||
let picture_file = profile_info
|
||||
.and_then(|value| value.get("gaia_picture_file_name"))
|
||||
.and_then(Value::as_str)
|
||||
.filter(|value| !value.is_empty());
|
||||
|
||||
if let Some(file_name) = picture_file {
|
||||
let candidate = profile_path.join(file_name);
|
||||
if let Some(data_url) = load_image_as_data_url(&candidate) {
|
||||
return Some(data_url);
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
fn scan_extensions_for_profile(
|
||||
profile_path: &Path,
|
||||
profile_id: &str,
|
||||
extensions: &mut BTreeMap<String, TempExtension>,
|
||||
) {
|
||||
let extensions_root = profile_path.join("Extensions");
|
||||
let Ok(entries) = fs::read_dir(&extensions_root) else {
|
||||
return;
|
||||
};
|
||||
|
||||
for entry in entries.flatten() {
|
||||
let Ok(file_type) = entry.file_type() else {
|
||||
continue;
|
||||
};
|
||||
if !file_type.is_dir() {
|
||||
continue;
|
||||
}
|
||||
|
||||
let extension_id = entry.file_name().to_string_lossy().to_string();
|
||||
let Some(version_path) = pick_latest_subdirectory(&entry.path()) else {
|
||||
continue;
|
||||
};
|
||||
|
||||
let manifest_path = version_path.join("manifest.json");
|
||||
let Some(manifest) = read_json_file(&manifest_path) else {
|
||||
continue;
|
||||
};
|
||||
|
||||
let name = resolve_extension_name(&manifest, &version_path)
|
||||
.filter(|value| !value.is_empty())
|
||||
.unwrap_or_else(|| extension_id.clone());
|
||||
let version = manifest
|
||||
.get("version")
|
||||
.and_then(Value::as_str)
|
||||
.map(str::to_string);
|
||||
let icon_data_url = resolve_extension_icon(&manifest, &version_path);
|
||||
|
||||
let entry = extensions
|
||||
.entry(extension_id.clone())
|
||||
.or_insert_with(|| TempExtension {
|
||||
id: extension_id.clone(),
|
||||
name: name.clone(),
|
||||
version: version.clone(),
|
||||
icon_data_url: icon_data_url.clone(),
|
||||
profile_ids: BTreeSet::new(),
|
||||
});
|
||||
|
||||
if entry.name == entry.id && name != extension_id {
|
||||
entry.name = name.clone();
|
||||
}
|
||||
if entry.version.is_none() {
|
||||
entry.version = version.clone();
|
||||
}
|
||||
if entry.icon_data_url.is_none() {
|
||||
entry.icon_data_url = icon_data_url.clone();
|
||||
}
|
||||
entry.profile_ids.insert(profile_id.to_string());
|
||||
}
|
||||
}
|
||||
|
||||
fn resolve_extension_name(manifest: &Value, version_path: &Path) -> Option<String> {
|
||||
let raw_name = manifest.get("name").and_then(Value::as_str)?;
|
||||
if let Some(localized_name) = resolve_localized_manifest_value(raw_name, manifest, version_path)
|
||||
{
|
||||
return Some(localized_name);
|
||||
}
|
||||
|
||||
manifest
|
||||
.get("short_name")
|
||||
.and_then(Value::as_str)
|
||||
.map(str::to_string)
|
||||
.or_else(|| Some(raw_name.to_string()))
|
||||
}
|
||||
|
||||
fn resolve_localized_manifest_value(
|
||||
raw_value: &str,
|
||||
manifest: &Value,
|
||||
version_path: &Path,
|
||||
) -> Option<String> {
|
||||
if !(raw_value.starts_with("__MSG_") && raw_value.ends_with("__")) {
|
||||
return Some(raw_value.to_string());
|
||||
}
|
||||
|
||||
let message_key = raw_value
|
||||
.trim_start_matches("__MSG_")
|
||||
.trim_end_matches("__");
|
||||
let default_locale = manifest
|
||||
.get("default_locale")
|
||||
.and_then(Value::as_str)
|
||||
.unwrap_or("en");
|
||||
|
||||
for locale in [default_locale, "en"] {
|
||||
let messages_path = version_path
|
||||
.join("_locales")
|
||||
.join(locale)
|
||||
.join("messages.json");
|
||||
let Some(messages) = read_json_file(&messages_path) else {
|
||||
continue;
|
||||
};
|
||||
if let Some(message) = messages
|
||||
.get(message_key)
|
||||
.and_then(|value| value.get("message"))
|
||||
.and_then(Value::as_str)
|
||||
.filter(|value| !value.is_empty())
|
||||
{
|
||||
return Some(message.to_string());
|
||||
}
|
||||
}
|
||||
|
||||
Some(raw_value.to_string())
|
||||
}
|
||||
|
||||
fn resolve_extension_icon(manifest: &Value, version_path: &Path) -> Option<String> {
|
||||
let mut candidates = Vec::new();
|
||||
|
||||
if let Some(icons) = manifest.get("icons").and_then(Value::as_object) {
|
||||
candidates.extend(icon_candidates_from_object(icons));
|
||||
}
|
||||
|
||||
for key in ["action", "browser_action", "page_action"] {
|
||||
if let Some(default_icon) = manifest
|
||||
.get(key)
|
||||
.and_then(|value| value.get("default_icon"))
|
||||
{
|
||||
if let Some(icon_path) = default_icon.as_str() {
|
||||
candidates.push((0, icon_path.to_string()));
|
||||
} else if let Some(icon_map) = default_icon.as_object() {
|
||||
candidates.extend(icon_candidates_from_object(icon_map));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
candidates.sort_by(|left, right| right.0.cmp(&left.0));
|
||||
candidates
|
||||
.into_iter()
|
||||
.find_map(|(_, relative_path)| load_image_as_data_url(&version_path.join(relative_path)))
|
||||
}
|
||||
|
||||
fn icon_candidates_from_object(map: &serde_json::Map<String, Value>) -> Vec<(u32, String)> {
|
||||
map.iter()
|
||||
.filter_map(|(size, value)| {
|
||||
value.as_str().map(|path| {
|
||||
let parsed_size = size.parse::<u32>().unwrap_or(0);
|
||||
(parsed_size, path.to_string())
|
||||
})
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn scan_bookmarks_for_profile(
|
||||
profile_path: &Path,
|
||||
profile_id: &str,
|
||||
bookmarks: &mut BTreeMap<String, TempBookmark>,
|
||||
) {
|
||||
let bookmarks_path = profile_path.join("Bookmarks");
|
||||
let Some(document) = read_json_file(&bookmarks_path) else {
|
||||
return;
|
||||
};
|
||||
|
||||
let Some(roots) = document.get("roots").and_then(Value::as_object) else {
|
||||
return;
|
||||
};
|
||||
|
||||
for root in roots.values() {
|
||||
collect_bookmarks(root, profile_id, bookmarks);
|
||||
}
|
||||
}
|
||||
|
||||
fn collect_bookmarks(
|
||||
node: &Value,
|
||||
profile_id: &str,
|
||||
bookmarks: &mut BTreeMap<String, TempBookmark>,
|
||||
) {
|
||||
match node.get("type").and_then(Value::as_str) {
|
||||
Some("url") => {
|
||||
let Some(url) = node.get("url").and_then(Value::as_str) else {
|
||||
return;
|
||||
};
|
||||
if url.is_empty() {
|
||||
return;
|
||||
}
|
||||
|
||||
let title = node
|
||||
.get("name")
|
||||
.and_then(Value::as_str)
|
||||
.filter(|value| !value.is_empty())
|
||||
.unwrap_or(url)
|
||||
.to_string();
|
||||
|
||||
let entry = bookmarks
|
||||
.entry(url.to_string())
|
||||
.or_insert_with(|| TempBookmark {
|
||||
url: url.to_string(),
|
||||
title: title.clone(),
|
||||
profile_ids: BTreeSet::new(),
|
||||
});
|
||||
|
||||
if entry.title == entry.url && title != url {
|
||||
entry.title = title;
|
||||
}
|
||||
entry.profile_ids.insert(profile_id.to_string());
|
||||
}
|
||||
Some("folder") => {
|
||||
if let Some(children) = node.get("children").and_then(Value::as_array) {
|
||||
for child in children {
|
||||
collect_bookmarks(child, profile_id, bookmarks);
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
fn pick_latest_subdirectory(root: &Path) -> Option<PathBuf> {
|
||||
let entries = fs::read_dir(root).ok()?;
|
||||
let mut candidates = entries
|
||||
.flatten()
|
||||
.filter_map(|entry| {
|
||||
let file_type = entry.file_type().ok()?;
|
||||
if !file_type.is_dir() {
|
||||
return None;
|
||||
}
|
||||
let metadata = entry.metadata().ok()?;
|
||||
let modified = metadata.modified().ok();
|
||||
Some((
|
||||
modified,
|
||||
entry.file_name().to_string_lossy().to_string(),
|
||||
entry.path(),
|
||||
))
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
candidates.sort_by(|left, right| right.0.cmp(&left.0).then_with(|| right.1.cmp(&left.1)));
|
||||
candidates.into_iter().next().map(|(_, _, path)| path)
|
||||
}
|
||||
|
||||
fn load_image_as_data_url(path: &Path) -> Option<String> {
|
||||
let bytes = fs::read(path).ok()?;
|
||||
let extension = path
|
||||
.extension()
|
||||
.and_then(|value| value.to_str())
|
||||
.map(|value| value.to_ascii_lowercase())?;
|
||||
let mime_type = match extension.as_str() {
|
||||
"png" => "image/png",
|
||||
"jpg" | "jpeg" => "image/jpeg",
|
||||
"webp" => "image/webp",
|
||||
"gif" => "image/gif",
|
||||
"svg" => "image/svg+xml",
|
||||
_ => return None,
|
||||
};
|
||||
|
||||
Some(format!(
|
||||
"data:{mime_type};base64,{}",
|
||||
STANDARD.encode(bytes)
|
||||
))
|
||||
}
|
||||
|
||||
fn read_json_file(path: &Path) -> Option<Value> {
|
||||
let content = fs::read_to_string(path).ok()?;
|
||||
serde_json::from_str(&content).ok()
|
||||
}
|
||||
|
||||
fn first_non_empty<'a>(values: impl IntoIterator<Item = Option<&'a str>>) -> Option<&'a str> {
|
||||
values
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.find(|value| !value.trim().is_empty())
|
||||
}
|
||||
|
||||
fn sort_profiles(mut profiles: Vec<ProfileSummary>) -> Vec<ProfileSummary> {
|
||||
profiles.sort_by(|left, right| profile_sort_key(&left.id).cmp(&profile_sort_key(&right.id)));
|
||||
profiles
|
||||
}
|
||||
|
||||
fn profile_sort_key(profile_id: &str) -> (u8, u32, String) {
|
||||
if profile_id == "Default" {
|
||||
return (0, 0, profile_id.to_string());
|
||||
}
|
||||
|
||||
if let Some(number) = profile_id
|
||||
.strip_prefix("Profile ")
|
||||
.and_then(|value| value.parse::<u32>().ok())
|
||||
{
|
||||
return (1, number, profile_id.to_string());
|
||||
}
|
||||
|
||||
(2, u32::MAX, profile_id.to_string())
|
||||
}
|
||||
|
||||
fn sort_extensions(mut extensions: Vec<ExtensionSummary>) -> Vec<ExtensionSummary> {
|
||||
extensions.sort_by(|left, right| {
|
||||
left.name
|
||||
.to_lowercase()
|
||||
.cmp(&right.name.to_lowercase())
|
||||
.then_with(|| left.id.cmp(&right.id))
|
||||
});
|
||||
extensions
|
||||
}
|
||||
|
||||
fn sort_bookmarks(mut bookmarks: Vec<BookmarkSummary>) -> Vec<BookmarkSummary> {
|
||||
bookmarks.sort_by(|left, right| {
|
||||
left.title
|
||||
.to_lowercase()
|
||||
.cmp(&right.title.to_lowercase())
|
||||
.then_with(|| left.url.cmp(&right.url))
|
||||
});
|
||||
bookmarks
|
||||
}
|
||||
6
src-tauri/src/main.rs
Normal file
@@ -0,0 +1,6 @@
|
||||
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
fn main() {
|
||||
chrom_tool_lib::run()
|
||||
}
|
||||
37
src-tauri/tauri.conf.json
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "chrom-tool",
|
||||
"version": "0.1.0",
|
||||
"identifier": "top.volan.chrom-tool",
|
||||
"build": {
|
||||
"beforeDevCommand": "pnpm dev",
|
||||
"devUrl": "http://localhost:1420",
|
||||
"beforeBuildCommand": "pnpm build",
|
||||
"frontendDist": "../dist"
|
||||
},
|
||||
"app": {
|
||||
"windows": [
|
||||
{
|
||||
"title": "Browser Assistant",
|
||||
"width": 1400,
|
||||
"height": 900,
|
||||
"minWidth": 1100,
|
||||
"minHeight": 720
|
||||
}
|
||||
],
|
||||
"security": {
|
||||
"csp": null
|
||||
}
|
||||
},
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"targets": "all",
|
||||
"icon": [
|
||||
"icons/32x32.png",
|
||||
"icons/128x128.png",
|
||||
"icons/128x128@2x.png",
|
||||
"icons/icon.icns",
|
||||
"icons/icon.ico"
|
||||
]
|
||||
}
|
||||
}
|
||||
328
src/App.vue
Normal file
@@ -0,0 +1,328 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref, watch } from "vue";
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
|
||||
type BrowserStats = {
|
||||
profileCount: number;
|
||||
extensionCount: number;
|
||||
bookmarkCount: number;
|
||||
};
|
||||
|
||||
type ProfileSummary = {
|
||||
id: string;
|
||||
name: string;
|
||||
email: string | null;
|
||||
avatarDataUrl: string | null;
|
||||
avatarLabel: string;
|
||||
path: string;
|
||||
};
|
||||
|
||||
type ExtensionSummary = {
|
||||
id: string;
|
||||
name: string;
|
||||
version: string | null;
|
||||
iconDataUrl: string | null;
|
||||
profileIds: string[];
|
||||
};
|
||||
|
||||
type BookmarkSummary = {
|
||||
url: string;
|
||||
title: string;
|
||||
profileIds: string[];
|
||||
};
|
||||
|
||||
type BrowserView = {
|
||||
browserId: string;
|
||||
browserName: string;
|
||||
dataRoot: string;
|
||||
profiles: ProfileSummary[];
|
||||
extensions: ExtensionSummary[];
|
||||
bookmarks: BookmarkSummary[];
|
||||
stats: BrowserStats;
|
||||
};
|
||||
|
||||
type ScanResponse = {
|
||||
browsers: BrowserView[];
|
||||
};
|
||||
|
||||
const loading = ref(true);
|
||||
const error = ref("");
|
||||
const response = ref<ScanResponse>({ browsers: [] });
|
||||
const selectedBrowserId = ref("");
|
||||
|
||||
const browsers = computed(() => response.value.browsers);
|
||||
const currentBrowser = computed(() =>
|
||||
browsers.value.find((browser) => browser.browserId === selectedBrowserId.value) ??
|
||||
browsers.value[0] ??
|
||||
null,
|
||||
);
|
||||
|
||||
watch(
|
||||
browsers,
|
||||
(items) => {
|
||||
if (!items.length) {
|
||||
selectedBrowserId.value = "";
|
||||
return;
|
||||
}
|
||||
const hasSelected = items.some(
|
||||
(browser) => browser.browserId === selectedBrowserId.value,
|
||||
);
|
||||
if (!hasSelected) {
|
||||
selectedBrowserId.value = items[0].browserId;
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
async function scanBrowsers() {
|
||||
loading.value = true;
|
||||
error.value = "";
|
||||
|
||||
try {
|
||||
response.value = await invoke<ScanResponse>("scan_browsers");
|
||||
} catch (scanError) {
|
||||
error.value =
|
||||
scanError instanceof Error
|
||||
? scanError.message
|
||||
: "Failed to scan browser data.";
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function browserMonogram(browserId: string) {
|
||||
if (browserId === "chrome") return "CH";
|
||||
if (browserId === "edge") return "ED";
|
||||
if (browserId === "brave") return "BR";
|
||||
return browserId.slice(0, 2).toUpperCase();
|
||||
}
|
||||
|
||||
function extensionMonogram(name: string) {
|
||||
return name.trim().slice(0, 1).toUpperCase() || "?";
|
||||
}
|
||||
|
||||
function domainFromUrl(url: string) {
|
||||
try {
|
||||
return new URL(url).hostname;
|
||||
} catch {
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
void scanBrowsers();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="app-shell">
|
||||
<aside class="sidebar">
|
||||
<div class="sidebar-header">
|
||||
<p class="eyebrow">Desktop Utility</p>
|
||||
<h1>Browser Assistant</h1>
|
||||
<p class="sidebar-copy">
|
||||
Scan local Chromium profiles, extensions, and bookmarks in one place.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<button class="refresh-button" type="button" @click="scanBrowsers">
|
||||
{{ loading ? "Scanning..." : "Refresh Data" }}
|
||||
</button>
|
||||
|
||||
<div v-if="browsers.length" class="browser-nav">
|
||||
<button
|
||||
v-for="browser in browsers"
|
||||
:key="browser.browserId"
|
||||
class="browser-nav-item"
|
||||
:class="[browser.browserId, { active: browser.browserId === currentBrowser?.browserId }]"
|
||||
type="button"
|
||||
@click="selectedBrowserId = browser.browserId"
|
||||
>
|
||||
<div class="browser-nav-icon">{{ browserMonogram(browser.browserId) }}</div>
|
||||
<div class="browser-nav-body">
|
||||
<strong>{{ browser.browserName }}</strong>
|
||||
<span>
|
||||
{{ browser.stats.profileCount }} profiles ·
|
||||
{{ browser.stats.extensionCount }} extensions ·
|
||||
{{ browser.stats.bookmarkCount }} bookmarks
|
||||
</span>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-else class="sidebar-empty">
|
||||
<p>No supported Chromium browser data was found yet.</p>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<main class="content-panel">
|
||||
<section v-if="loading" class="state-panel">
|
||||
<p class="eyebrow">Scanning</p>
|
||||
<h2>Reading local browser data</h2>
|
||||
<p>Profiles, installed extensions, and bookmarks are being collected.</p>
|
||||
</section>
|
||||
|
||||
<section v-else-if="error" class="state-panel error">
|
||||
<p class="eyebrow">Error</p>
|
||||
<h2>Scan failed</h2>
|
||||
<p>{{ error }}</p>
|
||||
</section>
|
||||
|
||||
<template v-else-if="currentBrowser">
|
||||
<header class="hero-card" :class="currentBrowser.browserId">
|
||||
<div class="hero-main">
|
||||
<p class="eyebrow">Current Browser</p>
|
||||
<h2>{{ currentBrowser.browserName }}</h2>
|
||||
<p class="hero-copy">
|
||||
Local data root: <span>{{ currentBrowser.dataRoot }}</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class="hero-stats">
|
||||
<div class="stat-card">
|
||||
<span>Profiles</span>
|
||||
<strong>{{ currentBrowser.stats.profileCount }}</strong>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<span>Extensions</span>
|
||||
<strong>{{ currentBrowser.stats.extensionCount }}</strong>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<span>Bookmarks</span>
|
||||
<strong>{{ currentBrowser.stats.bookmarkCount }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section class="content-section">
|
||||
<div class="section-heading">
|
||||
<div>
|
||||
<p class="eyebrow">Profiles</p>
|
||||
<h3>User Profiles</h3>
|
||||
</div>
|
||||
<span class="count-pill">{{ currentBrowser.profiles.length }}</span>
|
||||
</div>
|
||||
|
||||
<div v-if="currentBrowser.profiles.length" class="profile-grid">
|
||||
<article
|
||||
v-for="profile in currentBrowser.profiles"
|
||||
:key="profile.id"
|
||||
class="profile-card"
|
||||
>
|
||||
<div class="profile-avatar">
|
||||
<img
|
||||
v-if="profile.avatarDataUrl"
|
||||
:src="profile.avatarDataUrl"
|
||||
:alt="`${profile.name} avatar`"
|
||||
/>
|
||||
<span v-else>{{ profile.avatarLabel }}</span>
|
||||
</div>
|
||||
<div class="profile-body">
|
||||
<div class="profile-topline">
|
||||
<h4>{{ profile.name }}</h4>
|
||||
<span class="badge neutral">{{ profile.id }}</span>
|
||||
</div>
|
||||
<p class="profile-email">{{ profile.email || "No email found" }}</p>
|
||||
<p class="profile-path" :title="profile.path">{{ profile.path }}</p>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
<div v-else class="empty-card">
|
||||
<p>No profile directories were found for this browser.</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="content-section">
|
||||
<div class="section-heading">
|
||||
<div>
|
||||
<p class="eyebrow">Extensions</p>
|
||||
<h3>Installed Extensions</h3>
|
||||
</div>
|
||||
<span class="count-pill">{{ currentBrowser.extensions.length }}</span>
|
||||
</div>
|
||||
|
||||
<div v-if="currentBrowser.extensions.length" class="extension-grid">
|
||||
<article
|
||||
v-for="extension in currentBrowser.extensions"
|
||||
:key="extension.id"
|
||||
class="extension-card"
|
||||
>
|
||||
<div class="extension-icon">
|
||||
<img
|
||||
v-if="extension.iconDataUrl"
|
||||
:src="extension.iconDataUrl"
|
||||
:alt="`${extension.name} icon`"
|
||||
/>
|
||||
<span v-else>{{ extensionMonogram(extension.name) }}</span>
|
||||
</div>
|
||||
<div class="extension-body">
|
||||
<div class="extension-topline">
|
||||
<h4>{{ extension.name }}</h4>
|
||||
<span v-if="extension.version" class="badge neutral">
|
||||
v{{ extension.version }}
|
||||
</span>
|
||||
</div>
|
||||
<p class="meta-line">{{ extension.id }}</p>
|
||||
<div class="badge-row">
|
||||
<span
|
||||
v-for="profileId in extension.profileIds"
|
||||
:key="`${extension.id}-${profileId}`"
|
||||
class="badge"
|
||||
>
|
||||
{{ profileId }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
<div v-else class="empty-card">
|
||||
<p>No extensions were discovered for this browser.</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="content-section">
|
||||
<div class="section-heading">
|
||||
<div>
|
||||
<p class="eyebrow">Bookmarks</p>
|
||||
<h3>Saved Bookmarks</h3>
|
||||
</div>
|
||||
<span class="count-pill">{{ currentBrowser.bookmarks.length }}</span>
|
||||
</div>
|
||||
|
||||
<div v-if="currentBrowser.bookmarks.length" class="bookmark-list">
|
||||
<article
|
||||
v-for="bookmark in currentBrowser.bookmarks"
|
||||
:key="bookmark.url"
|
||||
class="bookmark-card"
|
||||
>
|
||||
<div class="bookmark-body">
|
||||
<div class="bookmark-topline">
|
||||
<h4>{{ bookmark.title }}</h4>
|
||||
<span class="badge neutral">{{ domainFromUrl(bookmark.url) }}</span>
|
||||
</div>
|
||||
<p class="bookmark-url" :title="bookmark.url">{{ bookmark.url }}</p>
|
||||
<div class="badge-row">
|
||||
<span
|
||||
v-for="profileId in bookmark.profileIds"
|
||||
:key="`${bookmark.url}-${profileId}`"
|
||||
class="badge"
|
||||
>
|
||||
{{ profileId }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
<div v-else class="empty-card">
|
||||
<p>No bookmarks were discovered for this browser.</p>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<section v-else class="state-panel">
|
||||
<p class="eyebrow">No Data</p>
|
||||
<h2>No supported browser was detected</h2>
|
||||
<p>Install or sign in to Chrome, Edge, or Brave and refresh the scan.</p>
|
||||
</section>
|
||||
</main>
|
||||
</div>
|
||||
</template>
|
||||
1
src/assets/vue.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 496 B |
5
src/main.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { createApp } from "vue";
|
||||
import App from "./App.vue";
|
||||
import "./styles.css";
|
||||
|
||||
createApp(App).mount("#app");
|
||||
503
src/styles.css
Normal file
@@ -0,0 +1,503 @@
|
||||
:root {
|
||||
color: #15202b;
|
||||
background:
|
||||
radial-gradient(circle at top left, rgba(108, 145, 255, 0.16), transparent 32%),
|
||||
radial-gradient(circle at top right, rgba(16, 185, 129, 0.14), transparent 24%),
|
||||
linear-gradient(180deg, #f5f8fc 0%, #edf2f7 100%);
|
||||
font-family:
|
||||
"Segoe UI Variable Text",
|
||||
"Segoe UI",
|
||||
"PingFang SC",
|
||||
"Microsoft YaHei UI",
|
||||
sans-serif;
|
||||
font-synthesis: none;
|
||||
text-rendering: optimizeLegibility;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
--panel: rgba(255, 255, 255, 0.76);
|
||||
--panel-strong: rgba(255, 255, 255, 0.94);
|
||||
--panel-border: rgba(148, 163, 184, 0.18);
|
||||
--shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
|
||||
--text: #0f172a;
|
||||
--muted: #526277;
|
||||
--muted-soft: #7b8aa2;
|
||||
--badge-bg: rgba(226, 232, 240, 0.7);
|
||||
--badge-text: #344256;
|
||||
--accent: #2f6fed;
|
||||
--accent-soft: rgba(47, 111, 237, 0.12);
|
||||
--chrome: #2563eb;
|
||||
--edge: #0891b2;
|
||||
--brave: #ea580c;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html,
|
||||
body,
|
||||
#app {
|
||||
margin: 0;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
min-height: 100vh;
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
button,
|
||||
input,
|
||||
textarea,
|
||||
select {
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
button {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.app-shell {
|
||||
display: grid;
|
||||
grid-template-columns: 320px minmax(0, 1fr);
|
||||
min-height: 100vh;
|
||||
padding: 24px;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.sidebar,
|
||||
.content-panel {
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 18px;
|
||||
padding: 28px 22px;
|
||||
border: 1px solid var(--panel-border);
|
||||
border-radius: 28px;
|
||||
background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.7));
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
.sidebar-header h1,
|
||||
.hero-main h2,
|
||||
.section-heading h3,
|
||||
.state-panel h2,
|
||||
.profile-topline h4,
|
||||
.extension-topline h4,
|
||||
.bookmark-topline h4 {
|
||||
margin: 0;
|
||||
font-weight: 600;
|
||||
letter-spacing: -0.03em;
|
||||
}
|
||||
|
||||
.sidebar-header h1 {
|
||||
font-size: 2rem;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.sidebar-copy,
|
||||
.hero-copy,
|
||||
.state-panel p,
|
||||
.meta-line,
|
||||
.profile-email,
|
||||
.profile-path,
|
||||
.bookmark-url,
|
||||
.browser-nav-body span,
|
||||
.sidebar-empty p {
|
||||
margin: 0;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.eyebrow {
|
||||
margin: 0 0 8px;
|
||||
color: var(--muted-soft);
|
||||
font-size: 0.76rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.18em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.refresh-button {
|
||||
padding: 13px 16px;
|
||||
border-radius: 18px;
|
||||
background: linear-gradient(135deg, #10213f 0%, #213f75 100%);
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
transition:
|
||||
transform 160ms ease,
|
||||
box-shadow 160ms ease;
|
||||
box-shadow: 0 16px 30px rgba(20, 44, 82, 0.22);
|
||||
}
|
||||
|
||||
.refresh-button:hover {
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.browser-nav {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.browser-nav-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
width: 100%;
|
||||
padding: 14px;
|
||||
border-radius: 20px;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
background: rgba(255, 255, 255, 0.54);
|
||||
border: 1px solid transparent;
|
||||
transition:
|
||||
transform 160ms ease,
|
||||
border-color 160ms ease,
|
||||
background 160ms ease;
|
||||
}
|
||||
|
||||
.browser-nav-item:hover {
|
||||
transform: translateY(-1px);
|
||||
border-color: var(--panel-border);
|
||||
}
|
||||
|
||||
.browser-nav-item.active {
|
||||
background: var(--accent-soft);
|
||||
border-color: rgba(47, 111, 237, 0.18);
|
||||
}
|
||||
|
||||
.browser-nav-item.chrome.active {
|
||||
background: rgba(37, 99, 235, 0.12);
|
||||
}
|
||||
|
||||
.browser-nav-item.edge.active {
|
||||
background: rgba(8, 145, 178, 0.12);
|
||||
}
|
||||
|
||||
.browser-nav-item.brave.active {
|
||||
background: rgba(234, 88, 12, 0.12);
|
||||
}
|
||||
|
||||
.browser-nav-icon,
|
||||
.profile-avatar,
|
||||
.extension-icon {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
flex-shrink: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.browser-nav-icon {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 16px;
|
||||
color: #fff;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.08em;
|
||||
background: linear-gradient(135deg, #10213f, #365f9f);
|
||||
}
|
||||
|
||||
.browser-nav-item.chrome .browser-nav-icon,
|
||||
.hero-card.chrome {
|
||||
--accent: var(--chrome);
|
||||
}
|
||||
|
||||
.browser-nav-item.edge .browser-nav-icon,
|
||||
.hero-card.edge {
|
||||
--accent: var(--edge);
|
||||
}
|
||||
|
||||
.browser-nav-item.brave .browser-nav-icon,
|
||||
.hero-card.brave {
|
||||
--accent: var(--brave);
|
||||
}
|
||||
|
||||
.browser-nav-item.chrome .browser-nav-icon {
|
||||
background: linear-gradient(135deg, #2563eb, #22c55e);
|
||||
}
|
||||
|
||||
.browser-nav-item.edge .browser-nav-icon {
|
||||
background: linear-gradient(135deg, #0f766e, #38bdf8);
|
||||
}
|
||||
|
||||
.browser-nav-item.brave .browser-nav-icon {
|
||||
background: linear-gradient(135deg, #c2410c, #fb923c);
|
||||
}
|
||||
|
||||
.browser-nav-body {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.browser-nav-body strong,
|
||||
.stat-card strong {
|
||||
display: block;
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.browser-nav-body span {
|
||||
display: block;
|
||||
margin-top: 4px;
|
||||
font-size: 0.88rem;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.sidebar-empty {
|
||||
padding: 18px;
|
||||
border-radius: 18px;
|
||||
background: rgba(255, 255, 255, 0.58);
|
||||
border: 1px dashed rgba(148, 163, 184, 0.35);
|
||||
}
|
||||
|
||||
.content-panel {
|
||||
padding: 12px 6px 12px 0;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.hero-card,
|
||||
.content-section,
|
||||
.state-panel {
|
||||
border: 1px solid var(--panel-border);
|
||||
border-radius: 28px;
|
||||
background: var(--panel);
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
.hero-card {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 24px;
|
||||
padding: 28px;
|
||||
background:
|
||||
linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.72)),
|
||||
linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, white), rgba(255, 255, 255, 0));
|
||||
}
|
||||
|
||||
.hero-copy span {
|
||||
color: var(--text);
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.hero-stats {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(120px, 1fr));
|
||||
gap: 14px;
|
||||
width: min(460px, 100%);
|
||||
}
|
||||
|
||||
.stat-card {
|
||||
padding: 18px;
|
||||
border-radius: 22px;
|
||||
background: rgba(255, 255, 255, 0.72);
|
||||
border: 1px solid rgba(148, 163, 184, 0.18);
|
||||
}
|
||||
|
||||
.stat-card span {
|
||||
display: block;
|
||||
color: var(--muted-soft);
|
||||
font-size: 0.84rem;
|
||||
}
|
||||
|
||||
.stat-card strong {
|
||||
margin-top: 10px;
|
||||
font-size: 2rem;
|
||||
letter-spacing: -0.05em;
|
||||
}
|
||||
|
||||
.content-section {
|
||||
margin-top: 20px;
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.section-heading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.count-pill,
|
||||
.badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 999px;
|
||||
background: var(--accent-soft);
|
||||
color: var(--accent);
|
||||
font-size: 0.82rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.count-pill {
|
||||
min-width: 44px;
|
||||
padding: 8px 12px;
|
||||
}
|
||||
|
||||
.badge {
|
||||
padding: 6px 10px;
|
||||
}
|
||||
|
||||
.badge.neutral {
|
||||
background: var(--badge-bg);
|
||||
color: var(--badge-text);
|
||||
}
|
||||
|
||||
.profile-grid,
|
||||
.extension-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.profile-card,
|
||||
.extension-card,
|
||||
.bookmark-card,
|
||||
.empty-card {
|
||||
border-radius: 24px;
|
||||
padding: 18px;
|
||||
border: 1px solid rgba(148, 163, 184, 0.18);
|
||||
background: var(--panel-strong);
|
||||
}
|
||||
|
||||
.profile-card,
|
||||
.extension-card,
|
||||
.bookmark-card {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.profile-avatar {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
border-radius: 20px;
|
||||
background: linear-gradient(135deg, #dbeafe, #eff6ff);
|
||||
color: #1d4ed8;
|
||||
font-size: 1.1rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.profile-avatar img,
|
||||
.extension-icon img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.profile-body,
|
||||
.extension-body,
|
||||
.bookmark-body {
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.profile-topline,
|
||||
.extension-topline,
|
||||
.bookmark-topline {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.profile-topline h4,
|
||||
.extension-topline h4,
|
||||
.bookmark-topline h4 {
|
||||
font-size: 1rem;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.profile-email,
|
||||
.profile-path,
|
||||
.meta-line,
|
||||
.bookmark-url {
|
||||
margin-top: 8px;
|
||||
font-size: 0.92rem;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.extension-icon {
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
border-radius: 18px;
|
||||
background: linear-gradient(135deg, #e2e8f0, #f8fafc);
|
||||
color: #475569;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.badge-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.bookmark-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.state-panel,
|
||||
.empty-card {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.state-panel {
|
||||
min-height: 320px;
|
||||
place-content: center;
|
||||
padding: 36px;
|
||||
}
|
||||
|
||||
.state-panel.error {
|
||||
background: linear-gradient(180deg, rgba(254, 242, 242, 0.92), rgba(255, 255, 255, 0.86));
|
||||
}
|
||||
|
||||
@media (max-width: 1180px) {
|
||||
.app-shell {
|
||||
grid-template-columns: 1fr;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.content-panel {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.hero-card {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.hero-stats {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.hero-stats {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.profile-grid,
|
||||
.extension-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.profile-card,
|
||||
.extension-card,
|
||||
.bookmark-card {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.profile-avatar,
|
||||
.extension-icon {
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
}
|
||||
}
|
||||
7
src/vite-env.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
declare module "*.vue" {
|
||||
import type { DefineComponent } from "vue";
|
||||
const component: DefineComponent<{}, {}, any>;
|
||||
export default component;
|
||||
}
|
||||
25
tsconfig.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2020",
|
||||
"useDefineForClassFields": true,
|
||||
"module": "ESNext",
|
||||
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"jsx": "preserve",
|
||||
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
|
||||
"references": [{ "path": "./tsconfig.node.json" }]
|
||||
}
|
||||
10
tsconfig.node.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"skipLibCheck": true,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"allowSyntheticDefaultImports": true
|
||||
},
|
||||
"include": ["vite.config.ts"]
|
||||
}
|
||||
32
vite.config.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { defineConfig } from "vite";
|
||||
import vue from "@vitejs/plugin-vue";
|
||||
|
||||
// @ts-expect-error process is a nodejs global
|
||||
const host = process.env.TAURI_DEV_HOST;
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig(async () => ({
|
||||
plugins: [vue()],
|
||||
|
||||
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
|
||||
//
|
||||
// 1. prevent Vite from obscuring rust errors
|
||||
clearScreen: false,
|
||||
// 2. tauri expects a fixed port, fail if that port is not available
|
||||
server: {
|
||||
port: 1420,
|
||||
strictPort: true,
|
||||
host: host || false,
|
||||
hmr: host
|
||||
? {
|
||||
protocol: "ws",
|
||||
host,
|
||||
port: 1421,
|
||||
}
|
||||
: undefined,
|
||||
watch: {
|
||||
// 3. tell Vite to ignore watching `src-tauri`
|
||||
ignored: ["**/src-tauri/**"],
|
||||
},
|
||||
},
|
||||
}));
|
||||