Compare commits
2 Commits
a2fdf862dd
...
cdb44655b7
Author | SHA1 | Date |
---|---|---|
Suguivy | cdb44655b7 | |
Sugui | 050eb48aa2 |
|
@ -38,6 +38,8 @@ services:
|
||||||
environment:
|
environment:
|
||||||
PORT: 8081
|
PORT: 8081
|
||||||
BOT_API_URI: "http://bot-api:8080"
|
BOT_API_URI: "http://bot-api:8080"
|
||||||
|
GELBOORU_IMAGES_PER_REQUEST: 100 # Number of images per request, maximum 100
|
||||||
|
GELBOORU_TAGS: "2girls sleeping" # Tags of the images. The images will have all of these tags
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/usr/src/app:ro
|
- ./:/usr/src/app:ro
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
|
import { env } from "bun";
|
||||||
import GelbooruApiResponse from "src/types/GelbooruApiResponse";
|
import GelbooruApiResponse from "src/types/GelbooruApiResponse";
|
||||||
import GelbooruServiceResponse from "src/types/GelbooruServiceResponse";
|
import GelbooruServiceResponse from "src/types/GelbooruServiceResponse";
|
||||||
|
|
||||||
class GelbooruApiService {
|
class GelbooruApiService {
|
||||||
async get(): Promise<GelbooruServiceResponse> {
|
async get(): Promise<GelbooruServiceResponse> {
|
||||||
const limit = 100;
|
const LIMIT = env.GELBOORU_IMAGES_PER_REQUEST || 100;
|
||||||
const url: string = `https://gelbooru.com/index.php?page=dapi&s=post&q=index&limit=${limit}&json=1&tags=2girls+sleeping`
|
const TAGS = encodeURIComponent(env.GELBOORU_TAGS || "");
|
||||||
|
const url: string = `https://gelbooru.com/index.php?page=dapi&s=post&q=index&limit=${LIMIT}&json=1&tags=${TAGS}`;
|
||||||
|
|
||||||
const response: GelbooruApiResponse = await fetch(url)
|
const response: GelbooruApiResponse = await fetch(url)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
|
|
Loading…
Reference in New Issue