Make mastofe work like all the other frontends #81
Labels
No labels
bug
can't reproduce
confirmed
discussion
duplicate
enhancement
glitch-soc
help needed
suggestion
upstream
won’t fix
No milestone
No project
No assignees
3 participants
Due date
No due date set.
Dependencies
No dependencies set.
Reference
pleroma/mastofe#81
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
This came up in pleroma/pleroma#5778. It would be nice if mastofe could work like the other frontends, live on
/and be able to log in etc. Rebasing it to/is probably easy, but adding the basics for log in seems harder. Maybe we can pull in some stuff from @alexgleason's soapbox?Live on / could be possible but wouldn't we need a configurable path instead?
Also login page is the OAuth one.
I'd be willing to help with this. The auth part wasn't the hardest though, the "initial-state" part was. The frontend has a LOT of stuff pulled from the initial state, and the code for it looks something like this:
The problem with this code is it relies on a Mastodon-specific element prerendered in the HTML, and you cannot simply pull it from an endpoint because the load order.
It needs to be converted into code like this:
Maybe with pleroma/pleroma#5759 it could work without rewiring all the internals. We would instead have to map the prerendered data to the initial_state variables. The user would have to enable this feature for mastofe to work.
I'm pretty amazed you've managed to keep it a "distribution" of glitch-soc so far instead of a fork, but I'm not sure you'll be able to continue doing it that way if you want it to work like a first class frontend.
In mastofe, getting rid of the initial-state would require changing 102 files. This is exactly what I did in Soapbox FE, and it was a huge undertaking:
In a perfect world we could fix this in upstream Mastodon. Also in a perfect world, they'd maintain their frontend in a separate repo.
initialState in glitch should be much easier to adapt and probably would be only itself to change to fetch an endpoint rather than extract from HTML.
But given that pleromafe has been given similar data-in-HTML I don't think it's much of an issue.
Also it managed to keep being a distribution thanks in part to glitch sock making it simpler and me avoiding to change a lot of files and rather modifying it in the smallest lines possible.
You'd still have to edit all 102 of those files and use mapStateToProps, there's no way around that unless we preload. It was more complicated than I expected because it changes the behavior of the components when they can't get the initial state immediately. The whole app has to be loaded differently.
Well maybe preload would be needed but in no way changing these 102 files is going to work (maybe divided by about two as the vanilla flavour doesn't matter).
Or if it's done it will be with cooperation with glitch-soc, but anyway, I want to be sure of what is actually needed so we could avoid extraneous work.
Also rebasing on
/is quite weird, a usual thing that I get from mastofe users is that they use it on one device but not another and this is likely to be even more the case with ChatMessages (as they're probably not going to be present soon enough).And right now MastoFE depends on PleromaFE as there is no profile edition and similarly I don't see it being there soon either.
It's pretty trivial to let it run on any path, you just have to change this:
It could be configurable, but I'm not sure where you'd configure it.
There is actually other places where changes would have to be done. For example there is the following commits that are done in our modifications:
feab0a424d805385ff53