Начата работа над opds
This commit is contained in:
30
server/core/opds/BasePage.js
Normal file
30
server/core/opds/BasePage.js
Normal file
@@ -0,0 +1,30 @@
|
||||
const XmlParser = require('../xml/XmlParser');
|
||||
|
||||
class BasePage {
|
||||
constructor(config) {
|
||||
this.config = config;
|
||||
|
||||
this.rootTag = 'feed';
|
||||
}
|
||||
|
||||
makeBody(content) {
|
||||
if (!this.id)
|
||||
throw new Error('makeBody: no id');
|
||||
|
||||
content.id = this.id;
|
||||
|
||||
const xml = new XmlParser();
|
||||
const xmlObject = {};
|
||||
xmlObject[this.rootTag] = content;
|
||||
|
||||
xml.fromObject(xmlObject);
|
||||
|
||||
return xml.toString({format: true});
|
||||
}
|
||||
|
||||
async body() {
|
||||
throw new Error('Body not implemented');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = BasePage;
|
||||
Reference in New Issue
Block a user