[ home / rules / faq ] [ overboard / sfw / alt ] [ leftypol / siberia / hobby / tech / edu / games / anime / music / draw / AKM ] [ meta / roulette ] [ cytube / git ] [ GET / ref / marx / booru / zine ]

/tech/ - Technology

"Technology reveals the active relation of man to nature" - Karl Marx
Password (For file deletion.)

Join our Matrix Chat <=> IRC: #leftypol on Rizon

File: 1612129656526.gif (2.28 MB, 224x240, 1608608621350.gif)

 No.6724[View All]

This thread is only for feedback related to technical issues (bug reports, suggestions). Otherwise use /meta/.
Public Repo:
If you have any grievances you can make a PR.

Mobile Support:
Thread For Mobile Feedback: >>>/tech/6316

Onion Link:


Matrix rooms:

We are currently working on improvements to the site, subject to the need of the tech team to sleep and go to their day jobs. If you need more immediate feedback please join the matrix room[s] and ask around. Feel free to leave comments, concerns, and suggestions about the tech side of the site here and we will try to get to it as soon as possible

Archived thread:
394 posts and 82 image replies omitted. Click reply to view.


That is a patch for files served to you by the backend. So first we wait patiently until the techs apply the patch on the backend. After that, if you don't like the default visual marking for deleted posts, you put
div.post.reply.auto-reload-removed {
  border: ...;

into User CSS and replace the ellipses with your own rules.


you made a mistake in https://leftypol.org/robots.txt
remove the last "Allow: /" line because A) it overrides all your preceding disallow rules, and B) is redundant/unnecessary, since anything not disallowed is already allowed by default
read https://www.robotstxt.org/robotstxt.html


your rotating banner system (/banners.php) is inefficient because it's impossible for users to cache these images in their browsers. everyone is constantly re-downloading previously-seen banners.

you can see if a file is already cached or is downloaded by refreshing a page (e.g. https://leftypol.org/banners.php ) by checking http responses in firefox in the Network tab in Firefox Developer Tools (ctrl+shift+i) and seeing if it says "cached" under the "Transferred" column for the file

you can instead make it so twig serves the direct path to a random image from your banners folder instead of sending it to your inlined banners.php image file stream so that browsers can actually cache these images. this can speed up frequent visitors' page loads and reduce a bit of bandwidth per frequent visitor.

1. go to /inc/lib/Twig/Extensions/Extension/Tinyboard.php
2. add this line in that list of Twig extension functions:
new Twig_SimpleFunction('random_banner_url', 'twig_random_banner_url'),

(don't forget to put a comma at the end of that previous item or you'll get php error / blank page)
3. at the end of the file add this function definition:
function twig_random_banner_url() {
	$path = dirname(__DIR__, 5) . '/banners/';
	$isDirEmpty = true;
	if (!file_exists($path)) {
		return '/static/blank.gif';
	$handle = opendir($path);
	while (false !== ($entry = readdir($handle))) {
		if ($entry != "." && $entry != "..") {
			$isDirEmpty = false;
	if (!$isDirEmpty) {
		$files = scandir($path);
		$files = array_diff($files, array('.', '..'));
		return '/banners/' . $files[array_rand($files)];
	return '/static/blank.gif';

4. go to /templates/index.html, and change
<img class="board_image" src="{{ config.url_banner }}"

<img class="board_image" src="{{ random_banner_url() }}"

5. do the exact same thing in #4 for /templates/thread.html, /templates/generic_page.html, and /templates/themes/index/index.html
6. rebuild all boards/threads in mod.php and test new banner system

obviously you need to test this in a dev environment first, i did this on vichan but it looks like it's identical on lainchan. the only minor drawback is that the banner changes on each thread/index based on user actions (a new reply, thread, delete, mod action, etc.) instead of refreshing the browser due to twig's caching system, but because leftypol has high enough traffic this will not be a problem, it will change frequently enough and it's worth it for the improved page load times and minor bandwidth savings of frequent visitors not having to constantly re-download previously-seen banner images. also in theory this may reduce cpu usage a bit because the banners.php opcode is no longer executed each time any user refreshes his browser or goes to a different page, whereas this new twig function would execute only on user actions which are obviously far less frequent than refreshes / page loads. the other minor issue is it will ignore whatever you set $config['url_banner'] in instance-config.php, it will only pull images from a "/banners" folder if it exists, can't think of a way right now to have this twig function work together with that, you can put a TODO comment on this function to change it later, i don't think it's a real priority.


> $isDirEmpty
If the directory is not empty, you call scandir on it. If the directory is empty, scandir would do no more work than your while loop. What is the purpose of prescanning the directory instead of testing whether the result of array_diff is empty?

> the other minor issue is it will ignore whatever you set $config['url_banner'] in instance-config.php, it will only pull images from a "/banners" folder if it exists, can't think of a way right now to have this twig function work together with that

The twig_* functions can take parameters from the calling templates. The templates can take parameters in their Element(template_source, array) invocations. The invokers of Element(template_source, array) will pass in config values for whichever openBoard call is in effect at the time. >>12386


function in step 3 is now:
function twig_random_banner_url($path) {
	if (substr($path, -1) !== "/") {
		$path = $path . '/';
	$path_twig_relative = dirname(__DIR__, 5) . $path;

	if (!file_exists($path_twig_relative)) {
		return '/static/blank.gif';

	$files = scandir($path_twig_relative);
	$files = array_diff($files, array('.', '..'));
	if ($files) {
		return $path . $files[array_rand($files)];
	return '/static/blank.gif';

in step 4 & 5 it is now:
<img class="board_image" src="{{ random_banner_url(config.url_banner) }}"

and now there's a new step between 5 and 6:
5.5. in instance-config.php set $config['url_banner'] to "/banners/" or "/banners" (either will work)


A note about Anon's >>15018 updated code. While it will pick up the correct config.url_banner in single-board template calls, on the overboard index pages, which feature banners, it will pick up the config.url_banner of whichever board had the last thread in the $top_threads, because that board had the last openBoard call in buildOne.

If this random pick by the last $top_threads item is not desired, config.url_banner can be remembered before the first buildOne call and sent into the index template separately in the Element invocation. >>15016

This way the overboard index pages would use the config.url_banner setting from the global instance-config.php. On the other hand, the random pick of the banner folder by the last item in $top_threads might be considered a feature.


File: 1653781104387.png (130.7 KB, 1819x857, alt_is_dead.png)

Currenly overboards use the default theme of the board their last visible post is from. Perhaps this should be changed in the new overboard code, if it isn't already.


this commit for checking report length is incorrect it will give an error saying strlen is expecting a string not an array if someone bypasses the input maxlength set in html
if (strlen($report)

should be
if (strlen($_POST['reason'])


File: 1654145706733.png (679.45 KB, 1022x731, ClipboardImage.png)

Anyone know of an LGBT content blocker extension or something? I don't hate gays, I'm just sick and tired of all the retarded idpol "pride" shit slapped onto everything in the most nauseatingly liberal way, I can't avoid it even though I search for content not even tangentially related to gay stuff.



File: 1654993228127.png (755.51 KB, 1064x6307, flaglist-git.png)

Flag list for >>>/meta/20864. This version uses the git repo static/flags folder https://git.leftypol.org/leftypol/leftypol/src/commit/631a5b5fc705252697734c74a69e9edffbd55bec/static/flags which is out of sync with the live site and the hidden >>11882 >>11883 >>11905 instance-config.php, so it will not match the live post form. Adjust the 80px height in the img tag's style to taste. Rerun when a new flag shows up in the git repo.
$ cd leftypol/static/flags
$ { echo '<div style="text-align: justify">'; for f in $(ls | grep -e '[.]png$' | grep -ve '^flags[.]png$'); do echo '<span style="display: inline-block; border: 1px dashed; text-align: center">'; echo '<img style="height: 80px; image-rendering: crisp-edges" src="'$f'">'; echo '<br>'; echo '<span style="font-size: 20px">'${f%.png}'</span>'; echo '</span>'; done; echo '</div>'; } > test.html


File: 1654993342506.png (386.26 KB, 1064x2264, flaglist-live.png)

Flag list for >>>/meta/20864. This version uses the live post form. It has to use the live static/flags folder because the git repo is out of sync >>15287. Mobile app users get their flags through https://leftypol.org/status.php which automatically syncs https://git.leftypol.org/leftypol/leftypol/src/commit/631a5b5fc705252697734c74a69e9edffbd55bec/status.php#L55 with the live post form, so it will match this version. Adjust the 80px height in the img tag's style to taste. Rerun when a new flag shows up in the live post form.
$ { echo '<div style="text-align: justify">'; wget -q -O - 'https://leftypol.org/meta/res/20864.html' | grep -E -oe '<option value="[^"]+">[^<]+</option>' | sed -r -e 's#^<option value="([^"]+)">([^<]+)</option>#<span style="display: inline-block; border: 1px dashed; text-align: center"><img style="height: 80px; image-rendering: crisp-edges" src="https://leftypol.org/static/flags/\1.png"><br><span style="font-size: 20px">\2</span><br><span style="font-size: 20px">\1</span></span>#'; echo '</div>'; } > test.html


I get 404s for images on /hobby/, /games/, /draw/, /anime/, /edu/, /music/, /AKM/, /meta/, /dead/ and /gulag/ when using the onion service.


Image posting is temporarily turned off for everyone so that's expected


1. Why doesn't this find anything at all?
2. Why do I have to select /siberia/ again in the search form?


File: 1655221706870.png (1.09 MB, 1080x1080, ClipboardImage.png)

Did the mods disable clipboard images for /siberia/? It works on the other boards, but not siberia (pic rel is an example)


works on my machine


File: 1655224315297.png (357.75 KB, 690x506, ClipboardImage.png)

It's not on mine, Tor didn't let me use it on /siberia/ either, pic rel is attempt 2 that failed. Like I CTRL+V it and tried Right-click+Paste but it just doesn't appear in the files. Neither does uploading images for that matter.


About >>15357
> 2. Why do I have to select /siberia/ again in the search form?

The board parameter sent from search.php to search_form.html is called 'board':
> $body = Element('search_form.html', Array('boards' => $boards, 'board' => isset($_GET['board']) ? $_GET['board'] : false, 'search' => isset($_GET['search']) ? str_replace('"', '&quot;', utf8tohtml($_GET['search'])) : false));

But search_form.html tests for equality with 'b':
{% for b2 in boards %}
    {% if b2 == b %}
    <option value="{{ b2 }}" selected>/{{ b2 }}/</option>
    {% else %}
    <option value="{{ b2 }}">/{{ b2 }}/</option>
    {% endif %}
{% endfor %}

If either the board parameter sent from search.php to search_form.html is renamed to 'b', or the equality test is switched to 'board', the search form should pick up the correct board as its initial selection.



Maybe the global $board interferes with the twig template, although I can't see why it would, and we should just switch both the loop variable equality test target and the Element parameter to searchboard.

> Benjamin

This is the same Southall guy who adds parens around &&, which took precedence anyway, instead of >>>/leftypol_archive/1691 around the || chain:


It's Appleman1234 of Lainchan fame.

I would just revert b89fe3046bfbc0d7db8e7e8773e92c0536417450.


The report function doesn't seem to be working on /leftypol/.
The /leftypol/ thread "Why is /pol/and so fucking right-wing?" Is overrun by /pol/yp raiders and constantly derailed. Mods don't react to reports. Could you please look into it and clean up?


I know it fails on posts that have already been deleted (a refresh will show if that's the case), is this a different issue?



Bug report:
When you have set another theme from the default, the Rules and FAQ pages look atrocious / almost unreadable



Dark Bunker Red, which is one of the very few dark themes with good contrast between the text v background, so please don't change anything else with it, it saved my eyes on here


You idiots do realize that Cloudflare is who shut down 8ch, right? Don't you think it'd be smarter to pick a different DDoS "protection" service?


In general, complaining about something isn't really useful. If you're going to complain about something, it helps to have a plan to fix it, at least. Even better if you're willing to commit the work required to make it happen.



> the Rules and FAQ pages look atrocious / almost unreadable >>16143
> Dark Bunker Red >>16149
The relevant property of dark_bunker_red.css is that it lacks ban class styling. >>16145
The default dark_red.css has three div.ban sections.

To fix add div.ban { … } and div.ban h2 { … } sections to Dev Tools → Style Editor → New Stylesheet while on the Dark Bunker Red theme, adjust the foreground and background colors as well as any other desired properties until the faq and rules pages are no longer "atrocious / almost unreadable", then once satisfied post the changes for inclusion into dark_bunker_red.css.



I just realized that this site is literally fully fucking functional without using JavaScript.

I want to give the devs a french kiss right now. A commie imageboard run by unpaid volunteers handles JavaScript better than most Fortune 500 websites.


I thought all imageboards are fully functional without JS unless they add crap like recaptcha.


I admittedly only really use 4chan so I can't speak for others, but with 4chan the catalog, posting (as you pointed out with the captcha part), and many other smaller little things don't work without JS. You can still browse and read but it's a much less pleasant experience than /leftypol/.


Why does the site now load when clicking >> links between posts in a thread? It's pretty annoying tbh


… U+2026 Po HORIZONTAL ELLIPSIS >>>/meta/22513 &hellip;

space >>16162
no space >>16162…

Happens here:
// Automatically convert things like "..." to Unicode characters ("…").
$config['auto_unicode'] = true;

if ($config['auto_unicode']) {
    $body = unicodify($body);

function unicodify($body) {
    $body = str_replace('...', '&hellip;', $body);

Cite markup:
> ((?=[\s,.:)?!])|$)

To fix add the ampersand to the character class.
< ((?=[\s,.:)?!&])|$)


You broke my ascii :(


File: 1663541209002.jpg (366.99 KB, 1392x2048, nitter.jpg)

User JS snippet for twitter → nitter conversion >>>/meta/22665
Array.from (document.querySelectorAll ('a[href^="https://twitter.com/"]')).forEach (e => { e.outerHTML = e.outerHTML + ' <a target="_blank" href="' + e.getAttribute ("href").replace (/^https:\/\/twitter\.com\//, "https://nitter.net/") + '">[nitter]</a>'; })

test link: >>>/meta/22666


Should there be an option to see "other pages" of posts? There are topics that seem to be visible only through enabling the catalog, but without that you can only see the newest posts on a single "page" of the standard UI. This is in contrast to some other imageboards (notably 4chan, among others) where you can select page 2, 3 etc.. displaying posts without having to go to the catalog display.

Is it intended functionality to not have that feature here (and a few other boards that seem to be on a similar vichan codebase like lain )? Or is there some strangeness going on on my browser's end, possibly because of addons or the like? Thanks.


File: 1665034717185.png (10.81 KB, 967x46, ClipboardImage.png)

(Sorry for late reply, I've been away from /tech/)
Looks like it's a local thing if you're not seeing the page list at the bottom of the board index.

Has anyone asked you if you want to be part of the dev team yet? We've been pretty slow for a couple of months due to other obligations.


can't report cp spam from /alt/


Onion link asking me for a login? Then if I don't just saying "Authentication required"


> Failed to resize image! Details: gm convert: iCCP: cHRM chunk does not match sRGB (/tmp/phpxeccyD).
When posting this: https://upload.wikimedia.org/wikipedia/commons/0/0b/Romance_languages.png


Dear tech team,
Can you guys make it possible to attach .mobi files?


Can .webm’s finally be uploaded on the site?

Last time I tried that it didn’t work, so I had to convert it to a .png instead.


Do you mean .webp?


NTA but probably.

Also IMO .webp is shit


OGG support when

Unique IPs: 20

[Return][Go to top] [Catalog] | [Home][Post a Reply]
Delete Post [ ]
[ home / rules / faq ] [ overboard / sfw / alt ] [ leftypol / siberia / hobby / tech / edu / games / anime / music / draw / AKM ] [ meta / roulette ] [ cytube / git ] [ GET / ref / marx / booru / zine ]