[ 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
Name
Email
Subject
Comment
Flag
File
Embed
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:
https://git.leftypol.org/leftypol/leftypol
If you have any grievances you can make a PR.

Mobile Support:
https://github.com/PietroCarrara/Clover/releases/latest
Thread For Mobile Feedback: >>>/tech/6316

Onion Link:
76i2c3hn55fcj5nut3tqlboqqbbh23zvphv7lefk3vftpx6wketlanyd.onion

Cytube:
https://tv.leftypol.org

Matrix rooms:
https://matrix.to/#/#leftypolPublic:matrix.org

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

 No.13964

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

 No.13977

>>13964
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

 No.14055

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.

 No.14081

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

 No.14117

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
https://git.leftypol.org/leftypol/leftypol/src/commit/985d6f4dd66bfead158c2be016024347073f8864/post.php#L340
https://www.php.net/manual/en/pdostatement.fetch.php#refsect1-pdostatement.fetch-returnvalues
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.

 No.14131

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

		if(!$thread)
			error('404');

 No.14135

>>14131
Reports support multiple posts at once.

 No.14141

>>14135
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

 No.14158

>>14141
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);

 No.14171

>>14158
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')

 No.14228

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

 No.14233

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

 No.14234

>>14233
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.

 No.14496

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.

 No.14531

The default catalog hover:
https://git.leftypol.org/leftypol/leftypol/src/commit/6f2e953bd51e273af63e49b457ab410c6e33684a/stylesheets/style.css#L865
.theme-catalog div.thread:hover {
  background: #D6DAF0;
  border-color: #B7C5D9;
}

Dark Red currently lacks catalog rules so it gets the default.
https://git.leftypol.org/leftypol/leftypol/src/commit/6f2e953bd51e273af63e49b457ab410c6e33684a/stylesheets/dark_red.css

The lainchanjp catalog hover:
https://git.leftypol.org/leftypol/leftypol/src/commit/6f2e953bd51e273af63e49b457ab410c6e33684a/stylesheets/lainchanjp.css#L653
.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.

 No.14658

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.

 No.14664


 No.14687

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

 No.14689

>>14687
Use the catalog search

 No.14690

>>14689
Thanks, Mah brudda.

 No.14840

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

 No.14841

>>14840
d. don't make mistakes

 No.14845

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

 No.14849

>>14845
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

>>14841
lmao fuck, why didn't I think of that

 No.14850

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.

 No.14862

>>14850
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?

 No.14865

>>14862
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.
https://developer.mozilla.org/en-US/docs/Web/CSS/border#syntax

 No.14998

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

 No.15005

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;
			break;
		}
	}
	closedir($handle);
	
	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 }}"

to
<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.

 No.15016

>>15005
> $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

 No.15018

>>15016
>>15005
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)

 No.15020

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.
https://git.leftypol.org/leftypol/leftypol/src/commit/631a5b5fc705252697734c74a69e9edffbd55bec/templates/themes/overboards/theme.php#L172

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
https://git.leftypol.org/leftypol/leftypol/src/commit/631a5b5fc705252697734c74a69e9edffbd55bec/templates/themes/overboards/theme.php#L204

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.

 No.15104

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.

 No.15161

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
https://github.com/towards-a-new-leftypol/leftypol_lainchan/commit/bb0b7007fd5e27bd29c76235cf7a1b8148995f99
if (strlen($report)

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

 No.15172

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.

 No.15173


 No.15287

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

 No.15288

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

 No.15346

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

 No.15348

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

 No.15357

https://leftypol.org/search.php?search=Grace&board=siberia
1. Why doesn't this find anything at all?
2. Why do I have to select /siberia/ again in the search form?

 No.15359

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)

 No.15360

>>15359
works on my machine

 No.15362

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

>>15360
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.

 No.15364

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':
https://git.leftypol.org/leftypol/leftypol/src/commit/631a5b5fc705252697734c74a69e9edffbd55bec/search.php#L18
> $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':
https://git.leftypol.org/leftypol/leftypol/src/commit/631a5b5fc705252697734c74a69e9edffbd55bec/templates/search_form.html#L10
{% 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.

 No.15365


 No.15374

>>15365
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:
https://git.leftypol.org/leftypol/leftypol/commit/1792bf48eec755ee9a07aa5bef5fbf1e27d406c4

 No.15377

>>15374
It's Appleman1234 of Lainchan fame.

I would just revert b89fe3046bfbc0d7db8e7e8773e92c0536417450.

 No.15464

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?

 No.15636

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