Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d52a9fd52 | ||
|
|
08287deaa4 | ||
|
|
c43c5520a4 | ||
|
|
4e2b7886a9 | ||
|
|
05744e8472 | ||
|
|
9126973378 | ||
|
|
018e1069d5 | ||
|
|
92617b3263 | ||
|
|
d0172f11c3 | ||
|
|
638126b5f3 | ||
|
|
ef938bff77 |
@@ -1,4 +1,8 @@
|
||||
1.5.0 / 2023-01-28
|
||||
1.5.2 / 2023-02-05
|
||||
|
||||
- Исправление проблемы чтения каталога opds для koreader
|
||||
|
||||
1.5.1 / 2023-01-28
|
||||
------------------
|
||||
|
||||
- Настройки веб-интерфейса и опции командной строки "--lib-dir", "--inpx" вынесены в конфиг (#6)
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "inpx-web",
|
||||
"version": "1.5.0",
|
||||
"version": "1.5.2",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "inpx-web",
|
||||
"version": "1.5.0",
|
||||
"version": "1.5.2",
|
||||
"hasInstallScript": true,
|
||||
"license": "CC0-1.0",
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "inpx-web",
|
||||
"version": "1.5.0",
|
||||
"version": "1.5.2",
|
||||
"author": "Book Pauk <bookpauk@gmail.com>",
|
||||
"license": "CC0-1.0",
|
||||
"repository": "bookpauk/inpx-web",
|
||||
|
||||
@@ -24,13 +24,18 @@ class BasePage {
|
||||
this.showDeleted = false;
|
||||
}
|
||||
|
||||
escape(s) {
|
||||
//костыль для koreader, не понимает hex-экранирование вида '
|
||||
return he.escape(s).replace(/'/g, ''').replace(/`/g, '`');
|
||||
}
|
||||
|
||||
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};
|
||||
}
|
||||
|
||||
|
||||
@@ -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),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -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 || '',
|
||||
};
|
||||
|
||||
|
||||
@@ -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`})
|
||||
|
||||
@@ -55,7 +55,7 @@ class SearchPage extends BasePage {
|
||||
this.makeEntry({
|
||||
id: 'next_page',
|
||||
title: '[Следующая страница]',
|
||||
link: this.navLink({href: `/${this.id}?type=${from}&term=${encodeURIComponent(query.term)}&page=${page + 1}`}),
|
||||
link: this.navLink({href: `/${this.id}?type=${from}&term=${encodeURIComponent(query.term)}&genre=${encodeURIComponent(query.genre)}&page=${page + 1}`}),
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user