API Refactor #3504

Merged
hj merged 90 commits from api-refactor into develop 2026-06-26 12:18:05 +00:00
Owner
  • BackendInteractorService is no more, instead all requests are done by importing API call and passing singleton credentials taken from OAuth store.
  • All polling fetchers are localized in their own respective stores/modules/services
  • 99% of requests now use promisedRequest:
    • Consistent error handling - non-ok responses throw StatusCodeError and it's handled in .catch() block instead of relying on "seemingly ok" response with error(s) field.
    • Redundant re-throws removed to help with debugging since throw new Error(oldError) hides the original stack and extra info
    • Consistent authorization - authorization header is always passed when token exists
    • Consistent url params:
      • URL query params are consistent now
        • Using new paramsString() function that takes an object (or Map) and turns it into a query param string i.e. ?foo=bar&baz=laz
          • Built-in checker for passing non-primitives as param values
          • Checker for passing non-object/non-map as value
          • null and undefined gets dropped
          • Built-in array support (?a[]=1&a[]=2)
        • Query params are always part of the url constant (interpolated) string and always filter only supported attributes, filtering out excess
      • POST data is always either JSON or FormData. Passing formData switches over to form-data mode.
    • Consistent parsing - requests actually take into account Content-Type and Content-Length when parsing response.
    • Consistent response - data is always in data field, response is also included (for extracting data from headers)
    • API is split into several files. This should improve code splitting, i.e. not loading extra stuff for anon visitors and not loading admin stuff for non-staff. Further splitting is in order but this is a good start.
      • public.js - publicly accessible stuff, i.e. user profiles, conversations. Authorization is optional but still passed just in case (i.e. loading locked conversations).
      • user.js - stuff that guaranteed to require authorization
      • admin.js - administrative stuff, i.e. moderation and configuration
      • oauth.js - OAuth stuff (moved from /new_api)
      • websocket.js - MastoAPI websocket stuff.
      • timelines.js - timelines and their fetchers
      • chats.js - Pleroma Chats
      • mfa.js - MFA (moved from /new_api)
    • The few remaining non-promisedRequests are mostly-static stuff like emoji fetching, nodeinfo etc., will probably get changed to use promisedRequest later.
  • Small updates/fixes for tests and running the (e2e) tests

Overall the development should be a bit more consistent and cleaner now. Unfortunately code-splitting doesn't bring much benefit for chunking, but I guess every little bit matters.

MR is a bit cross-polluted from #3505, sorry.

- `BackendInteractorService` is no more, instead all requests are done by importing API call and passing singleton credentials taken from OAuth store. - All polling fetchers are localized in their own respective stores/modules/services - 99% of requests now use `promisedRequest`: - Consistent error handling - non-ok responses throw `StatusCodeError` and it's handled in `.catch()` block instead of relying on "seemingly ok" response with `error`(s) field. - Redundant re-throws removed to help with debugging since `throw new Error(oldError)` hides the original stack and extra info - Consistent authorization - authorization header is always passed when token exists - Consistent url params: - URL query params are consistent now - Using new `paramsString()` function that takes an object (or `Map`) and turns it into a query param string i.e. `?foo=bar&baz=laz` - Built-in checker for passing non-primitives as param values - Checker for passing non-object/non-map as value - `null` and `undefined` gets dropped - Built-in array support (`?a[]=1&a[]=2`) - Query params are always part of the url constant (interpolated) string and always filter only supported attributes, filtering out excess - POST data is always either JSON or FormData. Passing `formData` switches over to form-data mode. - Consistent parsing - requests actually take into account `Content-Type` and `Content-Length` when parsing response. - Consistent response - data is always in `data` field, `response` is also included (for extracting data from headers) - API is split into several files. This should improve code splitting, i.e. not loading extra stuff for anon visitors and not loading admin stuff for non-staff. Further splitting is in order but this is a good start. - `public.js` - publicly accessible stuff, i.e. user profiles, conversations. Authorization is optional but still passed just in case (i.e. loading locked conversations). - `user.js` - stuff that guaranteed to require authorization - `admin.js` - administrative stuff, i.e. moderation and configuration - `oauth.js` - OAuth stuff (moved from `/new_api`) - `websocket.js` - MastoAPI websocket stuff. - `timelines.js` - timelines and their fetchers - `chats.js` - Pleroma Chats - `mfa.js` - MFA (moved from `/new_api`) - The few remaining non-`promisedRequest`s are mostly-static stuff like emoji fetching, nodeinfo etc., will probably get changed to use `promisedRequest` later. - Small updates/fixes for tests and running the (e2e) tests Overall the development should be a bit more consistent and cleaner now. Unfortunately code-splitting doesn't bring much benefit for chunking, but I guess every little bit matters. MR is a bit cross-polluted from #3505, sorry.
hj added 8 commits 2026-06-16 13:43:10 +00:00
fix status fetching
Some checks failed
ci/woodpecker/pr/changelog Pipeline failed
ci/woodpecker/pr/lint Pipeline failed
ci/woodpecker/pr/test-e2e Pipeline failed
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/build unknown status
e5c27fccc6
hj added 5 commits 2026-06-16 14:48:37 +00:00
use OAuthStore directly
Some checks failed
ci/woodpecker/pr/changelog Pipeline failed
ci/woodpecker/pr/lint Pipeline failed
ci/woodpecker/pr/test-e2e Pipeline failed
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/build unknown status
3984a5aefa
hj added 3 commits 2026-06-16 15:38:47 +00:00
fix and unify list and bookmark editors
Some checks failed
ci/woodpecker/pr/changelog Pipeline failed
ci/woodpecker/pr/lint Pipeline failed
ci/woodpecker/pr/test-e2e Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
bb3c7b2178
Merge branch 'more-fixes' into api-refactor
Some checks failed
ci/woodpecker/pr/changelog Pipeline failed
ci/woodpecker/pr/lint Pipeline failed
ci/woodpecker/pr/test-e2e Pipeline failed
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/build unknown status
4ad176a68b
lint
Some checks failed
ci/woodpecker/pr/changelog Pipeline failed
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/test-e2e Pipeline failed
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/build unknown status
9eee55df4a
hj added 6 commits 2026-06-16 20:19:00 +00:00
lint
Some checks failed
ci/woodpecker/pr/build Pipeline is pending
ci/woodpecker/pr/test Pipeline is pending
ci/woodpecker/pr/changelog Pipeline failed
ci/woodpecker/pr/lint Pipeline failed
ci/woodpecker/pr/test-e2e Pipeline was canceled
6e809aa11b
lint
Some checks failed
ci/woodpecker/pr/changelog Pipeline failed
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/test-e2e Pipeline failed
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/build unknown status
d13c1bef9d
fix "until"
Some checks failed
ci/woodpecker/pr/changelog Pipeline failed
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/test-e2e Pipeline failed
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/build unknown status
82c3fa0bd1
refactor promisedRequest to use async/await
Some checks failed
ci/woodpecker/pr/changelog Pipeline failed
ci/woodpecker/pr/lint Pipeline failed
ci/woodpecker/pr/test-e2e Pipeline failed
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/build unknown status
04a0b0b8a8
hj added 3 commits 2026-06-17 11:37:00 +00:00
src/services/api -> src/api
Some checks failed
ci/woodpecker/pr/changelog Pipeline failed
ci/woodpecker/pr/lint Pipeline failed
ci/woodpecker/pr/test-e2e Pipeline failed
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/build unknown status
c81813064b
refactor promisedRequest to always return whole response
Some checks failed
ci/woodpecker/pr/changelog Pipeline failed
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/test-e2e Pipeline failed
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/build unknown status
1ca0ffb1f0
hj added 7 commits 2026-06-17 16:26:30 +00:00
turns out announcements require login
Some checks failed
ci/woodpecker/pr/changelog Pipeline failed
ci/woodpecker/pr/lint Pipeline failed
ci/woodpecker/pr/test-e2e Pipeline failed
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/build unknown status
d9d50de3f6
fix login
Some checks failed
ci/woodpecker/pr/changelog Pipeline failed
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/test-e2e Pipeline failed
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/build unknown status
07a1d3b9c4
hj added 2 commits 2026-06-17 16:46:57 +00:00
add proxy to /auth for dev server
Some checks failed
ci/woodpecker/pr/changelog Pipeline failed
ci/woodpecker/pr/lint Pipeline failed
ci/woodpecker/pr/test-e2e Pipeline failed
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/build unknown status
20ff0c0091
hj added 5 commits 2026-06-17 18:06:05 +00:00
fix some tests
Some checks failed
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline failed
ci/woodpecker/pr/test-e2e Pipeline failed
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/build unknown status
f535a14dfc
hj added 2 commits 2026-06-18 10:57:33 +00:00
fix test?
Some checks failed
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/test-e2e Pipeline failed
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/build unknown status
38898ba571
fix?
Some checks failed
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline failed
ci/woodpecker/pr/test-e2e Pipeline failed
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/build unknown status
f3c77afff1
fix tests. msw has issues on firefox with vitest isolation.
Some checks failed
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/test-e2e Pipeline failed
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build unknown status
9d24782cd8
fixes
Some checks failed
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline failed
ci/woodpecker/pr/test-e2e Pipeline failed
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build unknown status
fe1790f217
refactor timelines
Some checks failed
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline failed
ci/woodpecker/pr/test-e2e Pipeline failed
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build unknown status
f4f83bc26f
hj added 2 commits 2026-06-19 12:51:12 +00:00
login/logout troubles
Some checks failed
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/test-e2e Pipeline failed
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build unknown status
55324aea13
hj added 6 commits 2026-06-22 13:39:19 +00:00
mfa fixes
Some checks failed
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline failed
ci/woodpecker/pr/test-e2e Pipeline failed
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/build unknown status
6c4f6dcd05
hj added 7 commits 2026-06-22 17:20:13 +00:00
small refactor+lint in poster
Some checks failed
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline failed
ci/woodpecker/pr/test-e2e Pipeline failed
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/build unknown status
00de60eec4
lint
Some checks failed
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/test-e2e Pipeline failed
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/build unknown status
c697041dfc
debugging e2e
Some checks failed
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/test-e2e Pipeline failed
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/build unknown status
8fa49f298f
Revert "debugging e2e"
Some checks failed
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/test-e2e Pipeline failed
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/build unknown status
7425392413
This reverts commit 8fa49f298f.
hj added 3 commits 2026-06-23 15:35:41 +00:00
should fix admin e2e test
Some checks failed
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline failed
ci/woodpecker/pr/test-e2e Pipeline failed
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/build unknown status
ab34412a2e
port?
Some checks failed
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline failed
ci/woodpecker/pr/test-e2e Pipeline failed
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/build unknown status
8c7369e15d
use port 8099
Some checks failed
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline failed
ci/woodpecker/pr/test-e2e Pipeline failed
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/build unknown status
0e4222c02b
hj added 2 commits 2026-06-23 17:15:58 +00:00
wrong fetcher
Some checks failed
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/test-e2e Pipeline was successful
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/build unknown status
ee42d4095a
hj added 3 commits 2026-06-24 16:07:08 +00:00
update playwright
Some checks failed
ci/woodpecker/pr/build Pipeline is pending
ci/woodpecker/pr/test Pipeline is pending
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline failed
ci/woodpecker/pr/test-e2e Pipeline was canceled
6060d4efbc
lint
Some checks failed
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/test-e2e Pipeline failed
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/build unknown status
728ba716b8
hj added 4 commits 2026-06-24 16:44:11 +00:00
missing file
Some checks failed
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/test-e2e Pipeline failed
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/build unknown status
aaa3f64a02
playwright
All checks were successful
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/test-e2e Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
0908d2bb65
hj added 2 commits 2026-06-25 12:32:41 +00:00
cleanup unused imports
All checks were successful
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/test-e2e Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
893ab9d73b
don't rethrow
Some checks failed
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline failed
ci/woodpecker/pr/test-e2e Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
8becc0704b
lint
All checks were successful
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/test-e2e Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
8dae81e29d
@ -28,6 +31,7 @@ const UserReportingModal = {
return !!this.$store.state.users.currentUser
},
isOpen() {
console.log(this.reportModal)
Author
Owner

console.log

console.log
hj marked this conversation as resolved
self-review
All checks were successful
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/test-e2e Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
9b53879e70
hj left a comment

self-review pass 2

self-review pass 2
hj merged commit 0045cdde37 into develop 2026-06-26 12:18:05 +00:00
hj deleted branch api-refactor 2026-06-26 12:18:51 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pleroma/pleroma-fe!3504
No description provided.