Skip to content

Commit

Permalink
frontend: resolve CSP issues and fix settings saving problem
Browse files Browse the repository at this point in the history
  • Loading branch information
xTVaser committed Jul 22, 2023
1 parent a181890 commit cb81c40
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src-tauri/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ impl LauncherConfig {
if let Some(features) = &mut game_config.features {
features
.texture_packs
.retain(|pack| cleanup_list.contains(pack));
.retain(|pack| !cleanup_list.contains(pack));
self.save_config()?;
}
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ fn main() {
//
// This allows us to avoid hacky globals, and pass around information (in this case, the config)
// to the relevant places
let mut config = tokio::sync::Mutex::new(config::LauncherConfig::load_config(
let config = tokio::sync::Mutex::new(config::LauncherConfig::load_config(
app.path_resolver().app_config_dir(),
));
app.manage(config);
Expand Down
5 changes: 1 addition & 4 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@
"visible": true,
"focus": true
}
],
"security": {
"csp": "default-src 'self'; img-src 'self' asset: https://asset.localhost"
}
]
}
}
14 changes: 9 additions & 5 deletions src/components/games/features/texture-packs/TexturePacks.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,15 @@
{/if}
<!-- Buttons -->
<div class="mt-2 flex flex-row gap-2">
<Toggle
bind:checked={pack.enabled}
class="m-0"
color="orange"
/>
<Button
size={"xs"}
color={pack.enabled ? "green" : "red"}
on:click={() => {
pack.enabled = !pack.enabled;
}}
>
{pack.enabled ? "Enabled" : "Disabled"}
</Button>
</div>
<div class="mt-2 flex flex-row gap-2">
{#if pack.enabled}
Expand Down

0 comments on commit cb81c40

Please sign in to comment.