tangled
alpha
login
or
join now
owdproject.org
/
module-atproto-persistence
1
fork
atom
Pinia Persistent Storage via AT Protocol for Open Web Desktop
1
fork
atom
overview
issues
pulls
pipelines
refactor: Update to nuxt-atproto 0.0.4
dxlliv
10 months ago
dbea8338
ed4bb97c
+8
-5
2 changed files
expand all
collapse all
unified
split
runtime
plugin.ts
utils
utilAtprotoApplicationStates.ts
+6
-4
runtime/plugin.ts
···
2
2
import { deepEqual } from '@owdproject/core/runtime/utils/utilCommon'
3
3
import { defineNuxtPlugin, useRuntimeConfig } from 'nuxt/app'
4
4
import { toRaw } from 'vue'
5
5
-
import { usePinia, useRouter, useAtproto } from '#imports'
5
5
+
import { usePinia, useRouter, useAtproto, useAgent } from '#imports'
6
6
7
7
import localforage from 'localforage/src/localforage.js'
8
8
import {
···
56
56
57
57
const atprotoTargetRecord = parseAtprotoStoreKey(piniaKey)
58
58
59
59
-
if (!atprotoTargetRecord || !atproto.agent.account) {
59
59
+
if (!atprotoTargetRecord || !atproto.isLogged()) {
60
60
return piniaValue
61
61
}
62
62
···
66
66
return piniaValue
67
67
}
68
68
69
69
+
const agent = useAgent('private')
70
70
+
69
71
return putAtprotoApplicationState(
70
70
-
atproto.agent.account,
71
71
-
atproto.agent.account.assertDid,
72
72
+
agent,
73
73
+
agent.assertDid,
72
74
collection,
73
75
rkey,
74
76
JSON.parse(piniaValue),
+2
-1
runtime/utils/utilAtprotoApplicationStates.ts
···
60
60
61
61
export function putAtprotoApplicationState(
62
62
agent: any,
63
63
+
repo: string,
63
64
collection: string,
64
65
rkey: string,
65
66
record: any,
66
67
) {
67
68
return agent.com.atproto.repo.putRecord({
68
68
-
repo: agent?.assertDid as string,
69
69
+
repo,
69
70
collection,
70
71
rkey,
71
72
record,