[ 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:
368 posts and 78 image replies omitted. Click reply to view.


Currently there's a 500 Internal Server Error response to requests for status.php, causing >>13960.


status.php was never upgraded in the move to Composer, causing it to crash on the require_once('inc/functions.php') line. I've made a hotfix that should resolve the problem, which will be updated in the git codebase soon


I think the site is wigging out to DDOS, I keep getting server down messages and my posts duplicate or don't post at all.


>> console.log (Array.from (new Set (Array.from (document.querySelectorAll ("span.name")).map (e => e.innerText))).sort ().map ((s, idx) => (idx + 1).toString ().padStart (4, " ") + " " + s).join ("\n"))
   1 Alexandra Kollontai
   2 Alexandra Petrovna Kim
   3 Angela Davis
   4 Camila Vallejo
   5 Celia Sánchez
   6 Chizuko Ueno
   7 Clara Zetkin
   8 Constance Markievicz
   9 Elizabeth Gurley Flynn
  10 Emma Goldman
  11 Gladys Marín
  12 Helen Keller
  13 Itō Noe
  14 Juliet Chin
  15 Kathleen Neal Cleave
  16 Kshama Sawant
  17 Li Qiu
  18 Lin Guan Ying
  19 Linda Chen
  20 Louise Michel
  21 Lucy Parsons
  22 Lucía Sánchez Saornil
  23 Marsinah
  24 Marta Harnecker
  25 Mother Jones
  26 Nadezhda Krupskaya
  27 Nathalie Le Mel
  28 Nguyễn Thị Định
  29 Rosa Luxemburg
  30 Simone de Beauvoir
  31 Soong Ching-ling
  32 Vilma Espín
  33 Voltairine de Cleyre
  34 Võ Thị Sáu
  35 Võ Thị Thắng
  36 Đặng Thùy Trâm

data: >>>/meta/17


A member of staff can perform the following test with impunity. Pick a random post, inspect its checkbox, edit the number in id and name "delete_NNN" to some higher number that has not yet been reached by post ids on that board, and report that post with a test message. This simulates reporting a post that has been deleted immediately before submitting the report, but without having to actually delete anything. This should result in a false fetch
which causes the link_for in the subsequent event call argument list to attempt false['id'], resulting in >>>/meta/18331. In that case something similar to
// check if post was deleted before the report arrived
if ($thread === false) continue;

could be added just after the fetch.


or you can just do:
$thread = $query->fetch(PDO::FETCH_ASSOC);



Reports support multiple posts at once.


it stills works if i deliberate change one of the hidden inputs to a higher a number and the others reports are normal. the error() isn't triggered and the (valid) reports goes normal and the undefined key isn't triggered aswell


If your statement is true within the context of a correctly performed >>14117 test, then simply provide us with a var_dump($thread) for the non-existent post id, so that we can see what $query->fetch returned while obeying the restrictions;
> WHERE `id` = :id
> $query->bindValue(':id', $id, PDO::PARAM_INT);


youre actually right. the earlier tests i did, was selecting the posts and going down to where report-delete.html is being rendering and press report from there. it never considered the altered value. when i did more tests and reported from the quick-post-controls.js, the altered post id begins to trigger the error('404')


>trying to upload 5 pics
>collective size is less than 18mb
>File Too Big
>upload a 50mb video as a test to see if file size got decreased
<uploaded perfectly
The fuck is going on?


I don't know. Can you zip up the 5 pictures and post that so I can test?


Sorry for late response, I realized the problem. I forgot the image size limit also applies to literal size, so a 11000 pixel image of 4mb reads as too large. Thanks for the response though.


The backend currently responds with
> Content-Type: application/octet-stream
to requests for jfif files >>>/leftypol/928733 which causes >>>/meta/19540. If this is switched at the server level to
< Content-Type: image/jpeg
or similar, the problem will go away.


The default catalog hover:
.theme-catalog div.thread:hover {
  background: #D6DAF0;
  border-color: #B7C5D9;

Dark Red currently lacks catalog rules so it gets the default.

The lainchanjp catalog hover:
.theme-catalog div.thread:hover {
  background: #4e4e4e;
  border-color: #1f1f1f;

Custom catalog hover can be added to Dark Red and friends to fix >>>/meta/19655.


Can the /tech/ team try and implement optional spoilers, at least for /siberia/? It's a real pain in the ass because a bunch of OPs are arbitrarily spoilered by the mods for being porn…. on a /b/ board. I get that overboard has all boards on it but making it optional ought to at least give non-prudes less of a headache searching catalog.
An example of such a script https://pastebin.com/R5G1JvFy (https://archive.ph/WOccP) by the late Bell.



You need to add the ability to search thread headers. I cannot find threads that I follow with the search function.


Use the catalog search


Thanks, Mah brudda.


Here's a recurring use-case problem:
Say I write a post and it had a formatting error or something. Let's say the thread is somewhat active and I copied my reply, deleted it and try to repost it. This will lead to a multitude of problems:
1. Since the thread not only bumped and a lot of people have the thread opened (which doesn't auto-update to correspond to the post-deletion!), the amount of eyes at the deleted post is now very high.
2. As I try to repost the corrected post fast to at least indirectly counteract this apparent bug, I am met with a hindrance which exacerbates the mess: a "flood detected" error message. Now I'm sitting waiting for an entire minute to post my corrected post to the deleted one that already have multiple green >>111111 replies.

Proposed solutions:
a. refresh the contents of the thread for all having the thread opened when a post is deleted
b. don't count a deleted post as a post in anti-spam mechanism
c. both of the above


d. don't make mistakes


This has been brought up previously >>12471 but there wasn't enough interest from the bug reporter to answer a follow-up >>12474 question.


I guess >>12474 sounds like a good solution too. But I still think not counting deleted posts as posts in the anti-spam mechanism is still a good addition too. >>14840

lmao fuck, why didn't I think of that


Here's a patch to implement the first option from >>14840 and >>12474 to make auto-reload.js mark deleted posts. Theme maintainers can customize the marking using the div.post.reply.auto-reload-removed selector. JS users can do the same in User CSS. Deleted posts are not considered important enough to reset the update timer, but if this is desired the removed_posts counter is available for this purpose. To test, inspect and edit a reply id to a non-existent one. Keep in mind that this is narrowly aimed at marking deleted posts, and auto-reload.js has other bugs >>>/leftypol_archive/1759 with which this patch does not concern itself.


Is this not being implemented by default?

Also I tried copy-pasting the contents of the .txt into first User CSS and User JS and neither seemed to have any result on thread. Or does it require browser restart / clearing cookies and cache?


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?

Unique IPs: 12

[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 ]