yacscript 0.3.1__tar.gz → 0.4.0__tar.gz
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.
- {yacscript-0.3.1 → yacscript-0.4.0}/COPYING +12 -12
- {yacscript-0.3.1 → yacscript-0.4.0}/PKG-INFO +268 -234
- {yacscript-0.3.1 → yacscript-0.4.0}/README.md +267 -233
- yacscript-0.4.0/app/__init__.py +151 -0
- yacscript-0.4.0/app/app.py +750 -0
- yacscript-0.4.0/app/db.py +82 -0
- {yacscript-0.3.1 → yacscript-0.4.0}/app/definitions.py +71 -71
- yacscript-0.4.0/app/static/admin.js +116 -0
- yacscript-0.4.0/app/static/dialog.js +178 -0
- yacscript-0.4.0/app/static/handoff.js +14 -0
- yacscript-0.4.0/app/static/room.js +629 -0
- yacscript-0.4.0/app/static/style.css +302 -0
- yacscript-0.4.0/app/static/vendor/98.css +2 -0
- yacscript-0.4.0/app/static/vendor/ms_sans_serif.woff +0 -0
- yacscript-0.4.0/app/static/vendor/ms_sans_serif.woff2 +0 -0
- yacscript-0.4.0/app/static/vendor/ms_sans_serif_bold.woff +0 -0
- yacscript-0.4.0/app/static/vendor/ms_sans_serif_bold.woff2 +0 -0
- yacscript-0.4.0/app/static/vendor/socket.io.min.js +7 -0
- yacscript-0.4.0/app/templates/handoff.jinja +12 -0
- yacscript-0.4.0/app/templates/index.jinja +50 -0
- yacscript-0.4.0/app/templates/room.jinja +99 -0
- {yacscript-0.3.1 → yacscript-0.4.0}/pyproject.toml +2 -2
- yacscript-0.3.1/app/__init__.py +0 -35
- yacscript-0.3.1/app/app.py +0 -710
- yacscript-0.3.1/app/db.py +0 -25
- yacscript-0.3.1/app/static/admin.js +0 -110
- yacscript-0.3.1/app/static/room.js +0 -369
- yacscript-0.3.1/app/static/style.css +0 -64
- yacscript-0.3.1/app/templates/index.jinja +0 -47
- yacscript-0.3.1/app/templates/room.jinja +0 -107
- {yacscript-0.3.1 → yacscript-0.4.0}/app/static/file.mp3 +0 -0
- {yacscript-0.3.1 → yacscript-0.4.0}/app/static/icon.png +0 -0
- {yacscript-0.3.1 → yacscript-0.4.0}/app/static/join.mp3 +0 -0
- {yacscript-0.3.1 → yacscript-0.4.0}/app/static/leave.mp3 +0 -0
- {yacscript-0.3.1 → yacscript-0.4.0}/app/static/msg.mp3 +0 -0
- {yacscript-0.3.1 → yacscript-0.4.0}/app/static/send.mp3 +0 -0
- {yacscript-0.3.1 → yacscript-0.4.0}/app/static/tile.gif +0 -0
- {yacscript-0.3.1 → yacscript-0.4.0}/app/static/tile.jpg +0 -0
- {yacscript-0.3.1 → yacscript-0.4.0}/app/static/welcome.mp3 +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
2
|
-
Version 2, December 2004
|
|
3
|
-
|
|
4
|
-
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
|
5
|
-
|
|
6
|
-
Everyone is permitted to copy and distribute verbatim or modified
|
|
7
|
-
copies of this license document, and changing it is allowed as long
|
|
8
|
-
as the name is changed.
|
|
9
|
-
|
|
10
|
-
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
11
|
-
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
12
|
-
|
|
1
|
+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
2
|
+
Version 2, December 2004
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
|
5
|
+
|
|
6
|
+
Everyone is permitted to copy and distribute verbatim or modified
|
|
7
|
+
copies of this license document, and changing it is allowed as long
|
|
8
|
+
as the name is changed.
|
|
9
|
+
|
|
10
|
+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
11
|
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
12
|
+
|
|
13
13
|
0. You just DO WHAT THE FUCK YOU WANT TO.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: yacscript
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: yet another chatroom script.
|
|
5
5
|
Author: Valine0x
|
|
6
6
|
Author-email: Valine0x <me@valine0x.icu>
|
|
@@ -15,236 +15,270 @@ Requires-Dist: webargs>=8.7.0
|
|
|
15
15
|
Requires-Python: >=3.13
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
|
|
18
|
-
# YACS
|
|
19
|
-
Yet Another Chatroom Script
|
|
20
|
-
|
|
21
|
-
Inspired by [LE-CHAT-PHP](https://github.com/DanWin/le-chat-php)
|
|
22
|
-
|
|
23
|
-

|
|
24
|
-
|
|
25
|
-
## Featuring
|
|
26
|
-
|
|
27
|
-
- Multiple channels.
|
|
28
|
-
- Admins.
|
|
29
|
-
- Files and embedded images/videos.
|
|
30
|
-
- BBCode.
|
|
31
|
-
- CAPTCHA.
|
|
32
|
-
- Vanilla HTML & CSS & JS.
|
|
33
|
-
- No Cookies, it's bad for your teeth.
|
|
34
|
-
|
|
35
|
-
##
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
$
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
$
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
18
|
+
# YACS
|
|
19
|
+
Yet Another Chatroom Script
|
|
20
|
+
|
|
21
|
+
Inspired by [LE-CHAT-PHP](https://github.com/DanWin/le-chat-php)
|
|
22
|
+
|
|
23
|
+

|
|
24
|
+
|
|
25
|
+
## Featuring
|
|
26
|
+
|
|
27
|
+
- Multiple channels.
|
|
28
|
+
- Admins.
|
|
29
|
+
- Files and embedded images/videos.
|
|
30
|
+
- BBCode.
|
|
31
|
+
- CAPTCHA.
|
|
32
|
+
- Vanilla HTML & CSS & JS.
|
|
33
|
+
- No Cookies, it's bad for your teeth.
|
|
34
|
+
|
|
35
|
+
## Migrating from Older Versions (IMPORTANT)
|
|
36
|
+
|
|
37
|
+
If you are upgrading from YACS 0.3.x or earlier, your existing database and resource files may not be compatible with the new release. Use the `migrate` command to fix things up **before** starting the server:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# From venv
|
|
41
|
+
(.venv) yacscript migrate --config config.toml
|
|
42
|
+
|
|
43
|
+
# From source
|
|
44
|
+
$ uv run yacscript migrate --config config.toml
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The `migrate` command will fix the database schema as well as the resource naming.
|
|
48
|
+
|
|
49
|
+
It is safe to run `migrate` multiple times — if there is nothing to migrate, no changes will be made anyway.
|
|
50
|
+
|
|
51
|
+
## Try It Out Right Now!
|
|
52
|
+
|
|
53
|
+
Join [The YACS Demo Server](https://chat.valine0x.icu) right now with passphrase **`the-yacs`** to see YACS in action!
|
|
54
|
+
|
|
55
|
+
## Deployment
|
|
56
|
+
|
|
57
|
+
### 1. Deploy with venv (Recommended)
|
|
58
|
+
|
|
59
|
+
Create a venv with python version 3.13 or greater.
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
$ python -m venv .venv
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Activate venv in *nix shell (e.g. bash, zsh)
|
|
67
|
+
$ source .venv/bin/activate
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```pwsh
|
|
71
|
+
# Activate venv in pwsh
|
|
72
|
+
> . .venv\Scripts\Activate.ps1"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
Then, install the package inside venv.
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
(.venv) pip install yacscript
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Create a configuration file and edit it to your liking.
|
|
83
|
+
|
|
84
|
+
For reference, see the <a href="#configuration">configuration section</a>.
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
(.venv) vi ./config.toml
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Finally, start the server within the venv:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
(.venv) yacscript start --config config.toml
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
In addition to that, you might want to deploy the program as a daemon. Here's an example of a possible simple unit file for systemd.
|
|
97
|
+
|
|
98
|
+
Assuming you have installed the venv as `/path/to/.venv`, for example `/opt/yacs/.venv`, making `/path/to/` means `/opt/yacs/` for the setup.
|
|
99
|
+
|
|
100
|
+
```ini
|
|
101
|
+
[Unit]
|
|
102
|
+
Description=YACS Service
|
|
103
|
+
After=network.target
|
|
104
|
+
|
|
105
|
+
[Service]
|
|
106
|
+
Type=simple
|
|
107
|
+
WorkingDirectory=/path/to
|
|
108
|
+
Environment="PATH=/path/to/.venv/bin"
|
|
109
|
+
ExecStart=/path/to/.venv/bin/yacscript start --config /path/to/config.toml
|
|
110
|
+
|
|
111
|
+
[Install]
|
|
112
|
+
WantedBy=multi-user.target
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 2. Deploy from source (with uv)
|
|
116
|
+
|
|
117
|
+
Deploying from source gives you access to the latest features but may be unstable
|
|
118
|
+
|
|
119
|
+
To deploy from source, first you need to install uv.
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# Install with pip.
|
|
123
|
+
$ pip install uv
|
|
124
|
+
|
|
125
|
+
# Install on macOS and Linux.
|
|
126
|
+
$ curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
127
|
+
|
|
128
|
+
# Install on Windows.
|
|
129
|
+
$ powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Then, clone the repo.
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
$ git clone https://github.com/valine-dev/yacs.git
|
|
136
|
+
$ cd yacs
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Create a config file, and edit it to your liking.
|
|
140
|
+
|
|
141
|
+
For reference, see the <a href="#configuration">configuration section</a>.
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
$ vi ./config.toml
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Finally, run the server, dependencies and venv will be installed along the way.
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
$ uv run yacscript start --config config.toml
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Additionally, it's also possible to make a daemon service out of deployment from source.
|
|
154
|
+
|
|
155
|
+
An example unit file is shown as below.
|
|
156
|
+
|
|
157
|
+
```ini
|
|
158
|
+
[Unit]
|
|
159
|
+
Description=YACS Service
|
|
160
|
+
After=network.target
|
|
161
|
+
|
|
162
|
+
[Service]
|
|
163
|
+
Type=simple
|
|
164
|
+
WorkingDirectory=/path/to/yacs
|
|
165
|
+
Environment="PATH=/path/to/yacs/.venv/bin"
|
|
166
|
+
# Notice the difference to deploying from package!
|
|
167
|
+
ExecStart=/path/to/uv run yacscript start --config /path/to/config.toml
|
|
168
|
+
|
|
169
|
+
[Install]
|
|
170
|
+
WantedBy=multi-user.target
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## CLI Reference
|
|
174
|
+
|
|
175
|
+
The `yacscript` command ships with the following subcommands:
|
|
176
|
+
|
|
177
|
+
- `yacscript start --config config.toml` — Start the YACS server.
|
|
178
|
+
- `yacscript gc --config config.toml` — Clean expired resources from disk.
|
|
179
|
+
- `yacscript migrate --config config.toml` — Migrate your data from older versions.
|
|
180
|
+
|
|
181
|
+
In which gc and migrate are mostly safe to run.
|
|
182
|
+
|
|
183
|
+
## User Manual
|
|
184
|
+
|
|
185
|
+
Consult <a href="docs/manual.md">User Manual</a> for guidance.
|
|
186
|
+
|
|
187
|
+
## Configuration
|
|
188
|
+
|
|
189
|
+
The program comes with a built in config, so you might want to only write fields that you need to deviates from default.
|
|
190
|
+
|
|
191
|
+
All possible fields are shown below.
|
|
192
|
+
|
|
193
|
+
```toml
|
|
194
|
+
[flask]
|
|
195
|
+
# here you can configure built-in config values defined by flask
|
|
196
|
+
DEBUG = false # DO NOT SET TO `true` WHEN EXPOSING TO PUBLIC!
|
|
197
|
+
|
|
198
|
+
[app]
|
|
199
|
+
# The app itself will only exposed through plain HTTP and it's strongly discorage to do so directly to public web. Use a reverse proxy with TLS in front of the app.
|
|
200
|
+
ip = "0.0.0.0"
|
|
201
|
+
port = 8080
|
|
202
|
+
|
|
203
|
+
admin_phrase = "CHANGE_ME_ADMIN"
|
|
204
|
+
# set user_phrase to empty will expose chatroom to the public
|
|
205
|
+
user_phrase = "CHANGE_ME"
|
|
206
|
+
|
|
207
|
+
log_level = "INFO"
|
|
208
|
+
timeout = 5000 # in milisecond, use for heartbeat
|
|
209
|
+
|
|
210
|
+
# Set to true only when the app is behind a reverse proxy!
|
|
211
|
+
# Make sure X-Forwarded-For and X-Forwarded-Host are properly set!
|
|
212
|
+
proxy_fix = false
|
|
213
|
+
|
|
214
|
+
# For socketio connections
|
|
215
|
+
# Do set a propper value in production enviroment
|
|
216
|
+
cors_allowed_origins = "https://me.example"
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
[custom]
|
|
220
|
+
title = "The YACS"
|
|
221
|
+
motd = "Hello!\nRule No.1"
|
|
222
|
+
|
|
223
|
+
# These are the emotes that will rendered to the webpage
|
|
224
|
+
emoticons = [
|
|
225
|
+
"( ゚∀。)",
|
|
226
|
+
"Insert Anything",
|
|
227
|
+
"⭐"
|
|
228
|
+
]
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
[res]
|
|
232
|
+
path = "./resource" # Relative to project's root
|
|
233
|
+
size_max = 1024 # In Megabytes
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
[captcha]
|
|
237
|
+
length = 4
|
|
238
|
+
max_cache = 60
|
|
239
|
+
expire = 120 # Expire time in seconds
|
|
240
|
+
|
|
241
|
+
[captcha.options]
|
|
242
|
+
# you don't want to have all of them turn on, it'll be confusing
|
|
243
|
+
numbers = false
|
|
244
|
+
lowercase = true
|
|
245
|
+
uppercase = false
|
|
246
|
+
|
|
247
|
+
[db]
|
|
248
|
+
path = "./yacs.db"
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
And, an example config could look like this.
|
|
252
|
+
|
|
253
|
+
```toml
|
|
254
|
+
[flask]
|
|
255
|
+
DEBUG = false
|
|
256
|
+
|
|
257
|
+
[app]
|
|
258
|
+
admin_phrase = "this-is-admin"
|
|
259
|
+
user_phrase = "hello"
|
|
260
|
+
|
|
261
|
+
[custom]
|
|
262
|
+
title = "My YACS Server"
|
|
263
|
+
motd = "Hello!\nRule No.1!"
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
## Acknowledgement
|
|
267
|
+
YACS will not be possible without following existing projects.
|
|
268
|
+
|
|
269
|
+
- [98.css](https://github.com/jdan/98.css)
|
|
270
|
+
- [flask](https://github.com/pallets/flask/)
|
|
271
|
+
- [bbcode](https://github.com/dcwatson/bbcode)
|
|
272
|
+
- [webargs](https://github.com/marshmallow-code/webargs)
|
|
273
|
+
- [captcha](https://github.com/lepture/captcha)
|
|
274
|
+
- [flask-socketio](https://github.com/miguelgrinberg/flask-socketio)
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
## Loicense
|
|
278
|
+
Oi mate! Got a loicense for that project Govna? Yes, and it is the best one!
|
|
279
|
+
|
|
280
|
+
YACS is licensed under WTFPL with NO WARRANTY.
|
|
281
|
+
|
|
282
|
+
<a href="http://www.wtfpl.net/"><img
|
|
283
|
+
src="http://www.wtfpl.net/wp-content/uploads/2012/12/wtfpl-badge-4.png"
|
|
284
|
+
width="80" height="15" alt="WTFPL" /></a>
|