fix: correct Memos links and author identities
This commit is contained in:
+6
-1
@@ -22,7 +22,12 @@ export async function getMemosIdentity(baseUrl: string, token: string) {
|
||||
if (!user.name) throw new Error("Memos did not return an account identity");
|
||||
return user;
|
||||
}
|
||||
export function memoUrl(baseUrl: string, memoName: string) { const id = memoName.split("/").at(-1); return id ? `${baseUrl.replace(/\/$/, "")}/m/${encodeURIComponent(id)}` : null; }
|
||||
export function memoUrl(baseUrl: string, memoName: string) {
|
||||
const id = memoName.split("/").at(-1);
|
||||
if (!id) return null;
|
||||
const path = /^\d+$/.test(id) ? `m/${encodeURIComponent(id)}` : `memos/${encodeURIComponent(id)}`;
|
||||
return `${baseUrl.replace(/\/$/, "")}/${path}`;
|
||||
}
|
||||
export type MemosPage = { memos: MemosMemo[]; nextPageToken: string };
|
||||
export async function listMemos(baseUrl: string, token: string, rules: MemosSyncRules = {}, page: { pageToken?: string; pageSize?: number } = {}): Promise<MemosPage> {
|
||||
let pageToken = page.pageToken || "";
|
||||
|
||||
Reference in New Issue
Block a user