Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b453c3efe5 | ||
|
|
56590ef8a4 | ||
|
|
7c133136b9 | ||
|
|
41881639aa | ||
|
|
416003f078 | ||
|
|
bbfcd0efa3 | ||
|
|
150e4332c3 | ||
|
|
49649765c7 | ||
|
|
726b7bfa93 | ||
|
|
265f838868 | ||
|
|
6e2e5b5520 | ||
|
|
100ea2f64a | ||
|
|
4e7ed1ee33 | ||
|
|
8ab6aed1aa | ||
|
|
4ff096014c | ||
|
|
03b60b6ca9 | ||
|
|
e30b832e05 | ||
|
|
e646de85a7 | ||
|
|
70a7a0e344 | ||
|
|
b444abeb3e | ||
|
|
c72f56917d | ||
|
|
192283d6b2 | ||
|
|
6be6fa1966 | ||
|
|
510553b055 | ||
|
|
6c4616892e | ||
|
|
1e79a099b8 |
@@ -9,7 +9,7 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|||||||
const CleanWebpackPlugin = require('clean-webpack-plugin');
|
const CleanWebpackPlugin = require('clean-webpack-plugin');
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||||
const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
|
const {GenerateSW} = require('workbox-webpack-plugin');
|
||||||
|
|
||||||
const publicDir = path.resolve(__dirname, '../dist/tmp/public');
|
const publicDir = path.resolve(__dirname, '../dist/tmp/public');
|
||||||
const clientDir = path.resolve(__dirname, '../client');
|
const clientDir = path.resolve(__dirname, '../client');
|
||||||
@@ -55,12 +55,12 @@ module.exports = merge(baseWpConfig, {
|
|||||||
filename: `${publicDir}/index.html`
|
filename: `${publicDir}/index.html`
|
||||||
}),
|
}),
|
||||||
new CopyWebpackPlugin([{from: `${clientDir}/assets/*`, to: `${publicDir}/`, flatten: true}]),
|
new CopyWebpackPlugin([{from: `${clientDir}/assets/*`, to: `${publicDir}/`, flatten: true}]),
|
||||||
new SWPrecacheWebpackPlugin({
|
new GenerateSW({
|
||||||
cacheId: 'liberama',
|
cacheId: 'liberama',
|
||||||
filepath: `${publicDir}/service-worker.js`,
|
swDest: `${publicDir}/service-worker.js`,
|
||||||
minify: true,
|
|
||||||
navigateFallback: '/index.html',
|
navigateFallback: '/index.html',
|
||||||
stripPrefix: publicDir,
|
navigateFallbackDenylist: [new RegExp('^/api'), new RegExp('^/ws'), new RegExp('^/tmp'),],
|
||||||
|
skipWaiting: true,
|
||||||
}),
|
}),
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<span v-if="loading"><q-spinner class="q-mr-sm" color="lime-12" size="20px" :thickness="7"/>Список загружается</span>
|
<span v-if="loading"><q-spinner class="q-mr-sm" color="lime-12" size="20px" :thickness="7"/>Список загружается</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<a ref="download" style='display: none;'></a>
|
<a ref="download" style='display: none;' target="_blank"></a>
|
||||||
|
|
||||||
<q-table
|
<q-table
|
||||||
class="recent-books-table col"
|
class="recent-books-table col"
|
||||||
@@ -298,6 +298,7 @@ class RecentBooksPage extends Vue {
|
|||||||
const d = this.$refs.download;
|
const d = this.$refs.download;
|
||||||
d.href = fb2path;
|
d.href = fb2path;
|
||||||
d.download = path.basename(fb2path).substr(0, 10) + '.fb2';
|
d.download = path.basename(fb2path).substr(0, 10) + '.fb2';
|
||||||
|
|
||||||
d.click();
|
d.click();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
let errMes = e.message;
|
let errMes = e.message;
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ export default class BookParser {
|
|||||||
offset: Number, //сумма всех length до этого параграфа
|
offset: Number, //сумма всех length до этого параграфа
|
||||||
length: Number, //длина text без тегов
|
length: Number, //длина text без тегов
|
||||||
text: String, //текст параграфа с вложенными тегами
|
text: String, //текст параграфа с вложенными тегами
|
||||||
cut: Boolean, //параграф - кандидат на сокрытие (cutEmptyParagraphs)
|
|
||||||
addIndex: Number, //индекс добавляемого пустого параграфа (addEmptyParagraphs)
|
addIndex: Number, //индекс добавляемого пустого параграфа (addEmptyParagraphs)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@@ -116,7 +115,6 @@ export default class BookParser {
|
|||||||
offset: paraOffset,
|
offset: paraOffset,
|
||||||
length: len,
|
length: len,
|
||||||
text: text,
|
text: text,
|
||||||
cut: (!addIndex && (len == 1 && text[0] == ' ')),
|
|
||||||
addIndex: (addIndex ? addIndex : 0),
|
addIndex: (addIndex ? addIndex : 0),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -132,10 +130,10 @@ export default class BookParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let p = para[paraIndex];
|
let p = para[paraIndex];
|
||||||
//добавление пустых (addEmptyParagraphs) параграфов
|
paraOffset -= p.length;
|
||||||
|
//добавление пустых (addEmptyParagraphs) параграфов перед текущим
|
||||||
if (p.length == 1 && p.text[0] == ' ' && len > 0) {
|
if (p.length == 1 && p.text[0] == ' ' && len > 0) {
|
||||||
paraIndex--;
|
paraIndex--;
|
||||||
paraOffset -= p.length;
|
|
||||||
for (let i = 0; i < 2; i++) {
|
for (let i = 0; i < 2; i++) {
|
||||||
newParagraph(' ', 1, i + 1);
|
newParagraph(' ', 1, i + 1);
|
||||||
}
|
}
|
||||||
@@ -144,15 +142,10 @@ export default class BookParser {
|
|||||||
p.index = paraIndex;
|
p.index = paraIndex;
|
||||||
p.offset = paraOffset;
|
p.offset = paraOffset;
|
||||||
para[paraIndex] = p;
|
para[paraIndex] = p;
|
||||||
paraOffset += p.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
paraOffset -= p.length;
|
//уберем начальный пробел
|
||||||
//параграф оказался непустой
|
|
||||||
if (p.length == 1 && p.text[0] == ' ' && len > 0) {
|
|
||||||
p.length = 0;
|
p.length = 0;
|
||||||
p.text = p.text.substr(1);
|
p.text = p.text.substr(1);
|
||||||
p.cut = (len == 1 && text[0] == ' ');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
p.length += len;
|
p.length += len;
|
||||||
@@ -633,10 +626,7 @@ export default class BookParser {
|
|||||||
imageHeightLines: this.imageHeightLines,
|
imageHeightLines: this.imageHeightLines,
|
||||||
imageFitWidth: this.imageFitWidth,
|
imageFitWidth: this.imageFitWidth,
|
||||||
compactTextPerc: this.compactTextPerc,
|
compactTextPerc: this.compactTextPerc,
|
||||||
visible: !(
|
visible: true, //вычисляется позже
|
||||||
(this.cutEmptyParagraphs && para.cut) ||
|
|
||||||
(para.addIndex > this.addEmptyParagraphs)
|
|
||||||
)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -652,9 +642,12 @@ export default class BookParser {
|
|||||||
text: String,
|
text: String,
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
let parts = this.splitToStyle(para.text);
|
let parts = this.splitToStyle(para.text);
|
||||||
|
|
||||||
|
//инициализация парсера
|
||||||
let line = {begin: para.offset, parts: []};
|
let line = {begin: para.offset, parts: []};
|
||||||
|
let paragraphText = '';//текст параграфа
|
||||||
let partText = '';//накапливаемый кусок со стилем
|
let partText = '';//накапливаемый кусок со стилем
|
||||||
|
|
||||||
let str = '';//измеряемая строка
|
let str = '';//измеряемая строка
|
||||||
@@ -667,6 +660,7 @@ export default class BookParser {
|
|||||||
// тут начинается самый замес, перенос по слогам и стилизация, а также изображения
|
// тут начинается самый замес, перенос по слогам и стилизация, а также изображения
|
||||||
for (const part of parts) {
|
for (const part of parts) {
|
||||||
style = part.style;
|
style = part.style;
|
||||||
|
paragraphText += part.text;
|
||||||
|
|
||||||
//изображения
|
//изображения
|
||||||
if (part.image.id && !part.image.inline) {
|
if (part.image.id && !part.image.inline) {
|
||||||
@@ -837,6 +831,12 @@ export default class BookParser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//parsed.visible
|
||||||
|
parsed.visible = !(
|
||||||
|
(para.addIndex > this.addEmptyParagraphs) ||
|
||||||
|
(para.addIndex == 0 && this.cutEmptyParagraphs && paragraphText.trim() == '')
|
||||||
|
);
|
||||||
|
|
||||||
parsed.lines = lines;
|
parsed.lines = lines;
|
||||||
para.parsed = parsed;
|
para.parsed = parsed;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,15 @@
|
|||||||
export const versionHistory = [
|
export const versionHistory = [
|
||||||
|
{
|
||||||
|
showUntil: '2020-05-20',
|
||||||
|
header: '0.9.3 (2020-05-21)',
|
||||||
|
content:
|
||||||
|
`
|
||||||
|
<ul>
|
||||||
|
<li>исправления багов</li>
|
||||||
|
</ul>
|
||||||
|
`
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
showUntil: '2020-04-25',
|
showUntil: '2020-04-25',
|
||||||
header: '0.9.2 (2020-03-15)',
|
header: '0.9.2 (2020-03-15)',
|
||||||
|
|||||||
@@ -277,24 +277,33 @@ class StdDialog extends Vue {
|
|||||||
|
|
||||||
keyHook(event) {
|
keyHook(event) {
|
||||||
if (this.active) {
|
if (this.active) {
|
||||||
|
let handled = false;
|
||||||
if (this.type == 'hotKey') {
|
if (this.type == 'hotKey') {
|
||||||
if (event.type == 'keydown') {
|
if (event.type == 'keydown') {
|
||||||
this.hotKeyCode = utils.keyEventToCode(event);
|
this.hotKeyCode = utils.keyEventToCode(event);
|
||||||
|
handled = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (event.code == 'Enter')
|
if (event.code == 'Enter') {
|
||||||
this.okClick();
|
this.okClick();
|
||||||
|
handled = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (event.code == 'Escape') {
|
if (event.code == 'Escape') {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.dialog.hide();
|
this.$refs.dialog.hide();
|
||||||
});
|
});
|
||||||
|
handled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (handled) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ server {
|
|||||||
root /home/beta.liberama/public;
|
root /home/beta.liberama/public;
|
||||||
|
|
||||||
location /tmp {
|
location /tmp {
|
||||||
add_header Content-Type text/xml;
|
types { } default_type "application/xml; charset=utf-8";
|
||||||
add_header Content-Encoding gzip;
|
add_header Content-Encoding gzip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ server {
|
|||||||
root /home/liberama/public;
|
root /home/liberama/public;
|
||||||
|
|
||||||
location /tmp {
|
location /tmp {
|
||||||
add_header Content-Type text/xml;
|
types { } default_type "application/xml; charset=utf-8";
|
||||||
add_header Content-Encoding gzip;
|
add_header Content-Encoding gzip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ server {
|
|||||||
root /home/liberama/public;
|
root /home/liberama/public;
|
||||||
|
|
||||||
location /tmp {
|
location /tmp {
|
||||||
add_header Content-Type text/xml;
|
types { } default_type "application/xml; charset=utf-8";
|
||||||
add_header Content-Encoding gzip;
|
add_header Content-Encoding gzip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
3157
package-lock.json
generated
3157
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "Liberama",
|
"name": "Liberama",
|
||||||
"version": "0.9.2",
|
"version": "0.9.3",
|
||||||
"author": "Book Pauk <bookpauk@gmail.com>",
|
"author": "Book Pauk <bookpauk@gmail.com>",
|
||||||
"license": "CC0-1.0",
|
"license": "CC0-1.0",
|
||||||
"repository": "bookpauk/liberama",
|
"repository": "bookpauk/liberama",
|
||||||
@@ -41,7 +41,6 @@
|
|||||||
"mini-css-extract-plugin": "^0.5.0",
|
"mini-css-extract-plugin": "^0.5.0",
|
||||||
"optimize-css-assets-webpack-plugin": "^5.0.3",
|
"optimize-css-assets-webpack-plugin": "^5.0.3",
|
||||||
"pkg": "^4.4.4",
|
"pkg": "^4.4.4",
|
||||||
"sw-precache-webpack-plugin": "^1.0.0",
|
|
||||||
"terser-webpack-plugin": "^1.4.1",
|
"terser-webpack-plugin": "^1.4.1",
|
||||||
"url-loader": "^1.1.2",
|
"url-loader": "^1.1.2",
|
||||||
"vue-class-component": "^6.3.2",
|
"vue-class-component": "^6.3.2",
|
||||||
@@ -52,7 +51,8 @@
|
|||||||
"webpack-cli": "^3.3.11",
|
"webpack-cli": "^3.3.11",
|
||||||
"webpack-dev-middleware": "^3.7.2",
|
"webpack-dev-middleware": "^3.7.2",
|
||||||
"webpack-hot-middleware": "^2.25.0",
|
"webpack-hot-middleware": "^2.25.0",
|
||||||
"webpack-merge": "^4.2.2"
|
"webpack-merge": "^4.2.2",
|
||||||
|
"workbox-webpack-plugin": "^5.1.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@quasar/extras": "^1.5.2",
|
"@quasar/extras": "^1.5.2",
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
"multer": "^1.4.2",
|
"multer": "^1.4.2",
|
||||||
"pako": "^1.0.11",
|
"pako": "^1.0.11",
|
||||||
"path-browserify": "^1.0.0",
|
"path-browserify": "^1.0.0",
|
||||||
"quasar": "^1.9.7",
|
"quasar": "^1.11.3",
|
||||||
"safe-buffer": "^5.2.0",
|
"safe-buffer": "^5.2.0",
|
||||||
"sjcl": "^1.0.8",
|
"sjcl": "^1.0.8",
|
||||||
"sql-template-strings": "^2.2.2",
|
"sql-template-strings": "^2.2.2",
|
||||||
|
|||||||
@@ -653,15 +653,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
"type": "svg",
|
|
||||||
"ext": "svg",
|
|
||||||
"mime": "image/svg+xml",
|
|
||||||
"rules": [
|
|
||||||
{ "type": "contains", "bytes": "3c737667" }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"type": "docx",
|
"type": "docx",
|
||||||
"ext": "docx",
|
"ext": "docx",
|
||||||
@@ -683,7 +674,9 @@
|
|||||||
{ "type": "or", "rules":
|
{ "type": "or", "rules":
|
||||||
[
|
[
|
||||||
{ "type": "equal", "end": 19, "bytes": "3c3f786d6c2076657273696f6e3d22312e3022" },
|
{ "type": "equal", "end": 19, "bytes": "3c3f786d6c2076657273696f6e3d22312e3022" },
|
||||||
{ "type": "equal", "end": 22, "bytes": "efbbbf3c3f786d6c2076657273696f6e3d22312e3022" }
|
{ "type": "equal", "end": 22, "bytes": "efbbbf3c3f786d6c2076657273696f6e3d22312e3022" },
|
||||||
|
{ "type": "equal", "end": 19, "bytes": "3c3f786d6c2076657273696f6e3d27312e3027" },
|
||||||
|
{ "type": "equal", "end": 22, "bytes": "efbbbf3c3f786d6c2076657273696f6e3d27312e3027" }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -698,6 +691,16 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"type": "djvu",
|
||||||
|
"ext": "djvu",
|
||||||
|
"mime": "image/vnd.djvu",
|
||||||
|
"rules": [
|
||||||
|
{ "type": "equal", "start": 0, "end": 8, "bytes": "41542654464f524d" },
|
||||||
|
{ "type": "equal", "start": 12, "end": 15, "bytes": "444a56" }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"type": "html",
|
"type": "html",
|
||||||
"ext": "html",
|
"ext": "html",
|
||||||
@@ -725,6 +728,14 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"type": "svg",
|
||||||
|
"ext": "svg",
|
||||||
|
"mime": "image/svg+xml",
|
||||||
|
"rules": [
|
||||||
|
{ "type": "contains", "bytes": "3c737667" }
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
1
server/core/Reader/BookConverter/.gitignore
vendored
Normal file
1
server/core/Reader/BookConverter/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
test
|
||||||
@@ -72,7 +72,7 @@ async function main() {
|
|||||||
maxAge: '30d',
|
maxAge: '30d',
|
||||||
setHeaders: (res, filePath) => {
|
setHeaders: (res, filePath) => {
|
||||||
if (path.basename(path.dirname(filePath)) == 'tmp') {
|
if (path.basename(path.dirname(filePath)) == 'tmp') {
|
||||||
res.set('Content-Type', 'text/xml');
|
res.set('Content-Type', 'application/xml');
|
||||||
res.set('Content-Encoding', 'gzip');
|
res.set('Content-Encoding', 'gzip');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user