tangled
alpha
login
or
join now
flo-bit.dev
/
blento
your personal website on atproto - mirror
blento.app
20
fork
atom
overview
issues
pulls
pipelines
fix client id
Florian
6 days ago
b55d35bc
654542f5
+18
-6
3 changed files
expand all
collapse all
unified
split
src
lib
atproto
auth.svelte.ts
routes
+layout.server.ts
+layout.svelte
+11
-4
src/lib/atproto/auth.svelte.ts
···
37
37
did: undefined as Did | undefined
38
38
});
39
39
40
40
-
export async function initClient() {
40
40
+
export async function initClient(options?: { customDomain?: string }) {
41
41
user.isInitializing = true;
42
42
43
43
-
const clientId = dev
43
43
+
const client_id = dev
44
44
? `http://localhost` +
45
45
`?redirect_uri=${encodeURIComponent('http://127.0.0.1:5179' + REDIRECT_PATH)}` +
46
46
`&scope=${encodeURIComponent(metadata.scope)}`
···
53
53
}
54
54
});
55
55
56
56
+
const redirect_uri = dev ? 'http://127.0.0.1:5179' + REDIRECT_PATH : metadata.redirect_uris[0];
57
57
+
58
58
+
if (options?.customDomain) {
59
59
+
client_id.replace('blento.app', options.customDomain);
60
60
+
redirect_uri.replace('blento.app', options.customDomain);
61
61
+
}
62
62
+
56
63
configureOAuth({
57
64
metadata: {
58
58
-
client_id: clientId,
59
59
-
redirect_uri: dev ? 'http://127.0.0.1:5179' + REDIRECT_PATH : metadata.redirect_uris[0]
65
65
+
client_id,
66
66
+
redirect_uri
60
67
},
61
68
identityResolver: new LocalActorResolver({
62
69
handleResolver: handleResolver,
+5
src/routes/+layout.server.ts
···
1
1
+
export async function load({ platform, request }) {
2
2
+
const customDomain = request.headers.get('X-Custom-Domain')?.toLocaleLowerCase();
3
3
+
4
4
+
return { customDomain };
5
5
+
}
+2
-2
src/routes/+layout.svelte
···
9
9
import { goto } from '$app/navigation';
10
10
import LoginModal from '$lib/atproto/UI/LoginModal.svelte';
11
11
12
12
-
let { children } = $props();
12
12
+
let { children, data } = $props();
13
13
14
14
const errorMessages: Record<string, (params: URLSearchParams) => string> = {
15
15
handle_not_found: (p) => `Handle ${p.get('handle') ?? ''} not found!`
16
16
};
17
17
18
18
onMount(() => {
19
19
-
initClient();
19
19
+
initClient({ customDomain: data.customDomain });
20
20
21
21
const error = page.url.searchParams.get('error');
22
22
if (error) {