mirror of
https://github.com/zhom/donutbrowser.git
synced 2026-06-07 23:43:57 +02:00
chore: formatting
This commit is contained in:
@@ -410,7 +410,10 @@ async fn update_profile(
|
|||||||
|
|
||||||
// Update profile fields
|
// Update profile fields
|
||||||
if let Some(new_name) = request.name {
|
if let Some(new_name) = request.name {
|
||||||
if profile_manager.rename_profile(&state.app_handle, &name, &new_name).is_err() {
|
if profile_manager
|
||||||
|
.rename_profile(&state.app_handle, &name, &new_name)
|
||||||
|
.is_err()
|
||||||
|
{
|
||||||
return Err(StatusCode::BAD_REQUEST);
|
return Err(StatusCode::BAD_REQUEST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -461,7 +464,10 @@ async fn update_profile(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let Some(tags) = request.tags {
|
if let Some(tags) = request.tags {
|
||||||
if profile_manager.update_profile_tags(&state.app_handle, &name, tags).is_err() {
|
if profile_manager
|
||||||
|
.update_profile_tags(&state.app_handle, &name, tags)
|
||||||
|
.is_err()
|
||||||
|
{
|
||||||
return Err(StatusCode::BAD_REQUEST);
|
return Err(StatusCode::BAD_REQUEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -635,7 +641,11 @@ async fn create_proxy(
|
|||||||
// Convert JSON value to ProxySettings
|
// Convert JSON value to ProxySettings
|
||||||
match serde_json::from_value(request.proxy_settings.clone()) {
|
match serde_json::from_value(request.proxy_settings.clone()) {
|
||||||
Ok(proxy_settings) => {
|
Ok(proxy_settings) => {
|
||||||
match PROXY_MANAGER.create_stored_proxy(&state.app_handle, request.name.clone(), proxy_settings) {
|
match PROXY_MANAGER.create_stored_proxy(
|
||||||
|
&state.app_handle,
|
||||||
|
request.name.clone(),
|
||||||
|
proxy_settings,
|
||||||
|
) {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
// Find the created proxy to return it
|
// Find the created proxy to return it
|
||||||
let proxies = PROXY_MANAGER.get_stored_proxies();
|
let proxies = PROXY_MANAGER.get_stored_proxies();
|
||||||
|
|||||||
@@ -909,7 +909,11 @@ impl BrowserRunner {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn delete_profile(&self, app_handle: tauri::AppHandle, profile_id: &str) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn delete_profile(
|
||||||
|
&self,
|
||||||
|
app_handle: tauri::AppHandle,
|
||||||
|
profile_id: &str,
|
||||||
|
) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let profile_manager = ProfileManager::instance();
|
let profile_manager = ProfileManager::instance();
|
||||||
profile_manager.delete_profile(&app_handle, profile_id)?;
|
profile_manager.delete_profile(&app_handle, profile_id)?;
|
||||||
|
|
||||||
@@ -2009,7 +2013,10 @@ pub fn rename_profile(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub async fn delete_profile(app_handle: tauri::AppHandle, profile_id: String) -> Result<(), String> {
|
pub async fn delete_profile(
|
||||||
|
app_handle: tauri::AppHandle,
|
||||||
|
profile_id: String,
|
||||||
|
) -> Result<(), String> {
|
||||||
let browser_runner = BrowserRunner::instance();
|
let browser_runner = BrowserRunner::instance();
|
||||||
browser_runner
|
browser_runner
|
||||||
.delete_profile(app_handle, &profile_id)
|
.delete_profile(app_handle, &profile_id)
|
||||||
|
|||||||
@@ -257,7 +257,10 @@ pub async fn get_groups_with_profile_counts() -> Result<Vec<GroupWithCount>, Str
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub async fn create_profile_group(app_handle: tauri::AppHandle, name: String) -> Result<ProfileGroup, String> {
|
pub async fn create_profile_group(
|
||||||
|
app_handle: tauri::AppHandle,
|
||||||
|
name: String,
|
||||||
|
) -> Result<ProfileGroup, String> {
|
||||||
let group_manager = GROUP_MANAGER.lock().unwrap();
|
let group_manager = GROUP_MANAGER.lock().unwrap();
|
||||||
group_manager
|
group_manager
|
||||||
.create_group(&app_handle, name)
|
.create_group(&app_handle, name)
|
||||||
@@ -265,7 +268,11 @@ pub async fn create_profile_group(app_handle: tauri::AppHandle, name: String) ->
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub async fn update_profile_group(app_handle: tauri::AppHandle, group_id: String, name: String) -> Result<ProfileGroup, String> {
|
pub async fn update_profile_group(
|
||||||
|
app_handle: tauri::AppHandle,
|
||||||
|
group_id: String,
|
||||||
|
name: String,
|
||||||
|
) -> Result<ProfileGroup, String> {
|
||||||
let group_manager = GROUP_MANAGER.lock().unwrap();
|
let group_manager = GROUP_MANAGER.lock().unwrap();
|
||||||
group_manager
|
group_manager
|
||||||
.update_group(&app_handle, group_id, name)
|
.update_group(&app_handle, group_id, name)
|
||||||
@@ -273,7 +280,10 @@ pub async fn update_profile_group(app_handle: tauri::AppHandle, group_id: String
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub async fn delete_profile_group(app_handle: tauri::AppHandle, group_id: String) -> Result<(), String> {
|
pub async fn delete_profile_group(
|
||||||
|
app_handle: tauri::AppHandle,
|
||||||
|
group_id: String,
|
||||||
|
) -> Result<(), String> {
|
||||||
let group_manager = GROUP_MANAGER.lock().unwrap();
|
let group_manager = GROUP_MANAGER.lock().unwrap();
|
||||||
group_manager
|
group_manager
|
||||||
.delete_group(&app_handle, group_id)
|
.delete_group(&app_handle, group_id)
|
||||||
|
|||||||
@@ -546,7 +546,9 @@ impl ProfileManager {
|
|||||||
})?;
|
})?;
|
||||||
|
|
||||||
// Check if the browser is currently running using the comprehensive status check
|
// Check if the browser is currently running using the comprehensive status check
|
||||||
let is_running = self.check_browser_status(app_handle.clone(), &profile).await?;
|
let is_running = self
|
||||||
|
.check_browser_status(app_handle.clone(), &profile)
|
||||||
|
.await?;
|
||||||
|
|
||||||
if is_running {
|
if is_running {
|
||||||
return Err(
|
return Err(
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ use std::collections::HashMap;
|
|||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
use tauri_plugin_shell::ShellExt;
|
|
||||||
use tauri::Emitter;
|
use tauri::Emitter;
|
||||||
|
use tauri_plugin_shell::ShellExt;
|
||||||
|
|
||||||
use crate::browser::ProxySettings;
|
use crate::browser::ProxySettings;
|
||||||
|
|
||||||
@@ -243,7 +243,11 @@ impl ProxyManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete a stored proxy
|
// Delete a stored proxy
|
||||||
pub fn delete_stored_proxy(&self, app_handle: &tauri::AppHandle, proxy_id: &str) -> Result<(), String> {
|
pub fn delete_stored_proxy(
|
||||||
|
&self,
|
||||||
|
app_handle: &tauri::AppHandle,
|
||||||
|
proxy_id: &str,
|
||||||
|
) -> Result<(), String> {
|
||||||
{
|
{
|
||||||
let mut stored_proxies = self.stored_proxies.lock().unwrap();
|
let mut stored_proxies = self.stored_proxies.lock().unwrap();
|
||||||
if stored_proxies.remove(proxy_id).is_none() {
|
if stored_proxies.remove(proxy_id).is_none() {
|
||||||
|
|||||||
+15
-5
@@ -62,11 +62,7 @@ export default function Home() {
|
|||||||
error: groupsError,
|
error: groupsError,
|
||||||
} = useGroupEvents();
|
} = useGroupEvents();
|
||||||
|
|
||||||
const {
|
const { isLoading: proxiesLoading, error: proxiesError } = useProxyEvents();
|
||||||
storedProxies,
|
|
||||||
isLoading: proxiesLoading,
|
|
||||||
error: proxiesError,
|
|
||||||
} = useProxyEvents();
|
|
||||||
|
|
||||||
const [createProfileDialogOpen, setCreateProfileDialogOpen] = useState(false);
|
const [createProfileDialogOpen, setCreateProfileDialogOpen] = useState(false);
|
||||||
const [settingsDialogOpen, setSettingsDialogOpen] = useState(false);
|
const [settingsDialogOpen, setSettingsDialogOpen] = useState(false);
|
||||||
@@ -274,6 +270,20 @@ export default function Home() {
|
|||||||
}
|
}
|
||||||
}, [profilesError]);
|
}, [profilesError]);
|
||||||
|
|
||||||
|
// Handle group errors from useGroupEvents hook
|
||||||
|
useEffect(() => {
|
||||||
|
if (groupsError) {
|
||||||
|
showErrorToast(groupsError);
|
||||||
|
}
|
||||||
|
}, [groupsError]);
|
||||||
|
|
||||||
|
// Handle proxy errors from useProxyEvents hook
|
||||||
|
useEffect(() => {
|
||||||
|
if (proxiesError) {
|
||||||
|
showErrorToast(proxiesError);
|
||||||
|
}
|
||||||
|
}, [proxiesError]);
|
||||||
|
|
||||||
const checkAllPermissions = useCallback(async () => {
|
const checkAllPermissions = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
// Wait for permissions to be initialized before checking
|
// Wait for permissions to be initialized before checking
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { invoke } from "@tauri-apps/api/core";
|
import { invoke } from "@tauri-apps/api/core";
|
||||||
import { emit, listen } from "@tauri-apps/api/event";
|
import { emit } from "@tauri-apps/api/event";
|
||||||
import { useCallback, useEffect, useState } from "react";
|
import { useCallback, useState } from "react";
|
||||||
import { FiEdit2, FiPlus, FiTrash2, FiWifi } from "react-icons/fi";
|
import { FiEdit2, FiPlus, FiTrash2, FiWifi } from "react-icons/fi";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { DeleteConfirmationDialog } from "@/components/delete-confirmation-dialog";
|
import { DeleteConfirmationDialog } from "@/components/delete-confirmation-dialog";
|
||||||
|
|||||||
Reference in New Issue
Block a user