fix: enhance fingerprint token generation and improve error handling in console access updates

This commit is contained in:
Damodar Lohani
2026-02-26 04:50:13 +00:00
parent 657366d101
commit 736e6675fc
4 changed files with 24 additions and 5 deletions
+6 -1
View File
@@ -206,7 +206,12 @@ export async function generateFingerprintToken(): Promise<string> {
};
const payload = JSON.stringify(signals);
const encoded = btoa(unescape(encodeURIComponent(payload)));
const bytes = new TextEncoder().encode(payload);
let binary = '';
for (const byte of bytes) {
binary += String.fromCharCode(byte);
}
const encoded = btoa(binary);
if (!SECRET) {
return encoded;
@@ -120,7 +120,7 @@
<slot />
{#if isCloud && data.project?.status === 'paused'}
<PausedProjectModal show={true} projectId={data.project.$id} />
<PausedProjectModal show={true} projectId={data.project.$id} teamId={data.project.teamId} />
{/if}
<div class="layout-level-progress-bars">
@@ -118,7 +118,7 @@ export const load: LayoutLoad = async ({ params, depends, parent }) => {
projectId: params.project
});
})
.catch(() => {})
.catch((e) => console.error('Failed to update console access:', e))
.finally(() => {
delete sdk.forConsole.client.headers['X-Appwrite-Console-Fingerprint'];
});
@@ -1,7 +1,8 @@
<script lang="ts">
import { Button } from '$lib/elements/forms';
import { sdk } from '$lib/stores/sdk';
import { invalidate } from '$app/navigation';
import { goto, invalidate } from '$app/navigation';
import { resolve } from '$app/paths';
import { Dependencies } from '$lib/constants';
import { addNotification } from '$lib/stores/notifications';
import { Submit, trackError } from '$lib/actions/analytics';
@@ -10,10 +11,12 @@
let {
show = $bindable(false),
projectId
projectId,
teamId
}: {
show: boolean;
projectId: string;
teamId: string;
} = $props();
let loading = $state(false);
@@ -78,6 +81,17 @@
<svelte:fragment slot="footer">
<Layout.Stack direction="row" justifyContent="flex-end">
<Button
text
disabled={loading}
on:click={() =>
goto(
resolve('/(console)/organization-[organization]', {
organization: teamId
})
)}>
Cancel
</Button>
<Button disabled={loading} on:click={handleResume}>
{#if loading}
Resuming...