@inner-dj/server 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,91 @@
1
+ # @inner-dj/server
2
+
3
+ [![NPM](https://nodei.co/npm/@inner-dj/server.svg?data=n,v,u,d,s)](https://www.npmjs.com/package/@inner-dj/server)
4
+
5
+ This is the web server component for [inner-dj](https://codeberg.org/sanin/inner-dj).
6
+
7
+ ## Requirements
8
+
9
+ - yt-dlp
10
+
11
+ ## Deployment
12
+
13
+ The inner-dj server is available via [Docker Hub](https://hub.docker.com/r/corysanin/inner-dj) and [npm](https://www.npmjs.com/package/@inner-dj/server).
14
+
15
+ ### Docker
16
+
17
+ ```
18
+ docker run -v "${PWD}/config:/usr/src/app/config/:ro" corysanin/inner-dj
19
+ ```
20
+
21
+ ### npm
22
+
23
+ ```
24
+ npx @inner-dj/server
25
+ ```
26
+
27
+ ### pnpm
28
+
29
+ ```
30
+ pnpm dlx --allow-build=better-sqlite3 --allow-build=bufferutil --allow-build=utf-8-validate @inner-dj/server
31
+ ```
32
+
33
+ ## Configuration
34
+
35
+ By default, inner-dj server will attempt to load a configuration file at `config/config.yaml` (relative to the current working directory).
36
+ To use a custom config path, set environment variable `CONFIG`.
37
+
38
+ ### Config Root
39
+
40
+ | YAML key | Environment Var | Type | Description | Default |
41
+ |---------------|-----------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------|
42
+ | port | PORT | number | Port to run the web server on | 8080 |
43
+ | trustProxy | TRUSTPROXY | boolean\|number\|string | Whether or not the server is behind a proxy and to trust proxy headers. See [express behind proxies](https://expressjs.com/en/guide/behind-proxies/) | false |
44
+ | secure | SECURE | boolean | Whether or not to set the Set-Cookie header to Secure, requiring https traffic for cookies | true |
45
+ | public | PUBLIC | boolean | False requires a TOTP code to request songs. Navigate to `/?override=1` to log in as admin. | false |
46
+ | sessionSecret | SESSIONSECRET | string | The session secret. Do not share. | REQUIRED |
47
+ | userOtp | USEROTP | string | TOTP token for user access. Unused if server is public. If blank, one is generated at start up. Check logs. | RANDOM |
48
+ | adminOtp | ADMINOTP | string | TOTP token for admin access. If blank, one is generated at start up. Check logs. | RANDOM |
49
+ | cookieTTL | COOKIETTL | number | Cookie max age in ms | 2592000000 (30d) |
50
+ | jwtSecret | JWTSECRET | string | Secret for communications between client and server. Only share with client. | REQUIRED |
51
+ | cookies | COOKIES | string | Optional path to Netscape-formatted file to read cookies from. See [how do I pass cookies to yt-dlp?](https://github.com/yt-dlp/yt-dlp/wiki/FAQ#how-do-i-pass-cookies-to-yt-dlp) | null |
52
+ | db | | [DBConfig](#dbconfig) | | |
53
+ | discord | | [DiscordReceiverConfig](#discordreceiverconfig) | | |
54
+ | twilio | | [TwilioReceiverConfig](#twilioreceiverconfig) | | |
55
+
56
+ ### DBConfig
57
+
58
+ | YAML key | Environment Var | Type | Description | Default |
59
+ |----------|-----------------|--------|------------------------------------|---------------------------------|
60
+ | path | DBPATH | string | Path to SQLite DB for session data | sessions.db next to config file |
61
+
62
+ ### DiscordReceiverConfig
63
+
64
+ | YAML key | Environment Var | Type | Description | Default |
65
+ |----------|-----------------|-----------------|-----------------------------------------------------------------------------------------------------------------|----------|
66
+ | enabled | DISCORDENABLED | boolean | Whether or not to use Discord for receiving song requests. | false |
67
+ | token | DISCORDTOKEN | string | Discord bot token. Required if Discord integration is enabled. | REQUIRED |
68
+ | route | DISCORDROUTE | string | If set, creates a redirect to the Discord application's authentication URL | null |
69
+ | activity | | ActivityOptions | See [interface ActivityOptions](https://discord.js.org/docs/packages/discord.js/main/ActivityOptions:Interface) | null |
70
+
71
+ ### TwilioReceiverConfig
72
+
73
+ | YAML key | Environment Var | Type | Description | Default |
74
+ |---------------|---------------------|---------|--------------------------------------------------------------------------------------------------|-----------------|
75
+ | enabled | TWILIOENABLED | boolean | Whether or not to use Twilio for receiving song requests via SMS. | false |
76
+ | authToken | TWILIOAUTHTOKEN | string | Twilio auth token. Required if Twilio integration is enabled. | REQUIRED |
77
+ | route | TWILIOROUTE | string | Webhook endpoint route | /webhook/twilio |
78
+ | url | TWILIOURL | string | Full URL to webhook endpoint. By default, inner-dj will guess this based on the request headers. | |
79
+ | response | TWILIORESPONSE | string | SMS response to send in reply to received requests. Empty string results in no reply. | EMPTY STRING |
80
+ | errorResponse | TWILIOERRORRESPONSE | string | SMS response to send if something went wrong . Empty string results in no reply. | EMPTY STRING |
81
+ | phone | TWILIOPHONE | string | Human-readable phone number to display in the user instructions. | REQUIRED |
82
+
83
+ ## Usage
84
+
85
+ Important pages:
86
+
87
+ - `/landing`: The page for users to request songs
88
+ - `/admin`: Kiosk-like page with instructions for guests
89
+ - `/admin/controls`: Admin control panel for skipping the current song
90
+
91
+ Load the `/admin` page on a device or screen that guests can see. The page has instructions that guests can follow. Skip tracks with `/admin/controls` when necessary.