Compare commits
3 Commits
2665fa1c02
...
11d8a66c18
Author | SHA1 | Date |
---|---|---|
pinks | 11d8a66c18 | |
pinks | 22d9c518be | |
pinks | 4ba6f494d2 |
|
@ -1,3 +1,3 @@
|
|||
.env
|
||||
app*.db*
|
||||
updateConfig.ts
|
||||
*.db
|
||||
*.db-*
|
||||
|
|
25
README.md
25
README.md
|
@ -14,21 +14,26 @@ You can put these in `.env` file or pass them as environment variables.
|
|||
- `TG_BOT_TOKEN` - Telegram bot token. Get yours from [@BotFather](https://t.me/BotFather).
|
||||
Required.
|
||||
- `TG_ADMIN_USERNAMES` - Comma separated list of usernames of users that can use admin commands.
|
||||
- `DENO_KV_PATH` - [Deno KV](https://deno.land/api?s=Deno.openKv&unstable) database file path. A
|
||||
temporary file is used by default.
|
||||
- `LOG_LEVEL` - [Log level](https://deno.land/std@0.201.0/log/mod.ts?s=LogLevels). Default: `INFO`.
|
||||
|
||||
You can configure more stuff in [Eris WebUI](http://localhost:5999/) when running.
|
||||
|
||||
## Running
|
||||
|
||||
- Start stable diffusion webui: `cd sd-webui`, `./webui.sh --api`
|
||||
- Start bot: `deno task start`
|
||||
|
||||
To connect your SD to the bot, open the [Eris UI](http://localhost:5999/), login as admin and add a
|
||||
worker.
|
||||
- Start Stable Diffusion WebUI: `./webui.sh --api` (in SD WebUI directory)
|
||||
- Start Eris: `deno task start`
|
||||
|
||||
## Codegen
|
||||
|
||||
The Stable Diffusion API in `app/sdApi.ts` is auto-generated. To regenerate it, first start your SD
|
||||
WebUI with `--nowebui --api`, and then run:
|
||||
The Stable Diffusion API types are auto-generated. To regenerate them, first start your SD WebUI
|
||||
with `--nowebui --api`, and then run `deno task generate`
|
||||
|
||||
```sh
|
||||
deno run npm:openapi-typescript http://localhost:7861/openapi.json -o app/sdApi.ts
|
||||
```
|
||||
## Project structure
|
||||
|
||||
- `/api` - Eris API served at `http://localhost:5999/api/`.
|
||||
- `/app` - Queue handling and other core processes.
|
||||
- `/bot` - Handling bot commands and other updates from Telegram API.
|
||||
- `/ui` - Eris WebUI frontend files served at `http://localhost:5999/`.
|
||||
- `/util` - Utility functions shared by other parts.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { KvFs } from "kvfs";
|
||||
|
||||
export const db = await Deno.openKv("./app.db");
|
||||
export const db = await Deno.openKv(Deno.env.get("DENO_KV_PATH"));
|
||||
export const fs = new KvFs(db);
|
||||
|
|
26
deno.json
26
deno.json
|
@ -1,7 +1,8 @@
|
|||
{
|
||||
"tasks": {
|
||||
"start": "deno run --unstable --allow-env --allow-read --allow-write --allow-net main.ts",
|
||||
"check": "deno check --unstable main.ts && deno check --unstable ui/main.tsx"
|
||||
"check": "deno check --unstable main.ts && deno check --unstable ui/main.tsx",
|
||||
"generate": "deno run npm:openapi-typescript http://localhost:7861/openapi.json -o app/sdApi.ts",
|
||||
"start": "deno run --unstable --allow-env --allow-read --allow-write --allow-net main.ts"
|
||||
},
|
||||
"compilerOptions": {
|
||||
"jsx": "react"
|
||||
|
@ -18,22 +19,29 @@
|
|||
},
|
||||
"imports": {
|
||||
"@date-fns/utc": "https://cdn.skypack.dev/@date-fns/utc@1.1.0?dts",
|
||||
"@twind/core": "https://esm.sh/@twind/core@1.1.3?dev",
|
||||
"@twind/preset-tailwind": "https://esm.sh/@twind/preset-tailwind@1.1.4?dev",
|
||||
"async": "https://deno.land/x/async@v2.0.2/mod.ts",
|
||||
"date-fns": "https://cdn.skypack.dev/date-fns@2.30.0?dts",
|
||||
"file_type": "https://esm.sh/file-type@18.5.0",
|
||||
"grammy": "https://lib.deno.dev/x/grammy@1/mod.ts",
|
||||
"grammy_autoquote": "https://lib.deno.dev/x/grammy_autoquote@1/mod.ts",
|
||||
"grammy_files": "https://lib.deno.dev/x/grammy_files@1/mod.ts",
|
||||
"grammy_parse_mode": "https://lib.deno.dev/x/grammy_parse_mode@1/mod.ts",
|
||||
"grammy_runner": "https://lib.deno.dev/x/grammy_runner@2/mod.ts",
|
||||
"grammy_stateless_question": "https://lib.deno.dev/x/grammy_stateless_question_alpha@3/mod.ts",
|
||||
"grammy_types": "https://lib.deno.dev/x/grammy_types@3/mod.ts",
|
||||
"grammy": "https://lib.deno.dev/x/grammy@1/mod.ts",
|
||||
"indexed_kv": "https://deno.land/x/indexed_kv@v0.5.0/mod.ts",
|
||||
"kvfs": "https://deno.land/x/kvfs@v0.1.0/mod.ts",
|
||||
"kvmq": "https://deno.land/x/kvmq@v0.3.0/mod.ts",
|
||||
"openapi_fetch": "https://esm.sh/openapi-fetch@0.7.6",
|
||||
"png_chunk_text": "https://esm.sh/png-chunk-text@1.0.0",
|
||||
"png_chunks_extract": "https://esm.sh/png-chunks-extract@1.0.0",
|
||||
"react": "https://esm.sh/react@18.2.0?dev",
|
||||
"react-dom/client": "https://esm.sh/react-dom@18.2.0/client?dev",
|
||||
"react-flip-move": "https://esm.sh/react-flip-move@3.0.5?dev",
|
||||
"react-intl": "https://esm.sh/react-intl@6.4.7?external=react&alias=@types/react:react&dev",
|
||||
"react-router-dom": "https://esm.sh/react-router-dom@6.16.0?dev",
|
||||
"reroute": "https://deno.land/x/reroute@v0.1.0/mod.ts",
|
||||
"serve_spa": "https://deno.land/x/serve_spa@v0.2.0/mod.ts",
|
||||
"std/async/": "https://deno.land/std@0.201.0/async/",
|
||||
|
@ -43,19 +51,11 @@
|
|||
"std/fmt/": "https://deno.land/std@0.202.0/fmt/",
|
||||
"std/log/": "https://deno.land/std@0.201.0/log/",
|
||||
"std/path/": "https://deno.land/std@0.204.0/path/",
|
||||
"t_rest/server": "https://esm.sh/ty-rest@0.4.0/server?dev",
|
||||
"ulid": "https://deno.land/x/ulid@v0.3.0/mod.ts",
|
||||
|
||||
"@twind/core": "https://esm.sh/@twind/core@1.1.3?dev",
|
||||
"@twind/preset-tailwind": "https://esm.sh/@twind/preset-tailwind@1.1.4?dev",
|
||||
"react-dom/client": "https://esm.sh/react-dom@18.2.0/client?dev",
|
||||
"react-flip-move": "https://esm.sh/react-flip-move@3.0.5?dev",
|
||||
"react-intl": "https://esm.sh/react-intl@6.4.7?external=react&alias=@types/react:react&dev",
|
||||
"react-router-dom": "https://esm.sh/react-router-dom@6.16.0?dev",
|
||||
"react": "https://esm.sh/react@18.2.0?dev",
|
||||
"swr": "https://esm.sh/swr@2.2.4?dev",
|
||||
"swr/mutation": "https://esm.sh/swr@2.2.4/mutation?dev",
|
||||
"t_rest/client": "https://esm.sh/ty-rest@0.4.0/client?dev",
|
||||
"t_rest/server": "https://esm.sh/ty-rest@0.4.0/server?dev",
|
||||
"ulid": "https://deno.land/x/ulid@v0.3.0/mod.ts",
|
||||
"use-local-storage": "https://esm.sh/use-local-storage@3.0.0?dev"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue