Compare commits

...

12 Commits

Author SHA1 Message Date
Book Pauk
c3f1707343 Merge branch 'release/0.7.9-1' 2019-12-23 21:02:02 +07:00
Book Pauk
1ed058a553 Мелкие поправки 2019-12-23 20:57:44 +07:00
Book Pauk
0500a8178d Merge tag '0.7.9' into develop
0.7.9
2019-11-27 18:16:52 +07:00
Book Pauk
7d0059f573 Merge branch 'release/0.7.9' 2019-11-27 18:16:43 +07:00
Book Pauk
4e3b882362 Версия 0.7.9 2019-11-27 18:15:28 +07:00
Book Pauk
13cf47873e Добавлен неубираемый баннер о переходе на httpS 2019-11-27 18:11:34 +07:00
Book Pauk
7ee23ec38f Удален устаревший код 2019-11-27 17:33:30 +07:00
Book Pauk
eebf17c42c Добавлена проверка наличия файла на сервере перед скачиванием fb2 2019-11-27 17:12:07 +07:00
Book Pauk
f84536788b Merge tag '0.7.8b' into develop
0.7.8b
2019-11-25 16:00:10 +07:00
Book Pauk
4bbfdc2cb2 Merge branch 'release/0.7.8b' 2019-11-25 16:00:00 +07:00
Book Pauk
211fec35e3 Исправлен баг 2019-11-25 15:56:29 +07:00
Book Pauk
b8214a46ae Merge tag '0.7.8' into develop
0.7.8
2019-11-25 15:39:35 +07:00
10 changed files with 53 additions and 23 deletions

View File

@@ -56,7 +56,11 @@ class Reader {
} }
} }
async loadCachedBook(url, callback){ async checkUrl(url) {
return await axios.head(url, {headers: {'Cache-Control': 'no-cache'}});
}
async loadCachedBook(url, callback) {
const response = await axios.head(url); const response = await axios.head(url);
let estSize = 1000000; let estSize = 1000000;

View File

@@ -1,5 +1,8 @@
<template> <template>
<el-container> <el-container>
<div v-show="isShowMigrationWarning" style="height: 30px; overflow: hidden; white-space:nowrap;">
<span style="margin-left: 10px; font-size: 20px; position: relative; top: 2px" class="clickable" @click="showMigrationHttp">HTTP-версия читалки скоро станет недоступна. Подробнее...</span>
</div>
<el-header v-show="toolBarActive" height='50px'> <el-header v-show="toolBarActive" height='50px'>
<div ref="header" class="header"> <div ref="header" class="header">
<el-tooltip content="Загрузить книгу" :open-delay="1000" effect="light"> <el-tooltip content="Загрузить книгу" :open-delay="1000" effect="light">
@@ -320,15 +323,6 @@ class Reader extends Vue {
}); });
this.loadSettings(); this.loadSettings();
//TODO: убрать в будущем
if (this.showToolButton['history']) {
const newShowToolButton = Object.assign({}, this.showToolButton);
newShowToolButton['recentBooks'] = true;
delete newShowToolButton['history'];
const newSettings = Object.assign({}, this.settings, { showToolButton: newShowToolButton });
this.commit('reader/setSettings', newSettings);
}
} }
mounted() { mounted() {
@@ -444,6 +438,14 @@ class Reader extends Vue {
} }
} }
get isShowMigrationWarning() {
return window.location.protocol == 'http:';
}
showMigrationHttp() {
this.migrationVisible1 = true;
}
migrationDialogDisable() { migrationDialogDisable() {
this.migrationVisible1 = false; this.migrationVisible1 = false;
this.migrationVisible2 = false; this.migrationVisible2 = false;

View File

@@ -5,6 +5,7 @@
<span v-show="loading"><i class="el-icon-loading" style="font-size: 25px"></i> <span style="position: relative; top: -4px">Список загружается</span></span> <span v-show="loading"><i class="el-icon-loading" style="font-size: 25px"></i> <span style="position: relative; top: -4px">Список загружается</span></span>
</template> </template>
<a ref="download" style='display: none;'></a>
<el-table <el-table
:data="tableData" :data="tableData"
style="width: 570px" style="width: 570px"
@@ -72,7 +73,7 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<a v-show="isUrl(scope.row.url)" :href="scope.row.url" target="_blank">Оригинал</a><br> <a v-show="isUrl(scope.row.url)" :href="scope.row.url" target="_blank">Оригинал</a><br>
<a :href="scope.row.path" :download="getFileNameFromPath(scope.row.path)">Скачать FB2</a> <a :href="scope.row.path" @click.prevent="downloadBook(scope.row.path)">Скачать FB2</a>
</template> </template>
</el-table-column> </el-table-column>
@@ -104,6 +105,7 @@ import _ from 'lodash';
import * as utils from '../../../share/utils'; import * as utils from '../../../share/utils';
import Window from '../../share/Window.vue'; import Window from '../../share/Window.vue';
import bookManager from '../share/bookManager'; import bookManager from '../share/bookManager';
import readerApi from '../../../api/reader';
export default @Component({ export default @Component({
components: { components: {
@@ -209,7 +211,7 @@ class RecentBooksPage extends Vue {
a.middleName a.middleName
]).join(' ')); ]).join(' '));
author = authorNames.join(', '); author = authorNames.join(', ');
} else { } else {//TODO: убрать в будущем
author = _.compact([ author = _.compact([
fb2.lastName, fb2.lastName,
fb2.firstName, fb2.firstName,
@@ -268,8 +270,20 @@ class RecentBooksPage extends Vue {
return result; return result;
} }
getFileNameFromPath(fb2Path) { async downloadBook(fb2path) {
return path.basename(fb2Path).substr(0, 10) + '.fb2'; try {
await readerApi.checkUrl(fb2path);
const d = this.$refs.download;
d.href = fb2path;
d.download = path.basename(fb2path).substr(0, 10) + '.fb2';
d.click();
} catch (e) {
let errMes = e.message;
if (errMes.indexOf('404') >= 0)
errMes = 'Файл не найден на сервере (возможно был удален как устаревший)';
this.$alert(errMes, 'Ошибка', {type: 'error'});
}
} }
openOriginal(url) { openOriginal(url) {

View File

@@ -32,9 +32,6 @@ export default class BookParser {
//defaults //defaults
let fb2 = { let fb2 = {
firstName: '',
middleName: '',
lastName: '',
bookTitle: '', bookTitle: '',
}; };

View File

@@ -319,7 +319,6 @@ class BookManager {
metaOnly(book) { metaOnly(book) {
let result = Object.assign({}, book); let result = Object.assign({}, book);
delete result.data;//можно будет убрать эту строку со временем
delete result.parsed; delete result.parsed;
return result; return result;
} }

View File

@@ -1,4 +1,16 @@
export const versionHistory = [ export const versionHistory = [
{
showUntil: '2019-11-26',
header: '0.7.9 (2019-11-27)',
content:
`
<ul>
<li>добавлен неубираемый баннер для http-версии о переходе на httpS</li>
<li>исправления багов</li>
</ul>
`
},
{ {
showUntil: '2019-11-24', showUntil: '2019-11-24',
header: '0.7.8 (2019-11-25)', header: '0.7.8 (2019-11-25)',
@@ -6,6 +18,7 @@ export const versionHistory = [
` `
<ul> <ul>
<li>улучшение html-фильтров для сайтов</li> <li>улучшение html-фильтров для сайтов</li>
<li>исправления багов</li>
</ul> </ul>
` `
}, },

View File

@@ -1,6 +1,6 @@
{ {
"name": "Liberama", "name": "Liberama",
"version": "0.7.8", "version": "0.7.9",
"engines": { "engines": {
"node": ">=10.0.0" "node": ">=10.0.0"
}, },

View File

@@ -41,9 +41,9 @@ class ConfigManager {
process.env.NODE_ENV = this.branch; process.env.NODE_ENV = this.branch;
this.branchConfigFile = __dirname + `/${this.branch}.js`; this.branchConfigFile = __dirname + `/${this.branch}.js`;
await fs.access(this.branchConfigFile);
this._config = require(this.branchConfigFile); this._config = require(this.branchConfigFile);
await fs.ensureDir(this._config.dataDir);
this._userConfigFile = `${this._config.dataDir}/config.json`; this._userConfigFile = `${this._config.dataDir}/config.json`;
this.inited = true; this.inited = true;
@@ -83,6 +83,7 @@ class ConfigManager {
async save() { async save() {
if (!this.inited) if (!this.inited)
throw new Error('not inited'); throw new Error('not inited');
const dataToSave = _.pick(this._config, propsToSave); const dataToSave = _.pick(this._config, propsToSave);
await fs.writeFile(this.userConfigFile, JSON.stringify(dataToSave, null, 4)); await fs.writeFile(this.userConfigFile, JSON.stringify(dataToSave, null, 4));
} }

View File

@@ -23,7 +23,7 @@ class ConvertFb2 extends ConvertBase {
const right = data.indexOf('?>', left); const right = data.indexOf('?>', left);
if (right >= 0) { if (right >= 0) {
const head = data.slice(left, right + 2).toString(); const head = data.slice(left, right + 2).toString();
const m = head.match(/encoding="(.*)"/); const m = head.match(/encoding="(.*?)"/);
if (m) { if (m) {
let encoding = m[1].toLowerCase(); let encoding = m[1].toLowerCase();
if (encoding != 'utf-8') { if (encoding != 'utf-8') {

View File

@@ -18,7 +18,7 @@ async function init() {
const log = appLogger.log; const log = appLogger.log;
//dirs //dirs
log(`${config.name} v${config.version}`); log(`${config.name} v${config.version}, Node.js ${process.version}`);
log('Initializing'); log('Initializing');
await fs.ensureDir(config.dataDir); await fs.ensureDir(config.dataDir);