Damus

Recent Notes

Random Penguin · 7w
Vier Facelift? Before I started work on BookLook the plan was to just create a modern UI style for the "Vier" theme along the same lines of what I did with Bookface for the "Frio" theme. I didn't re...
Random Penguin profile picture
If neither "Smart Threading" nor "Compact Conversation View" are enabled you get the default layout for replies. I'm calling this "Flow Chat" because it's a bit like a flow chart for the conversation that, unlike simple thread lines or indenting, shows the relationship between the replies in detail:




Again, direct replies to the OP are separated by thick dashed lines, so you can see replies beneath them form separate conversations, with those replies separated by thin dashed lines. But the big difference are the bracket-thread lines. Second level are gray. Third level are blue. Fourth level are orange. Fifth level are green. Sixth level are red. Seventh+ level are purple. Friendica never indents anything more than thread_level_7.

If you compare the second conversation here to the "smart threaded" version you can see how this shows the actual relationship and depth of the replies, where "smart threading" does not.

Random Penguin · 7w
Vier Facelift? Before I started work on BookLook the plan was to just create a modern UI style for the "Vier" theme along the same lines of what I did with Bookface for the "Frio" theme. I didn't re...
Random Penguin profile picture
For the aforementioned "Smart Threaded" option the replies under that depth test post would look like this with thick dashed lines between direct replies to the OP and thin lines and indenting for replies to replies:




The point of the "smart threaded" option is to reduce the amount of indentation. It accomplishes that by making any reply, at any depth, that has < 2 direct replies a thread_level_2 post (as if it were a direct reply to the OP). Once there are 2 or more replies to that comment its thread level changes and it starts indenting.

However, that purposely completely breaks the relationship of replies to replies that have fewer than two direct replies. Nothing I can do about that. That's how it intentionally works.

If you enable the new "Compact Conversation View" option, which only shows comments by the current user and the OP, whether "smart threading" is also enabled or not, this is the layout used.

Random Penguin · 7w
Vier Facelift? Before I started work on BookLook the plan was to just create a modern UI style for the "Vier" theme along the same lines of what I did with Bookface for the "Frio" theme. I didn't re...
Random Penguin profile picture
I'm still working on this layout but haven't tackled the mobile version yet. I got sidetracked trying to make post replies look and work better. One thing that annoys me is that the engagement count for comments only shows the number of direct replies to the post instead of the total of all replies. So I've been thinking of at least adding a counter for how many total replies are downloaded/visible:

I think you only ever see that button with the full comment count if you enable "smart threading." My downloaded number is done entirely with CSS counters and only appears on a post that has at least one reply. It dynamically updates if you press the button to load more comments. I would prefer an option to just show the total reply count in every thread view mode, but it doesn't just hide that "16" it doesn't even create it in the other views. So the best I can do is a count of how many are currently downloaded and visible.

Random Penguin · 3w
Bookface for Friendica 2028.06-rc ONLY FOR FRIENDICA 2026.08-rc! It will NOT work with any earlier version of Friendica!Keep in mind that the Release Candidate is still receiving frequent updates and...
Random Penguin profile picture
FYI: There is going to be an update to this in a couple of days or so. I'm reworking how it calculates colors on the PHP side because some of the accent colors are coming out way too dark in Dark Mode and I'm also implementing a contrast color on a bunch of buttons so when the accent color is dark the test is light and vice versa.
1
Random Penguin · 2w
That update is released: gitlab.com/randompenguin/bookf… Main difference is it now handles a contrasting text color on buttons that have an accent color background.
Random Penguin profile picture
Bookface for Friendica 2028.06-rc

ONLY FOR FRIENDICA 2026.08-rc! It will NOT work with any earlier version of Friendica!Keep in mind that the Release Candidate is still receiving frequent updates and possible breaking changes.

There are now MORE files to copy into the /view/themes/frio/schemes folder!

bookface_auto.css
bookface_auto.php
bookface_dark.css
bookface_dark.php
bookface_light.css
bookface_light.php
bookface_legacy.css (new!)
bookface_legacy.php (new!)
bookface_assets folder (new!)


You should not copy the /src folder unless you're planning to make changes or contribute.

Make sure you set the permissions correctly on the files, the assets subfolder, and its contents.

This Bookface version represents a massive rewrite of Bookface due to the major refactoring of Friendica. Some of the most noticeable changes are:

Most of the Nav and Action button label variables are now removed because auto-translated labels have been added as an option in Friendica.
The --link-color variable now only applies to text color while backgrounds and borders use --accent-color
The user's color choice now creates a full "color theme" using tints, shades, and tones of the accent color.
The File Browser button is no longer hidden by default. While there is still no way to actually manage the files the browser layout has been improved.
Bookface now makes extensive use of the new light-dark() CSS function. It is widely supported by new browsers. However some users on older devices that can't update the browser may experience unexpected results. So there is also a "Bookface Auto Legacy" style included that uses the older, more widely supported prefers-light-color and prefers-dark-color method.
In Settings > Display > Theme and Admin > Themes > Frio it now shows a screenshot of Bookface instead of Frio
The stylesheets are now modularized to make it easier to update and maintain this project.OTHER NOTES:

The README file references the "Bookface Custom" add-on. That add-on has not yet been updated to work with 2.1.7.
The README file points user to the "Bookface Wiki." That has not yet been updated to reflect the changes in version 2.1.7. The wiki will be updated when there is a stable release.


@admins @Friendica Developers #Friendica #theme #dev

gitlab.com/randompenguin/bookf…
1
Random Penguin · 3w
FYI: There is going to be an update to this in a couple of days or so. I'm reworking how it calculates colors on the PHP side because some of the accent colors are coming out way too dark in Dark Mode and I'm also implementing a contrast color on a bunch of buttons so when the accent color is dark t...
hypolite · 3w
nostr:nprofile1qy2hwumn8ghj7un9d3shjtnyd968gmewwp6kyqpqjyfhtfwc40hrc7pxrxvp5ztve3nz4lc4yrxguq2saxpycwmre78q6m9q72 Let's see, you would have to write something like this: function bookface_custom_foote...
Random Penguin profile picture
@hypolite Oh, so it's similar to using templates in a theme, only addon ones are appended rather than replacements?

Thank you for your help! Turns out it was simpler than I thought and I was messing it up by making it overly complicated.

I've got it working now 😃 And because I moved all the settings into an array my footer.tpl is just 7 lines of code to iterate through that array.

The original purpose of this add-on was to make it easier to change/translate all the pseudo-element nav and action button labels. With all of those now moved into the core I'm not sure how useful this add-on still is, but it also gives pretty granular control over most of the Bookface CSS variables. I knew someone who was colorblind and their computer looked like the Joker's from Batman because it was all purple, yellow, and lime green. Looked great to them I guess.

I'm just about finished updating Bookface for 2026.08-rc. I just need to actually install the RC on my Dev Server to check it.
1
hypolite · 3w
nostr:nprofile1qy2hwumn8ghj7un9d3shjtnyd968gmewwp6kyqpqjyfhtfwc40hrc7pxrxvp5ztve3nz4lc4yrxguq2saxpycwmre78q6m9q72 Yeah, as an addon developer you get to define your own templates instead of overriding existing ones from the core. It can also be used for specific addon screen. Glad I could help!
hypolite · 3w
nostr:nprofile1qy2hwumn8ghj7un9d3shjtnyd968gmewwp6kyqpqjyfhtfwc40hrc7pxrxvp5ztve3nz4lc4yrxguq2saxpycwmre78q6m9q72 Looking at the bookface_custom_footer code from your repository, I'd encourage you to ...
Random Penguin profile picture
@hypolite I used the footer hook because I couldn't figure out how to do it with a template. The documentation on this stuff is still pretty thin so if you could either point me to an add-on already doing that or just tell me how to do it I'd appreciate it.

I'm also planning on moving all those settings into a single array so this add-on isn't cluttering up the pConfig table with a gazilion entries.
1
hypolite · 3w
nostr:nprofile1qy2hwumn8ghj7un9d3shjtnyd968gmewwp6kyqpqjyfhtfwc40hrc7pxrxvp5ztve3nz4lc4yrxguq2saxpycwmre78q6m9q72 Let's see, you would have to write something like this: function bookface_custom_footer(string &$body) { $t = Renderer::getMarkupTemplate('footer.tpl', 'addon/bookface'); $html = Ren...
hypolite · 3w
nostr:nprofile1qy2hwumn8ghj7un9d3shjtnyd968gmewwp6kyqpqjyfhtfwc40hrc7pxrxvp5ztve3nz4lc4yrxguq2saxpycwmre78q6m9q72 Did you use template variable interpolation?
Random Penguin profile picture
@hypolite Specifically I'm in the process of updating this addon: gitlab.com/randompenguin/bookf… which you can see uses the settings template and add-on and the footer hooks. So, no, it's not going through a template to display it's appending to the HTML in the footer hook. So that can't really be filtering HTML code, including scripts.

I wasn't surprised that the footer hook wrote the script into the page, I've seen other add-ons include dynamically generated footer scripts that way. I'm actually generating a <style> block that way. It was more that I was surprised the pConfig() and config() don't sanitize the config values before saving them into the database.

Maybe it's because I've spent so many years working of WordPress stuff where you never trust anything entered in a form and sanitize it all before it goes into the database.

I guess I'll just include the sanitizing in my add-on, but I was wondering if there's already a function like that in Friendica I can use or if I need to write my own function for the task?
1
hypolite · 3w
nostr:nprofile1qy2hwumn8ghj7un9d3shjtnyd968gmewwp6kyqpqjyfhtfwc40hrc7pxrxvp5ztve3nz4lc4yrxguq2saxpycwmre78q6m9q72 Looking at the bookface_custom_footer code from your repository, I'd encourage you to create a template in your addon where you build the custom CSS tag using variable interpolation. Thi...
hypolite · 3w
nostr:nprofile1qy2hwumn8ghj7un9d3shjtnyd968gmewwp6kyqpqjyfhtfwc40hrc7pxrxvp5ztve3nz4lc4yrxguq2saxpycwmre78q6m9q72 Code is only malicious when it's retrieved and displayed. This is why all template var...
Random Penguin profile picture
@hypolite I wasn't really thinking about SQL injection, I was thinking about malicious JS code getting written to the front-end and executed by an add-on that just uses a hook that injects it somewhere in the page code like the head, footer, etc.

I tested this by entering an annoying JS script into the text field and saving it. Where the add-on displays the user text from that setting, sure enough it wrote it <script> tags and all into the page and executed it. That doesn't seem like something that should be possible to do.
1
hypolite · 3w
nostr:nprofile1qy2hwumn8ghj7un9d3shjtnyd968gmewwp6kyqpqjyfhtfwc40hrc7pxrxvp5ztve3nz4lc4yrxguq2saxpycwmre78q6m9q72 Did you use template variable interpolation?
Random Penguin profile picture
I've been looking though the source code and when you set an option it looks like no sanitization is done? I see serialization of arrays and everything else is cast to type string.

So theme and addon settings should be doing the sanitizing ahead of using pConfig()->set() or config()->set()? If so, is there already a Friendica method for doing that? I made a couple add-ons that have text fields on their settings pages and I wouldn't want anyone to be able to save malicious code into the database with them.
1
hypolite · 3w
nostr:nprofile1qy2hwumn8ghj7un9d3shjtnyd968gmewwp6kyqpqjyfhtfwc40hrc7pxrxvp5ztve3nz4lc4yrxguq2saxpycwmre78q6m9q72 Code is only malicious when it's retrieved and displayed. This is why all template variables are escaped by default. This way even malicious HTML/Javascript entered into config files wil...