profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/shish/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.

shish/context2 70

Golang flame chart viewer

calaldees/KaraKara 24

Karaoke Event System - Attendees can view and queue tracks from their mobile phones

shish/devtools-py 15

A Python client for Chrome's DevTools protocol / a headless chrome control library

shish/cview3 12

AJAX comic viewer

shish/eve-mlp 12

Mobile Launch Platform for EVE Online

shish/clearskies-gui 9

A simple GUI for clearskies

shish/apache2rrd 7

Makes pretty graphs out of apache (or similar) log files

shish/csb 4

A curses-based browser for SQL databases

shish/context-apis 3

A collection of libraries for creating .ctxt files

issue openedshish/shimmie2

How to migrate to another server

I want to transfer shimmie from a Rasperry Pi to a new server. I am running Apache on both servers and I can install a new instance. How can I copy everything onto my new server?

created time in 17 hours

startedmludvig/smtp-cli

started time in a day

startedidank/explainshell

started time in a day

PR opened shish/shimmie2

CSS and JS files configurable by themes

I have multiple CSS files on my theme and I wanted them to be part of the cache system :) Is this good enough?

+20 -4

0 comment

1 changed file

pr created time in 2 days

Pull request review commentshish/shimmie2

Attempt at externalizing layout from extensions

 protected function sb_to_html(SetupBlock $block): string 		";         return $html;     }++    protected function build_setup_chunk(string $html): string+    {+        return "<table class='form'>$html</table>";+    }++    protected function build_setup_row(string $html): string+    {+        return "<tr>$html</tr>";+    }++    protected function build_setup_cell(string $html, bool $is_header=false, bool $full_width=false): string+    {+        $colspan = ($is_header || $full_width ? 2 : 1);+        if ($is_header) {+            return $this->build_setup_row("<th colspan='$colspan'>$html</th>");+        } else {+            if ($full_width) {+                return $this->build_setup_row("<td colspan='$colspan'>$html</td>");+            } else {+                return "<td colspan='$colspan'>$html</td>";+            }+        }+    }++    public function format_item(?string $label, ?string $html, ?string $config_name, bool $label_is_header=false, bool $full_width=false): string+    {+        if (empty($label) && empty($html)) {+            return "";+        }++        if (!empty($label)) {+            if (!empty($config_name)) {+                $label = "<label for='{$config_name}'>{$label}</label>";+            }+            $label = $this->build_setup_cell($label, $label_is_header, $full_width);+        } else {+            $label = "";+        }++        if (!empty($html)) {+            $html = $this->build_setup_cell($html, $label_is_header, $full_width);+        } else {+            $html = "";+        }++        if ($label_is_header) {+            return $label . $this->build_setup_row($html);+        }+        +        return $this->build_setup_row($label . $html);

Found a bug here. I'll work on it tomorrow. It's pretty harmless tho, creates an empty table row when formatting a full width label.

LaureeGrd

comment created time in 2 days

Pull request review commentshish/shimmie2

Attempt at externalizing layout from extensions

 public function onPageRequest(PageRequestEvent $event)                         return;                     } -                    $uobe = new UserOptionsBuildingEvent($display_user, new SetupPanel($user_config));+                    $uobe = new UserOptionsBuildingEvent($display_user, new SetupPanel($user_config, new SetupTheme));

This is the only thing that's not working with the SetupBlock changes. How should I access SetupTheme? Maybe UserConfigTheme should extend SetupTheme now? I feel like it should.

LaureeGrd

comment created time in 3 days

Pull request review commentshish/shimmie2

Attempt at externalizing layout from extensions

 protected function sb_to_html(SetupBlock $block): string 		";         return $html;     }++    public function format_option(string $name, $html, ?string $label, bool $table_row, bool $label_row = false): string+    {+        $output = "";+        if ($table_row) {+            $output .= "<tr><th colspan='".($label_row ? 2 : 1)."' style='text-align: ".($label_row ? 'center' : 'right')."'>";+        }+        if (!is_null($label)) {+            $output .= "<label for='{$name}'>{$label}</label>";+        }++        if ($table_row) {+            $output .= "</th>";+        }++        if ($table_row && $label_row) {+            $output .= "</tr><tr>";+        }++        if ($table_row) {+            $output .= "<td colspan='".($label_row ? 2 : 1)."'>";+        }+        $output .= $html;+        if ($table_row) {+            $output .= "</td>";+        }+        if ($table_row) {+            $output .= "</tr>";+        }++        return $output;+    }

It seems flexible right until you don't want to use tables :smile: Also, I'm noticing extensions create their tables in very different ways, which explains why I had so much trouble getting everything to look consistent on my theme. There's even setupblocks that don't use tables at all and just populate the items in the div.

I know it's going to look a lot less flexible when I commit this. But giving extensions that much flexibility leads to inconsistencies... I'm also trying to send everything through this format_option function, which I now renamed to format_item and takes care of labels and text as well, and I created other functions in theme.php to wrap them in the table elements (the ones one would override to get rid of tables entirely)

We can discard it if you think it's too much anyway. I'm adapting all extensions to the revised format now, I'll probably commit after that.

LaureeGrd

comment created time in 3 days

pull request commentshish/shimmie2

Standardized HTML layouts: Proof of concept

This does look good :)

To deal with the formatting test:

./vendor/bin/php-cs-fixer fix

Thanks. I'll fix everything when I feel like it's ready for full review and merging.

LaureeGrd

comment created time in 3 days

Pull request review commentshish/shimmie2

Attempt at externalizing layout from extensions

 public function get_user_editor_html(Image $image): string         $h_av = $image->get_owner()->get_avatar_html();         $h_date = autodate($image->posted);         $h_ip = $user->can(Permissions::VIEW_IP) ? " (".show_ip($image->owner_ip, "Post posted {$image->posted}").")" : "";-        return "-			<tr>-				<th>Uploader</th>-				<td>-		".($user->can(Permissions::EDIT_IMAGE_OWNER) ? "+        return ($user->can(Permissions::EDIT_IMAGE_OWNER) ? " 					<span class='view'><a class='username' href='".make_link("user/$h_owner")."'>$h_owner</a>$h_ip, $h_date</span> 					<input class='edit' type='text' name='tag_edit__owner' value='$h_owner'> 		" : " 					<a class='username' href='".make_link("user/$h_owner")."'>$h_owner</a>$h_ip, $h_date-		")."-				</td>-				<td width='80px' rowspan='4'>$h_av</td>-			</tr>-		";+		"); //TODO: Implement removed <td width='80px' rowspan='4'>$h_av</td>

oh, don't worry. I'll implement it accordingly. This PR is not meant to be merged yet as it is a bit less polished, because I'm working on multiple things at the same time. I wanted to make sure I wasn't making a big mistake and have to discard too much work. I'm working on setup's layout at the moment, which was a big pain when I tried to theme it.

LaureeGrd

comment created time in 3 days

Pull request review commentshish/shimmie2

Attempt at externalizing layout from extensions

 protected function build_info(Image $image, $editor_parts): string 					<table style='width: 500px; max-width: 100%;' class='image_info form'> 		";         foreach ($editor_parts as $part) {-            $html .= $part;+            // This could be using something like MicroHTML? but the contents need to allow HTML anyway.

That is nice. Will add this to my TODO list :)

LaureeGrd

comment created time in 3 days

release DemocracyClub/design-system

0.1.3

released time in 3 days

Pull request review commentshish/shimmie2

Attempt at externalizing layout from extensions

 protected function sb_to_html(SetupBlock $block): string 		";         return $html;     }++    public function format_option(string $name, $html, ?string $label, bool $table_row, bool $label_row = false): string+    {+        $output = "";+        if ($table_row) {+            $output .= "<tr><th colspan='".($label_row ? 2 : 1)."' style='text-align: ".($label_row ? 'center' : 'right')."'>";+        }+        if (!is_null($label)) {+            $output .= "<label for='{$name}'>{$label}</label>";+        }++        if ($table_row) {+            $output .= "</th>";+        }++        if ($table_row && $label_row) {+            $output .= "</tr><tr>";+        }++        if ($table_row) {+            $output .= "<td colspan='".($label_row ? 2 : 1)."'>";+        }+        $output .= $html;+        if ($table_row) {+            $output .= "</td>";+        }+        if ($table_row) {+            $output .= "</tr>";+        }++        return $output;+    }

main.php still uses a lot of small non-overridable functions to generate tables (I think we should avoid that) but at least this one can be overridden now.

LaureeGrd

comment created time in 3 days

PR opened shish/shimmie2

Attempt at externalizing layout from extensions

Decided to go for a different branch for this, so we can easily discard it or merge onto the other one, since I'm still trying to find the workflow we should go for with this rework.

If we want to let themes completely replace layouts, like replacing this table with a flexbox or grid, we should externalize the TR, TH, TD wrappers found in extensions. This is just one example of them.

I decided to go for a custom class for parts of this ImageInfo block but this is not the only place where an object with header, body and order is needed, so I can see Parts becoming its own thing like Blocks but with just the bare minimum information. They would be useful for events that build blocks like this one. Maybe we end up using an array and not a dedicated class for this, idk.

The part building process is not definitive, it's just a quick prototype.

I wanted to use MicroHTML on ext/view/theme.php's build_info but the contents of the table still needed to allow for HTML to be injected. This may be improved as well.

There's a few TODOs here, mainly notes for myself. Also, sorry @shish, I know this is a lot of work and a lot to think about and review. I'm trying to maximize my contributions since this is my last free week before starting uni.

+63 -103

0 comment

16 changed files

pr created time in 4 days

startedshauntarves/wyze-sdk

started time in 4 days

startedXunnamius/rainloop-webmail

started time in 4 days

fork Xunnamius/rainloop-webmail

Simple, modern & fast web-based email client

http://rainloop.net

fork in 4 days

PR opened shish/shimmie2

Standardized HTML layouts: Proof of concept

Same proof of concept from #827 but without my custom wrapper. build_selector has been moved to basethemelet.php. I didn't even think of it before. Putting this function here means that in addition to overriding on the entire site, themes can override them on a per-extension basis, giving even more control to the designer. Let's just hope we don't override the new functions on extensions themselves or we will end up in the same road :smile:

  • The doc-string might be a bit too much, I just wanted to make it clear for this PR.
  • There's an unrelated change that makes pools sort posts by ID when order is the same. It was a personal uncommitted change and it slipped on this one.

If this looks good, I will implement build_selector on more extensions.

+39 -19

0 comment

4 changed files

pr created time in 4 days

issue commentshish/shimmie2

General theme improvements

FWIW I am happy to help and advise, both on shimmie and programming in general, and I am honoured that you would spend your time here :) Also for the record my day job varies between "overwhelming" and "nothing to do", hence my activity here being variable too ^^;;

Thanks! I felt very welcome here ever since I started studying the code and posted my first PR n.n Hopefully I can look back someday and see many more contributions because this project fascinates me.

LaureeGrd

comment created time in 4 days

issue commentshish/shimmie2

Theming 'select' elements

Also to expand on the html-generation-library thing - I've started creating some wrappers in core/util.php to make sure that common concepts like "a submit button" are done the same way every time

That's a good one too. I wonder which elements should be done in that way and what's best to keep simple. In my experience, any helper function that returns HTML tags that are not closed is problematic. Example:

https://github.com/shish/shimmie2/blob/c4ae68fb471382db6350b82236cf0cc52a2cdf81/core/util.php#L703

This one generates a <form>, which is useful, but never closes it. Having such helpers for very specific things is ok but I can imagine too many of those "partial" HTML helpers would be confusing to work with.

I wonder if these functions should actually live in the base theme, so that custom themes can override them 🤔

I think so. Being able to override simple functions without having to rewrite a lot of code is always better for me, mainly because it makes themes more resistant to changes in the base code. But also because it makes creating themes faster in general. I found myself spending too much time adapting things that I wouldn't have touched otherwise rather than spend it designing my layout. (I guess I'm still doing that with this lol)

I do have a question, though: Would that approach (with the small helpers) replace the one I posted here? That is, would we still have a function that combines said helpers to create entire blocks in basepage.php or basethemelet.php like the build_selector example, or would extensions directly use helpers on their theme.php functions?

If we kept both, themes could use a mix of 3 options according to how specific the layout change needs to be:

  1. Override the new generalized layout functions that affect all extensions.
  2. Override those helpers to change specific HTML tags across all the site.
  3. Override an extension's specific layout, like until now.

I like this approach more than having just the new functions or just the helpers.

LaureeGrd

comment created time in 4 days

issue commentshish/shimmie2

Theming 'select' elements

Correct - only stuff in theme.php can be customised (ideally all HTML would be in themes, and main.php would only deal with pure data...

Right, so I will work on moving HTML to theme.php where necessary first, then we can more comfortably apply the new ideas. First offender I found: https://github.com/shish/shimmie2/blob/c4ae68fb471382db6350b82236cf0cc52a2cdf81/ext/setup/main.php#L236-L257

In any new code I write, I'm generally using an html-generation library (microhtml) rather than using raw strings

Yes I noticed those in the ImageInfo table already! IIRC it was another offender in terms of generating its HTML in main.php. Tbh I didn't have the time to get my head around microhtml yet but it would be a good idea to use that when possible then.

LaureeGrd

comment created time in 4 days

startednginxinc/NGINX-Demos

started time in 5 days

startedzsh-users/zsh

started time in 6 days

startedohmyzsh/ohmyzsh

started time in 6 days

starteddenysdovhan/spaceship-prompt

started time in 6 days

startedzsh-users/zsh-autosuggestions

started time in 6 days

startedzsh-users/zsh-syntax-highlighting

started time in 6 days

startedshish/esphome-projects

started time in 6 days

startedmoxystudio/next-router-scroll

started time in 6 days

startedcommaai/openpilot

started time in 6 days

startedshish/esphome-projects

started time in 6 days