diff --git a/plug-api/silverbullet-syscall/space.ts b/plug-api/silverbullet-syscall/space.ts index 5c9a53d..93ea135 100644 --- a/plug-api/silverbullet-syscall/space.ts +++ b/plug-api/silverbullet-syscall/space.ts @@ -42,7 +42,7 @@ export function getAttachmentMeta(name: string): Promise { */ export function readAttachment( name: string, -): Promise<{ data: Uint8Array; meta: AttachmentMeta }> { +): Promise { return syscall("space.readAttachment", name); } diff --git a/plugs/share/publish.ts b/plugs/share/publish.ts index c21812a..b7f776c 100644 --- a/plugs/share/publish.ts +++ b/plugs/share/publish.ts @@ -31,6 +31,9 @@ export async function publishCommand() { } async function publish(pageName: string, uris: string[]) { + if (!Array.isArray(uris)) { + uris = [uris]; + } for (const uri of uris) { const publisher = uri.split(":")[0]; const results = await events.dispatchEvent( diff --git a/web/space.ts b/web/space.ts index 6186b90..f8ed909 100644 --- a/web/space.ts +++ b/web/space.ts @@ -17,9 +17,8 @@ export type SpaceEvents = { const pageWatchInterval = 5000; export class Space extends EventEmitter { - pageMetaCache = new Map(); - imageHeightCache: Record = {}; + pageMetaCache = new Map(); debouncedCacheFlush = throttle(() => { this.kvStore.set("imageHeightCache", this.imageHeightCache).catch( @@ -168,16 +167,21 @@ export class Space extends EventEmitter { } } + // We're listing all pages that don't start with a _ + isListedPageName(name: string): boolean { + return name.endsWith(".md") && !name.startsWith("_"); + } + async fetchPageList(): Promise { return (await this.spacePrimitives.fetchFileList()) - .filter((fileMeta) => fileMeta.name.endsWith(".md")) + .filter((fileMeta) => this.isListedPageName(fileMeta.name)) .map(fileMetaToPageMeta); } async fetchAttachmentList(): Promise { return (await this.spacePrimitives.fetchFileList()).filter( (fileMeta) => - !fileMeta.name.endsWith(".md") && + !this.isListedPageName(fileMeta.name) && !fileMeta.name.endsWith(".plug.js"), ); }