Implement endpoint for getting recent directories

This commit is contained in:
Asher
2020-02-18 14:13:22 -06:00
parent 16bcf59cb0
commit 8793110941
6 changed files with 89 additions and 11 deletions

View File

@@ -90,14 +90,14 @@ export class MainHttpProvider extends HttpProvider {
}
public async getRoot(route: Route): Promise<HttpResponse> {
const recent = await this.api.recent()
const running = await this.api.running()
const apps = await this.api.installedApplications()
const response = await this.getUtf8Resource(this.rootPath, "src/browser/pages/home.html")
response.content = response.content
.replace(/{{COMMIT}}/g, this.options.commit)
.replace(/{{BASE}}/g, this.base(route))
.replace(/{{UPDATE:NAME}}/, await this.getUpdate())
.replace(/{{APP_LIST:RUNNING}}/, this.getAppRows(recent.running))
.replace(/{{APP_LIST:RUNNING}}/, this.getAppRows(running.applications))
.replace(
/{{APP_LIST:EDITORS}}/,
this.getAppRows(apps.filter((app) => app.categories && app.categories.includes("Editor"))),