Open samip5 opened 4 years ago
Maybe I don't quite understand, but Maniwani has support at the (S)CSS level for themes, as that's how the theme selector at the corner of the page works (by switching the CSS file retrieved between the built-in stock
/harajuku
/wildride
themes). The Bootstrap-based classes are pretty ugly under the hood, though, and could do with a rework, maybe removing Bootstrap altogether for the sake of simplicity. If you want to take a peek, the files are built from the scss
directory.
Or were you asking for custom templating to emit different HTML? That would be a little wonky but workable with Jinja but probably more-or-less impossible with the React UI since React components emit their own HTML elements. On the other hand the way Maniwani is rendered with the React rework allows entirely separate frontends, since the Flask portion of Maniwani just fires JSON over HTTP at an admin-specified endpoint before taking the result and sending it to the browser. Not really the intention I had in mind when designing that part of the architecture and so there's no kind of switch or anything to swap frontends, but it's another possibility that could be implemented with fairly little work.
Improving the default look-and-feel and moving away from Bootstrap is something I've been meaning to do for a while, preferably from scratch with liberal use of flexbox and CSS grid since browser support for both is pretty standardized - I'm definitely interested in any suggestions for improving the UI/UX in that regard.
I meant it more like full frontend, including templates and css can be semi-easilly swapped.
I like this frontend: https://gitgud.io/LynxChan/PenumbraLynx/-/tree/master/, and I have a herokuapp running with the default front, but there's no boards so you cannot really see what board view looks.
Got it, then it sounds like the architecture of the in-progress React port is a lot closer to what you want - let me see if I can expand on the overview I gave in my previous comment:
With the way things currently work on the react-ui
branch, Flask still listens for HTTP requests as usual, but the rendering of everything except the site menu (and that will/should probably change) is done by a function render_react_template. Despite the name, there's nothing React-specific about it, I just named it that to contrast with the built-in Jinja templating system. What it does is send a JSON document representing whatever needs to be rendered - a board catalog, a thread, etc. - at an URL given by the RENDERER_HOST
configuration variable, and wait for a result to come back. The result is then sent to the waiting browser as the rendered page, without Flask changing it in any capacity.
So giving Maniwani full pluggable frontend support wouldn't be too hard, if that's what you're looking for - at least once react-ui
gets merged, and I suspect it'll be less than a week before I make the PR. Modifying the RENDERER_HOST
configuration variable to point at any custom renderer frontend of your choosing should provide a good amount of flexibility, and stuff like render_react_template
can be easily renamed should pluggable/swappable frontend support be implemented. All any custom frontend would have to do is implement a few endpoints to get the Flask backend to fully support it; only /render/catalog
and /render/thread
at the moment are needed, though /render/firehose
and a couple others for some of the other pages will probably be a part of the full spec.
I would like to see a theme support added, so that one can just use config to specify which frontend templates/styles to load and/or improve the current defaults.