Add pleroma-fe to list of available frontends (in admin-fe) #944
No reviewers
Labels
No labels
approved, awaiting change
bug
configuration
documentation
duplicate
enhancement
extremely low priority
feature request
Fix it yourself
help wanted
invalid
mastodon_api
needs change/feedback
needs docs
needs tests
not a bug
planned
pleroma_api
privacy
question
static_fe
triage
wontfix
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: AkkomaGang/akkoma#944
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "HJ/akkoma:pleroma-admin-support"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
As of
168430fff2
PleromaFE supports Akkoma backendI believe as is this would end up automatically migrating all existing akkoma-fe users over to pleroma’s pleroma-fe; this shouldn’t happen. Ideally our frontend would have been renamed at the time of forking, but to be fair probably nobody expected pleroma’s main FE would gain explicit Akkoma compat an so initially the name stayed
pleroma-fe
and when it was later renamed the internal name still remained unchanged for compat reasons.So, even though
pleroma-fe
is the most natural name for this, I’m afraid it will need to use some other name likepleroma-pleroma-fe
,pleroma-fe-classic
or similar.Additionally and more generally, currently all frontends with built-in references are built and shipped by us, ensuring the it’s the same trust zone as the backend. I’ll leave it to floati to decide whether it’s acceptable to add a ref pointing to external sources. (If it’s acceptable, I expected other frontends like Mangane will also follow up with similar patches)
If akkoma bundles its own FE in same way pleroma does it shouldn't migrate anyone. It would migrate if admin used AdminFE and set used frontend to
pleroma-fe
it will only migrate if admin updates it without changing default frontend.I think pointing to remote urls are better so that admins would get instant updates instead of waiting on you to pull recent changes, especially given that right now only
develop
branch is supported (akkoma support is not inmaster
yet)we do not - akkoma ships without a frontend by default, the two are entirely separate. akk-fe is installed and updated via mix commands
To add to the above: "akkoma-fe" is installed under the name and in the directory "pleroma-fe" (since that used to be its name). All mix commands (and admin-fe) refer to it as
pleroma-fe
.Your patch reassigns the name "pleroma-fe" to pleroma’s pleroma-fe. Meaning the next time anyone updates their existing frontend install, they’ll overwrite "akkoma-fe" with pleroma’s pleroma-fe. This should not happen. (Also all docs would then suddenly recommend installing pleroma’s pleroma-fe by default instead of "akkoma-fe").
Thus this needs to use a different name.
Even if we changed the preferred name for "akkoma-fe" now,
pleroma-fe
would need to continue to work as an alias for akkoma-fe to not break/migrate existing setups.yeah i understand, i'll change it to
pleroma-fe-upstream
ideally it should be just a different
ref
but even pleroma's backend doesn't support multiple refs, i had to hack it into UI.done
installing work and it seems to use the new files if setting
pleroma-fe-upstream
as the primary frontend, but the frontend just runs into an error for me. Did it work for you?Also, several CSP violations are logged (no inline styles allowed)
@ -775,3 +775,3 @@
available: %{
"pleroma-fe" => %{
"pleroma-fe-upstream" => %{
"name" => "pleroma-fe",
"name" => "pleroma-fe-upstream"
@ -778,0 +782,4 @@
"build_dir" => "dist"
},
"pleroma-fe" => %{
"name" => "akkoma-fe",
"name" => "pleroma-fe"
@Oneric wrote in #944 (comment):
what is the instance? i wanna look at it in devtools
My local test/dev setup. It doesn’t federate and is not publicly available
The only logged API requests are for instance info and frontend config; results attached below
API responses
instance
frontend config
can you open devtools and look where it fails exactly?
CSP on pleroma is:
upgrade-insecure-requests;script-src 'self' 'wasm-unsafe-eval';connect-src 'self' blob: https://shigusegubu.club wss://shigusegubu.club https:;media-src 'self' https:;img-src 'self' data: blob: https:;default-src 'none';base-uri 'self';frame-ancestors 'none';style-src 'self' 'unsafe-inline';font-src 'self';manifest-src 'self';
don't know what exactly causing it, might be that CSP violation, pleroma-fe does some magic that inserts CSS into DOM but by default it will use adoptedStyleSheets: https://developer.mozilla.org/en-US/docs/Web/API/Document/adoptedStyleSheets and only falls back to inserting
<style>
tags if it fails.As I said before, Akkoma doesn’t allow inline styles for security reasons, check:
lib/pleroma/web/plugs/http_security_plug.ex
style_setter.js:250:
If you already have a pleroma dev env, setting up a local akkoma test env is likely as simple as cloning the backend repo, running the instance setup task (or copying a simple dev config) and running
mix phx.server
the source of this may
336d06b2a8
in which we prevent inline stylesheets from loading to keep things nice and sanitisedI don't have local pleroma backend set up, I usually proxy frontend towards existing instance, helps with dogfooding and investigating real cases.
I added a fix in pleroma-fe for this, gotta wait until develop build is complete
fix is in, build successful, you can try installing pleroma-fe again
this didn’t change anything but the name of the minified property being
null
(and looking at the "fix" i’m not sure how it was supposed to help, even if such an element would exists, it would still fail to add the inline styles a few lines later due to CSP)I strongly recommend you either force matching CSP headers in your proxy, or setup a local akkoma dev/testing instance as described here: https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/docs/docs/development/setting_up_akkoma_dev.md – no need for HTTPS and later bits
the fix i did https://git.pleroma.social/pleroma/pleroma-fe/-/blob/develop/index.html?ref_type=heads#L138 is basically the same as in akkoma-fe https://akkoma.dev/AkkomaGang/akkoma-fe/src/branch/develop/index.html#L10 but I guess there's more to it. I will force CSP to be the same and do a proper fix
OK, I did the necessary changes and tested on shigusegubu with stricter CSP header, should be working fine now.
It no longer crashes on load; base viewing and posting functionality seems to mostly work. Most prominently notifications are broken and cause repeated error popups because they query a category not existing in akkoma:
Further, less prominent issues (not counting known missing features like MFM etc):
/api/v1/pleroma/accounts/:id/scrobbles?limit=1
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
window.navigator.serviceWorker is undefined
I did not test any admin stuff besides adding an emoji.
An advantage it seems to have (apart from personal preferences) over akkoma-fe is the built-in emoji management UI.
It sends one request to determine if scrobbles are available or not because backend devs forgot to add it to
nodeinfo
That's probably just your browser not supporting or not allowing serviceworkers, it's not fatal in any way, but on mobile it means no native notifications in chrome
That is very strange, I was testing against suya.place and outerheaven and everthing was fine.
there are more IMO, like customizable navigation and cutomizable post actions, plus proper popovers that don't get cut-off by parent, scalable UI. But otherwise I think it's more of a personal preference, I just want akkoma users to try using what i've been working on.
it logs the error repeatedly, not just once
yeah, would be nice if it would only be tested/logged once, but not a deal breaker
Fixed aformentioned issues.
pleroma:chat_message
to type list only if chats are supportedStill don't know what
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
is about but I'm guessing it's just that instance is missing some (custom) styles/palettes.There is some sort of performance degradation after pleroma-fe has been running for a while but i'm not sure what it is and currently investigating. Shouldn't be a blocker though.
Actually changing the way theme previews work increased performance of them significantly lol
I misread the error message before too, but actually it seems there were two invalid enums in notification requests:
pleroma:chat_messages
(which is now gone) andstatus
, the latter seems to’ve been added to pleroma about a year ago without a corresponding nodeinfo entry and still causes notification requests to fail(related: #531 )
Do those notifications return 500 error code or something? I don't know how to detect if this if they don't and not in nodeinfo.
Once again it works completely fine on frontend side when proxied to outerheaven and suya.place so I can't reproduce. I'm guessing the issue is spammy logs on backend side? IMO backend should ignore any unrecognized types, I think masto does the same.
If i remove all include_types it seem to work just fine.
also noticed that custom emoji reacts are kinda broken, gonna fix
custom emoji reacts now are un-broken.
BAD REQUEST
isHTTP 400
i added check if notification fetch ends up with 400 and remove
status
type from it (and send request again). It's hacky and IMO backend should just ignore extraneous types.Again, I can't reproduce it on instances i mentioned, so i don't know if status message is helpful or not, it would be good if it tells you whan is wrong exactly.
That’s exactly what happens though; you get the error message I posted earlier as part of the
400 BAD REQUEST
responseAnyway, I don’t spot anything obviously broken anymore, so functionality-wise this seems good enough now for inclusion. Now only the question how to handle trust etc for third-party builds remains
oh, i missed that, i'll update pleroma-fe to look specifically for those types of messages
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.