Skip to content

Commit 9e25d27

Browse files
author
Mauve Signweaver
committed
feat: show full site data in list
1 parent 8958235 commit 9e25d27

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

api/sites.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,9 @@ export const siteRoutes = (cfg: APIConfig, store: StoreI) => async (server: Fast
143143
})
144144

145145
if (cfg.useWebringDirectoryListing === true) {
146-
server.get<{ Reply: string[] }>('/sites', {
146+
server.get<{
147+
Reply: Array<Static<typeof Site>>
148+
}>('/sites', {
147149
schema: {
148150
description: 'Returns a list of all sites on the instance',
149151
tags: ['site'],

config/sites.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ export class SiteConfigStore extends Config<Static<typeof Site>> {
102102
return await this.db.get(id)
103103
}
104104

105-
async listAll (hidePrivate: boolean): Promise<string[]> {
105+
async listAll (hidePrivate: boolean): Promise<Array<Static<typeof Site>>> {
106106
const ids = await this.keys()
107+
const sites = await Promise.all(ids.map(async id => await this.get(id)))
107108
if (!hidePrivate) {
108-
return ids
109+
return sites
109110
} else {
110-
const sites = await Promise.all(ids.map(async id => await this.get(id)))
111-
return sites.filter(site => site.public).map(site => site.id)
111+
return sites.filter(site => site.public)
112112
}
113113
}
114114

0 commit comments

Comments
 (0)