Skip to content

Commit

Permalink
Merge branch 'release/1.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
bookpauk committed Dec 7, 2022
2 parents 90c3faa + b8589ea commit 7fe0bce
Show file tree
Hide file tree
Showing 48 changed files with 3,317 additions and 2,216 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
1.4.0 / 2022-12-07
------------------
- Добавлена возможность расширенного поиска (раздел "</>"). Поиск не оптимизирован и может сильно нагружать сервер.
Отключить можно в конфиге, параметр extendedSearch
- Улучшение поддержки reverse-proxy, в конфиг добавлены параметры server.root и opds.root для встраивания inpx-web в уже существующий веб-сервер
- В настройки веб-интерфейса добавлена опция "Скачивать книги в виде zip-архива"
- Исправлен баг "Android-читалки не очень хорошо работают с OPDS" (#4)
- Добавлена сборка релизов для Linux arm64
- В readme добавлена ссылка для донатов: [отблагодарить автора проекта](https://donatty.com/liberama)

1.3.3 / 2022-11-28
------------------

Expand Down
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ OPDS-сервер доступен по адресу [http://127.0.0.1:12380/opd
Для указания местоположения .inpx-файла или папки с файлами библиотеки, воспользуйтесь [параметрами командной строки](#cli).
Дополнительные параметры сервера настраиваются в [конфигурационном файле](#config).

[Отблагодарить автора проекта](https://donatty.com/liberama)

##
* [Возможности программы](#capabilities)
* [Использование](#usage)
Expand Down Expand Up @@ -87,6 +89,11 @@ Options:
// 0 - отключить таймаут, время доступа по паролю не ограничено
"accessTimeout": 0,

// включить(true)/выключить(false) возможность расширенного поиска (раздел "</>")
// расширенный поиск не оптимизирован, поэтому может сильно нагружать сервер
// чтобы ускорить поиск, увеличьте параметр dbCacheSize
"extendedSearch": true,

// содержимое кнопки-ссылки "(читать)", если не задано - кнопка "(читать)" не показывается
// пример: "https://omnireader.ru/#/reader?url=${DOWNLOAD_LINK}"
// на место ${DOWNLOAD_LINK} будет подставлена ссылка на скачивание файла книги
Expand All @@ -99,7 +106,7 @@ Options:
// если надо кешировать всю БД, можно поставить значение от 1000 и больше
"dbCacheSize": 5,

// максимальный размер в байтах директории закешированных файлов в <раб.дир>/public/files
// максимальный размер в байтах директории закешированных файлов в <раб.дир>/public-files
// чистка каждый час
"maxFilesDirSize": 1073741824,

Expand Down Expand Up @@ -140,17 +147,23 @@ Options:
"remoteLib": false,

// настройки веб-сервера
// парамертр root указывает путь для кореневой страницы inpx-web
// например для "root": "/library", веб-интерфейс будет доступен по адресу http://127.0.0.1:12380/library
// root необходим при настройке reverse-proxy и встраивании inpx-web в уже существующий сервер
"server": {
"host": "0.0.0.0",
"port": "12380"
"port": "12380",
"root": ""
},

// настройки opds-сервера
// user, password используются для Basic HTTP authentication
// параметр root задает путь для доступа к opds-серверу
"opds": {
"enabled": true,
"user": "",
"password": ""
"password": "",
"root": "/opds"
}
}
```
Expand Down Expand Up @@ -198,7 +211,6 @@ Options:
{
"info": {
"collection": "Новое название коллекции",
"structure": "",
"version": "1.0.0"
},
"filter": "(r) => r.del == 0",
Expand Down Expand Up @@ -280,6 +292,8 @@ sudo service nginx reload
Сборка только в среде Linux.
Необходима версия node.js не ниже 16.

Для сборки linux-arm64 необходимо предварительно установить [QEMU](https://wiki.debian.org/QemuUserEmulation).

```sh
git clone https://github.com/bookpauk/inpx-web
cd inpx-web
Expand Down
1 change: 1 addition & 0 deletions build/appdir.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = 'app0b58f8bd9fbfa95504ba';
4 changes: 2 additions & 2 deletions build/prepkg.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ const publicDir = `${tmpDir}/public`;
const outDir = `${distDir}/${platform}`;

async function build() {
if (platform != 'linux' && platform != 'win' && platform != 'macos')
throw new Error(`Unknown platform: ${platform}`);
if (!platform)
throw new Error(`Please set platform`);

await fs.emptyDir(outDir);

Expand Down
1 change: 1 addition & 0 deletions build/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ async function main() {
await fs.emptyDir(outDir);
await makeRelease('win');
await makeRelease('linux');
await makeRelease('linux-arm64');
await makeRelease('macos');
} catch(e) {
console.error(e);
Expand Down
4 changes: 3 additions & 1 deletion build/webpack.base.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ const path = require('path');
const DefinePlugin = require('webpack').DefinePlugin;
const { VueLoaderPlugin } = require('vue-loader');

const appdir = require('./appdir');

const clientDir = path.resolve(__dirname, '../client');

module.exports = {
Expand All @@ -12,7 +14,7 @@ module.exports = {
},
entry: [`${clientDir}/main.js`],
output: {
publicPath: '/app/',
publicPath: `/${appdir}/`,
clean: true
},

Expand Down
3 changes: 1 addition & 2 deletions build/webpack.dev.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ module.exports = merge(baseWpConfig, {
mode: 'development',
devtool: 'inline-source-map',
output: {
path: `${publicDir}/app`,
path: `${publicDir}${baseWpConfig.output.publicPath}`,
filename: 'bundle.js',
clean: true
},

module: {
Expand Down
3 changes: 1 addition & 2 deletions build/webpack.prod.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ fs.emptyDirSync(publicDir);
module.exports = merge(baseWpConfig, {
mode: 'production',
output: {
path: `${publicDir}/app`,
path: `${publicDir}${baseWpConfig.output.publicPath}`,
filename: 'bundle.[contenthash].js',
clean: true
},
module: {
rules: [
Expand Down
4 changes: 4 additions & 0 deletions client/components/Api/Api.vue
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ class Api {
return await this.request({action: 'search', from, query}, 30);
}
async bookSearch(query) {
return await this.request({action: 'bookSearch', query}, 30);
}
async getAuthorBookList(authorId) {
return await this.request({action: 'get-author-book-list', authorId});
}
Expand Down
6 changes: 5 additions & 1 deletion client/components/Api/webSocketConnection.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import WebSocketConnection from '../../../server/core/WebSocketConnection';

export default new WebSocketConnection();
const protocol = (window.location.protocol == 'https:' ? 'wss:' : 'ws:');
let url = `${protocol}//${window.location.host}${window.location.pathname}`;
url += (url[url.length - 1] === '/' ? 'ws' : '/ws');

export default new WebSocketConnection(url);
52 changes: 35 additions & 17 deletions client/components/Search/BaseList.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import axios from 'axios';
import dayjs from 'dayjs';
import _ from 'lodash';

Expand All @@ -20,13 +21,16 @@ const componentOptions = {
this.loadSettings();
},
search: {
handler(newValue) {
this.limit = newValue.limit;

if (this.pageCount > 1)
this.prevPage = this.search.page;

this.refresh();
handler() {
if (!this.isExtendedSearch)
this.refresh();
},
deep: true,
},
extSearch: {
handler() {
if (this.isExtendedSearch)
this.refresh();
},
deep: true,
},
Expand All @@ -40,6 +44,7 @@ export default class BaseList {
_props = {
list: Object,
search: Object,
extSearch: Object,
genreMap: Object,
};

Expand All @@ -50,6 +55,7 @@ export default class BaseList {
expandedAuthor = [];
expandedSeries = [];

downloadAsZip = false;
showCounts = true;
showRates = true;
showGenres = true;
Expand All @@ -66,6 +72,7 @@ export default class BaseList {
tableData = [];

created() {
this.isExtendedSearch = false;
this.commit = this.$store.commit;
this.api = this.$root.api;

Expand All @@ -81,6 +88,7 @@ export default class BaseList {

this.expandedAuthor = _.cloneDeep(settings.expandedAuthor);
this.expandedSeries = _.cloneDeep(settings.expandedSeries);
this.downloadAsZip = settings.downloadAsZip;
this.showCounts = settings.showCounts;
this.showRates = settings.showRates;
this.showGenres = settings.showGenres;
Expand All @@ -105,16 +113,19 @@ export default class BaseList {
}

selectAuthor(author) {
this.search.author = `=${author}`;
const search = (this.isExtendedSearch ? this.extSearch : this.search);
search.author = `=${author}`;
this.scrollToTop();
}

selectSeries(series) {
this.search.series = `=${series}`;
const search = (this.isExtendedSearch ? this.extSearch : this.search);
search.series = `=${series}`;
}

selectTitle(title) {
this.search.title = `=${title}`;
const search = (this.isExtendedSearch ? this.extSearch : this.search);
search.title = `=${title}`;
}

async download(book, action) {
Expand All @@ -133,13 +144,20 @@ export default class BaseList {
const response = await this.api.getBookLink(book._uid);

const link = response.link;
const href = `${window.location.origin}${link}`;
let href = `${window.location.origin}${link}`;

//downloadAsZip
if (this.downloadAsZip && (action == 'download' || action == 'copyLink')) {
href += '/zip';
//подожлем формирования zip-файла
await axios.head(href);
}

//action
if (action == 'download') {
//скачивание
const d = this.$refs.download;
d.href = href;
d.download = response.downFileName;

d.click();
} else if (action == 'copyLink') {
Expand Down Expand Up @@ -506,9 +524,9 @@ export default class BaseList {
}

getQuery() {
let newQuery = _.cloneDeep(this.search);
newQuery = newQuery.setDefaults(newQuery);
delete newQuery.setDefaults;
const search = (this.isExtendedSearch ? this.extSearch : this.search);
const newQuery = {};
search.setDefaults(newQuery, search);

//дата
if (newQuery.date) {
Expand All @@ -519,8 +537,8 @@ export default class BaseList {
newQuery.offset = (newQuery.page - 1)*newQuery.limit;

//del
if (!this.showDeleted)
newQuery.del = 0;
if (!newQuery.del && !this.showDeleted)
newQuery.del = '0';

return newQuery;
}
Expand Down
12 changes: 7 additions & 5 deletions client/components/Search/BookView/BookView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</div>

<div class="q-ml-sm column">
<div v-if="(mode == 'series' || mode == 'title') && bookAuthor" class="row">
<div v-if="(mode == 'series' || mode == 'title' || mode == 'extended') && bookAuthor" class="row">
<div class="clickable2 text-green-10" @click.stop.prevent="emit('authorClick')">
{{ bookAuthor }}
</div>
Expand All @@ -46,7 +46,7 @@
<div class="clickable2" :class="titleColor" @click.stop.prevent="emit('titleClick')">
{{ book.title }}
</div>
<div v-if="mode == 'title' && bookSeries" class="q-ml-xs clickable2" @click.stop.prevent="emit('seriesClick')">
<div v-if="(mode == 'title' || mode == 'extended') && bookSeries" class="q-ml-xs clickable2" @click.stop.prevent="emit('seriesClick')">
{{ bookSeries }}
</div>

Expand Down Expand Up @@ -79,10 +79,10 @@
{{ bookDate }}
</div>
</div>
</div>

<div v-show="false">
{{ book }}
<div v-show="showJson && mode == 'extended'">
<pre style="font-size: 80%; white-space: pre-wrap;">{{ book }}</pre>
</div>
</div>
</div>
</template>
Expand Down Expand Up @@ -117,6 +117,7 @@ class BookView {
showGenres = true;
showDeleted = false;
showDates = false;
showJson = false;
created() {
this.loadSettings();
Expand All @@ -130,6 +131,7 @@ class BookView {
this.showGenres = settings.showGenres;
this.showDates = settings.showDates;
this.showDeleted = settings.showDeleted;
this.showJson = settings.showJson;
}
get settings() {
Expand Down
Loading

0 comments on commit 7fe0bce

Please sign in to comment.