Исправление проблемы чтения каталога opds для koreader
This commit is contained in:
@@ -24,13 +24,18 @@ class BasePage {
|
|||||||
this.showDeleted = false;
|
this.showDeleted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
escape(s) {
|
||||||
|
//костыль для koreader, не понимает hex-экранирование вида '
|
||||||
|
return he.escape(s).replace(/'/g, ''').replace(/`/g, '`');
|
||||||
|
}
|
||||||
|
|
||||||
makeEntry(entry = {}) {
|
makeEntry(entry = {}) {
|
||||||
if (!entry.id)
|
if (!entry.id)
|
||||||
throw new Error('makeEntry: no id');
|
throw new Error('makeEntry: no id');
|
||||||
if (!entry.title)
|
if (!entry.title)
|
||||||
throw new Error('makeEntry: no title');
|
throw new Error('makeEntry: no title');
|
||||||
|
|
||||||
entry.title = he.escape(entry.title);
|
entry.title = this.escape(entry.title);
|
||||||
|
|
||||||
const result = {
|
const result = {
|
||||||
updated: (new Date()).toISOString().substring(0, 19) + 'Z',
|
updated: (new Date()).toISOString().substring(0, 19) + 'Z',
|
||||||
@@ -48,7 +53,7 @@ class BasePage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
makeLink(attrs) {
|
makeLink(attrs) {
|
||||||
attrs.href = he.escape(attrs.href);
|
attrs.href = this.escape(attrs.href);
|
||||||
return {'*ATTRS': attrs};
|
return {'*ATTRS': attrs};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const he = require('he');
|
|
||||||
const dayjs = require('dayjs');
|
const dayjs = require('dayjs');
|
||||||
|
|
||||||
const BasePage = require('./BasePage');
|
const BasePage = require('./BasePage');
|
||||||
@@ -190,7 +189,7 @@ class BookPage extends BasePage {
|
|||||||
if (content) {
|
if (content) {
|
||||||
e.content = {
|
e.content = {
|
||||||
'*ATTRS': {type: 'text/html'},
|
'*ATTRS': {type: 'text/html'},
|
||||||
'*TEXT': he.escape(content),
|
'*TEXT': this.escape(content),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
const he = require('he');
|
|
||||||
|
|
||||||
const BasePage = require('./BasePage');
|
const BasePage = require('./BasePage');
|
||||||
|
|
||||||
class SearchHelpPage extends BasePage {
|
class SearchHelpPage extends BasePage {
|
||||||
@@ -45,7 +43,7 @@ class SearchHelpPage extends BasePage {
|
|||||||
title: this.title,
|
title: this.title,
|
||||||
content: {
|
content: {
|
||||||
'*ATTRS': {type: 'text/html'},
|
'*ATTRS': {type: 'text/html'},
|
||||||
'*TEXT': he.escape(content),
|
'*TEXT': this.escape(content),
|
||||||
},
|
},
|
||||||
link: [
|
link: [
|
||||||
this.downLink({href: '/book/fake-link', type: `application/fb2+zip`})
|
this.downLink({href: '/book/fake-link', type: `application/fb2+zip`})
|
||||||
|
|||||||
Reference in New Issue
Block a user