Commit Graph

408 Commits

Author SHA1 Message Date
Jason Rhinelander c6ccc53574
Replace README with an archive notice 2021-12-21 14:51:48 -04:00
Jason Rhinelander d403f34b17
Merge pull request #36 from sakuramboo/dev
Added build instructions for rpm packages
2021-11-03 15:24:51 -03:00
sakuramboo 7c07d543eb
Added build instructions for rpm packages
Tested on CentOS 8
2021-11-03 14:18:45 -04:00
Jason Rhinelander c7bf4acf5a
Merge pull request #30 from jagerman/new-api
Add openapi spec for new SOGS API
2021-10-26 13:02:24 -03:00
Jason Rhinelander e229a69424
Merge pull request #24 from jagerman/db-refactor
Db refactor
2021-10-14 10:14:03 -03:00
Sean Darcy d796195dca minor review notes 2021-10-14 15:47:10 +11:00
Jason Rhinelander c5624b6280 Add drone builds 2021-10-14 15:12:41 +11:00
Sean Darcy 953b752100 test suite and cargp fmt 2021-10-14 15:00:32 +11:00
Kee Jefferys fe3306aa45
Update links in docker guide 2021-10-13 21:09:41 +11:00
Jason Rhinelander ad4cc06ad8 Support multiple pinned messages & related
- Rename `info_updated` -> `info_updates` to be consistent with `updates`.
- Relax triggers to only update `info_updates` instead of both updates
  and info_updates, and fix some trigger statements that were updating
  the wrong value.
- Add table for tracking (multiple) pinned messages.
- Trigger info_updates update when pinning/unpinning.
2021-10-11 20:23:45 -03:00
Jason Rhinelander 6c7f2e08e8 Separate old Room response from new Room response
The old Room response included the room token as "id", which is quite
awkward, and not something we want to propagate into the future API, so
we can't just start returning the extra details if we don't want to
maintain that misnaming.

This changes the API so that existing (deprecated) endpoints get the
deprecated field, and the new Room deserialization is free to break
backwards compat.
2021-10-11 20:23:45 -03:00
Jason Rhinelander 8abac252a7 Add missing description field to Room struct 2021-10-11 20:23:45 -03:00
Jason Rhinelander db10956822 Add 0.1.x database migration 2021-10-11 20:23:45 -03:00
Jason Rhinelander af211fc775 Reformatting: cargo fmt + various manual tweaks 2021-10-11 20:23:45 -03:00
Jason Rhinelander 0f3e6dc071 Fix metadata trigger queries
They have to be defined after the tables on which they run, of course.
Also fixed some syntax errors in them and made them work.
2021-10-11 20:23:45 -03:00
Jason Rhinelander c616318a26 Fix room user counts 2021-10-11 20:23:45 -03:00
Jason Rhinelander 4e27e8d60b Don't store padding in db
Trim padding when storing and repad on the fly when retrieving.
2021-10-11 20:23:45 -03:00
Jason Rhinelander c0e0d61dbf Add update counter on metadata; add room description 2021-10-11 20:23:45 -03:00
Jason Rhinelander 30472120fb Add stubs/fixmes for new endpoints 2021-10-11 20:23:45 -03:00
Jason Rhinelander a126c072ec Fix room image expiry, fix file pruning
Uploaded room images shouldn't expire; this makes the expiry column
nullable and sets their expiry to null, and adds a trigger to expire
replaced room images.

Also fixes a panic in file deletion that made it not actually delete
files.
2021-10-11 20:23:45 -03:00
Jason Rhinelander 5d21033743 Fix deletions; global moderator
- "Deleted" messages should be set to null, not actually deleted
- Add automatic updating of "edited" to the message update trigger
- Accomodate janky deprecated Session compact_poll logic that expects
  deletion lists even if it doesn't ask for them.
- Add a useful view for (admin direct sqlite) message querying.
- Fix message_details VIEW query
2021-10-11 20:23:45 -03:00
Jason Rhinelander a18f87c544 Fix file upload 2021-10-11 20:23:45 -03:00
Jason Rhinelander 3ca0be59a5 fix 1 2021-10-11 20:23:45 -03:00
Jason Rhinelander 68f6ab50c1 Make it work 2021-10-11 20:23:45 -03:00
Jason Rhinelander 8f7bacb62d Add shm/wal db files to .gitignore 2021-10-11 20:23:45 -03:00
Jason Rhinelander aa28325366 Add --log-level; make --help messages more descriptive 2021-10-11 20:23:45 -03:00
Jason Rhinelander 1e8203f76e Database redesign and code associated refactor 2021-10-11 20:23:45 -03:00
Jason Rhinelander 688d01f83a Fix grammatically incorrect 'due to'
"due to" works as an adjective that follows a noun (not verbs/verb
phrases) and is being used incorrectly in all the error messages fixed
here.
2021-10-11 20:23:45 -03:00
Jason Rhinelander 96f979d2ac Rename identifier -> token, make case insensitive, add constraint 2021-10-11 20:23:45 -03:00
Jason Rhinelander b5fcac5e48 Apply arrived-at future user permissions 2021-10-11 20:23:45 -03:00
Jason Rhinelander ace493f643 Initial DB redesign
Completely overhauls the underlying database design:

- referential integrity
- data normalization
- using triggers for various updates to reduce the amount of data logic
  in code.
- indexes
- one single database rather than 1 + 1/room
- various structural improvements for useful features such as:
    - individually and default-assignable read/write/upload
    - time-based permission expiries (e.g. restrict this permission for
      x amount of time)
    - distinguishing between admins (who can add/remove moderators) and
      moderators (who can only moderate but not control the moderator
      list)
    - global server moderators/admins
    - global server bans
    - single VIEW for simple querying of a user's effective permissions
      (i.e. with database-side coalescing of global/local permissions).
    - pinned message via foreign key
    - room icon as a regular uploaded file
    - per-file file expiries (so that admins/mods can upload non-expiry
      files, such as the room icon, or pinned downloads).
    - message history so that when messages get edited or deleted a log
      is kept of the old value (the idea being that mods would be able
      to look this up).
    - movable messages (e.g. so there could be a "bad posts" room that
      only moderators have access to).
2021-10-11 20:23:43 -03:00
Jason Rhinelander 177ae7fd2e Fix postinst to properly chown privkeys 2021-10-11 20:18:47 -03:00
Jason Rhinelander 886a78b83b Re-wrap descriptions properly at 100 columns
The initial version came out of swagger edit, which is a crappy text
editor.
2021-10-08 14:41:02 -03:00
Jason Rhinelander f4ae24c5ea Nonce: make size exact 2021-10-08 14:30:35 -03:00
Jason Rhinelander b6b9a56499 Add openapi spec for new SOGS API 2021-10-08 11:32:16 -03:00
Jason Rhinelander 26851becfd
Merge pull request #29 from jagerman/no-default-main
Don't create default rooms
2021-10-05 19:41:02 -03:00
Jason Rhinelander 734ee32897
Merge pull request #28 from jagerman/no-ghost-rooms
Check for room token in main table before opening db
2021-10-05 19:40:46 -03:00
Jason Rhinelander ecc6212f5d Don't create default rooms
This is obnoxious because it is *impossible* to get rid of the room
without it getting recreated at every restart.

Note: this breaks file server mode, but that's okay, the DB refactor
completely breaks it anyway, and current version will work fine for the
global file server.
2021-10-05 19:38:58 -03:00
Jason Rhinelander 56fda143fb Check for room token in main table before opening db
This was allowing old (deleted) room databases to persist and even be
recreated if clients were still polling them.  Worse, they would grow
forever because files and old tokens are only cleaned up for rooms
listed in the main db.
2021-09-29 23:57:30 -03:00
Kee Jefferys e56e32d11a
Update links
Point links to Oxen repo instead of Niels repo
2021-09-30 11:59:02 +10:00
Jason Rhinelander f13b903478
Merge pull request #25 from darcys22/bump-version
Bump version to 0.1.9
2021-09-14 11:31:42 -03:00
Sean Darcy 6538d558f3 Bump version to 0.1.9 2021-09-14 14:07:05 +10:00
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 0c638094aa
Merge pull request #19 from darcys22/patch-1
Update BUILDING.md
2021-09-13 21:24:00 -03:00
Sean aa9fbf0a6d
Merge pull request #18 from jagerman/remove-table-name-globals
Remove table name globals
2021-09-13 11:50:35 +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
Sean 5718c48524
Merge pull request #9 from msgmaxim/in-memory-db
Make file deletion async; use in-memory database in tests
2021-09-13 10:59:58 +10:00