File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,22 @@ import { authRedirect } from '~/utils/atproto/helpers'
55const handleInput = shallowRef (' ' )
66const route = useRoute ()
77const { user, logout } = useAtproto ()
8+ const { settings } = useSettings ()
9+
10+ // TODO probably need to work out some kind of hashing so it doesnt get -> post
11+ // TODO also need to figure out how to sync things like locale and theme
12+ watch (
13+ user ,
14+ async loggedInUser => {
15+ if (! loggedInUser ) return
16+
17+ const remote = await $fetch (' /api/auth/settings' )
18+ if (remote ) {
19+ Object .assign (settings .value , remote )
20+ }
21+ },
22+ { immediate: true },
23+ )
824
925// https://atproto.com supports 4 locales as of 2026-02-07
1026const { locale } = useI18n ()
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ const { settings } = useSettings()
55const { locale, locales, setLocale : setNuxti18nLocale } = useI18n ()
66const colorMode = useColorMode ()
77const { currentLocaleStatus, isSourceLocale } = useI18nStatus ()
8+ const { user } = useAtproto ()
89
910// Escape to go back (but not when focused on form elements or modal is open)
1011onKeyStroke (
@@ -34,7 +35,11 @@ defineOgImageComponent('Default', {
3435 primaryColor: ' #60a5fa' ,
3536})
3637
37- watch (settings .value , syncSettings )
38+ watch (settings .value , async () => {
39+ if (! user .value ) return
40+
41+ await syncSettings (settings .value )
42+ })
3843
3944const setLocale: typeof setNuxti18nLocale = locale => {
4045 settings .value .selectedLocale = locale
Original file line number Diff line number Diff line change 1- //Want to check the cooki login state, can be slightly more laxed?
2- //
3- export default defineEventHandler ( async _ => { } )
1+ import type { AppSettings } from '#shared/schemas/app-settings'
2+
3+ export default defineEventHandler ( async event => {
4+ // Current thinking is reads can just be a normal event handler and writes use the oauth
5+ const serverSession = await useServerSession ( event )
6+
7+ const storage = useStorage ( 'atproto:generic' )
8+ const storageKey = `settings:${ serverSession . data . public . did } `
9+ return storage . getItem < AppSettings > ( storageKey )
10+ } )
You can’t perform that action at this time.
0 commit comments