mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-12-02 13:04:08 +01:00
Better data key for window
This commit is contained in:
1 parent
52937c3097
commit
c0dbe46318
5 files changed
+37
-9
No files matched your search
@@ -22,10 +22,24 @@ export async function deleteToken(ctx: Context, contextId: string) {
|
||||
return ctx.store.delete(tokenStoreKey(contextId));
|
||||
}
|
||||
|
||||
export async function resetDataDirKey(ctx: Context, contextId: string) {
|
||||
const key = new Date().toISOString();
|
||||
return ctx.store.set<string>(dataDirStoreKey(contextId), key);
|
||||
}
|
||||
|
||||
export async function getDataDirKey(ctx: Context, contextId: string) {
|
||||
const key = (await ctx.store.get<string>(dataDirStoreKey(contextId))) ?? 'default';
|
||||
return `${contextId}::${key}`;
|
||||
}
|
||||
|
||||
function tokenStoreKey(context_id: string) {
|
||||
return ['token', context_id].join('::');
|
||||
}
|
||||
|
||||
function dataDirStoreKey(context_id: string) {
|
||||
return ['data_dir', context_id].join('::');
|
||||
}
|
||||
|
||||
export interface AccessToken {
|
||||
response: AccessTokenRawResponse,
|
||||
expiresAt: number | null;
|
||||
|
||||
Reference in new issue
Block a user