Skip to content

Commit

Permalink
Merge branch 'release/1.5.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
bookpauk committed Apr 12, 2023
2 parents 636e34b + deeac0b commit c3810d1
Show file tree
Hide file tree
Showing 21 changed files with 383 additions and 79 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
1.5.4 / 2023-04-12

- Добавлена возможность поиска по типу файла
- Улучшена работа с inpx, теперь понимает файлы в каталогах (без zip-архива)
- В readme добавлен раздел "Запуск без сборки релиза" для запуска inpx-web на любых платформах
- Исправления мелких багов

1.5.3 / 2023-03-02

- OPDS: исправление проблемы поиска для koreader
Expand Down
34 changes: 28 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ OPDS-сервер доступен по адресу [http://127.0.0.1:12380/opd
* [Удаленная библиотека](#remotelib)
* [Фильтр по авторам и книгам](#filter)
* [Настройка https с помощью nginx](#https)
* [Сборка проекта](#build)
* [Сборка релизов](#build)
* [Запуск без сборки релиза](#native_run)
* [Разработка](#development)

<a id="capabilities" />
Expand Down Expand Up @@ -321,7 +322,7 @@ sudo service nginx reload

<a id="build" />

### Сборка проекта
### Сборка релизов
Сборка только в среде Linux.
Необходима версия node.js не ниже 16.

Expand All @@ -331,15 +332,36 @@ sudo service nginx reload
git clone https://github.com/bookpauk/inpx-web
cd inpx-web
npm i
```

#### Релизы
```sh
npm run release
```

Результат сборки будет доступен в каталоге `dist/release`

<a id="native_run" />

### Запуск без сборки релиза
Т.к. сборщик pkg поддерживает не все платформы, то не всегда удается собрать релиз.
Однако, можно скачать и запустить inpx-web нативным путем, с помощью nodejs.
Ниже пример для Ubuntu, для других линуксов различия не принципиальны:

```sh
# установка nodejs v16 и выше:
curl -s https://deb.nodesource.com/setup_16.x | sudo bash
sudo apt install nodejs -y

# подготовка
git clone https://github.com/bookpauk/inpx-web
cd inpx-web
npm i
npm run build:client && node build/prepkg.js linux

# удалим файл development-среды, чтобы запускался в production-режиме
rm ./server/config/application_env

# запуск inpx-web, тут же будет создан каталог .inpx-web
node server --app-dir=.inpx-web
```

<a id="development" />

### Разработка
Expand Down
12 changes: 9 additions & 3 deletions client/components/Search/AuthorList/AuthorList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@
</div>
<!-- Формирование списка конец ------------------------------------------------------------------>

<div v-if="!refreshing && !tableData.length" class="row items-center q-ml-md" style="font-size: 120%">
<div v-if="!refreshing && (!tableData.length || error)" class="row items-center q-ml-md" style="font-size: 120%">
<q-icon class="la la-meh q-mr-xs" size="28px" />
Поиск не дал результатов
{{ (error ? error : 'Поиск не дал результатов') }}
</div>
</div>
</template>
Expand Down Expand Up @@ -438,6 +438,7 @@ class AuthorList extends BaseList {
if (this.refreshing)
return;
this.error = '';
this.refreshing = true;
(async() => {
Expand Down Expand Up @@ -467,7 +468,12 @@ class AuthorList extends BaseList {
this.highlightPageScroller(query);
}
} catch (e) {
this.$root.stdDialog.alert(e.message, 'Ошибка');
this.list.queryFound = 0;
this.list.totalFound = 0;
this.searchResult = {found: []};
await this.updateTableData();
//this.$root.stdDialog.alert(e.message, 'Ошибка');
this.error = `Ошибка: ${e.message}`;
}
}
} finally {
Expand Down
12 changes: 11 additions & 1 deletion client/components/Search/BaseList.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export default class BaseList {
genreMap: Object,
};

error = '';
loadingMessage = '';
loadingMessage2 = '';

Expand Down Expand Up @@ -371,7 +372,8 @@ export default class BaseList {
bookValue = emptyFieldValue;

bookValue = bookValue.toLowerCase();
searchValue = searchValue.toLowerCase();
if (searchValue[0] !== '~')
searchValue = searchValue.toLowerCase();

//особая обработка префиксов
if (searchValue[0] == '=') {
Expand Down Expand Up @@ -450,6 +452,13 @@ export default class BaseList {
librateFound = searchLibrate.has(book.librate);
}

//ext
let extFound = !s.ext;
if (!extFound) {
const searchExt = new Set(s.ext.split('|'));
extFound = searchExt.has(book.ext.toLowerCase() || emptyFieldValue);
}

return (this.showDeleted || !book.del)
&& authorFound
&& filterBySearch(book.series, s.series)
Expand All @@ -458,6 +467,7 @@ export default class BaseList {
&& langFound
&& dateFound
&& librateFound
&& extFound
;
});
}
Expand Down
2 changes: 1 addition & 1 deletion client/components/Search/BookInfoDialog/BookInfoDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<div class="poster-size">
<div class="column justify-center items-center" :class="{'poster': coverSrc, 'no-poster': !coverSrc}" @click.stop.prevent="posterClick">
<img v-if="coverSrc" :src="coverSrc" class="fit row justify-center items-center" style="object-fit: contain" @error="coverSrc = ''" />
<div v-if="!coverSrc" class="fit row justify-center items-center text-grey-5" style="border: 1px solid #ccc; font-size: 300%">
<div v-if="!coverSrc" class="fit row justify-center items-center text-grey-5 overflow-hidden" style="border: 1px solid #ccc; font-size: 300%">
<i>{{ book.ext }}</i>
</div>
</div>
Expand Down
12 changes: 9 additions & 3 deletions client/components/Search/ExtendedList/ExtendedList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
</div>
<!-- Формирование списка конец ------------------------------------------------------------------>

<div v-if="!refreshing && !tableData.length" class="row items-center q-ml-md" style="font-size: 120%">
<div v-if="!refreshing && (!tableData.length || error)" class="row items-center q-ml-md" style="font-size: 120%">
<q-icon class="la la-meh q-mr-xs" size="28px" />
Поиск не дал результатов
{{ (error ? error : 'Поиск не дал результатов') }}
</div>
</div>
</template>
Expand Down Expand Up @@ -74,6 +74,7 @@ class ExtendedList extends BaseList {
if (this.refreshing)
return;
this.error = '';
this.refreshing = true;
(async() => {
Expand Down Expand Up @@ -103,7 +104,12 @@ class ExtendedList extends BaseList {
this.highlightPageScroller(query);
}
} catch (e) {
this.$root.stdDialog.alert(e.message, 'Ошибка');
this.list.queryFound = 0;
this.list.totalFound = 0;
this.searchResult = {found: []};
await this.updateTableData();
//this.$root.stdDialog.alert(e.message, 'Ошибка');
this.error = `Ошибка: ${e.message}`;
}
}
} finally {
Expand Down
32 changes: 30 additions & 2 deletions client/components/Search/Search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
<div class="q-mx-xs" />
<q-input
v-model="librateNames" :maxlength="inputMaxLength" :debounce="inputDebounce"
class="q-mt-xs col-1" :bg-color="inputBgColor()" input-style="cursor: pointer" style="min-width: 90px;" label="Оценка" stack-label outlined dense clearable readonly
class="q-mt-xs col-2" :bg-color="inputBgColor()" input-style="cursor: pointer" style="min-width: 140px;" label="Оценка" stack-label outlined dense clearable readonly
@click.stop.prevent="selectLibRate"
>
<template v-if="librateNames" #append>
Expand All @@ -171,6 +171,21 @@
{{ librateNames }}
</q-tooltip>
</q-input>

<div class="q-mx-xs" />
<q-input
v-model="search.ext" :maxlength="inputMaxLength" :debounce="inputDebounce"
class="q-mt-xs col-2" :bg-color="inputBgColor()" input-style="cursor: pointer" style="min-width: 140px;" label="Тип файла" stack-label outlined dense clearable readonly
@click.stop.prevent="selectExt"
>
<template v-if="search.ext" #append>
<q-icon name="la la-times-circle" class="q-field__focusable-action" @click.stop.prevent="search.ext = ''" />
</template>

<q-tooltip v-if="search.ext && showTooltips" :delay="500" anchor="bottom middle" content-style="font-size: 80%" max-width="400px">
{{ search.ext }}
</q-tooltip>
</q-input>
</div>
<div v-show="!isExtendedSearch && !extendedParams && extendedParamsMessage" class="row q-mx-sm items-center clickable" @click.stop.prevent="extendedParams = true">
+{{ extendedParamsMessage }}
Expand Down Expand Up @@ -331,6 +346,7 @@
<SelectLangDialog v-model="selectLangDialogVisible" v-model:lang="search.lang" :lang-list="langList" :lang-default="langDefault" />
<SelectLibRateDialog v-model="selectLibRateDialogVisible" v-model:librate="search.librate" />
<SelectDateDialog v-model="selectDateDialogVisible" v-model:date="search.date" />
<SelectExtDialog v-model="selectExtDialogVisible" v-model:ext="search.ext" :ext-list="extList" />
<BookInfoDialog v-model="bookInfoDialogVisible" :book-info="bookInfo" />
<SelectExtSearchDialog v-model="selectExtSearchDialogVisible" v-model:ext-search="extSearch" />
</div>
Expand All @@ -351,6 +367,7 @@ import SelectGenreDialog from './SelectGenreDialog/SelectGenreDialog.vue';
import SelectLangDialog from './SelectLangDialog/SelectLangDialog.vue';
import SelectLibRateDialog from './SelectLibRateDialog/SelectLibRateDialog.vue';
import SelectDateDialog from './SelectDateDialog/SelectDateDialog.vue';
import SelectExtDialog from './SelectExtDialog/SelectExtDialog.vue';
import BookInfoDialog from './BookInfoDialog/BookInfoDialog.vue';
import SelectExtSearchDialog from './SelectExtSearchDialog/SelectExtSearchDialog.vue';
Expand Down Expand Up @@ -384,6 +401,7 @@ const componentOptions = {
SelectLangDialog,
SelectLibRateDialog,
SelectDateDialog,
SelectExtDialog,
BookInfoDialog,
SelectExtSearchDialog,
Dialog,
Expand Down Expand Up @@ -495,6 +513,7 @@ class Search {
selectLangDialogVisible = false;
selectLibRateDialogVisible = false;
selectDateDialogVisible = false;
selectExtDialogVisible = false;
bookInfoDialogVisible = false;
selectExtSearchDialogVisible = false;
Expand Down Expand Up @@ -531,6 +550,7 @@ class Search {
genreTree = [];
genreMap = new Map();
langList = [];
extList = [];
genreTreeInpxHash = '';
showTooltips = true;
Expand Down Expand Up @@ -561,7 +581,7 @@ class Search {
this.commit = this.$store.commit;
this.api = this.$root.api;
this.generateDefaults(this.search, ['author', 'series', 'title', 'genre', 'lang', 'date', 'librate']);
this.generateDefaults(this.search, ['author', 'series', 'title', 'genre', 'lang', 'date', 'librate', 'ext']);
this.search.setDefaults(this.search);
this.loadSettings();
Expand Down Expand Up @@ -705,6 +725,7 @@ class Search {
result.push(s.genre ? 'Жанр' : '');
result.push(s.date ? 'Дата поступления' : '');
result.push(s.librate ? 'Оценка' : '');
result.push(s.ext ? 'Тип файла' : '');
return result.filter(s => s).join(', ');
}
Expand Down Expand Up @@ -941,6 +962,11 @@ class Search {
this.selectLibRateDialogVisible = true;
}
selectExt() {
this.hideTooltip();
this.selectExtDialogVisible = true;
}
selectExtSearch() {
this.hideTooltip();
this.selectExtSearchDialogVisible = true;
Expand Down Expand Up @@ -1079,6 +1105,7 @@ class Search {
lang: (typeof(query.lang) == 'string' ? query.lang : this.langDefault),
date: query.date,
librate: query.librate,
ext: query.ext,
page: parseInt(query.page, 10),
limit: parseInt(query.limit, 10) || this.search.limit,
Expand Down Expand Up @@ -1170,6 +1197,7 @@ class Search {
}
this.langList = result.langList;
this.extList = result.extList;
this.genreTreeInpxHash = result.inpxHash;
}
} catch (e) {
Expand Down
Loading

0 comments on commit c3810d1

Please sign in to comment.