Commit Graph
100 Commits
Author SHA1 Message Date
Alec Murphy c4ec8ae999 Slon/Modules/ActivityPub: Add http_signature_is_always_valid option
For testing purposes, we can set http_signature_is always_valid to any
value in the db settings Object. This allows us e.g. to replay
ActivityPub payloads using curl, without having to deal with signatures
while we are implementing new features.
2025-03-15 18:02:47 -04:00
Alec Murphy 11d114aa9d System/Setup/Environment: Patch reboot-on-crash to Fault2 instead of Dbg2 2025-03-15 17:53:06 -04:00
Alec Murphy 8175debbac Meta: Remove newline for debugging separator 2025-03-15 17:52:31 -04:00
Alec Murphy 400d9c9c01 Slon/Api/V1/Bookmarks: Implement Bookmarks
Fixes #10
2025-03-14 18:24:10 -04:00
Alec Murphy 5a9bf4f32b Slon/Api/V1/CustomEmojis: Implement Custom Emojis
Fixes #6
2025-03-13 15:50:48 -04:00
Alec Murphy a4a959d875 Meta: Suppress compiler warnings 2025-03-12 20:49:05 -04:00
Alec Murphy 401035a0d1 Slon/Api/V1/Favourites: Implement Favourites
Fixes #7
2025-03-12 20:33:39 -04:00
Alec Murphy 475e648feb Slon/Api/V1/Announcements: Implement Announcements
Fixes #9
2025-03-12 16:19:00 -04:00
Alec Murphy 6e9f86b4ae Slon/Modules/Db: Show progress when loading profiles and statues 2025-03-12 13:41:05 -04:00
Alec Murphy de213e35fe System/Libraries/Json: Implement array->contains() 2025-03-12 13:38:11 -04:00
Alec Murphy 8ef544d912 System/Libraries/Json: Set arr->last_item to NULL if arr->length is zero 2025-03-12 09:39:51 -04:00
Alec Murphy fd8d6ca2b7 Slon/Modules/ActivityPub: Fix offset for HTTP signatures (for now) 2025-03-12 09:05:42 -04:00
Alec Murphy c726b7e206 Slon/Http/AdminServer: Display free memory in /info/stats 2025-03-12 08:23:41 -04:00
Alec Murphy 06c8433616 Slon/Static/html/admin: Make whitelist_ip a protected settings field
Just a simple QoL change, not "security" by any means.
2025-03-12 08:03:25 -04:00
Alec Murphy 5f2ed89f61 Slon/Endpoints/Get/ActivityPub: Match json anywhere in Accept header
We shouldn't 404 if a client accepts many different content-types, or is
unnecessarily verbose, when requesting a user profile.
2025-03-12 07:58:44 -04:00
Alec Murphy 3faed0e966 Slon/Modules/OAuth: Return client state for /oauth/verify_access
Most clients don't care about this, but the (deprecated) Tooot iOS app
does, so now we support it.
2025-03-12 07:47:09 -04:00
Alec Murphy 52d769defc net/tcpip: Fix 128K leak on each bound socket connection 2025-03-10 09:58:21 -04:00
Alec Murphy 5010de73a0 Slon/Api/V1/Accounts: Fix nested for loops in @slon_api_v1_accounts_get 2025-03-10 09:12:05 -04:00
Alec Murphy ba296cceb8 Slon/Api/V1/Accounts: Create relationship object in session's mem_task
This fixes a crash when the Mona iOS client makes a GET request to the
/api/v1/accounts/relationships endpoint.
2025-03-10 08:21:40 -04:00
Alec Murphy 08579df0b8 Slon/Modules/Http: Add mem_task to SlonHttpSession
We should be using the CHeapCtrl from the Spawned @slon_http_task to
allocate memory for each individual session, which will automatically
be freed when the CTask dies, so let's give ourselves the ability to
do that.
2025-03-10 08:18:13 -04:00
Alec Murphy e982c9584a System/FFI/LibC: Round-robin mem_task selection for malloc
This fixes an issue where multiple HTTP requests would arrive
simultaneously, and the subsequent calls to @rsa_import would
end up clobbering the shared mem_task's CHeapCtrl, leading to #GP.

Eventually, we may want to simplify this to only init the CHeapCtrl,
rather than creating the entire CTask, but for now it seems ok.
2025-03-10 07:51:19 -04:00
Alec Murphy 546cbaf18d Slon/Modules/Api: Add NULL check to SLON_AUTH_ACCOUNT_ID macro 2025-03-09 20:34:45 -04:00
Alec Murphy d5a09373e4 Everywhere: Update JSON API 2025-03-09 19:39:44 -04:00
Alec Murphy 6a0ecc2bd2 System/Utilities/Time: Update JSON API, remove tz stuff for now 2025-03-09 13:32:20 -04:00
Alec Murphy bacab705b3 System/Libraries/Http: Update JSON API 2025-03-09 13:26:03 -04:00
Alec Murphy 90af0edcbb System/Libraries/Json: Fundamental (breaking) changes to API
Going forward, the following methods will require a mem_task to be
provided: Clone, CreateArray, CreateObject, Parse, Stringify.

For JsonArray, append/insert/prepend will take arguments in the form
((index,) value, type). A JsonItem will automatically be created which
encapsulates this value and type. If type is not specified, the
following will be done to determine the type:

- Cast value to JsonElement* and check if the signature matches. If it
  does, assign type as value(JsonElement*)->type; or

- If value > 0x1000, assign type as JSON_STRING; or

- Otherwise, assign type as JSON_BOOLEAN.
2025-03-09 13:16:33 -04:00
Alec Murphy b4e6abc79f System/Utilities/Time: Update for DST 2025-03-08 16:28:12 -05:00
Alec Murphy b0c1016955 Slon/Modules/ActivityPub: Pass actor as argument to @slon_activitypub_get_account_for_remote_actor 2025-03-06 15:09:57 -05:00
Alec Murphy 74455c59ab Slon/Modules/Db: Add @slon_db_save_status_to_disk() to save an individual account's statuses 2025-03-06 15:03:05 -05:00
Alec Murphy aded79c192 Slon/Modules/Db: Save/load accounts to/from individual JSON files 2025-03-06 10:54:25 -05:00
Alec Murphy 64f31de070 Everywhere: Use slon_mem_task for memory allocation 2025-03-06 09:54:26 -05:00
Alec Murphy 5333b64917 Everywhere: Store statuses by account id, generate timelines as array of object:account_id,status_id 2025-03-05 13:43:35 -05:00
Alec Murphy 33a92718c7 Slon/Api/V1/Accounts: Handle array of ids for /api/v1/accounts/relationships 2025-03-05 13:04:22 -05:00
Alec Murphy 62b6d75851 Slon/Modules/Api: Use @slon_api_find_status_by_id 2025-03-05 08:09:17 -05:00
Alec Murphy b8fba64ab0 Slon/Api/V1/Accounts: Allow updating avatar/header images via PATCH /api/v1/accounts/update_credentials 2025-03-04 20:46:43 -05:00
Alec Murphy 3100707e78 Slon/Api/V2/Media: Remove unnecessary no_warn 2025-03-04 20:14:26 -05:00
Alec Murphy f1d78783a3 Slon/Endpoints/Get/Web: Remove some test data 2025-03-04 15:12:49 -05:00
Alec Murphy 9ed7e1c1e3 Slon/Http/Server: Use @slon_http_json_object_add_nested_value() when
parsing url-encoded strings to JSON

Fixes #3
2025-03-04 14:45:12 -05:00
Alec Murphy a7649a00c8 Everywhere: Use Catbox API asynchronously
Fixes #2
2025-03-04 13:26:35 -05:00
Alec Murphy 04dce33aca Slon/Modules/Api: Move Catbox API routines here 2025-03-03 21:12:33 -05:00
Alec Murphy e1c6ca1b2b Slon/Http/Server: Reimplement multipart/form-data to JSON parser 2025-03-03 21:00:55 -05:00
Alec Murphy 68e5cf5eb9 System/Libraries/String: Use mode instead of always trimming both ends in String.Trim() 2025-03-03 13:53:47 -05:00
Alec Murphy 691504f48f System/Libraries/String: Add String.Trim() 2025-03-03 10:35:29 -05:00
Alec Murphy 8eddf1fdc7 Slon/Static/html,js: Let IMG tags know width,height from status' media attachments 2025-03-02 19:58:34 -05:00
Alec Murphy 5258ab19a8 Slon/Api/V1/Statuses: Allow retrieval of individual status from public timeline 2025-03-02 18:07:09 -05:00
Alec Murphy 715d119882 Slon/Api/V1/Statuses: Implement Context descendants
Fixes #1
2025-03-02 17:34:59 -05:00
Alec Murphy 27fa0f8aad Slon/Api/V2/Media: Add support for Catbox API 2025-03-02 15:08:39 -05:00
Alec Murphy 6ff3a74914 Slon/Modules/Db,Slon/Http/AdminServer: Add a settings object to the database for misc parameters 2025-03-02 09:55:22 -05:00
Alec Murphy 6f11f7830d Slon/Api/V1/Statuses: Handle 'sensitive' parameter if POSTed as string rather than boolean 2025-03-01 21:27:09 -05:00
Alec Murphy c0a28a6f17 Slon/Modules/Http: Increase session buffer size to 10MB 2025-03-01 21:11:01 -05:00
Alec Murphy bcb46d47f1 Slon/Http/Server: Add @slon_http_json_object_from_multipart_form_data() 2025-03-01 21:08:39 -05:00
Alec Murphy 140284233d Slon/Static/html: Display images in user statuses 2025-03-01 20:18:35 -05:00
Alec Murphy b104551bbd Slon/Api/{V1,V2}/Media: Implement PUT /api/v1/media, POST /api/v2/media 2025-03-01 19:46:13 -05:00
Alec Murphy 95aecb9fb1 Slon/Api/V1/Markers: Implement /api/v1/markers 2025-02-28 18:39:20 -05:00
Alec Murphy e223273300 Slon/Api/V1/Statuses: Refactor /api/v1/statues/:id/context 2025-02-28 18:35:23 -05:00
Alec Murphy da6998c637 Slon/Http/Server: Support arrays and objects in urlencoded strings 2025-02-28 16:23:30 -05:00
Alec Murphy 1ecc5f4995 Slon/Api/V1/Statuses: Don't clobber status with each lookup 2025-02-28 16:21:21 -05:00
Alec Murphy 88f4c39968 Api/V1/Statuses: Include parameter in @slon_api_v1_statuses_query 2025-02-28 12:35:38 -05:00
Alec Murphy afee70ad38 Slon/Api/V1/Statuses: Implement GET /api/v1/statues/:id/context 2025-02-28 12:22:32 -05:00
Alec Murphy 9a5a49ae80 Slon/Http/Server: Add Slon/Endpoints/Get/Statuses 2025-02-28 11:29:06 -05:00
Alec Murphy 90e553abc3 Slon/Api/V1/Statuses: Implement GET /api/v1/statuses/:id 2025-02-28 11:26:33 -05:00
Alec Murphy b487e381e8 Slon/Modules/ActivityPub: Associate replies with known statuses 2025-02-28 10:21:02 -05:00
Alec Murphy 2f879bc9ef Slon/Static/html/admin: Show total of known accounts in Admin interface 2025-02-28 08:51:17 -05:00
Alec Murphy 81d65056a9 System/Libraries/Json: Implement @json_stringify_string to eliminate StrLen() bottleneck 2025-02-27 11:30:08 -05:00
Alec Murphy 4b7e5b2836 Slon/Http/AdminServer: Implement Manage>Instance 2025-02-24 15:00:24 -05:00
Alec Murphy c44f5b482e Slon/Modules/ActivityPub: Use atomUri as idempotency key for Create status requests 2025-02-23 09:25:03 -05:00
Alec Murphy 6ee0f037f6 Slon/Modules/ActivityPub: Always send the Accept request to signatory, rather than the actor specified in the object 2025-02-23 09:23:09 -05:00
Alec Murphy 430e92cbe0 Slon/Modules/ActivityPub: Sign GET request in @slon_activitypub_http_signature_is_valid 2025-02-23 08:20:56 -05:00
Alec Murphy 89e70359c4 Slon/Modules/ActivityPub: Remove invalid newline when building headers for signing GET request 2025-02-23 07:26:08 -05:00
Alec Murphy d447744ac4 Meta: Add .gitattributes 2025-02-23 07:01:59 -05:00
Alec Murphy 19893a775d Slon/Api/V1/Accounts: Deduplicate relationship object creation into @slon_accounts_default_relationship_object 2025-02-23 06:13:19 -05:00
Alec Murphy 4a5a23d7fb Slon/Http/AdminServer: Paginate list of accounts 2025-02-22 22:25:13 -05:00
Alec Murphy 8838d0446d Everywhere: Deduplicate local account creation for remote actors in @slon_accounts_create_local_for_remote_actor 2025-02-22 21:43:19 -05:00
Alec Murphy 1a5aa1e22c Slon/Modules/ActivityPub: Fix typo passing http_headers to Http.Get 2025-02-22 21:41:48 -05:00
Alec Murphy 6c87604d56 Everywhere: Deduplicate status queries into @slon_api_v1_statuses_query 2025-02-22 20:58:56 -05:00
Alec Murphy 045893b6c6 Everywhere: Be more granular with @db_save_* calls 2025-02-22 20:38:35 -05:00
Alec Murphy a9f5a1de0c Slon/Modules/ActivityPub: Deduplicate signed requests into @slon_activitypub_signed_request 2025-02-22 19:25:23 -05:00
Alec Murphy 500a3115cc Meta: Update README.md 2025-02-22 11:08:16 -05:00
Alec Murphy 3379454d59 Meta: Update .gitignore 2025-02-21 19:45:10 -05:00
Alec Murphy d6c1b8dbfd Slon/Api/V1/Timelines: Implement public timeline 2025-02-21 18:38:11 -05:00
Alec Murphy 66074a5472 Everywhere: Use session->path() 2025-02-21 18:10:25 -05:00
Alec Murphy ff5a07dc04 Everywhere: Make session->content_type() callable 2025-02-21 18:03:12 -05:00
Alec Murphy 614e68194b Slon/Modules/NodeInfo: Implement .well-known/nodeinfo and nodeinfo/2.0 2025-02-21 17:44:54 -05:00
Alec Murphy 545d408512 Everywhere: Make session->path(), session->path_count() callable 2025-02-21 16:51:22 -05:00
Alec Murphy 3728d56ea0 Everywhere: Make session->verb() callable 2025-02-21 11:13:31 -05:00
Alec Murphy 69a4d6916f Slon/Api/V1/Accounts,Timelines: Sort statuses by most recent first 2025-02-20 14:28:39 -05:00
Alec Murphy 2b03e16583 Slon/Modules/ActivityPub: Don't assume actor is signatory when fetching public key for signature verification 2025-02-20 11:44:43 -05:00
Alec Murphy a50156872d Slon/Http/Server: Cleanup session->send() on free 2025-02-20 08:26:07 -05:00
Alec Murphy c6f74cfa84 Everywhere: Make session->send() callable 2025-02-20 08:24:04 -05:00
Alec Murphy 40b3fceab1 System/Libraries/Json: Prepend signature to elements 2025-02-20 08:05:07 -05:00
Alec Murphy e757758289 Slon/Modules/ActivityPub: Allow federated replies to posts on user's home timeline 2025-02-19 22:56:22 -05:00
Alec Murphy 71c8db66f1 Everywhere: Make session->header() callable 2025-02-19 21:53:31 -05:00
Alec Murphy 0960af9aef Slon/Modules/Http: Remove unused function @slon_http_set_status_code() 2025-02-19 21:11:14 -05:00
Alec Murphy 6813c13ab3 Everywhere: Make session->status() callable 2025-02-19 21:07:09 -05:00
Alec Murphy ca8e7ae7f6 Slon/Modules/ActivityPub: Accept statuses to/cc followed actors 2025-02-19 11:51:46 -05:00
Alec Murphy cf5b8fe46a Slon/Api/V1/Statuses: Don't set internal deleted flag on status object being sent via ActivityPub 2025-02-17 18:50:04 -05:00
Alec Murphy 591bd3ecbb Slon/Modules/ActivityPub: Propagate create/delete statuses to followers 2025-02-17 18:21:59 -05:00
Alec Murphy 16d65c88ee Slon/Api/V1/Accounts: Implement Follow 2025-02-17 17:39:49 -05:00
Alec Murphy 3312c86836 Slon/Modules/ActivityPub: Send smol Accept request to ack Create, instead of sending the entire message contents 2025-02-17 16:37:20 -05:00
Alec Murphy 2fa9fbd350 Slon/Http/AdminServer: Suppress warning 2025-02-17 16:35:23 -05:00