···747475756. (optionally) set your base in `svelte.config.js` (e.g. for github pages: `base: '/your-repo-name/'`) while keeping it as `''` in development.
76767777-7877```ts
7978const config = {
8079 // ...
···939294937. setup the correct permissions (see below)
95949696-9795## how to use
98969997### set permissions you request on sign-in in `$lib/atproto/settings.ts` (see commented out examples for more info)
1009810199- add collections to the collections array
102102-- add rpcs to rpcCalls
100100+- rpcs for authenticated proxied requests
103101- blobs for uploading blobs
104102105103### change sign up pds
···152150 }
153151});
154152```
153153+154154+## todo
155155+156156+- check if pds supports prompt=create
157157+- add lexicon stuff
···77 deleteStoredSession
88} from '@atcute/oauth-browser-client';
99import { AppBskyActorDefs } from '@atcute/bluesky';
1010-import type { ActorIdentifier, Did } from '@atcute/lexicons';
1110import {
1211 CompositeDidDocumentResolver,
1312 CompositeHandleResolver,
···2524import { metadata } from './metadata';
2625import { getDetailedProfile } from './methods';
2726import { signUpPDS } from './settings';
2727+2828+import type { ActorIdentifier, Did } from '@atcute/lexicons';
28292930export const user = $state({
3031 agent: null as OAuthUserAgent | null,
···11export const SITE = 'https://flo-bit.dev';
2233-// optionally add action=create/update/delete to only allow those actions for a collection
44-export const collections: string[] = ['xyz.statusphere.status'];
55-// example: only allow create and delete
66-// export const collections: string[] = ['xyz.statusphere.status?action=create&action=update'];
33+type Permissions = {
44+ collections: readonly string[];
55+ rpc: Record<string, string | string[]>;
66+ blobs: readonly string[];
77+};
7888-export const rpcCalls: Record<string, string | string[]> = {
99+export const permissions = {
1010+ // collections you can create/delete/update
1111+1212+ // example: only allow create and delete
1313+ // collections: ['xyz.statusphere.status?action=create&action=update'],
1414+ collections: ['xyz.statusphere.status'],
1515+1616+ // what types of authenticated proxied requests you can make to services
1717+918 // example: allow authenticated proxying to bsky appview to get a users liked posts
1010- //'did:web:api.bsky.app#bsky_appview': ['app.bsky.feed.getActorLikes']
1111- // https://docs.bsky.app/docs/api/app-bsky-feed-get-actor-likes
1212-};
1919+ //rpc: {'did:web:api.bsky.app#bsky_appview': ['app.bsky.feed.getActorLikes']}
2020+ rpc: {},
13211414-export const blobs = [] as string | string[] | undefined;
2222+ // what types of blobs you can upload to a users PDS
15231616-// example: allowing video and html uploads
1717-// export const blobs = ['video/*', 'text/html'] as string | string[] | undefined;
2424+ // example: allowing video and html uploads
2525+ // blobs: ['video/*', 'text/html']
2626+ // example: allowing all blob types
2727+ // blobs: ['*/*']
2828+ blobs: ['hello']
2929+} as const satisfies Permissions;
18301919-// example: allowing all blob types
2020-// export const blobs = ['*/*'] as string | string[] | undefined;
3131+// Extract base collection name (before any query params)
3232+type ExtractCollectionBase<T extends string> = T extends `${infer Base}?${string}` ? Base : T;
3333+3434+export type AllowedCollection = ExtractCollectionBase<(typeof permissions.collections)[number]>;
21352236// which PDS to use for signup
2337// ATTENTION: pds.rip is only for development, all accounts get deleted automatically after a week