From 9c7a1b49ac58ea86b323cf3415c2795dbaa9f9f9 Mon Sep 17 00:00:00 2001 From: Fun Maker Date: Sat, 8 May 2021 18:39:36 +0200 Subject: [PATCH] README.md improvements. Fixed glitched regen logs when collection is empty. --- README.md | 15 +++++++++++++++ server/helpers/dbImport/import.ts | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/README.md b/README.md index f6cee0f..77565ff 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,21 @@ It does not provide any way to manage your posts or tags. The only way to add/mo changes in Hydrus and then rebuild Hybooru's database again(can be done from the cog menu on search/post page). +## Setup + +1) Install NodeJS, npm and PostgreSQL. +2) Create new Postgresql database and user. +3) Allow user to use `pg_trgm` and `intarray` extensions. Either: + - Grant the user permission to create trusted extensions: `GRANT CREATE ON DATABASE TO `. + - Create the extensions yourself: `CREATE EXTENSION IF NOT EXISTS pg_trgm; CREATE EXTENSION IF NOT EXISTS intarray;`. +4) Download latest [Release](/releases) production build [or build it yourself](#development). +5) Extract server files. +6) Edit `configs.json` to specify database credentials, hydrus db location and other options. See [Configuration](#configuration). +7) (Optional) Configure [reverse proxy](#reverse-proxy). +7) Run `npm start` to start server. + + + ## Searching Query Syntax Searching tries to imitate classical booru's syntax. All tags are lowercase and use `_` instead of space character. diff --git a/server/helpers/dbImport/import.ts b/server/helpers/dbImport/import.ts index 999175d..74427d5 100644 --- a/server/helpers/dbImport/import.ts +++ b/server/helpers/dbImport/import.ts @@ -40,6 +40,11 @@ export abstract class Import { const total = await this.total(); let count = 0; + if(total === 0) { + printProgress(true, this.display); + return; + } + const input = this.hydrus.prepare(this.inputQuery).raw(true); const output: Writable = await this.postgres.query(copy.from(this.outputQuery));