Skip to content

Commit

Permalink
Added "Export configuration" button in Misc tab
Browse files Browse the repository at this point in the history
  • Loading branch information
OrigamingWasTaken committed Oct 6, 2024
1 parent a66cb8b commit 98d2f9a
Showing 1 changed file with 35 additions and 4 deletions.
39 changes: 35 additions & 4 deletions frontend/src/windows/main/pages/Misc.svelte
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<script lang="ts">
import * as AlertDialog from '$lib/components/ui/alert-dialog/index.js';
import { os } from '@neutralinojs/lib';
import { Trash2, List } from 'lucide-svelte';
import { version } from '@root/package.json';
import { FileArchive, FolderCog, FolderOpen, List, Trash2 } from 'lucide-svelte';
import path from 'path-browserify';
import { toast } from 'svelte-sonner';
import { clearLogs, disableConsoleRedirection, enableConsoleRedirection } from '../ts/debugging';
import { SettingsPanelBuilder, getConfigPath } from '../components/settings';
import Panel from '../components/settings/panel.svelte';
import shellFS from '../ts/tools/shellfs';
import { clearLogs, disableConsoleRedirection, enableConsoleRedirection } from '../ts/debugging';
import Roblox from '../ts/roblox';
import shellFS from '../ts/tools/shellfs';
export let render = true;
Expand Down Expand Up @@ -39,6 +40,23 @@
case 'open_roblox_folder':
shellFS.open(path.join(Roblox.path, 'Contents'), { reveal: true });
break;
case 'export_config':
const configPath = await getConfigPath();
const logPath = path.join(path.dirname(configPath), 'appleblox.log');
const exportPath = await os.showFolderDialog('Where do you want to save the file?', {
defaultPath: path.join(await os.getEnv('HOME'), 'Desktop'),
});
if (!exportPath || exportPath.length < 1) return; // User canceled
const archivePath = path.join(exportPath, `abloxconfig-${version}.zip`);
if (await shellFS.exists(archivePath)) {
await shellFS.remove(archivePath);
}
await shellFS.zip(archivePath, [path.basename(logPath), path.basename(configPath)], {
recursive: true,
cwd: path.dirname(configPath),
});
await shellFS.open(archivePath, { reveal: true });
break;
}
}
Expand Down Expand Up @@ -73,7 +91,7 @@
.addSwitch({
label: 'Redirect logs to file',
description:
'Redirect every console.log(), etc... to the logs. Useful for finding bugs and errors (Recommended: ON)',
'Redirect every console.log(), etc... to the logs file. (Recommended: ON)',
id: 'redirect_console',
default: true,
})
Expand All @@ -91,17 +109,30 @@
variant: 'destructive',
icon: { component: Trash2 },
})
.addButton({
label: 'Export configuration',
description: 'Exports your logs and config folder as an archive',
id: 'export_config',
variant: 'secondary',
icon: { component: FileArchive },
})
.addButton({
label: 'Open AppleBlox folder',
description: 'Opens the AppleBlox folder in Finder',
id: 'open_folder',
variant: 'outline',
icon: {
component: FolderCog,
},
})
.addButton({
label: 'Open Roblox app folder',
description: 'Opens the Roblox.app folder in Finder',
id: 'open_roblox_folder',
variant: 'outline',
icon: {
component: FolderOpen,
},
})
)
.build();
Expand Down

0 comments on commit 98d2f9a

Please sign in to comment.