mirror of
https://github.com/zhom/donutbrowser.git
synced 2026-04-29 15:26:05 +02:00
feat: profile cloning
This commit is contained in:
@@ -488,6 +488,18 @@ export default function Home() {
|
||||
}
|
||||
}, []);
|
||||
|
||||
const handleCloneProfile = useCallback(async (profile: BrowserProfile) => {
|
||||
try {
|
||||
await invoke<BrowserProfile>("clone_profile", {
|
||||
profileId: profile.id,
|
||||
});
|
||||
} catch (err: unknown) {
|
||||
console.error("Failed to clone profile:", err);
|
||||
const errorMessage = err instanceof Error ? err.message : String(err);
|
||||
showErrorToast(`Failed to clone profile: ${errorMessage}`);
|
||||
}
|
||||
}, []);
|
||||
|
||||
const handleDeleteProfile = useCallback(async (profile: BrowserProfile) => {
|
||||
console.log("Attempting to delete profile:", profile.name);
|
||||
|
||||
@@ -876,6 +888,7 @@ export default function Home() {
|
||||
profiles={filteredProfiles}
|
||||
onLaunchProfile={launchProfile}
|
||||
onKillProfile={handleKillProfile}
|
||||
onCloneProfile={handleCloneProfile}
|
||||
onDeleteProfile={handleDeleteProfile}
|
||||
onRenameProfile={handleRenameProfile}
|
||||
onConfigureCamoufox={handleConfigureCamoufox}
|
||||
|
||||
@@ -159,6 +159,7 @@ type TableMeta = {
|
||||
// Overflow actions
|
||||
onAssignProfilesToGroup?: (profileIds: string[]) => void;
|
||||
onConfigureCamoufox?: (profile: BrowserProfile) => void;
|
||||
onCloneProfile?: (profile: BrowserProfile) => void;
|
||||
onCopyCookiesToProfile?: (profile: BrowserProfile) => void;
|
||||
|
||||
// Traffic snapshots (lightweight real-time data)
|
||||
@@ -672,6 +673,7 @@ interface ProfilesDataTableProps {
|
||||
profiles: BrowserProfile[];
|
||||
onLaunchProfile: (profile: BrowserProfile) => void | Promise<void>;
|
||||
onKillProfile: (profile: BrowserProfile) => void | Promise<void>;
|
||||
onCloneProfile: (profile: BrowserProfile) => void | Promise<void>;
|
||||
onDeleteProfile: (profile: BrowserProfile) => void | Promise<void>;
|
||||
onRenameProfile: (profileId: string, newName: string) => Promise<void>;
|
||||
onConfigureCamoufox: (profile: BrowserProfile) => void;
|
||||
@@ -695,6 +697,7 @@ export function ProfilesDataTable({
|
||||
profiles,
|
||||
onLaunchProfile,
|
||||
onKillProfile,
|
||||
onCloneProfile,
|
||||
onDeleteProfile,
|
||||
onRenameProfile,
|
||||
onConfigureCamoufox,
|
||||
@@ -1310,6 +1313,7 @@ export function ProfilesDataTable({
|
||||
|
||||
// Overflow actions
|
||||
onAssignProfilesToGroup,
|
||||
onCloneProfile,
|
||||
onConfigureCamoufox,
|
||||
onCopyCookiesToProfile,
|
||||
|
||||
@@ -1359,6 +1363,7 @@ export function ProfilesDataTable({
|
||||
onKillProfile,
|
||||
onLaunchProfile,
|
||||
onAssignProfilesToGroup,
|
||||
onCloneProfile,
|
||||
onConfigureCamoufox,
|
||||
onCopyCookiesToProfile,
|
||||
syncStatuses,
|
||||
@@ -1999,6 +2004,14 @@ export function ProfilesDataTable({
|
||||
Copy Cookies to Profile
|
||||
</DropdownMenuItem>
|
||||
)}
|
||||
<DropdownMenuItem
|
||||
onClick={() => {
|
||||
meta.onCloneProfile?.(profile);
|
||||
}}
|
||||
disabled={isDisabled}
|
||||
>
|
||||
Clone Profile
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
onClick={() => {
|
||||
setProfileToDelete(profile);
|
||||
|
||||
@@ -156,7 +156,8 @@
|
||||
"edit": "Edit",
|
||||
"delete": "Delete",
|
||||
"copyCookies": "Copy Cookies",
|
||||
"configure": "Configure"
|
||||
"configure": "Configure",
|
||||
"clone": "Clone Profile"
|
||||
}
|
||||
},
|
||||
"createProfile": {
|
||||
|
||||
@@ -156,7 +156,8 @@
|
||||
"edit": "Editar",
|
||||
"delete": "Eliminar",
|
||||
"copyCookies": "Copiar Cookies",
|
||||
"configure": "Configurar"
|
||||
"configure": "Configurar",
|
||||
"clone": "Clonar perfil"
|
||||
}
|
||||
},
|
||||
"createProfile": {
|
||||
|
||||
@@ -156,7 +156,8 @@
|
||||
"edit": "Modifier",
|
||||
"delete": "Supprimer",
|
||||
"copyCookies": "Copier les cookies",
|
||||
"configure": "Configurer"
|
||||
"configure": "Configurer",
|
||||
"clone": "Cloner le profil"
|
||||
}
|
||||
},
|
||||
"createProfile": {
|
||||
|
||||
@@ -156,7 +156,8 @@
|
||||
"edit": "編集",
|
||||
"delete": "削除",
|
||||
"copyCookies": "Cookieをコピー",
|
||||
"configure": "設定"
|
||||
"configure": "設定",
|
||||
"clone": "プロファイルを複製"
|
||||
}
|
||||
},
|
||||
"createProfile": {
|
||||
|
||||
@@ -156,7 +156,8 @@
|
||||
"edit": "Editar",
|
||||
"delete": "Excluir",
|
||||
"copyCookies": "Copiar Cookies",
|
||||
"configure": "Configurar"
|
||||
"configure": "Configurar",
|
||||
"clone": "Clonar perfil"
|
||||
}
|
||||
},
|
||||
"createProfile": {
|
||||
|
||||
@@ -156,7 +156,8 @@
|
||||
"edit": "Редактировать",
|
||||
"delete": "Удалить",
|
||||
"copyCookies": "Копировать Cookie",
|
||||
"configure": "Настроить"
|
||||
"configure": "Настроить",
|
||||
"clone": "Клонировать профиль"
|
||||
}
|
||||
},
|
||||
"createProfile": {
|
||||
|
||||
@@ -156,7 +156,8 @@
|
||||
"edit": "编辑",
|
||||
"delete": "删除",
|
||||
"copyCookies": "复制 Cookies",
|
||||
"configure": "配置"
|
||||
"configure": "配置",
|
||||
"clone": "克隆配置文件"
|
||||
}
|
||||
},
|
||||
"createProfile": {
|
||||
|
||||
Reference in New Issue
Block a user