Commit graph

89 commits

Author SHA1 Message Date
ca63a2a13c Merge pull request 'feat: implement cors' (#10) from wip/cors into main
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
Reviewed-on: #10
Reviewed-by: Radical <radical@radical.fun>
2025-05-06 08:06:32 +00:00
c0f2948b76
feat: implement cors 2025-05-06 00:41:23 +02:00
135375f5b7 Merge pull request 'wip/username-regex' (#6) from wip/username-regex into main
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
Reviewed-on: #6
Reviewed-by: Radical <radical@radical.fun>
2025-05-05 01:16:31 +00:00
77245e98c5 refactor: combine crypto.rs with utils.rs
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
2025-05-04 23:50:38 +02:00
8a1467c26a Merge branch 'main' into wip/username-regex 2025-05-04 21:41:40 +00:00
ab5c85c4f5
fix: add numbers to username regex 2025-05-04 23:25:48 +02:00
c2bface373 Merge pull request 'wip/authorization-header' (#7) from wip/authorization-header into main
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
Reviewed-on: #7
Reviewed-by: SauceyRed <saucey@saucey.red>

Uses authorization headers instead of keeping access_token and refresh_token in body.

auth header is used for `access_token`

## Changes
Moved everything to /api

### POST -> GET /v1/users/me
Request: auth header

### POST -> GET /v1/users/{uuid}
Request: auth header

### POST -> GET /v1/users
Request: auth header and query params `start=int` and `amount=int`

### POST /v1/auth/register
Response: Remove `refresh_token` from body and instead set-cookie `refresh_token`

### POST /v1/auth/login
Response: Remove `refresh_token` from body and instead set-cookie `refresh_token`

### POST /v1/auth/refresh
Request: cookie `refresh_token`
Response: Remove `refresh_token` from body and instead set-cookie `refresh_token`

### POST /v1/auth/revoke
Request: auth header (password still in body)
2025-05-04 21:18:27 +00:00
c61f96ffe7 feat: expire refresh_token immediately on unauthorized response 2025-05-04 23:02:17 +02:00
0f897dc0c6 feat: return refresh_token in cookie 2025-05-04 22:13:28 +02:00
ebb4286c08 refactor: move api to /api
serve api under /api
2025-05-04 22:13:05 +02:00
f12f81d584 fix: extract auth value 2025-05-04 21:30:33 +02:00
a3846a2620 fix: use correct header 2025-05-04 20:30:28 +02:00
cbf0131d14 feat: switch to headers for auth 2025-05-04 19:09:12 +02:00
6c706d973e style: use created_at instead of created 2025-05-04 19:09:06 +02:00
aa865e2ed4 feat: add utils.rs
provides a function that extracts auth header from headers
2025-05-04 18:11:12 +02:00
e29940d080
feat: only allow lowercase usernames 2025-05-03 03:04:07 +02:00
b530de8f52
fix: username regex 2025-05-03 02:20:37 +02:00
bcf857d6b2 refactor: flatten login function
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
2025-05-02 20:32:13 +02:00
0d07af7d79 feat: style: return unauthorized when token isnt found and flatten function structure
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
2025-05-02 19:26:37 +02:00
1d7cdf343b feat: add users endpoint and add me and uuid under it
Some checks failed
ci/woodpecker/push/build-and-publish Pipeline failed
Adds a users endpoint that returns all users on the server, will require instance permissions in future.
Place previous user requests under users to avoid having multiple endpoints.
2025-05-02 19:19:59 +02:00
cc07d78325 build: add a run-dev.sh for local testing
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
2025-05-02 16:23:45 +02:00
2c73a07961 build: use one log file instead of 2 2025-05-02 16:23:11 +02:00
c76fd73179 refactor: move regex code to mod.rs 2025-05-02 16:22:30 +02:00
0ccfa53746 docs: remove left over comment 2025-05-02 16:21:44 +02:00
97f7595cc5 style: cargo clippy and format
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
2025-05-02 15:20:22 +02:00
5d0d666094 ci: remove unused cross file
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
2025-05-02 14:52:28 +02:00
b853ed3e98 use docker as build system
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
2025-05-02 14:23:50 +02:00
4295e93134 ci: dont use tee
Some checks failed
ci/woodpecker/push/build-and-publish Pipeline failed
2025-05-02 13:53:03 +02:00
ad4effd425 ci: specify path for tee since the command wasnt found
Some checks failed
ci/woodpecker/push/build-and-publish Pipeline failed
I have no idea how this even happened, it should be included in the image
2025-05-02 13:50:06 +02:00
f020345e8a ci: install docker in rust container
Some checks failed
ci/woodpecker/push/build-and-publish Pipeline failed
2025-05-02 13:46:03 +02:00
040be2126c ci: try using cross for cross compile
Some checks failed
ci/woodpecker/push/build-and-publish Pipeline failed
2025-05-02 13:38:33 +02:00
3647dbcd41 ci: add musl-dev
Some checks failed
ci/woodpecker/push/build-and-publish Pipeline failed
2025-05-02 13:25:50 +02:00
eaa4fab96f Revert "ci: add step to install libssl-dev"
This reverts commit df99a1effe.
2025-05-02 13:24:52 +02:00
df99a1effe ci: add step to install libssl-dev
Some checks failed
ci/woodpecker/push/build-and-publish Pipeline failed
2025-05-02 13:18:13 +02:00
dc5ac8889a ci: try using alpine for cross
Some checks failed
ci/woodpecker/push/build-and-publish Pipeline failed
2025-05-02 13:13:01 +02:00
0f94bfbd28 fix: add missing dashes
Some checks failed
ci/woodpecker/push/build-and-publish Pipeline failed
2025-05-02 13:09:24 +02:00
b16d9c3b71 ci: build for x86_64 and arm64
Some checks failed
ci/woodpecker/push/build-and-publish Pipeline failed
This is an *attempt* to make the build system work for arm64 images as well, fingers crossed!
2025-05-02 13:08:24 +02:00
8f611c5d37 chore: use debian:12-slim in docker 2025-05-02 13:07:41 +02:00
481c2c3648 feat: use a logging library
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
gives us logs from actix and sqlx that otherwise arent exposed to us
2025-05-02 01:18:13 +02:00
80111af3de chore: use image from forgejo container registry
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
2025-05-02 00:41:26 +02:00
280e989c4b ci: remove unused docker commands
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
2025-05-02 00:34:46 +02:00
6c53d23bb7 ci: use --push on docker build
Some checks failed
ci/woodpecker/push/build-and-publish Pipeline failed
2025-05-02 00:29:43 +02:00
28fdcdcd3e ci: add missing tag to push
Some checks failed
ci/woodpecker/push/build-and-publish Pipeline failed
2025-05-02 00:26:11 +02:00
f6888b1803 ci: use environment instead of settings
Some checks failed
ci/woodpecker/push/build-and-publish Pipeline failed
2025-05-02 00:22:48 +02:00
7ad2771f52 ci: add build and docker publish ci 2025-05-02 00:21:18 +02:00
22ab3d8a04 feat: add a way to revoke refresh_tokens using device_name 2025-05-01 20:19:39 +02:00
a89d705239 feat: use device_name in refresh_tokens table 2025-05-01 20:19:18 +02:00
c009d578a7 perf: optimize user fetching code 2025-05-01 20:18:39 +02:00
705abeb643 fix: fix password regex
this should probably be moved to its own function so we can change it on the fly
2025-05-01 20:17:59 +02:00
1646e60e65 fix: underscore unused config var in data 2025-05-01 20:15:38 +02:00