Skip to content

Commit

Permalink
fix: sharex
Browse files Browse the repository at this point in the history
  • Loading branch information
MrExplode committed Nov 29, 2023
1 parent 4524e8a commit 340a1a2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/routes/dash/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,21 @@
export let data: PageData
$: info = data.profileData
function getToken() {
const value = `; ${document.cookie}`;
const parts = value.split(`token=`);
if (parts.length === 2) return parts.pop().split(';').shift();
return ''
}
</script>

<nav class="fixed bg-slate-800 w-full flex justify-between items-center mx-auto px-8 h-20">
<DashLogo />
<StorageUsage usedStorage={info.usedSpace} maxStorage={info.maxSpace} class="w-96 bg-slate-900" />
<Searchbar />
<Uploadbutton />
<a href="http://api.unideb.tech/profile/sharexConfig" target="_blank">
<a href={`http://api.unideb.tech/profile/sharexConfig?token=${getToken()}`} target="_blank">
<Button>
ShareX
</Button>
Expand Down
3 changes: 1 addition & 2 deletions src/routes/login/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ export const actions: Actions = {
return setError(form, 'username', error.message)
} else {
const result = data as LoginResponse
cookies.set('token', result.token, {})
await fetch(`https://api.unideb.tech/cookie?token=${result.token}`)
cookies.set('token', result.token, { httpOnly: false })
throw redirect(303, '/dash')
}
}
Expand Down

0 comments on commit 340a1a2

Please sign in to comment.