Commit Graph

148 Commits

Author SHA1 Message Date
Sean 0b897052ee
Merge pull request #20 from darcys22/room-id-type
Replaces room_id variables with typed versions
2021-09-14 12:07:14 +10:00
Sean Darcy 1523699dd1 Replaces room_id variables with typed versions
Allows for better protection of the input strings and fits into type
checking.
2021-09-14 11:49:33 +10:00
Jason Rhinelander dd02092519 Reformat 2021-09-13 11:48:01 +10:00
Jason Rhinelander 3d99ba221a Rust version compatibility
Because it should still work even if your rustc is more than 5 minutes
old.
2021-09-13 11:48:01 +10:00
Jason Rhinelander f242a82738 Remove table-names-in-global-variables antipattern
These make the code more complex and make the the queries harder to
read.

Tables in global variables is an antipattern that stemmed from old PHP
(or similar) web hosts that came with a single MySQL table requiring you
use different prefixes to load multiple instances in the same table.
Without mysql or prefix configurability it's an antipattern that just
results in less readable code.
2021-09-13 11:48:01 +10:00
Niels Andriesse 5768a75d88 Run cargo fmt 2021-07-13 14:22:23 +10:00
Niels Andriesse 3010309a28 Add ban and delete all messages endpoint 2021-07-13 14:13:49 +10:00
Niels Andriesse 9f0c6cab4e Add documentation 2021-07-13 14:00:44 +10:00
Niels Andriesse d308e58d1c Debug 2021-07-13 08:57:46 +10:00
Niels Andriesse 70a34b7bfb Implement basic rate limiting for message sending 2021-07-12 16:13:37 +10:00
Niels Andriesse c56268365e Fix multi device auth token handling 2021-06-11 09:47:34 +10:00
nielsandriesse 4d8bdf33c3 Re-use connection to main pool 2021-06-04 15:54:36 +10:00
Niels Andriesse a016dd42ae
Merge pull request #8 from Bilb/return-404-deleted-room
Return a 404 if a room in compactPoll was removed
2021-06-04 15:51:16 +10:00
Audric Ackermann 9be356f45c Return a 404 if a room in compactPoll was removed
This is to avoid returning messages of a deleted room
2021-06-04 05:47:43 +00:00
nielsandriesse faed07bf7d Minor cleanup 2021-06-04 15:42:10 +10:00
nielsandriesse c61d6e7036 Don't fail get messages endpoint if usage stats update fails 2021-06-04 15:38:19 +10:00
Niels Andriesse a14659ea46
Merge pull request #32 from majestrate/user-activity-stats-2021-05-28
Active User Stats Endpoint
2021-06-04 15:24:06 +10:00
Niels Andriesse 55d4390b4e
Merge branch 'main' into use_rwlock 2021-06-03 10:59:33 +10:00
Niels Andriesse 63a38e2f1e
Merge pull request #5 from msgmaxim/avoid_unnecessary_collect
Avoid creating a Vec just to extract a single element from Iter
2021-06-03 10:58:39 +10:00
Jeff Becker d73e2cbb48
add active session stats
* make a table for user activity so we can calculate the number of active sessions
* every time a public key fetches messages mark it as an active session
* expose an api endpoint to fetch the number of active sessions from now to a given number of seconds ago
* make sure user tables are updated when we run migrations
* give posts posted in the last time slice along with active users
2021-06-02 07:48:48 -04:00
nielsandriesse e31c050620 Also update timestamp in response 2021-05-31 11:11:40 +10:00
nielsandriesse 297d024965 Ignore client-specified timestamp in favor of server generated one 2021-05-31 10:39:11 +10:00
Maxim Shishmarev b513e7f268 Use RwLock for session versions 2021-05-31 10:21:31 +10:00
Maxim Shishmarev 2339272496 Avoid creating a Vec just to extract a single element from Iter 2021-05-31 10:11:13 +10:00
nielsandriesse 27c345f662 Merge branch 'main' of github.com:oxen-io/session-open-group-server into main 2021-05-28 15:34:09 +10:00
Niels Andriesse d13801410d
Merge pull request #2 from msgmaxim/lint
Fix various lint warnings
2021-05-28 15:33:27 +10:00
Niels Andriesse 2087ac172e
Merge pull request #30 from majestrate/optimize-sql-queries-2021-05-27
Optimize SQL Queries
2021-05-28 15:14:18 +10:00
nielsandriesse 965b448950 Implement Session version endpoint 2021-05-28 13:55:51 +10:00
Jeff Becker 9107d0899e
optimize sql queries
* get_member_count could fetch a large amount of keys so we use COUNT in the sql query to count the number of rows
* is_banned could be implemented without fetching every banned key using COUNT in the sql query
2021-05-27 08:27:22 -04:00
Maxim Shishmarev fd43521b0b Fix a bunch of lint warnings 2021-05-14 14:22:33 +10:00
Niels Andriesse 51b75100b8 Fix id re-use issue 2021-04-29 11:18:05 +10:00
Niels Andriesse 889f5cf436 Add comment 2021-04-29 10:27:04 +10:00
Niels Andriesse 1f34858cbd Add delete messages endpoint 2021-04-29 10:21:27 +10:00
nielsandriesse 79a648494d Don't use nanos 2021-04-28 11:56:28 +10:00
nielsandriesse af0049aa5a Remove parentheses 2021-04-28 11:08:42 +10:00
nielsandriesse cf62f82735 Add documentation & fix indentation 2021-04-28 10:30:39 +10:00
nielsandriesse 7fcaa80cce Fix SQL usage & include deletion ID in JSON response 2021-04-28 09:50:03 +10:00
Niels Andriesse cb67709ba5 Debug 2021-04-28 08:43:04 +10:00
Niels Andriesse 7df4117c7d Use create_dir_all 2021-04-27 16:04:40 +10:00
Niels Andriesse 1bbc521893 Store files by room 2021-04-27 15:51:53 +10:00
Niels Andriesse bf3771aab2 Make upper bound a constant 2021-04-27 15:35:50 +10:00
Niels Andriesse 95bbb32e8e Debug 2021-04-27 14:20:36 +10:00
Niels Andriesse 18108dddfd Expose add/delete moderator endpoints 2021-04-27 13:48:34 +10:00
Niels Andriesse de16e74d53 Fix incorrect ID handling 2021-04-27 11:42:00 +10:00
Niels Andriesse 416dedb193 Use random attachment IDs 2021-04-27 11:01:20 +10:00
Niels Andriesse 564357e45d Debug file server issues 2021-04-27 09:12:07 +10:00
Niels Andriesse 9c50877110 Add set group image endpoint 2021-04-23 11:16:31 +10:00
Niels Andriesse 36a3ab427a Add print-url CLI option 2021-04-23 10:18:24 +10:00
Niels Andriesse dbe6412b14 Fix compact polling auth token handling 2021-04-22 15:42:21 +10:00
Niels Andriesse 10d02b014b Clean 2021-04-19 11:00:03 +10:00