Commit Graph

51 Commits (a3f041cff7b7549dcecfe58aa75f42920a075f8e)

Author SHA1 Message Date
absc a3f041cff7 Remove not needed newline. 2024-08-15 21:22:54 +00:00
absc 38d8e29734 Abstract setting the cookie for the client request. 2024-08-15 21:20:38 +00:00
absc c9fcd47064 Abstract cookies invalidation. 2024-08-15 21:12:07 +00:00
absc a18fa4989c Use the auth_cookie function to extract cookies. 2024-08-15 21:02:41 +00:00
absc dac21c4537 Abstract cookie handling. 2024-08-15 21:00:06 +00:00
absc a0cbc962d1 Corrected call to authenticate. 2024-08-15 20:41:30 +00:00
absc 29cb046e3d Corrected authenticate function calls. 2024-08-15 20:37:08 +00:00
absc 73d98ed56f Move the defines in their own file.
At the same time, simplify a bunch of APIs.
2024-08-15 20:27:02 +00:00
absc e7e34d78d6 We plan to use this with a reverse proxy. The plan may change in the future. 2024-08-12 21:01:16 +00:00
absc e8ccc3a29f Keep it simple for now. We want to write a proper test suite for this and
letting it crash is more than good enough.

It was a mistake to try to add more complications to the APIs at this point
in time.
2024-08-12 21:00:26 +00:00
absc 2ad3b52c06 Corrected syntax error. 2024-08-12 20:41:24 +00:00
absc f60a8b1725 Import "gun", the HTTP client. We will use it for the tests and the
ActivityPub activities.
2024-08-11 22:08:52 +00:00
absc 640ffe4d75 Corrected stuffs found through the dialyzer. 2024-08-11 20:56:11 +00:00
absc 2b530fbe7e Added some more detailed responses to the JSON API calls. 2024-08-11 20:49:48 +00:00
absc 2d0d384d1e Add the JSON body to the user API responses. 2024-08-09 22:35:53 +00:00
absc dcc7bc3ca3 Introduce the authentication handler.
The user handler will also receive the ability to answer with
JSON bodies soon.
2024-08-09 22:19:17 +00:00
absc 51675065a9 Pass the user for authentication with cookies in a cookie itself. 2024-08-09 20:37:47 +00:00
absc 6acd5e3a5a Move the cookie parameter as value. 2024-08-09 19:50:19 +00:00
absc 318ab0d301 Corrected module documentation. 2024-08-07 22:19:11 +00:00
absc ceea61c1ed Add the username to the JSON response to GET.
In addition to this, version the API with the classic
"api/v1" path.
2024-08-07 22:10:45 +00:00
absc df09a192b0 Updated function documentation specification. 2024-08-07 20:26:38 +00:00
absc 3b9693e276 Properly set the cookie validity, and return it to the
caller along with the cookie itself.
2024-08-07 20:22:45 +00:00
absc 9bf0e3609a Replace hard-coded value with the macro. 2024-08-07 01:23:30 +02:00
absc b06e7d9f50 Complete the registration API.
After some fight to decide on the right design, we finally have
a module to handle users details.

The API is JSON-based and it's documented on the top of the
dudeswave_handler.erl file.

The dudeswave_auth module, implements the functions that handle
things at the storage layer, as we would like to reuse those
capabilties in the future.

To add, the "delete" call doesn't handle removing the cookies for
the moment, It'll come with the next commit.

Additionally, after that, a related test suite will be added, in
order to start to test the whole thing locally.
2024-08-07 01:17:35 +02:00
absc 2b995f67c8 After some internal (with myself) debate, we will go with JSON.
It just makes much more sense, to build a decent and modern
platform.
2024-08-04 13:54:46 +02:00
absc 96781451b0 Improve the registration bit.
Now, we return a proper answer when creating a user through a
POST request.

Maybe in the future we will convert the APIs to use JSON, like
all cool kids do. However, it doesn't look like it makes much
sense in this case.
2024-08-03 01:13:47 +02:00
absc fa66ec399d We only allow POST for the registration form. 2024-08-02 23:46:24 +02:00
absc 2470af1296 Give a better name to the registration handler. 2024-08-02 23:43:03 +02:00
absc 631f729ed9 No, JSON is not needed here.
For this simple blogging platform, let's start simple, basic
HTML forms are enough.
2024-08-02 23:40:55 +02:00
absc 33cc07914d Complete the GET handler. It would return some wrong codes before. 2024-08-02 23:24:54 +02:00
absc f1ad05f789 Make the ip address type configurable.
We want to be able to use both IPv4 and IPv6.
2024-08-02 23:15:28 +02:00
absc dbf5371122 The routes were in the wrong format. Correct them. 2024-08-02 23:12:33 +02:00
absc 59f02f4edf This application will handle the mime types at the web request layer. 2024-08-02 23:05:41 +02:00
absc 94ee24c777 Add the right arguments to the bootstrap procedure. 2024-08-02 22:56:03 +02:00
absc c6328bd174 The bootstrap procedure must be done before the first start.
The bootstrap will create the various tables, the admin user,
and the initial content of the platform, with the possibility
to add replication for everything.
2024-08-02 22:53:04 +02:00
absc 60989b17cd Revert "Remove table replica functions."
This reverts commit 529f15c301.

We want to be able to move things around in the end.
2024-07-28 19:26:44 +02:00
absc 529f15c301 Remove table replica functions.
Those were there when this application didn't use fragmented
tables.

Now, all the buckets are fragmented by default and we provide
the grow/1 and shrink/1 functions to expand the tables along
with the fragment properties.
2024-07-28 17:50:04 +02:00
absc e571a69820 Use crypto:rand_seed().
It's cryptographically strong and set a better state for the
pseudo-random number generator.
2024-07-27 13:16:05 +02:00
absc ab3ca1ec64 No need to use an additional variable just to compose the salted pass. 2024-07-27 12:38:30 +02:00
absc 80af46c6be Just use the classic POST form.
JSON doesn't make any sense in this case.
2024-07-27 12:36:14 +02:00
absc 895e0a5330 Enter the user handler API.
For now it handles PUTs, to create new users. It's still a
partial implementation and there is no documentation yet.

POST, PATCH and DELETE will arrive later to handle other users
operations.
2024-07-27 01:57:34 +02:00
absc 285f4ad402 Correct the callback matching for the ProvidedCallback function. 2024-07-25 01:18:00 +02:00
absc 8f7481d785 Use the REST handler instead of the default one.
This makes the code simpler and more manageable.
2024-07-24 23:32:16 +02:00
absc 03b76bddf2 No need for the bucket to be configurable.
While there, create the bucket for the users during initialization.
2024-07-23 23:42:31 +02:00
absc 3280596836 Skeleton for the storage bootstrap.
We want to automate this, for example, when deploying in a docker
container.

A bunch of static files will be loaded into the storage, in order
to be served to the clients.
2024-07-23 23:15:36 +02:00
absc 65d6e5fa05 File committed as error. 2024-07-23 22:59:39 +02:00
absc 1f243b16d3 Import the initial dudeswave code.
At this point it handles only GETs, giving back plain text
responses in case of errors.

The intention is to also produce some static pages for those,
where the CSS we will chose applies.

Other APIs will be managed through their respective handlers,
whose routes will be setup before this one.
2024-07-23 22:52:57 +02:00
absc 14e6c3cc94 Import the storage application.
This is a small abstraction layer on top of mnesia. It simplifies
table management and addition of replicas and nodes.

Some things to add in the near future:

	* Removing nodes from a mnesia cluster is not supported.
	* Observability and event handling is missing.

While it's possible to perform the aformentioned functions with
the mnesia own APIs, adding some simplifications for day to day
management may be a good idea.

However, the library is already used in another project and it's
good enough for an initial use. It will be extended if and when
required.
2024-07-23 22:09:08 +02:00
absc 4aa09346d7 Import ranch.
Ranch is the listener used by cowboy to handle HTTP connections.

URL: https://github.com/ninenines/ranch
2024-07-23 22:07:38 +02:00
absc 9fdf706bcb Import cowboy.
Cowboy is a complete and light erlang webserver, used to serve
the dudeswave blog.

URL: https://github.com/ninenines/cowboy
2024-07-23 22:06:21 +02:00