yacscript 0.3.2__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.
Files changed (37) hide show
  1. {yacscript-0.3.2 → yacscript-0.4.0}/COPYING +12 -12
  2. {yacscript-0.3.2 → yacscript-0.4.0}/PKG-INFO +268 -238
  3. {yacscript-0.3.2 → yacscript-0.4.0}/README.md +267 -237
  4. {yacscript-0.3.2 → yacscript-0.4.0}/app/__init__.py +151 -113
  5. {yacscript-0.3.2 → yacscript-0.4.0}/app/app.py +750 -656
  6. yacscript-0.4.0/app/db.py +82 -0
  7. {yacscript-0.3.2 → yacscript-0.4.0}/app/definitions.py +71 -72
  8. yacscript-0.4.0/app/static/admin.js +116 -0
  9. yacscript-0.4.0/app/static/dialog.js +178 -0
  10. yacscript-0.4.0/app/static/handoff.js +14 -0
  11. yacscript-0.4.0/app/static/room.js +629 -0
  12. yacscript-0.4.0/app/static/style.css +302 -0
  13. yacscript-0.4.0/app/static/vendor/98.css +2 -0
  14. yacscript-0.4.0/app/static/vendor/ms_sans_serif.woff +0 -0
  15. yacscript-0.4.0/app/static/vendor/ms_sans_serif.woff2 +0 -0
  16. yacscript-0.4.0/app/static/vendor/ms_sans_serif_bold.woff +0 -0
  17. yacscript-0.4.0/app/static/vendor/ms_sans_serif_bold.woff2 +0 -0
  18. yacscript-0.4.0/app/static/vendor/socket.io.min.js +7 -0
  19. yacscript-0.4.0/app/templates/handoff.jinja +12 -0
  20. yacscript-0.4.0/app/templates/index.jinja +50 -0
  21. yacscript-0.4.0/app/templates/room.jinja +99 -0
  22. {yacscript-0.3.2 → yacscript-0.4.0}/pyproject.toml +2 -2
  23. yacscript-0.3.2/app/db.py +0 -24
  24. yacscript-0.3.2/app/static/admin.js +0 -110
  25. yacscript-0.3.2/app/static/room.js +0 -369
  26. yacscript-0.3.2/app/static/style.css +0 -64
  27. yacscript-0.3.2/app/templates/index.jinja +0 -47
  28. yacscript-0.3.2/app/templates/room.jinja +0 -107
  29. {yacscript-0.3.2 → yacscript-0.4.0}/app/static/file.mp3 +0 -0
  30. {yacscript-0.3.2 → yacscript-0.4.0}/app/static/icon.png +0 -0
  31. {yacscript-0.3.2 → yacscript-0.4.0}/app/static/join.mp3 +0 -0
  32. {yacscript-0.3.2 → yacscript-0.4.0}/app/static/leave.mp3 +0 -0
  33. {yacscript-0.3.2 → yacscript-0.4.0}/app/static/msg.mp3 +0 -0
  34. {yacscript-0.3.2 → yacscript-0.4.0}/app/static/send.mp3 +0 -0
  35. {yacscript-0.3.2 → yacscript-0.4.0}/app/static/tile.gif +0 -0
  36. {yacscript-0.3.2 → yacscript-0.4.0}/app/static/tile.jpg +0 -0
  37. {yacscript-0.3.2 → 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.2
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,240 +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
- ![Splash Screen](docs/the-yacs.jpeg)
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
- ## Try It Out Right Now!
36
-
37
- Join [The YACS Demo Server](https://chat.valine0x.icu) right now with passphrase **`the-yacs`** to see YACS in action!
38
-
39
- ## Deployment
40
-
41
- ### 1. Deploy with venv (Recommended)
42
-
43
- Create a venv with python version 3.13 or greater.
44
-
45
- ```bash
46
- $ python -m venv .venv
47
- ```
48
-
49
- ```bash
50
- # Activate venv in *nix shell (e.g. bash, zsh)
51
- $ source .venv/bin/activate
52
- ```
53
-
54
- ```pwsh
55
- # Activate venv in pwsh
56
- > . .venv\Scripts\Activate.ps1"
57
- ```
58
-
59
-
60
- Then, install the package inside venv.
61
-
62
- ```bash
63
- (.venv) pip install yacscript
64
- ```
65
-
66
- Create a configuration file and edit it to your liking.
67
-
68
- For reference, see the <a href="#configuration">configuration section</a>.
69
-
70
- ```bash
71
- (.venv) vi ./config.toml
72
- ```
73
-
74
- Finally, you run the server within the venv
75
-
76
- 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.
77
-
78
- Assuming you have installed the venv as `/path/to/.venv`, for example `/opt/yacs/.venv`, making `/path/to/` means `/opt/yacs/` for the setup.
79
-
80
- ```ini
81
- [Unit]
82
- Description=YACS Service
83
- After=network.target
84
-
85
- [Service]
86
- Type=simple
87
- WorkingDirectory=/path/to
88
- Environment="PATH=/path/to/.venv/bin"
89
- ExecStart=/path/to/.venv/bin/yacs-run --config /path/to/config.toml
90
-
91
- [Install]
92
- WantedBy=multi-user.target
93
- ```
94
-
95
- ### 2. Deploy from source (with uv)
96
-
97
- Deploying from source gives you access to the latest features but may be unstable
98
-
99
- To deploy from source, first you need to install uv.
100
-
101
- ```bash
102
- # Install with pip.
103
- $ pip install uv
104
-
105
- # Install on macOS and Linux.
106
- $ curl -LsSf https://astral.sh/uv/install.sh | sh
107
-
108
- # Install on Windows.
109
- $ powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
110
- ```
111
-
112
- Then, clone the repo.
113
-
114
- ```bash
115
- $ git clone https://github.com/valine-dev/yacs.git
116
- $ cd yacs
117
- ```
118
-
119
- Create a config file, and edit it to your liking.
120
-
121
- For reference, see the <a href="#configuration">configuration section</a>.
122
-
123
- ```bash
124
- $ vi ./config.toml
125
- ```
126
-
127
- Finally, run the server, dependencies and venv will be installed along the way.
128
-
129
- ```bash
130
- $ uv run yacs-run --config config.toml
131
- ```
132
-
133
- Additionally, it's also possible to make a daemon service out of deployment from source.
134
-
135
- An example unit file is shown as below.
136
-
137
- ```ini
138
- [Unit]
139
- Description=YACS Service
140
- After=network.target
141
-
142
- [Service]
143
- Type=simple
144
- WorkingDirectory=/path/to/yacs
145
- Environment="PATH=/path/to/yacs/.venv/bin"
146
- # Notice the difference to deploying from package!
147
- ExecStart=/path/to/uv run yacs-run --config /path/to/config.toml
148
-
149
- [Install]
150
- WantedBy=multi-user.target
151
- ```
152
-
153
- ## User Manual
154
-
155
- Consult <a href="docs/manual.md">User Manual</a> for guidance.
156
-
157
- ## Configuration
158
-
159
- The program comes with a built in config, so you might want to only write fields that you need to deviates from default.
160
-
161
- All possible fields are shown below.
162
-
163
- ```toml
164
- [flask]
165
- # here you can configure built-in config values defined by flask
166
- DEBUG = false # DO NOT SET TO `true` WHEN EXPOSING TO PUBLIC!
167
-
168
- [app]
169
- # 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.
170
- ip = "0.0.0.0"
171
- port = 8080
172
-
173
- admin_phrase = "CHANGE_ME_ADMIN"
174
- # set user_phrase to empty will expose chatroom to the public
175
- user_phrase = "CHANGE_ME"
176
-
177
- log_level = "INFO"
178
- timeout = 5000 # in milisecond, use for heartbeat
179
-
180
- # Set to true only when the app is behind a reverse proxy!
181
- # Make sure X-Forwarded-For and X-Forwarded-Host are properly set!
182
- proxy_fix = false
183
-
184
- # For socketio connections
185
- # Do set a propper value in production enviroment
186
- cors_allowed_origins = "https://me.example"
187
-
188
-
189
- [custom]
190
- title = "The YACS"
191
- motd = "Hello!\nRule No.1"
192
-
193
- # These are the emotes that will rendered to the webpage
194
- emoticons = [
195
- "( ゚∀。)",
196
- "Insert Anything",
197
- "⭐"
198
- ]
199
-
200
-
201
- [res]
202
- path = "./resource" # Relative to project's root
203
- size_max = 1024 # In Megabytes
204
-
205
-
206
- [captcha]
207
- length = 4
208
- max_cache = 60
209
- expire = 120 # Expire time in seconds
210
-
211
- [captcha.options]
212
- # you don't want to have all of them turn on, it'll be confusing
213
- numbers = false
214
- lowercase = true
215
- uppercase = false
216
-
217
- [db]
218
- path = "./yacs.db"
219
- ```
220
-
221
- And, an example config could look like this.
222
-
223
- ```toml
224
- [flask]
225
- DEBUG = false
226
-
227
- [app]
228
- admin_phrase = "this-is-admin"
229
- user_phrase = "hello"
230
-
231
- [custom]
232
- title = "My YACS Server"
233
- motd = "Hello!\nRule No.1!"
234
- ```
235
-
236
- ## Acknowledgement
237
- YACS will not be possible without following existing projects.
238
-
239
- - [98.css](https://github.com/jdan/98.css)
240
- - [flask](https://github.com/pallets/flask/)
241
- - [bbcode](https://github.com/dcwatson/bbcode)
242
- - [webargs](https://github.com/marshmallow-code/webargs)
243
- - [captcha](https://github.com/lepture/captcha)
244
- - [flask-socketio](https://github.com/miguelgrinberg/flask-socketio)
245
-
246
-
247
- ## Loicense
248
- Oi mate! Got a loicense for that project Govna? Yes, and it is the best one!
249
-
250
- YACS is licensed under WTFPL with NO WARRANTY.
251
-
252
- <a href="http://www.wtfpl.net/"><img
253
- src="http://www.wtfpl.net/wp-content/uploads/2012/12/wtfpl-badge-4.png"
254
- width="80" height="15" alt="WTFPL" /></a>
18
+ # YACS
19
+ Yet Another Chatroom Script
20
+
21
+ Inspired by [LE-CHAT-PHP](https://github.com/DanWin/le-chat-php)
22
+
23
+ ![Splash Screen](docs/the-yacs.jpeg)
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>