484 Commits

Author SHA1 Message Date
Severin Alexander Bühler
178bae142e fix(homeserver): DDoS due to slow uploads or downloads (#132)
* switch branch

* moved files around

* validate webdav path in requests

* async and sync writer

* implemented file read and write via disk

* cleaning up

* clippy and fmt

* cleanup 1

* last cleanup

* fmt

* test concurrent read/write

* cleanup3

* cleanup3

* added log in case of a join error

* removed pub from max_chunk_size()

* fmt and clippy

* fixed test

* fmt

* fixed main merge errors
2025-05-25 10:51:25 +03:00
Severin Alexander Bühler
a485d8c2f4 feat(client): Set Relays in the JS Client Config (#139)
* added js pubky client constructor config

* fixed bugs

* fmt and cargotoml

* moved wasm constructor order

* removed pubky-common reexport of client
2025-05-23 18:32:37 +03:00
Severin Alexander Bühler
9b8e1ab8c9 feat(homeserver): Whitelist for rate limits (#129)
* added whitelist for rate limits

* simplified whitelist print
2025-05-23 17:46:06 +03:00
SHAcollision
4e8810f4b4 chore: bump pkarr to 3.7.2 (#141) 2025-05-22 09:57:06 +02:00
Ilya Evdokimov
c09e917986 Merge pull request #135 from pubky/readme-docker-section
Readme docker section
2025-05-20 17:37:57 +02:00
Ilya Evdokimov
fb79fcebeb Update README.md
Co-authored-by: Severin Alexander Bühler <8782386+SeverinAlexB@users.noreply.github.com>
2025-05-20 17:25:11 +02:00
Ilya Evdokimov
fb5b6c5d71 Update README.md
Co-authored-by: Severin Alexander Bühler <8782386+SeverinAlexB@users.noreply.github.com>
2025-05-20 17:25:03 +02:00
Ilya Evdokimov
21fe558e45 fixed /admin paths 2025-05-20 16:28:26 +02:00
Ilya Evdokimov
8b032f0c55 Docker-only section 2025-05-19 14:16:10 +02:00
Severin Alexander Bühler
2dae4b18b0 fix(general): Main readme links (#134) 2025-05-19 15:15:13 +03:00
Ilya Evdokimov
3a8c4571ef main updates 2025-05-19 12:22:04 +02:00
Ilya Evdokimov
54ad664b6f docker/podman info 2025-05-19 12:16:09 +02:00
Severin Alexander Bühler
2937baf360 chore (repo): Version Unification (#133)
* part1

* pre-release

* last changes

* fixed testnet issue
2025-05-19 12:20:59 +03:00
Severin Alexander Bühler
30e5387fd4 fix: Changed default pkarr relays (#131)
* fix: Changed default pkarr relays

* fmt

* Update native.rs
2025-05-16 15:32:02 +03:00
Severin Alexander Bühler
93ae488196 feat: Only block disabled users from writing files, not reading #130 2025-05-16 14:05:38 +03:00
James
af206c7fc9 Merge pull request #128 from pubky/catch-21/fix-dockerfile
chore: update rust in Dockerfile
2025-05-14 10:11:39 +01:00
Severin Alexander Bühler
44eb42dd9a Fix: Rate limit - can not extract user limit key & memory leak (#127)
* before ThrottledBody

* added upload rate limiting

* before dynamic rate limiting

* flexible rate limiter + config

* fixed tests

* fmt and clippy

* reset auth.js e2e

* more cleaning up

* improved code and added comments

* limit downloads too

* fmt and clippy

* improved sample comments

* fixed comment

* removed http dependency in favour of axum:http

* parse speed units as lowercase

* replaced regex with glob

* clippy and fmt

* fix: user rate limiting finding limit key

* fmt

* turn **/* patterns into **

* improved cleanup task
2025-05-14 10:05:01 +03:00
James Browning
ebbb8de488 chore: update rust in Dockerfile 2025-05-13 20:29:55 +01:00
SHAcollision
1be8bf5e9e Fix(homeserver): session expired on browser restart (#125)
* fix: session expired on browser restart

* expire at 1 year

* Update pubky-homeserver/src/core/routes/auth.rs

Co-authored-by: Severin Alexander Bühler <8782386+SeverinAlexB@users.noreply.github.com>

---------

Co-authored-by: Severin Alexander Bühler <8782386+SeverinAlexB@users.noreply.github.com>
2025-05-13 11:39:16 +02:00
Severin Alexander Bühler
8a0cec71ef feat: Flexible endpoint rate limiting (#124)
* before ThrottledBody

* added upload rate limiting

* before dynamic rate limiting

* flexible rate limiter + config

* fixed tests

* fmt and clippy

* reset auth.js e2e

* more cleaning up

* improved code and added comments

* limit downloads too

* fmt and clippy

* improved sample comments

* fixed comment

* removed http dependency in favour of axum:http

* parse speed units as lowercase

* replaced regex with glob

* clippy and fmt
2025-05-13 11:06:23 +03:00
SHAcollision
00aafb2163 fix(client): signup-publish-retry-flexible (#120)
* feat(client): signup-publish-retry-flexible

* fix wasm

* Retry on known query errors fixed 3 attemps 1s

* simplify
2025-05-08 13:27:11 +02:00
SHAcollision
64d003c235 feat(homeserver): add info endpoint (#118)
* feat(homeserver): add info endpoint

* fix clippy
2025-05-05 09:47:07 +02:00
SHAcollision
d3b9cf0f69 chore(homeserver): unify source of default config (#116)
* chore(homeserver): unify source of default configs

* add docstring

* introduce serde toml merge

* Fix defaults to be None

* simplify remove once cell

* add sample config

* fix and validate sample config

* Update pubky-homeserver/src/data_directory/config_toml.rs

Co-authored-by: Severin Alexander Bühler <8782386+SeverinAlexB@users.noreply.github.com>

* Update pubky-homeserver/src/data_directory/config_toml.rs

Co-authored-by: Severin Alexander Bühler <8782386+SeverinAlexB@users.noreply.github.com>

* Update pubky-homeserver/src/data_directory/persistent_data_dir.rs

Co-authored-by: Severin Alexander Bühler <8782386+SeverinAlexB@users.noreply.github.com>

* fix

---------

Co-authored-by: Severin Alexander Bühler <8782386+SeverinAlexB@users.noreply.github.com>
2025-05-02 11:46:59 +02:00
Severin Alexander Bühler
ec40609d11 fix (homeserver): disable relays when republishing user keys to avoid rate limiting (#117) 2025-05-01 15:15:54 +03:00
Severin Alexander Bühler
639eec4d26 fix(homeserver): move exposed admin endpoints behind pw protection (#115)
* move exposed admin endpoints behind pw protection

* removed /admin path

* fmt

* fixed tests

* fmt

* fixed singuptoken url in js client
2025-04-29 17:25:46 +03:00
SHAcollision
b3c134c73e feat(homeserver): add user disk quota (#108)
* Add user disk quotas

* fix extract helpers

* Add tests

* improve err message

* pr review fixes

* small fixes

* PR fixes

* fix unnecesary clone

* fix default user bug
2025-04-29 10:10:49 +02:00
Severin Alexander Bühler
1613c625ea feat(homeserver): Admin delete entry + ban user endpoints (#110)
* moved changes over from feat/moderation

* fixed test

* changed label for webapi

* small fixes

* fixed delete_entry status code

* use axum statuscodes

* tested events

* fmt

* valid /pub in handler, not route path

* added used_bytes to migration

* fmt

* fixed tests
2025-04-29 09:42:55 +03:00
Severin Alexander Bühler
bafa89f395 feat(homeserver): Set default icann_domain to localhost (#112) 2025-04-28 09:59:40 +03:00
Severin Alexander Bühler
8c6e3caf17 feat: Make config headers optional (#106)
* make config headers optional

* fmt and clippy
2025-04-23 13:24:00 +03:00
Severin Alexander Bühler
d4d44f7898 feat: add ability to configure hs config with statictestnet (#104) 2025-04-21 13:38:01 +03:00
Severin Alexander Bühler
f6f2ce6203 fix: trim secret when reading (#105) 2025-04-21 10:54:23 +03:00
SHAcollision
606ee5feb7 Bump to next release candidate 2025-04-18 10:29:07 +02:00
Severin Alexander Bühler
55d52ec4b8 chore(homeserver): Refactor Core (#96)
* first draft

* config2 for the time being

* more refactoring

* write default config if it doesnt exist

* added relays to config

* some refactor

* proper bootstrap nodes and relay config validation

* small comments

* rename module

* renamings

* turn listen_ports to listen_socket

* connected config with homeserver

* cleaned up old config

* cleaned up config_old

* removed old config.example.toml

* cleanup tryfrom conversions

* removed dirs-next

* review cleanup

* extracted default config to its own toml file

* use hostname_validator for rfc1123 domain verification

* Domain struct

* fmt

* small config restructure

* use SignupMode in config and moved it to config dir

* moved and simplified lmdb

* save to switch branches

* lots done already

* missin lock file

* pkarr config

* constants

* app context

* used context in more places

* made homeserver independant

* testing feature

* added datadirmock

* getting the hang about testing

* fixed homeserver core tests

* added HandleHolder

* make the homeserver tasks stop when its dropped

* make server handles optional

* properly cleanup all background tasks

* moved logs

* fixed config default toml

* fmt, clippy

* moved stuff around

* lots of moving and readme

* fixed pkarr republisher tests

* removed docs from include

* fixed and refactored testnet

* make simple_testnet work

* httprelay shutdown

* different testnets

* fixing tests1

* fixing tests

* fixing more tests

* unified pkarr versions

* fixed config with bootstrap nodes and relays

* split up test_republish_on_signin to prevent timing issues

* fixed all tests in e2e?

* fixed multi publisher tests

* fixed pubky-client readme

* fixed testnet readme

* added better errors

* admin error

* fixed tests

* format

* clippy

* cllippy

* fixed testnet ports

* fixed client future issue

* improved testnet

* fixed cache_size pkarr relay issue

* small improvements

* fixed low prio dns record

* removed fixed testnet test due to port conflicts

* fixed browserify issues

* fmt

* clippy

* changed wait for testnet hs admin

* fixed docs clippy issues

* added comments

* moved icann_domain

* renamed datadirs

* implemented default for MockDataDir

* renamed run() to start()

* removed unwraps

* fmt

* fixed rename test

* cleaned up admin trace

* added santity values for periodic backup conf and user keys republisher

* fmt

* fmt

* fixed readme lint

* removed println

* fixed admin server edge to anyhow

* added ipv6 support

* removed unnecessary expects

* renamed testnet

* fmt

* renamed me

* changed import

* fmt
2025-04-18 10:00:43 +03:00
Severin Alexander Bühler
6ad1509263 fix(homeserver): simplified config with serde(default) (#95)
* simplified config with serde(default)

* removed signupmode display
2025-03-26 17:07:26 +02:00
SHAcollision
283a38e9cc feat(homeserver): fallback missing pubky-host header to query param (#94)
* feat(homeserver): fallback missing pubky-host header to query param

* fix: host and overwrite with pubky-host

* add query pubky-host test
2025-03-26 09:33:40 -04:00
SHAcollision
8b0094ae6a fix(docs): legacy microseconds on record age docstring 2025-03-25 10:07:25 -04:00
SHAcollision
a021813f18 fix(docs): fix cache action (#93) 2025-03-25 08:21:59 -04:00
SHAcollision
2363089ef4 feat(homeserver): add backup service (#92)
* feat(homeserver): add backup service

* Fix PR review

* fix: make lmdb backup interval a config

* fix change default backup to disabled
2025-03-25 08:13:49 -04:00
Severin Alexander Bühler
5eb61d589b chore(homeserver): Refactor config (#91)
* first draft

* config2 for the time being

* more refactoring

* write default config if it doesnt exist

* added relays to config

* some refactor

* proper bootstrap nodes and relay config validation

* small comments

* rename module

* renamings

* turn listen_ports to listen_socket

* connected config with homeserver

* cleaned up old config

* cleaned up config_old

* removed old config.example.toml

* cleanup tryfrom conversions

* removed dirs-next

* review cleanup

* extracted default config to its own toml file

* use hostname_validator for rfc1123 domain verification

* Domain struct

* fmt

* small config restructure

* use SignupMode in config and moved it to config dir
2025-03-25 09:44:05 +02:00
Severin Alexander Bühler
6f94333101 chore: Renamed pubky member dir to pubky-client (#90)
* chore: Renamed pubky member dir to pubky-client

* fixed paths

* fixed wasm test workflow
2025-03-21 14:24:34 +02:00
Severin Alexander Bühler
ca0995cb23 chore: Moved e2e tests / Fixes circular dependency (#88)
* moved e2e tests

* moved e2e tests to its own workspace member

* fmt
2025-03-21 13:15:33 +02:00
SHAcollision
8e1056c397 chore: prepare release 2025-03-20 15:23:18 -04:00
Severin Alexander Bühler
6c4821fe7a fix (pkarr-republisher): Include in Github workflow (#89) 2025-03-20 13:08:28 +02:00
Severin Alexander Bühler
3e761720de Feat(client): getHomeserver (#86)
* added method

* added wasm rust analyzer section

* getHomeserver wasm

* updated readme

* getHomeserver js test

* correct js typing

* fixed js getHomeserver call

* fmt and clippy

* Update pubky/README.md

Co-authored-by: SHAcollision <127778313+SHAcollision@users.noreply.github.com>

* moved get_homeserver from internal to auth

* reuse extract_host_from_packet

* removed unused imports

* removed version from testnet

* fixed tests

---------

Co-authored-by: SHAcollision <127778313+SHAcollision@users.noreply.github.com>
2025-03-19 11:17:13 +02:00
Severin Alexander Bühler
5393b4575a feat: Pkarr republisher for user and homeserver keys (#85)
* added bin folder

* removed published_secrets.txt

* added single key publisher

* read and republish

* some changes

* made everything nice

* added RetrySettings

* added resilient client

* fmt

* renamed package

* readme

* added user key republisher

* fmt

* extracted DB and homeserver core from mod

* homeserver packet republish periodically

* small changes

* with final message

* conditional republish

* fmt

* clippy

* moved bin to examples

* improved readme

* handle relay only clients

* handled no dht available

* ignore corrupt users

* handle heed entry errors

* improved unwraps

* fixes

* fixes

* added republish interval to config

* use warn when some keys are missing

* removed old todo

* fixes

* fmt

* fix relays

* use resilient client in homeserverkeyrepublisher

* moved some news to default

* more defaults

* fixed tests

* fmt

* test

* removed resilient client for homeserver publish again

* clippy

* made code simpler

* refactored code

* added .vscode to gitingore

* resutlt match
2025-03-18 17:07:07 +02:00
SHAcollision
6386f1ae43 feat: signup tokens (#80)
* Add admin and signup config

* Add signup tokens API, db, admin endpoint

* Add client api for signup codes

* Add tests and fixes

* Fix wasm build

* Lint

* enable and use same admin pswd on all test homeservers

* fix pr review comments

* Add nodejs and browser signup token to tests

* update signup example

* admin authing as layer

* Update pubky-homeserver/src/core/routes/auth.rs

Co-authored-by: Severin Alexander Bühler <8782386+SeverinAlexB@users.noreply.github.com>

* Update pubky-homeserver/src/core/routes/auth.rs

Co-authored-by: Severin Alexander Bühler <8782386+SeverinAlexB@users.noreply.github.com>

* rename getSignupToken util

* add is_used() SignupToken method

---------

Co-authored-by: Severin Alexander Bühler <8782386+SeverinAlexB@users.noreply.github.com>
2025-03-17 15:58:58 -04:00
SHAcollision
b685f8a085 feat: client api for pkarr record republishing (#79)
* feat: add public method to repub homeserver and repub on signin

* Add extract host unit test

* refactor and expose to wasm

* lint

* Fixes add republish tests

* Use pubky timestamp

* Fix wasm spawn

* update republish min time

* fix wasm build

* fix: change republish wasm apii to expect public key

* Update pubky/src/native/internal/pkarr.rs

Co-authored-by: Severin Alexander Bühler <8782386+SeverinAlexB@users.noreply.github.com>

* Update pubky/src/native/internal/pkarr.rs

Co-authored-by: Severin Alexander Bühler <8782386+SeverinAlexB@users.noreply.github.com>

* r record to s signed_packet

* clean up determine host

* fix max_record_age api and change to 1h

---------

Co-authored-by: Severin Alexander Bühler <8782386+SeverinAlexB@users.noreply.github.com>
2025-03-17 10:46:33 -04:00
SHAcollision
3407a90756 chore(tests): add wasm tests to CI (#83)
* ci: add WASM testing workflow to GitHub Actions

* ci: enhance WASM testing workflow with testnet startup and cleanup

* ci: enhance testnet setup and testing workflow with improved logging and connectivity checks

* trying something different

* fix: skip testing browser

---------

Co-authored-by: Miguel Medeiros <miguel@miguelmedeiros.com.br>
2025-02-28 19:57:10 -03:00
SHAcollision
bb310d46d1 fix: improve start up times in some environments (#76) 2025-02-22 18:37:37 -04:00
SHAcollision
00fbd47cb8 chore: add doctests to CI (#77) 2025-02-22 15:48:14 -03:00