Compare commits
2 Commits
800c9cb651
...
76397a4fc0
| Author | SHA1 | Date | |
|---|---|---|---|
| 76397a4fc0 | |||
| 7b86090b75 |
@@ -1,15 +1,5 @@
|
||||
# Local-Booru
|
||||
|
||||
Version Naming Rules:
|
||||
## [ENGLISH README](doc/readme_en.md) | [РУССКИЙ README](doc/readme_ru.md)
|
||||
|
||||
[Version Code][Version Type]
|
||||
|
||||
All technical versions are designated as snapshots (s)
|
||||
|
||||
All test versions are designated as beta (b)
|
||||
|
||||
All pre-release and release versions are designated as release candidate and release (rc, r)
|
||||
|
||||
## AI Usage Disclaimer
|
||||
|
||||
Files in the "template" folder may be entirely or partially generated by AI.
|
||||
## [INSTALL INSRUCTION](doc/readme_en.md) | [ИНСТРУКЦИЯ ПО УСТАНОВКЕ](doc/readme_ru.md)
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
@@ -0,0 +1,63 @@
|
||||
# Installation Guide
|
||||
|
||||
## System Requirements
|
||||
|
||||
- **OS:** Windows 10+, macOS 10.13+, Linux kernel 3.x+
|
||||
- **RAM:** 512 MB or higher
|
||||
- **Disk Space:** 512 MB minimum + additional space for data
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Python 3.13.13 or higher
|
||||
- ffmpeg 2026-01-29 (required if you intend to store video files)
|
||||
- git (optional)
|
||||
|
||||
## Instructions
|
||||
|
||||
Once you have installed the required software, you need to configure the booru.
|
||||
|
||||
### Downloading the package
|
||||
|
||||
You have two options depending on whether you have git installed:
|
||||
|
||||
#### Using CLI (recommended)
|
||||
Run the following command in the folder where the site will be located:
|
||||
`git clone https://git.nekono.su/Nyako/Local-Booru.git .`
|
||||
|
||||
#### Using the website
|
||||
1. Download the archive by clicking the buttons shown below:
|
||||

|
||||

|
||||
2. Extract the archive into the folder where the site will be hosted.
|
||||
|
||||
### Installing dependencies
|
||||
|
||||
In the terminal, navigate to the folder where the site is located and run:
|
||||
`pip install -r requirements.txt`
|
||||
|
||||
### Configuring `config.json`
|
||||
|
||||
Config explanation:
|
||||
|
||||
| Key | Default | Description |
|
||||
| :--- | :--- | :--- |
|
||||
| `server`-`host` | `"127.0.2.1"` | Server host address |
|
||||
| `server`-`port` | `80` | Server port |
|
||||
| `server`-`count_page` | `25` | Number of items per page |
|
||||
| `server`-`thumb_size` | `250` | Thumbnail size (pixels, long side) |
|
||||
| `gb`-`id` | `""` | Gelbooru User ID |
|
||||
| `gb`-`hash` | `""` | Gelbooru User Hash |
|
||||
| `file`-`repos` | `["data/files"]` | List of directories where source files are stored |
|
||||
| `file`-`dw` | `"data/files"` | Directory for new downloads |
|
||||
| `file`-`thumb` | `"data/thumb"` | Directory for thumbnails |
|
||||
|
||||
1. You must obtain your Gelbooru User ID and Hash and add them to the config file for the system to function correctly.
|
||||
2. Install the script in [VioletMonkey](https://git.nekono.su/Nyako/Local-Booru/raw/branch/main/button_script.user.js).
|
||||
|
||||
#### If you changed the Host or Port:
|
||||
- Open any post.
|
||||
- Update the base URL in the script configuration to match your custom settings.
|
||||
|
||||
### Launch
|
||||
|
||||
Simply run: `python run.py`
|
||||
@@ -0,0 +1,69 @@
|
||||
## Системные требования
|
||||
|
||||
OC: Windows 10+, macOS 10.13+, Linux kernel 3.x+
|
||||
ОЗУ: 512 МБ и выше
|
||||
Диск: 512 МБ минимум + место под данные
|
||||
|
||||
## Требуеться заранее установить
|
||||
|
||||
- Python 3.13.13 и выше
|
||||
- ffmpeg 2026-01-29 (Если вы будете хранить видео)
|
||||
- git (по желанию)
|
||||
|
||||
## Инструкиция
|
||||
|
||||
Приготовив все программы вам надо настроить booru
|
||||
|
||||
### Скачиваем пакет
|
||||
|
||||
У вас есть два варианта в зависимости от установленного git
|
||||
|
||||
#### Используя CLI сделать в папке где будет размещен сайт
|
||||
|
||||
`git clone https://git.nekono.su/Nyako/Local-Booru.git .`
|
||||
|
||||
#### Используя веб-сайт
|
||||
|
||||
1. Скачиваем по кнопке:
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
2. Делаем распаковку в папку где будет сайт
|
||||
|
||||
### Производим установку зависимостей
|
||||
|
||||
Используя CLI сделать в папке где будет размещен сайт
|
||||
|
||||
`pip install -r requirements.txt`
|
||||
|
||||
### Делаем конфигурацию файла config.json
|
||||
|
||||
Объяснение конфига:
|
||||
|
||||
| Ключ | По умолчанию | Пояснение |
|
||||
|----------|----------|----------|
|
||||
| `server`-`host` | `"127.0.2.1"` | Хост запуска сервера |
|
||||
| `server`-`port` | `80` | Порт запуска сервера |
|
||||
| `server`-`count_page` | `25` | Количество элементов на странице |
|
||||
| `server`-`thumb_size` | `250` | Размер превью в пикселях по широкой стороне |
|
||||
| `gb`-`id` | `""` | ID пользователя Gelbooru |
|
||||
| `gb`-`hash` | `""` | Hash пользователя Gelbooru |
|
||||
| `file`-`repos` | `["data/files"]` | Список каталогов где храняться полные файлы |
|
||||
| `file`-`dw` | `"data/files"` | Каталог хранения загрузок |
|
||||
| `file`-`thumb` | `"data/thumb"` | Каталог обложек |
|
||||
|
||||
1. Обязательно надо получить ID и Hash пользователя и внести в конфиг для работы!
|
||||
|
||||
2. Установить скрипт в VioletMonkey [отсюда](https://git.nekono.su/Nyako/Local-Booru/raw/branch/main/button_script.user.js)
|
||||
|
||||
#### Если вы меняли Host или Port
|
||||
|
||||
- Открыть любой пост
|
||||
|
||||
- Ввести корневой путь в конфигурации скрипта на тот что у вас
|
||||
|
||||
### Запуск
|
||||
|
||||
Просто выполните `python run.py`
|
||||
@@ -0,0 +1,15 @@
|
||||
## Remarque
|
||||
|
||||
Version Naming Rules:
|
||||
|
||||
[Version Code][Version Type]
|
||||
|
||||
All technical versions are designated as snapshots (s)
|
||||
|
||||
All test versions are designated as beta (b)
|
||||
|
||||
All pre-release and release versions are designated as release candidate and release (rc, r)
|
||||
|
||||
## AI Usage Disclaimer
|
||||
|
||||
Files in the "template" folder may be entirely or partially generated by AI.
|
||||
@@ -1,4 +1,4 @@
|
||||
# Local-Booru
|
||||
## Ремарка
|
||||
|
||||
Правила найменования версий:
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
blinker==1.9.0
|
||||
certifi==2026.5.20
|
||||
charset-normalizer==3.4.7
|
||||
click==8.4.1
|
||||
colorama==0.4.6
|
||||
Flask==3.1.3
|
||||
idna==3.17
|
||||
itsdangerous==2.2.0
|
||||
Jinja2==3.1.6
|
||||
MarkupSafe==3.0.3
|
||||
pillow==12.2.0
|
||||
requests==2.34.2
|
||||
urllib3==2.7.0
|
||||
Werkzeug==3.1.8
|
||||
@@ -84,7 +84,9 @@ def dw_api():
|
||||
for chunk in r.iter_content(chunk_size=8192):
|
||||
f.write(chunk)
|
||||
database.add_raw(data_get)
|
||||
image_processor.generate_thumb(FILE_DW_FOLDERS+"/"+file_name, THUMB_FOLDER, TARGET_MIN_SIZE)
|
||||
res_data = image_processor.generate_thumb(FILE_DW_FOLDERS+"/"+file_name, THUMB_FOLDER, TARGET_MIN_SIZE)
|
||||
if not res_data["status"]:
|
||||
print(res_data["message"])
|
||||
return jsonify({'status': 'success'})
|
||||
except requests.exceptions.RequestException as e:
|
||||
error_message = f"Network error {image_id}: {e}"
|
||||
|
||||
@@ -29,7 +29,12 @@ class GB:
|
||||
return response.json()["post"][0], url_file, file_name
|
||||
|
||||
def get_from_md5(self, md5):
|
||||
pass
|
||||
params = {"page": "dapi", "s": "post", "q": "index", "json": 1, "tags":"md5:"+md5, "api_key":self.api_hash, "user_id":self.api_id}
|
||||
response = requests.get(self.root_url, params=params, headers=self.HEADERS, timeout=15)
|
||||
print(response.url)
|
||||
url_file = response.json()["post"][0]["file_url"]
|
||||
file_name = response.json()["post"][0]["image"]
|
||||
return response.json()["post"][0], url_file, file_name
|
||||
|
||||
def get_binary_file(self, id_post):
|
||||
pass
|
||||
@@ -2,8 +2,8 @@ import subprocess
|
||||
from PIL import Image
|
||||
import os
|
||||
|
||||
EXTENSIONS_IMG = ('.jpg', '.jpeg', '.png', '.gif', '.webp', '.bmp')
|
||||
EXTENSIONS_VID = ('.mp4', '.webm')
|
||||
EXTENSIONS_IMG = ('jpg', 'jpeg', 'png', 'gif', 'webp', 'bmp')
|
||||
EXTENSIONS_VID = ('mp4', 'webm')
|
||||
VALID_EXTENSIONS = EXTENSIONS_IMG + EXTENSIONS_VID
|
||||
|
||||
def check_ffmpeg():
|
||||
@@ -27,15 +27,10 @@ def video_gen(input_path_file, output_path_file, TARGET_MIN_SIZE):
|
||||
def image_and_gif_gen(input_path_file, output_path_file, TARGET_MIN_SIZE):
|
||||
with Image.open(input_path_file) as img:
|
||||
img_rgba = img.convert("RGBA")
|
||||
|
||||
background = Image.new("RGB", img_rgba.size, (255, 255, 255))
|
||||
|
||||
background.paste(img_rgba, mask=img_rgba)
|
||||
|
||||
final_img = background
|
||||
|
||||
width, height = final_img.size
|
||||
|
||||
if width <= TARGET_MIN_SIZE and height <= TARGET_MIN_SIZE:
|
||||
final_img.save(output_path_file, "JPEG", quality=90)
|
||||
else:
|
||||
@@ -45,7 +40,6 @@ def image_and_gif_gen(input_path_file, output_path_file, TARGET_MIN_SIZE):
|
||||
else:
|
||||
new_height = TARGET_MIN_SIZE
|
||||
new_width = int(TARGET_MIN_SIZE * (width / height))
|
||||
|
||||
resized_img = final_img.resize((new_width, new_height), Image.Resampling.LANCZOS)
|
||||
resized_img.save(output_path_file, "JPEG", quality=85)
|
||||
|
||||
@@ -53,7 +47,7 @@ def generate_thumb(input_path_file, THUMB_FOLDER, TARGET_MIN_SIZE):
|
||||
ext_file = input_path_file.split(".")[-1]
|
||||
if ext_file not in VALID_EXTENSIONS:
|
||||
return {"status":False, "message":"Расширение не поддерживаеться!"}
|
||||
thumb_filename = f"{input_path_file.split(".")[-2]}.jpg"
|
||||
thumb_filename = f"{os.path.basename(input_path_file).split(".")[-2]}.jpg"
|
||||
output_path_file = os.path.join(THUMB_FOLDER, thumb_filename)
|
||||
if ext_file in EXTENSIONS_IMG:
|
||||
image_and_gif_gen(input_path_file, output_path_file, TARGET_MIN_SIZE)
|
||||
|
||||
@@ -63,7 +63,9 @@
|
||||
|
||||
<header>
|
||||
<a href="/" class="logo">LocalBooru</a>
|
||||
<!--
|
||||
<a class="analytics" href="/analytics">📊 Analytics</a>
|
||||
-->
|
||||
<div class="search-wrapper">
|
||||
<input type="text" id="searchInput" placeholder="Search tags...">
|
||||
<ul id="autocompleteList" class="autocomplete-list"></ul>
|
||||
|
||||
Reference in New Issue
Block a user