Skip to content

Commit 9d96e99

Browse files
committed
fix: allow UTF-8 characters
This changes the encoding to only use encode/decodeURIComponent so non-latin1 characters work. Fixes #17
1 parent 27b359d commit 9d96e99

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/App.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,12 @@ export const App = () => {
5353
new URLSearchParams(window.location.search).get('hidePastSessions') !== null
5454

5555
if (hash) {
56+
const payload = decodeURIComponent(hash)
5657
cfg = {
5758
...cfg,
58-
...JSON.parse(atob(decodeURIComponent(hash))),
59+
...JSON.parse(
60+
payload.substr(0, 3) === 'v2:' ? payload.substr(3) : atob(payload),
61+
),
5962
}
6063
console.log(cfg)
6164
}
@@ -89,7 +92,7 @@ export const App = () => {
8992
window.location.assign(
9093
`${
9194
new URL(document.location.href).origin
92-
}#${encodeURIComponent(btoa(JSON.stringify(cfg)))}`,
95+
}#${encodeURIComponent(`v2:${JSON.stringify(cfg)}`)}`,
9396
)
9497
setEditing(false)
9598
}}
@@ -181,7 +184,7 @@ export const App = () => {
181184
<a
182185
href={`${
183186
new URL(document.location.href).origin
184-
}?schedule=${encodeURIComponent(btoa(JSON.stringify(cfg)))}`}
187+
}?schedule=${encodeURIComponent(`v2:${JSON.stringify(cfg)}`)}`}
185188
>
186189
this URL
187190
</a>{' '}

0 commit comments

Comments
 (0)