7 Commits
1.5.1 ... 1.5.2

Author SHA1 Message Date
Book Pauk
0d52a9fd52 Merge branch 'release/1.5.2' 2023-02-05 17:50:52 +07:00
Book Pauk
08287deaa4 Версия 1.5.2 2023-02-05 17:50:26 +07:00
Book Pauk
c43c5520a4 Улучшена обработка ошибок 2023-02-05 17:48:02 +07:00
Book Pauk
4e2b7886a9 Мелкий рефакторинг 2023-02-05 17:43:24 +07:00
Book Pauk
05744e8472 CHANGELOG 2023-02-05 17:35:32 +07:00
Book Pauk
9126973378 Исправление проблемы чтения каталога opds для koreader 2023-02-05 17:35:24 +07:00
Book Pauk
018e1069d5 Merge tag '1.5.1' into develop
1.5.1
2023-01-28 21:21:18 +07:00
8 changed files with 20 additions and 14 deletions

View File

@@ -1,3 +1,7 @@
1.5.2 / 2023-02-05
- Исправление проблемы чтения каталога opds для koreader
1.5.1 / 2023-01-28
------------------

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "inpx-web",
"version": "1.5.1",
"version": "1.5.2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "inpx-web",
"version": "1.5.1",
"version": "1.5.2",
"hasInstallScript": true,
"license": "CC0-1.0",
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "inpx-web",
"version": "1.5.1",
"version": "1.5.2",
"author": "Book Pauk <bookpauk@gmail.com>",
"license": "CC0-1.0",
"repository": "bookpauk/inpx-web",

View File

@@ -24,13 +24,18 @@ class BasePage {
this.showDeleted = false;
}
escape(s) {
//костыль для koreader, не понимает hex-экранирование вида &#x27;
return he.escape(s).replace(/&#x27;/g, '&#39;').replace(/&#x60;/g, '&#96;');
}
makeEntry(entry = {}) {
if (!entry.id)
throw new Error('makeEntry: no id');
if (!entry.title)
throw new Error('makeEntry: no title');
entry.title = he.escape(entry.title);
entry.title = this.escape(entry.title);
const result = {
updated: (new Date()).toISOString().substring(0, 19) + 'Z',
@@ -48,7 +53,7 @@ class BasePage {
}
makeLink(attrs) {
attrs.href = he.escape(attrs.href);
attrs.href = this.escape(attrs.href);
return {'*ATTRS': attrs};
}

View File

@@ -1,6 +1,5 @@
const path = require('path');
const _ = require('lodash');
const he = require('he');
const dayjs = require('dayjs');
const BasePage = require('./BasePage');
@@ -190,7 +189,7 @@ class BookPage extends BasePage {
if (content) {
e.content = {
'*ATTRS': {type: 'text/html'},
'*TEXT': he.escape(content),
'*TEXT': this.escape(content),
};
}

View File

@@ -14,7 +14,7 @@ class GenrePage extends BasePage {
const query = {
from: req.query.from || 'search',
term: req.query.term || '*',
term: req.query.term || '',
section: req.query.section || '',
};

View File

@@ -1,5 +1,3 @@
const he = require('he');
const BasePage = require('./BasePage');
class SearchHelpPage extends BasePage {
@@ -45,7 +43,7 @@ class SearchHelpPage extends BasePage {
title: this.title,
content: {
'*ATTRS': {type: 'text/html'},
'*TEXT': he.escape(content),
'*TEXT': this.escape(content),
},
link: [
this.downLink({href: '/book/fake-link', type: `application/fb2+zip`})

View File

@@ -11,6 +11,8 @@ const OpensearchPage = require('./OpensearchPage');
const SearchPage = require('./SearchPage');
const SearchHelpPage = require('./SearchHelpPage');
const log = new (require('../AppLogger'))().log;//singleton
module.exports = function(app, config) {
if (!config.opds || !config.opds.enabled)
return;
@@ -63,10 +65,8 @@ module.exports = function(app, config) {
next();
}
} catch (e) {
log(LM_ERR, `OPDS: ${e.message}, url: ${req.originalUrl}`);
res.status(500).send({error: e.message});
if (config.branch == 'development') {
console.error({error: e.message, url: req.originalUrl});
}
}
};