2024-05-31 01:55:35 +08:00
|
|
|
import { space, system } from "$sb/syscalls.ts";
|
|
|
|
import { AttachmentMeta } from "$sb/types.ts";
|
2024-05-28 02:33:41 +08:00
|
|
|
import { indexObjects } from "./api.ts";
|
|
|
|
|
2024-05-31 01:55:35 +08:00
|
|
|
export async function indexAttachment(name: string) {
|
|
|
|
if (await system.getMode() === "ro") {
|
|
|
|
return;
|
2024-05-28 02:33:41 +08:00
|
|
|
}
|
2024-05-31 01:55:35 +08:00
|
|
|
const fileMeta = await space.getAttachmentMeta(name);
|
|
|
|
await indexObjects<AttachmentMeta>(fileMeta.name, [fileMeta]);
|
2024-05-28 02:33:41 +08:00
|
|
|
}
|