Commit Graph

181 Commits

Author SHA1 Message Date
Up
3ed5f41d58
make server automatically create DB schema if not exists (#5)
* add default values for CLI args

* add development docker compose file

* prevent crash if userdata dir does not exist

* accounts, acccountStats

* account stats and create db indices

* compensations and daily runs

* ensure uniqueness of daily seed

* start on port 8001 by default for client parity

* make generated schema match production

* sort imports
2024-05-10 15:30:47 -04:00
maru
fadd10602a
Don't log ErrNoRows in savedata 2024-05-09 14:26:54 -04:00
maru
192b777ac3
Set ArgonMaxInstances to number of cores 2024-05-08 20:08:10 -04:00
maru
0ead2da2da
Remove unused endpoint game/playercount 2024-05-08 15:47:56 -04:00
Up
405a578e8c manually parse all save states for now 2024-05-07 19:33:21 -04:00
Up
0d6539a87b
continue on existing save (#3)
* long blob

* fix continue

* one slot only?

* fallback if there is no slot data yet

* Revert "one slot only?"

This reverts commit 20997e9cd8.
2024-05-07 19:14:07 -04:00
Up
1f95f7c042
hotfix: move save data to DB (#2)
* start reading save data from DB

* finish migration code

* remove leftover dir creation

* fix import cycle

* remove more dir creation

* update gitignore

* fix pk

* better table creation

* use REPLACE INTO

* fix typo
2024-05-07 17:10:33 -04:00
maru
a087234aa8
Replace usernameFromRequest 2024-05-05 16:12:10 -04:00
Flashfyre
c0a23079fa Re-implement fix for data overwrites 2024-04-30 15:26:13 -04:00
Flashfyre
8a17845d42 Revert "Fix underlying issue with save override prevention"
This reverts commit c12c770844.
2024-04-30 15:11:01 -04:00
Flashfyre
c12c770844 Fix underlying issue with save override prevention 2024-04-30 15:06:37 -04:00
maru
512a24e5c3
Remove anti cheat 2024-04-30 14:34:40 -04:00
Flashfyre
cde572d626 Revert "Fix data override prevention on update"
This reverts commit 52756fdba3.
2024-04-30 13:39:06 -04:00
Flashfyre
52756fdba3 Fix data override prevention on update 2024-04-30 11:17:14 -04:00
maru
786e947e09
Change 'banned' to 'limited 2024-04-30 00:32:55 -04:00
maru
8481626193
Relicense under AGPL 2024-04-29 17:26:46 -04:00
maru
235fb9c91c
Add copyright notice to files 2024-04-29 15:32:58 -04:00
maru
e8240c9c38
Rename to rogueserver 2024-04-29 15:22:27 -04:00
maru
b52abbf7fe
Ban if daily score over 20000 2024-04-28 22:21:30 -04:00
maru
e184e9da91
Ban if vouchers over a certain threshold 2024-04-28 20:59:53 -04:00
Flashfyre
bc8084b70b Increment server version 2024-04-28 20:44:33 -04:00
maru
ec33952aaa
Simplify variable declaration 2024-04-28 17:41:00 -04:00
maru
cbcc68f8e4
Add password changes 2024-04-28 17:27:58 -04:00
maru
4ce5a0198d
Don't check token length twice in Logout 2024-04-26 13:17:06 -04:00
maru
1ea2829f63
Increase stat refresh interval to 30 seconds 2024-04-25 16:16:35 -04:00
maru
65e7696e7e
Use tokenFromRequest in handleAccountLogout 2024-04-25 15:31:53 -04:00
maru
2656c0a033
Enforce HTTP method on endpoints 2024-04-25 15:30:12 -04:00
Flashfyre
2f8c2d3f07 Match trainer and secret ID on update for data integrity 2024-04-25 09:56:56 -04:00
maru
849bc601f0
Remove get prefix from certain function names 2024-04-25 03:50:35 -04:00
maru
768900d885
Change seedCompletions to dailyRunCompletions 2024-04-25 03:40:22 -04:00
maru
7e3ba249df
Move httpError to common.go 2024-04-24 20:23:20 -04:00
maru
fa5dcb0052
Use ServeMux router instead of switch statement 2024-04-24 20:05:57 -04:00
maru
da572ebdd9
Add default case to router 2024-04-24 18:54:24 -04:00
maru
96f8a74396
Unduplicate more code 2024-04-22 18:32:45 -04:00
maru
1de3ce72e4
Reuse zstandard encoder 2024-04-22 18:20:58 -04:00
maru
697c5335d7
Prevent writing empty save files 2024-04-22 18:06:32 -04:00
maru
b00ed4c0b9
Use WriteFile instead of stream writing to files 2024-04-22 18:01:17 -04:00
maru
8f51cd826c
Run formatter on code 2024-04-21 18:57:27 -04:00
maru
4a017b0f32
Clean up recent API changes 2024-04-21 16:52:26 -04:00
Flashfyre
6acbb6448a Protect against cross-session overwrites 2024-04-21 16:23:25 -04:00
maru
75cf6f3ab1
Use Sprintf instead of encoding UUIDs to hex 2024-04-20 17:10:48 -04:00
maru
6816df3158
Set content type of JSON responses 2024-04-20 16:58:04 -04:00
maru
f7ab2719a2
Don't make rankings endpoint update user activity 2024-04-19 16:44:33 -04:00
maru
1d54c1ad64
Use channels to rate limit argon2 2024-04-19 13:27:55 -04:00
maru
fbd4a60a4a
Add mutex to deriveArgon2IDKey 2024-04-19 12:48:14 -04:00
maru
0fec7cb4c3
Revert "Serve game content and API"
This reverts commit 6bd7deb3de.
2024-04-19 12:41:05 -04:00
maru
6bd7deb3de
Serve game content and API 2024-04-19 03:27:47 -04:00
Flashfyre
a36a8f5be9 Update schema and version for variant update 2024-04-18 21:54:07 -04:00
maru
62102ab4fd
Use forms instead of JSON for login/register requests 2024-04-18 18:26:43 -04:00
maru
35641e420b
Clean up compensation code 2024-04-18 02:11:31 -04:00
maru
09abd1fb66
Fix bug with /savedata/clear endpoint 2024-04-18 02:02:02 -04:00
maru
136aac6614
Sleep for one second in recordNewDaily task 2024-04-18 00:46:00 -04:00
maru
9f1349d6a0
Move gob Register functions to pokerogue-server.go 2024-04-17 21:11:53 -04:00
maru
dbcc0d04e6
Add new exit handler 2024-04-17 19:31:12 -04:00
maru
5916c9e5e5
Use UTC for cron 2024-04-17 19:03:25 -04:00
maru
9477889390
Use better cron package 2024-04-16 21:01:24 -04:00
Flashfyre
420a4d17b3 Fix version check for outdated client 2024-04-16 09:21:23 -04:00
Flashfyre
d232773ecd Add game version check to save (WiP) 2024-04-15 10:10:22 -04:00
maru
25abf4914b
Use TokenSize const in api common.go 2024-04-15 03:24:45 -04:00
maru
39199dc1b1
Move consts in account package to common.go 2024-04-15 03:18:40 -04:00
maru
f395dc145b
Code consistency 2024-04-15 03:15:10 -04:00
maru
98ecbbb529
Rename 'recordNewRun' to 'recordNewDaily' 2024-04-14 20:15:25 -04:00
maru
c3a3746639
Clean up daily package 2024-04-14 20:13:45 -04:00
maru
1f0f38d38e
Move endpoint categories into their own packages 2024-04-14 20:03:53 -04:00
maru
522ce9f4fa
Update GitHub link 2024-04-14 19:25:36 -04:00
maru
10606ebb13
Consistency in handleSavedataClear 2024-04-14 19:08:47 -04:00
maru
2d5f777efd
Move argon2 functions to its own file 2024-04-14 19:05:04 -04:00
Flashfyre
a4014feea8 Track player vouchers 2024-04-11 10:13:35 -04:00
Flashfyre
ba7ab22d4d Fix voucher compensation logic 2024-04-11 10:01:26 -04:00
maru
72151d9c01
Fix new save reader/writer functions 2024-04-11 00:15:07 -04:00
maru
9a0d4a2698
Defer close calls in save data reader functions 2024-04-10 15:39:53 -04:00
maru
1b5da99cda
Make save reading/writing more efficient 2024-04-10 07:25:39 -04:00
maru
af5f9798ae
Fix comment indentation in generic.go 2024-04-10 02:54:12 -04:00
maru
5893350784
Pass struct to handleAccountLogin and handleAccountRegister 2024-04-10 02:49:41 -04:00
maru
422a850354
Move httpError func to generic.go 2024-04-10 02:41:58 -04:00
maru
01c037a7a2
Use JSON encoders instead of Marshal 2024-04-10 00:00:47 -04:00
Flashfyre
992864b785 Add voucher compensation logic 2024-04-09 22:22:00 -04:00
maru
0f8fc0085e
Change certain struct field names back to what they were 2024-04-09 01:28:56 -04:00
maru
85055d2921
Fix variable re-use bug 2024-04-08 21:34:42 -04:00
maru
d97e07b522
Fix condition to read save data from request body 2024-04-08 20:50:47 -04:00
maru
977a05049e
Add missing return 2024-04-08 20:47:23 -04:00
maru
5778675171
Major refactor of API 2024-04-08 20:44:36 -04:00
maru
0edfeab3ca
Various styling changes 2024-04-08 18:15:09 -04:00
maru
80a2c637d2
Indentation consistency near calls to rand.Read 2024-04-08 17:49:50 -04:00
maru
93bb792964
Don't include http error code in log 2024-04-07 17:29:21 -04:00
maru
0eed542b2e
Add http error logging 2024-04-07 17:22:34 -04:00
Flashfyre
dcb1c76370 Add endpoints for stats 2024-04-06 18:15:47 -04:00
Flashfyre
99d3490172 Update account stats on system save 2024-04-06 17:43:11 -04:00
maru
d12a008259
Various changes 2024-04-01 22:54:55 -04:00
Flashfyre
253e462536 Cache player count instead of querying per user 2024-04-01 21:42:48 -04:00
Flashfyre
8ad0f396ea Add seed check to daily run update condition 2024-03-24 20:06:04 -04:00
Flashfyre
eb671f2cb7 Update account activity on rankings load 2024-03-24 19:00:04 -04:00
Flashfyre
7d23859dea Add player count handler 2024-03-23 21:34:18 -04:00
Flashfyre
53ccdc5921 Add weekly rankings and ranking pagination support 2024-03-23 16:26:00 -04:00
Flashfyre
4419ead54c Delete session on loss 2024-03-22 10:18:53 -04:00
Flashfyre
a0f8ab658f Fix daily run scheduler not working 2024-03-19 22:05:37 -04:00
Flashfyre
be04408336 Update random daily seed logic 2024-03-18 19:55:02 -04:00
Flashfyre
2cb7be52eb Change daily seed generation and update schema for recording failed daily runs 2024-03-17 20:48:49 -04:00
Flashfyre
4710617f23 Add limit and pagination to rankings query 2024-03-17 13:36:32 -04:00
Flashfyre
ff98047caa Add daily run rankings 2024-03-17 13:18:51 -04:00