Fork of atp.tools as a universal profile for people on the ATmosphere
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

update qtprovider?

+18 -14
+18 -14
src/providers/qtprovider.tsx
··· 25 25 interface QtContextType { 26 26 client: QtClient; 27 27 currentAgent: OAuthUserAgent | null; 28 - accounts: `did:${string}`[]; 28 + accounts: `did:${string}:${string}`[]; 29 29 isManagementModalOpen: boolean; 30 30 openManagementModal: () => void; 31 31 closeManagementModal: () => void; ··· 45 45 export function QtProvider({ children }: { children: React.ReactNode }) { 46 46 const [client, setClient] = useState<QtClient | null>(null); 47 47 const [currentAgent, setCurrentAgent] = useState<OAuthUserAgent | null>(null); 48 - const [accounts, setAccounts] = useState<`did:${string}`[]>([]); 48 + const [accounts, setAccounts] = useState<`did:${string}:${string}`[]>([]); 49 49 const [isLoading, setIsLoading] = useState(true); 50 50 const [error, setError] = useState<Error | null>(null); 51 51 const [isManagementModalOpen, setIsManagementModalOpen] = useState(false); ··· 96 96 export class QtClient { 97 97 manager: CredentialManager; 98 98 rpc: XRPC; 99 - accounts: `did:${string}`[]; 99 + accounts: `did:${string}:${string}`[]; 100 100 currentAgent: OAuthUserAgent | null; 101 - currentAgentDid: `did:${string}` | null; 101 + currentAgentDid: `did:${string}:${string}` | null; 102 102 onStateChange?: ( 103 103 agent: OAuthUserAgent | null, 104 - accounts: `did:${string}`[], 104 + accounts: `did:${string}:${string}`[], 105 105 ) => void; 106 106 107 107 constructor(service: URL = new URL("https://bsky.social")) { ··· 110 110 this.accounts = 111 111 (JSON.parse( 112 112 localStorage.getItem("currentAccountList") as string, 113 - ) as `did:${string}`[]) || []; 113 + ) as `did:${string}:${string}`[]) || []; 114 114 this.currentAgent = null; 115 115 this.currentAgentDid = localStorage.getItem("currentAgentDid") as 116 - | `did:${string}` 116 + | `did:${string}:${string}` 117 117 | null; 118 118 119 119 // Only attempt to resume session if it's the default service ··· 161 161 console.log("Logging in as ", sess.info.sub); 162 162 const agent = new OAuthUserAgent(sess); 163 163 this.currentAgent = agent; 164 - this.currentAgentDid = agent.sub; 165 - if (!this.accounts.includes(agent.sub)) this.accounts.push(agent.sub); 164 + this.currentAgentDid = agent.sub as `did:${string}:${string}`; 165 + if (!this.accounts.includes(agent.sub as `did:${string}:${string}`)) 166 + this.accounts.push(agent.sub as `did:${string}:${string}`); 166 167 this.rpc = new XRPC({ handler: this.manager }); 167 168 this.updateState(); 168 169 console.log("Successfully logged in!"); ··· 192 193 } 193 194 } 194 195 195 - async switchAccount(did: `did:${string}`) { 196 + async switchAccount(did: `did:${string}:${string}`) { 196 197 let sess; 197 198 console.log("Switching account to", did); 198 199 try { ··· 227 228 } 228 229 const agent = new OAuthUserAgent(sess); 229 230 this.currentAgent = agent; 230 - this.currentAgentDid = agent.sub; 231 + this.currentAgentDid = agent.sub as `did:${string}:${string}`; 231 232 console.log(); 232 233 this.rpc = new XRPC({ handler: this.currentAgent }); 233 234 this.updateState(); 234 235 } 235 236 236 - async logout(did: `did:${string}`) { 237 - const currentDid = this.currentAgent?.sub; 237 + async logout(did: `did:${string}:${string}`) { 238 + const currentDid = this.currentAgent?.sub as `did:${string}:${string}`; 238 239 await this.switchAccount(did); 239 240 await this.currentAgent?.signOut(); 240 241 deleteStoredSession(did); ··· 249 250 } 250 251 } 251 252 252 - export async function resolveBskyUser(did: `did:${string}`, qt: QtContextType) { 253 + export async function resolveBskyUser( 254 + did: `did:${string}:${string}`, 255 + qt: QtContextType, 256 + ) { 253 257 const context = qt; 254 258 255 259 const cachedData = context.userCache.get(did);