routes: Move pijul routes to controllers module
As with the root routes, now the pijul routes are moved. The mounting of the
routes is still done in main.rs though the controller module now collects them.
This should DRY this code
Created by zj on Sep 21, 2021, 8:44 AM
State:
F5O7DR37RFO4CMEG7VMZJZ5FCCCWEPOOTTJ5FC3RJR7AEBZPNVHQCroutes: Move root route to controllers module
The routes were now in modules in the root, which created a messy situation for
the future. For now the routes will be moved to the controllers module and later
additional changes will be done to further clean this up.
Created by zj on Sep 21, 2021, 8:34 AM
State:
VKZLLMJZAFJFNS3Q3ZJUU5VQTHB4PPDGCCNM742775H5VPUN6K7ACnix: Fix creation of 2 file
The output was redirected to a file called 2 when validating if the PG server
was already running. This typo was fixed, also fixing which source of text to
stream to /dev/null.
Created by zj on Sep 17, 2021, 9:00 AM
State:
3PP3LSS6R5PXKOR7SIZVTOG7R43KLWYQM4H7U2VOHQ6B2ZH3HOTQCpijul: GET change works, now clone and pull works too
Pull/Clone depends on routes already implemented for content negotiation, and
thus was easy to get working. Again, this route lacks authentication and
authorization.
Created by zj on Sep 17, 2021, 8:26 AM
State:
OMGUW5AZLFJBJNO7ZSH5YBFB2KY7D7AGMYV5ACW2ILNT2KCJDHXACpijul: Pushes now work completely
While still missing authn and authz, the flow of pushing now works. This enables
validation of at least storing data. Later changes will show the data on the
project page.
Created by zj on Sep 16, 2021, 9:26 AM
State:
DSNSDM6AZYQ63DCN7JGCFR4XP5DOOZJP43WRNPXEBXRKZUJLDJGACCleanup leftover files
Recorded earlier, but uninteded. Now it's cleaned up again.
Created by zj on Sep 15, 2021, 11:00 AM
State:
PKEQINBQRWAHSJ34ZBWZPWCYR22GYYCRLC7RB274LWT7DFEHJ37ACpijul: HTTP push now works
While missing Auth{n,z}, one can now push to the main channel. The patches
are stored and normal Pijul command can be run in the repository on disk.
Created by zj on Sep 15, 2021, 8:22 AM
State:
HCUYSDIMYHNLG7ZWMD2TPTNCE64FGPZSLHTIHRZLR3MQMM2B3EMACusers: Introduce User guard for routes
Rockets guards are very powerful to disallow users for certain routes. This far
this wasn't implemented, and allowed no-one other than the first user to sign
up. This change introduces the User guard and employs it for a few routes.
The guard works by checking the encrypted cookie for the user_id, and perform
a database lookup on it.
Created by zj on Sep 13, 2021, 7:12 PM
State:
PSEJTO5YAQFYPA5GFCOIEGHGTM6LVZAZGEHLPQKF6LZIUZ5GWDEACroutes: User route mod exposes routes() now
Other routes already did this to keep the routes clean
when mounting. Now the user routes do too.
Created by zj on Sep 13, 2021, 2:10 PM
State:
EZBZFQZKMQ7F42KHZ4MAY5CYNQQUS62XJKA7LFYJRSY64YK3T7LACpijul: Start of push/pull work
This change includes one API endpoint, .pijul. It allows for getting a channels
remote ID. A lot of plumbing around repositories is added too, from init to
opening pristine and actions like it.
Created by zj on Sep 13, 2021, 1:58 PM
State:
OZBGEN7WAFJ7RDUJFB4QJQYYRL6YMZAS5GS4EZQ44E42HXDZZW5QCdb: Add interface to add a project
Right now a project has a name, and an owner which is hardcoded
to 1. This is because basically I'm speedrunning to implement push/pull
of Pijul and then revisit to add depth to features and tests.
Model code is now split into files properly too.
Created by zj on Sep 9, 2021, 12:52 PM
State:
CDWOK4J5XGZ24FWBQCUGEUMLONDGTVMSSOKXWVXP6IQ35WZZ77TACdb: Move migrations to require up/down migrations
When generating migrations, up/down migrations are revertable. Thus better. This
change moves the oldest migration to have both, and thus sqlx will require
everyone to create up/down migrations.
Created by zj on Sep 7, 2021, 6:29 PM
State:
EH2VD6TD7VK7J6JGTKLHGF75WG74JNZHLRU4IQBDHPYB6TA6IG2ACmodels: Put User model in their own file
Before adding a next model, let's start organizing the code a little, to make
extending easier.
Created by zj on Sep 7, 2021, 12:20 PM
State:
7FMU3BRNPWWOC53TNTHDHGQZXD5XSB3LG7NA4GVBO3WKMHV57GYACfrontend: Introduce navigation bar
Minor changes to the front-end mostly, to allow users to
register, sign in, and sign out. The sign out route is changed
to a GET endpoint, as links in HTML cannot DELETE.
Created by zj on Sep 3, 2021, 12:08 PM
State:
27D5LU3PWAD2BNF6TYU2KFXYRCRQGOUCU7G5ACVJDSBL3ZQRGI4QCroutes: Register and authenticate users
Allow users to sign up, and sign in/sign out. The routes are added, though the
design of the pages is very bare bones still, it's hard to go through the full
flow to demo.
On the server side: Passwords are stored encrypted in the database with salts.
This uses the PG encrypt tooling to prevent against bugs and maintainance costs
on this project. When a user is signed in, the user ID is set in a private
cookie.
Rocket has Guards for routes, which has not been implemented yet for this
project.
Created by zj on Sep 3, 2021, 7:09 AM
State:
K3LJIDU7Q5GTOFCS5BPAVKOJC4QXGAERKA55VA6OBBT4ISF2YZXQCnix: Darwin SDK packages added
While some Darwin packages were already added through SystemConfiguration, the
CoreServices and SystemConfiguration were both missing. This change adds these
to ensure compilation on Darwin systems.
Created by zj on Aug 26, 2021, 10:18 AM
State:
JH3OD33UYMWZS2IZILZYDMXRD4UGVDESN6DSIUH6MEZ6YD3E6ALACdocs: Explain sqlx usage
Both how migrations are ran, as well as how to create migrations is now described in the
readme. This should help contributors going when introducing a new model.
Created by zj on Aug 10, 2021, 7:54 PM
State:
VLIEVYR6S4NGGMELHPSYJKSUHGYNBY24O3J7YNW3JIXNOOMD3XZACnix: Do not start PG if running
In a nix hook the PG server is started when `nix-shell` is invoked. This
created extra output when nix-shell was invoked on an extra shell as it
tried to start a new PG server again while it was already running.
This change updates the behaviour to not do this, and verify with pg_ctl
if PG is already running.
Created by zj on Aug 9, 2021, 1:00 PM
State:
D5BKJFKGHHVYZYDJQVYMJWFQCO7EPEOE6QCWWOEFRDCRAE76ILQQCdatabase: Add migration support
Fairly minor change codewise; add support for creating migrations and run them
at the start of the runtime. In this case not a lot of changes happen, only the
migrations tracking table is added.
The sqlx command line tool is used to manage migrations; invoke `cargo sqlx --help`
for more info.
Created by zj on Jul 20, 2021, 7:12 PM
State:
MURNHXXYQJ25CYTUGFGIWWZWJRN7NH7CTNTOJ44YEYQDFGYK3K7ACdatabase: Connect to postgres on Rocket boot
As database I've chosen PostgreSQL, as my personal experience has been good with
it. This change allows Rocket to connect to the database on booting the server.
It depends on the DATABASE_URL being set, and for now circumvents the Rocket
config helpers as it seemed faster to be up and running this way.
Created by zj on Jul 20, 2021, 5:45 PM
State:
YZCPYPDSES4MUNNXPPS5WWBBBMKIYXSJIBHIA2GWML4RK2GFRLQQCnix: Install and initialize a Postgres DB
For a persistance layer, this change introduces postgresql as dependency. The
daemon is started when `nix-shell` is invoked. `pg_ctl stop` is not invoked,
and this has to be done by a developer.
Data is persisted in a tmp directory, which is added to the ignore file.
Created by zj on Jul 15, 2021, 11:52 AM
State:
ZMBR6UXF5ITMO2YKHN5DEVRS6CPLEGESU2L77IVRXF7L5YU4QS7AC