Files
inpx-web/server/core/opds/RootPage.js
2022-11-23 14:38:23 +07:00

33 lines
805 B
JavaScript

const BasePage = require('./BasePage');
const AuthorPage = require('./AuthorPage');
class RootPage extends BasePage {
constructor(config) {
super(config);
this.id = 'root';
this.title = '';
this.authorPage = new AuthorPage(config);
}
async body(req) {
const result = {};
if (!this.title) {
const dbConfig = await this.webWorker.dbConfig();
const collection = dbConfig.inpxInfo.collection.split('\n');
this.title = collection[0].trim();
if (!this.title)
this.title = 'Неизвестная коллекция';
}
result.entry = [
this.authorPage.myEntry(),
];
return this.makeBody(result, req);
}
}
module.exports = RootPage;