Compare commits
3 Commits
6a61e36c21
...
0c77149c9e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c77149c9e | ||
|
|
91936aab19 | ||
|
|
5cd6210dd2 |
@@ -368,6 +368,19 @@ fn clean_directory_contents(path: &Path, filter_days: Option<u64>) -> (u64, u32,
|
|||||||
|
|
||||||
// --- 浏览器清理逻辑 ---
|
// --- 浏览器清理逻辑 ---
|
||||||
|
|
||||||
|
const BROWSER_CACHE_DIRS: &[&str] = &[
|
||||||
|
"Cache",
|
||||||
|
"Code Cache",
|
||||||
|
"GPUCache",
|
||||||
|
"Media Cache",
|
||||||
|
"Service Worker/CacheStorage",
|
||||||
|
"Service Worker/ScriptCache",
|
||||||
|
"GrShaderCache",
|
||||||
|
"DawnCache",
|
||||||
|
"File System",
|
||||||
|
"blob_storage"
|
||||||
|
];
|
||||||
|
|
||||||
#[derive(Serialize, Clone)]
|
#[derive(Serialize, Clone)]
|
||||||
pub struct BrowserProfile {
|
pub struct BrowserProfile {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
@@ -416,9 +429,8 @@ pub async fn run_browser_scan(browser: BrowserType) -> Result<BrowserScanResult,
|
|||||||
|
|
||||||
if profile_path.exists() {
|
if profile_path.exists() {
|
||||||
let mut size = 0;
|
let mut size = 0;
|
||||||
// 扫描常见的缓存目录
|
// 扫描配置的缓存目录
|
||||||
let cache_dirs = ["Cache", "Code Cache", "GPUCache", "Media Cache"];
|
for sub in BROWSER_CACHE_DIRS {
|
||||||
for sub in cache_dirs {
|
|
||||||
let target = profile_path.join(sub);
|
let target = profile_path.join(sub);
|
||||||
if target.exists() {
|
if target.exists() {
|
||||||
size += get_dir_size_simple(&target);
|
size += get_dir_size_simple(&target);
|
||||||
@@ -461,8 +473,8 @@ pub async fn run_browser_clean(browser: BrowserType, profile_paths: Vec<String>)
|
|||||||
for profile_dir in profile_paths {
|
for profile_dir in profile_paths {
|
||||||
let profile_path = user_data_path.join(&profile_dir);
|
let profile_path = user_data_path.join(&profile_dir);
|
||||||
if profile_path.exists() {
|
if profile_path.exists() {
|
||||||
let cache_dirs = ["Cache", "Code Cache", "GPUCache", "Media Cache"];
|
// 清理配置的缓存目录
|
||||||
for sub in cache_dirs {
|
for sub in BROWSER_CACHE_DIRS {
|
||||||
let target = profile_path.join(sub);
|
let target = profile_path.join(sub);
|
||||||
if target.exists() {
|
if target.exists() {
|
||||||
let (f, s, fl) = clean_directory_contents(&target, None);
|
let (f, s, fl) = clean_directory_contents(&target, None);
|
||||||
|
|||||||
48
src/App.vue
48
src/App.vue
@@ -212,6 +212,20 @@ async function runAdvancedTask(task: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// --- 浏览器清理逻辑 ---
|
// --- 浏览器清理逻辑 ---
|
||||||
|
function toggleAllProfiles(enabled: boolean) {
|
||||||
|
const s = activeTab.value === 'clean-browser-chrome' ? chromeState.value : edgeState.value;
|
||||||
|
if (s.scanResult) {
|
||||||
|
s.scanResult.profiles.forEach(p => p.enabled = enabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function invertProfiles() {
|
||||||
|
const s = activeTab.value === 'clean-browser-chrome' ? chromeState.value : edgeState.value;
|
||||||
|
if (s.scanResult) {
|
||||||
|
s.scanResult.profiles.forEach(p => p.enabled = !p.enabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function startBrowserScan(browser: 'chrome' | 'edge') {
|
async function startBrowserScan(browser: 'chrome' | 'edge') {
|
||||||
const s = browser === 'chrome' ? chromeState.value : edgeState.value;
|
const s = browser === 'chrome' ? chromeState.value : edgeState.value;
|
||||||
s.isScanning = true;
|
s.isScanning = true;
|
||||||
@@ -677,6 +691,11 @@ function splitSize(sizeStr: string | number) {
|
|||||||
<span class="stat-value">{{ chromeState.cleanResult.success_count }}</span>
|
<span class="stat-value">{{ chromeState.cleanResult.success_count }}</span>
|
||||||
<span class="stat-label">成功清理</span>
|
<span class="stat-label">成功清理</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="stat-divider"></div>
|
||||||
|
<div class="stat-item">
|
||||||
|
<span class="stat-value highlight-gray">{{ chromeState.cleanResult.fail_count }}</span>
|
||||||
|
<span class="stat-label">跳过/失败</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button class="btn-secondary" @click="resetPageState">返回</button>
|
<button class="btn-secondary" @click="resetPageState">返回</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -733,6 +752,11 @@ function splitSize(sizeStr: string | number) {
|
|||||||
<span class="stat-value">{{ edgeState.cleanResult.success_count }}</span>
|
<span class="stat-value">{{ edgeState.cleanResult.success_count }}</span>
|
||||||
<span class="stat-label">成功清理</span>
|
<span class="stat-label">成功清理</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="stat-divider"></div>
|
||||||
|
<div class="stat-item">
|
||||||
|
<span class="stat-value highlight-gray">{{ edgeState.cleanResult.fail_count }}</span>
|
||||||
|
<span class="stat-label">跳过/失败</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button class="btn-secondary" @click="resetPageState">返回</button>
|
<button class="btn-secondary" @click="resetPageState">返回</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -741,7 +765,14 @@ function splitSize(sizeStr: string | number) {
|
|||||||
|
|
||||||
<!-- 详情列表 -->
|
<!-- 详情列表 -->
|
||||||
<div class="detail-list" v-if="activeTab === 'clean-browser-chrome' ? (chromeState.isScanning || chromeState.scanResult) && !chromeState.isDone : (edgeState.isScanning || edgeState.scanResult) && !edgeState.isDone">
|
<div class="detail-list" v-if="activeTab === 'clean-browser-chrome' ? (chromeState.isScanning || chromeState.scanResult) && !chromeState.isDone : (edgeState.isScanning || edgeState.scanResult) && !edgeState.isDone">
|
||||||
|
<div class="list-header">
|
||||||
<h3>用户资料列表</h3>
|
<h3>用户资料列表</h3>
|
||||||
|
<div class="list-actions">
|
||||||
|
<button class="btn-text" @click="toggleAllProfiles(true)">全选</button>
|
||||||
|
<button class="btn-text" @click="toggleAllProfiles(false)">取消</button>
|
||||||
|
<button class="btn-text" @click="invertProfiles()">反选</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
class="detail-item"
|
class="detail-item"
|
||||||
v-for="profile in (activeTab === 'clean-browser-chrome' ? chromeState.scanResult?.profiles : edgeState.scanResult?.profiles) || []"
|
v-for="profile in (activeTab === 'clean-browser-chrome' ? chromeState.scanResult?.profiles : edgeState.scanResult?.profiles) || []"
|
||||||
@@ -1313,7 +1344,22 @@ body {
|
|||||||
margin-top: 40px;
|
margin-top: 40px;
|
||||||
border: 1px solid rgba(0,0,0,0.02);
|
border: 1px solid rgba(0,0,0,0.02);
|
||||||
}
|
}
|
||||||
.detail-list h3 { font-size: 18px; margin-bottom: 20px; font-weight: 700; color: var(--text-main); }
|
.list-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
|
||||||
|
.list-header h3 { font-size: 18px; margin-bottom: 0; font-weight: 700; color: var(--text-main); }
|
||||||
|
.list-actions { display: flex; gap: 8px; }
|
||||||
|
.btn-text {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
color: var(--primary-color);
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 6px 10px;
|
||||||
|
border-radius: 8px;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
.btn-text:hover { background-color: #F0F7FF; }
|
||||||
|
|
||||||
.detail-item {
|
.detail-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|||||||
Reference in New Issue
Block a user