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
did: undefined as Did | undefined
38
});
39
40
-
export async function initClient() {
41
user.isInitializing = true;
42
43
-
const clientId = dev
44
? `http://localhost` +
45
`?redirect_uri=${encodeURIComponent('http://127.0.0.1:5179' + REDIRECT_PATH)}` +
46
`&scope=${encodeURIComponent(metadata.scope)}`
···
53
}
54
});
55
0
0
0
0
0
0
0
56
configureOAuth({
57
metadata: {
58
-
client_id: clientId,
59
-
redirect_uri: dev ? 'http://127.0.0.1:5179' + REDIRECT_PATH : metadata.redirect_uris[0]
60
},
61
identityResolver: new LocalActorResolver({
62
handleResolver: handleResolver,
···
37
did: undefined as Did | undefined
38
});
39
40
+
export async function initClient(options?: { customDomain?: string }) {
41
user.isInitializing = true;
42
43
+
const client_id = dev
44
? `http://localhost` +
45
`?redirect_uri=${encodeURIComponent('http://127.0.0.1:5179' + REDIRECT_PATH)}` +
46
`&scope=${encodeURIComponent(metadata.scope)}`
···
53
}
54
});
55
56
+
const redirect_uri = dev ? 'http://127.0.0.1:5179' + REDIRECT_PATH : metadata.redirect_uris[0];
57
+
58
+
if (options?.customDomain) {
59
+
client_id.replace('blento.app', options.customDomain);
60
+
redirect_uri.replace('blento.app', options.customDomain);
61
+
}
62
+
63
configureOAuth({
64
metadata: {
65
+
client_id,
66
+
redirect_uri
67
},
68
identityResolver: new LocalActorResolver({
69
handleResolver: handleResolver,
+5
src/routes/+layout.server.ts
···
0
0
0
0
0
···
1
+
export async function load({ platform, request }) {
2
+
const customDomain = request.headers.get('X-Custom-Domain')?.toLocaleLowerCase();
3
+
4
+
return { customDomain };
5
+
}
+2
-2
src/routes/+layout.svelte
···
9
import { goto } from '$app/navigation';
10
import LoginModal from '$lib/atproto/UI/LoginModal.svelte';
11
12
-
let { children } = $props();
13
14
const errorMessages: Record<string, (params: URLSearchParams) => string> = {
15
handle_not_found: (p) => `Handle ${p.get('handle') ?? ''} not found!`
16
};
17
18
onMount(() => {
19
-
initClient();
20
21
const error = page.url.searchParams.get('error');
22
if (error) {
···
9
import { goto } from '$app/navigation';
10
import LoginModal from '$lib/atproto/UI/LoginModal.svelte';
11
12
+
let { children, data } = $props();
13
14
const errorMessages: Record<string, (params: URLSearchParams) => string> = {
15
handle_not_found: (p) => `Handle ${p.get('handle') ?? ''} not found!`
16
};
17
18
onMount(() => {
19
+
initClient({ customDomain: data.customDomain });
20
21
const error = page.url.searchParams.get('error');
22
if (error) {