Skip to content

Commit

Permalink
Encode (base64) window states object in url #4
Browse files Browse the repository at this point in the history
  • Loading branch information
Lev Z Király authored and Lev Z Király committed Nov 23, 2023
1 parent e26ad5e commit caa1d8f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions stores/use-windows-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,11 @@ export const useWindowsStore = defineStore("windows", () => {
await initializeScreen();
return;
}
const w = atob(route.query.w);

let windowStates: Array<WindowStateInferred>;
try {
windowStates = JSON.parse(route.query.w as string) as Array<WindowStateInferred>;
windowStates = JSON.parse(w) as Array<WindowStateInferred>;
} catch (e) {
toasts.addToast({
title: "RestoreState Error: JSON parse failed",
Expand Down Expand Up @@ -311,7 +312,7 @@ export const useWindowsStore = defineStore("windows", () => {
void navigateTo({
path: "/",
query: {
w: JSON.stringify(windowStates),
w: btoa(JSON.stringify(windowStates)),
a: arrangement.value,
},
});
Expand Down

0 comments on commit caa1d8f

Please sign in to comment.