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

/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
Please give feedback on proposals, new on Mondays : /meta/
New /roulette/ topic: /spoox/ - Paranormal, horror and the occult.
New board: /AKM/ - Guns, weapons and the art of war.


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
275 posts and 66 image replies omitted. Click reply to view.

 No.12396

>>12395
>My friend, do you honestly think it likely that the posts would be missing their reply count information when the catalog template already shows reply counts for every thread?
Kek. You're right, just doing:
$post['reply'] >= $config['noko50_min'] was enough.

The href links are fixed now without workaround in the templates, thanks.

 No.12403

Invidious proxy is broke.
Vid as an example

 No.12404

>>12403
Title: `Unexpected char ' ' at line 1, column 1 (JSON::ParseException)`
Date: `2021-11-25T05:45:19Z`
Route: `/embed/N9o1X_TNXWA?autoplay=1&html5=1`
Version: `2021.11.18-b5a96b17 @ master`
<details>
<summary>Backtrace</summary>
<p>

```
Unexpected char ' ' at line 1, column 1 (JSON::ParseException)
from /usr/share/crystal/src/json/lexer.cr:331:7 in 'raise'
from /usr/share/crystal/src/json/lexer.cr:327:5 in 'unexpected_char'
from /usr/share/crystal/src/json/lexer.cr:326:11 in 'unexpected_char'
from /usr/share/crystal/src/slice.cr:213:5 in 'next_token'
from /usr/share/crystal/src/json/parser.cr:13:12 in '_post_json'
from src/invidious/yt_backend/youtube_api.cr:317:12 in 'extract_video_info:video_id'
from src/invidious/videos.cr:972:10 in 'get_video:region'
from src/invidious/routes/embed.cr:122:15 in 'show'
from lib/kemal/src/kemal/route.cr:13:9 in '->'
from /usr/share/crystal/src/primitives.cr:266:3 in 'call'
from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call'
from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next'
from lib/kemal/src/kemal/filter_handler.cr:21:7 in 'call'
from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next'
from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next'
from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next'
from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call'
from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next'
from src/invidious/helpers/static_file_handler.cr:167:15 in 'call'
from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call'
from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call'
from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next'
from lib/kemal/src/kemal/init_handler.cr:12:7 in 'process'
from /usr/share/crystal/src/http/server.cr:500:5 in '->'
from /usr/share/crystal/src/primitives.cr:266:3 in 'run'
from ???
```
</p>
</details>

 No.12406

>>12403 >>12404
The first script of >>11649 continues to work.

 No.12407

>>12403 >>12404
The issue is an indirect invidious bug caused by the crystal-lang upstrem: https://github.com/iv-org/invidious/issues/2612
The invidious workaround with manual decompression is in testing: https://github.com/iv-org/invidious/pull/2623
When it's merged and the instances update or when crystal-lang fixes the HTTP::Client, whichever comes sooner, the issue will go away.

 No.12424

https://git.leftypol.org/leftypol/leftypol/src/branch/config/post.php#L1115
Is this really how the PDF thumbnail is made? I tried doing it by hand on my machine but it wouldn't let me use `convert' on PDF files because there are known RCE vulnerabilities regarding that:
https://bugs.archlinux.org/task/59778

 No.12427

>>7820
Would it be possible to have an option to search for posts based on filename too? It would be extremely useful

 No.12431

>>12427
>Would it be possible to have an option to search for posts based on filename too?
Sure, but the non-body field test would have to be loosened from always using equality.
https://git.leftypol.org/leftypol/leftypol/src/commit/199f9f5fd077e3beb9a7091295e390ac75345de1/search.php#L124
> $like .= '`' . $name . '` = '. $pdo->quote($value);

A new filter type can be added here:
https://git.leftypol.org/leftypol/leftypol/src/commit/199f9f5fd077e3beb9a7091295e390ac75345de1/search.php#L60
> if(!in_array($name, array('id', 'thread', 'subject', 'name'))) {

The file names are inside a json_encode in the 'files' field of posts.
https://git.leftypol.org/leftypol/leftypol/src/commit/199f9f5fd077e3beb9a7091295e390ac75345de1/templates/posts.sql#L13
> `files` text DEFAULT NULL,
https://git.leftypol.org/leftypol/leftypol/src/commit/199f9f5fd077e3beb9a7091295e390ac75345de1/inc/functions.php#L1075
> $query->bindValue(':files', json_encode($post['files']));

The 'files' structure is an array of objects with a 'filename' field holding the upload file name.
https://git.leftypol.org/leftypol/leftypol/src/commit/199f9f5fd077e3beb9a7091295e390ac75345de1/post.php#L797
> $file['filename'] = urldecode($file['name']);

So as a trial version a LIKE test can be applied to a new files:value filter in search.php. After that with a little more effort the test can be targeted at the 'filename' field with a json path query like:
'$[*] ? (@.filename like_regex ".*valuegoeshere.*" flag "i").size()'

but this will depend on the quality of the SQL/JSON support available in the exact database type and version in use.
https://www.postgresql.org/docs/12/functions-json.html

 No.12444

>YouTube now embeds as Incognet's invidious on onion site
Amazing. Thank you based devs

 No.12446

Would be possible to scramble original filename? It's a pain in the ass to do it manual.

 No.12449

File: 1638483249769-0.jpg (175.44 KB, 680x986, 0.jpg)

File: 1638483249769-1.png (208.37 KB, 798x680, 1.png)

>>12446
Luckily I have done this before for 8chan, I had to fiddle with it a bit but now it seems to work. Add this to your User JS and it will automatically rename the files just to their index like with this post:
function getFiles(t) {
    return jQuery(t).children('.tmb-container').map(function (i, e) {
        return $(e).data('file-ref');
    });
}

function changeName(i, file) {
    var name = i + '.' + file.name.split('.').pop();
    var newFile = new File([file], name, { type: file.type }); 
    return newFile;
}

function renameFiles(files) {
    return files.map(changeName);
}

function removeFiles(t) {
    jQuery('.dropzone .remove-btn').each(function (i, e) {
        $(e).trigger('click');
    });
}

function addFiles(t, files) {
    transfer = new DataTransfer();
    for (i = 0; i < files.length; i++) {
        transfer.items.add(files[i]);
    }

    jQuery(t).parents('.dropzone').trigger(
        $.Event('drop', {
            originalEvent: new DragEvent(
                'drop',
                { dataTransfer : transfer})}));
}

function stripFilenames(t) {
    var files = getFiles(t);
    removeFiles(t);
    addFiles(t, renameFiles(files));
}

function observer(e) {
    // You have to remove it first to avoid recursion.
    jQuery('.file-thumbs').unbind("DOMSubtreeModified", observer);
    // Always do it on the main form
    stripFilenames(jQuery('.file-thumbs').first()[0]);
    jQuery('.file-thumbs').bind("DOMSubtreeModified", observer);
}

// Initialize
jQuery('.file-thumbs').bind("DOMSubtreeModified", observer);

 No.12452

For a backend version of Anon's >>12449 code a checkbox can be added to the post form wherever convenient
https://git.leftypol.org/leftypol/leftypol/src/commit/0e98c35dc59f42db891ce680f0995ec40cbb782c/templates/post_form.html#L51
then the $file['filename'] can be suppressed between $file['extension'] and $config['filename_func']
https://git.leftypol.org/leftypol/leftypol/src/commit/0e98c35dc59f42db891ce680f0995ec40cbb782c/post.php#L797
if ($config['suppress_filenames'] && isset($_POST['suppressfilenames'])) $file['filename'] = "$i." . $file['extension'];

Checkbox sync is in >>10441 and memory leak cleanup in >>10455 and >>10478.

 No.12462

>>12452
You can change the filename doing this way, but it doesn't change the json value for some reason.

 No.12471

Hey, when you dont F5 a thread, the auto update doesnt remove post deleted by mods, so you can end up replying to already banned retards
what about quickly checking if the replied to post still exist when sending it, and displaying a warning if it does not ?

also what about inline reply expansion

 No.12474

>>12471
>the replied to post
You might reply to several posts, with only one of them having been deleted. You might mean some of the post references in your reply as part of the substance of your reply, rather than as posts being replied to.

What are your thoughts on auto update applying some visual marking to those posts that are still present in your view of the thread but would go away if you were to press F5?

 No.12518


 No.12519

>>12518
Good idea, NPFchan faced a lot of abuse so it has some good moderation stuff that we can sample. Hash filters currently can't be done through the moderation interface.
There were plans for a vichan-NPFchan uplift (getting all the stuff lainchan never pulled), but unfortunately most of the development manpower is on hold for a while and (as one may have noticed) available time is mostly focused on maintenance and easy wins rather than new features and infrastructure improvement. People getting involved in the git repo would help this massively.

I haven't implemented phashes yet but it's always an option and possible with existing tools. I feel that most people able to intentionally evade a hash ban should be motivated and able to evade a phash, so it might be a wasted and computationally expensive effort.

 No.12522

>Perceptual hashing >>12518
>I feel that most people able to intentionally evade a hash ban should be motivated and able to evade a phash, so it might be a wasted and computationally expensive effort. >>12519
This would autoban false positives. Once autobanning a small fraction of innocents is conceded, that would provide an incentive for the spammers to push for a higher false positive rate.

 No.12524

Concerning >>>/meta/15307
>How the hell do you turn it off?
the current snow test is
https://git.leftypol.org/leftypol/leftypol/src/commit/b3db9c52b70f0f7103b96b61891f752791e996ab/js/winter-snow.js#L3
> var snow = localStorage['snow'] ? false : true;
while the current option uncheck handler is
https://git.leftypol.org/leftypol/leftypol/src/commit/b3db9c52b70f0f7103b96b61891f752791e996ab/js/winter-snow.js#L17
> localStorage.snow = false;
which causes snow to remain true regardless of the checkbox state.

To disable the effect without waiting for a backend fix use the dev tools console to set localStorage.snow to a value that evaluates to true in a conditional, such as
localStorage.snow = "nothanks";

then check in dev tools storage that your browser stored the new value, then reload the page.

 No.12586

Bug report that I think is reproducible:
In the following post I place a youtube link in the embed and the enter three lines of [code] text. The result is that only the embed is posted with zero text whatsoever.

 No.12587

text

textblabla

textan bloo blee blouf

 No.12588

The text missing from the above are these three lines, which perhaps (testing) will be posted normally when I now do not enter an embed in the following post:

 No.12589

text

textblabla

textan bloo blee blouf

 No.12594

>>12588
>The text missing from the above
The text is present:
<div class="post reply" id="reply_12587" data-board="tech"><p class="intro"><a id="12587" class="post_anchor"></a><input type="checkbox" class="delete" name="delete_12587" id="delete_12587"><label for="delete_12587"><span class="name">Anonymous</span> <time datetime="2021-12-20T14:45:22Z">2021-12-20 (Mon) 14:45:22</time></label>&nbsp;<a class="post_no" id="post_no_12587" onclick="highlightReply(12587)" href="/tech/res/6724.html#12587">No.</a><a class="post_no" onclick="citeReply(12587)" href="/tech/res/6724.html#q12587">12587</a></p>    <div class="video-container" data-video="NLpPyuzxSf4"><a href="https://youtu.be/NLpPyuzxSf4" target="_blank" class="file"><img style="width:255px;height:190px;" src="/vi/NLpPyuzxSf4/0.jpg" class="post-image"></a></div>         <div class="body"><pre class="code lang-">text</pre><br><pre class="code lang-">textblabla</pre><br><pre class="code lang-">textan bloo blee blouf</pre></div></div>

You can apply this CSS workaround:
pre { clear: both; }

 No.12595

File: 1640037484931.png (79.16 KB, 440x173, ClipboardImage.png)

>>12587
For me (desktop), this text shows a scroll bar.
I assume the issue is that it's invisible on your device so it looks like it's just cut off.

 No.12596

>>12595
Very strange. It is indeed invisible on my end, still.
I'm on desktop using Tor Browser, latest version, which is based on Firefox ESR, with javascript disabled (highest security setting).
Is [code] a javascript function? It doesn't seem like it. Another strange thing is that sometimes it works and I can see the [code] text like regular (leading me to speculate if it's to do with the number of lines). I did a similar test post on /siberia/ with typed in another way with an embed and it showed up normal, which made me think you had just disabled [code] on /leftypol/ as a board specifically. This was all without JS too (I always post without JS).

 No.12598

>>12596
I turned off JS (also desktop Tor; Ubuntu-based OS) and it still showed up. There is no JS involved, just CSS. That is weird. It may be a far show and I have no evidence for this but maybe Firefox's recent theming changes affected it for your OS/current-theme.

 No.12773

>>12724
$(document).on('ajax_after_post', function(e, r) { localStorage.own_posts = '{}'; });

 No.12776

Update of js/show-own-posts.js to allow users to opt out of (You) tracking. >>12724

 No.12777

>>12776
You are a hero of leftypol

 No.12801

So who's the dummy who shat up APNG uploads because of this weird error?
>Failed to resize image! Details: gm convert: fcTL: no space in chunk cache (/tmp/phpsZjJMc).

 No.12809

>>12801
APNG upload works in principle. >>>/meta/15840 The error is "benign" but for separate reasons shell_exec_error considers any stderr output an error. >>>/leftypol_archive/1787 The workaround is the same as for the iCCP family of errors. >>7107 The error means that your image has too many sPLT, tEXt, zTXt, iTXt or unknown chunks for libpng's taste.
https://github.com/glennrp/libpng/blob/a37d4836519517bdce6cb9d956092321eca3e73b/pngrutil.c#L3070
png_chunk_benign_error(png_ptr, "no space in chunk cache");

https://github.com/glennrp/libpng/blob/a37d4836519517bdce6cb9d956092321eca3e73b/pngstruct.h#L440
   /* Added in libpng-1.4.0: Total number of sPLT, text, and unknown
    * chunks that can be stored (0 means unlimited).
    */
   png_uint_32 user_chunk_cache_max;

In practice this most likely means that your animation has more frames than leftypol->gm->libpng is currently willing to quietly accept. I assume that your image was good faith but it's also possible that you were attempting a resource consumption attack. I cannot check this as you have not provided a link to an external upload of your image. >>7106 For future reference, uploading your file to http://0x0.st/ or similar and including a link will improve your bug reports.

 No.12819

>>12809
https://litter.catbox.moe/aj8vsc.png

I'm fairly certain I've uploaded this exact animation before here with no problem, and certainly without trouble on other image boards. Fix your shit, I'm never using that webp crap.

 No.12820

>>12777
>>12777
>>12777
Update on the implementation of this?

 No.12830

>>12819
Your image is legitimate >>>/meta/15862 but it has 6228 frames and 12462 chunks.
< In practice this most likely means that your animation has more frames than leftypol->gm->libpng is currently willing to quietly accept. >>12809
You have the option of uploading it spoilered, which bypasses thumbnailing. >>10845 Since the image is a type 3 8-bit PLTE with single-index transparency (tRNS=0x00) which was converted from a gif using gif2apng.sf.net, you also have the option of uploading the source gif, or losslessly reobtaining it with apng2gif. >>>/meta/15864 The techs can try adding [0] to the first %s of $config['convert_args'] to explicitly request only the first source frame, which may or may not fix the problem.
https://git.leftypol.org/leftypol/leftypol/src/commit/c5814178aee666b34902665a0bd0b4667758a875/inc/config.php#L773
     // Command-line options passed to ImageMagick when using `convert` for thumbnailing. Don't touch the
    // placement of "%s" and "%d".
    $config['convert_args'] = '-size %dx%d %s -thumbnail %dx%d -auto-orient +profile "*" %s';

Another option is the general workaround shared with the iCCP family of errors. >>12809 >>7107 >>>/leftypol_archive/1787

 No.12928

>>12776
Hopefully this is update made by a helpful anon arrives soon for leftypol.

 No.12946

File: 1641893877973.png (7.25 KB, 708x236, posthistory.png)

suggestion: username registration and post history. it's the next logical step for this website.

 No.12947

>>12946
cry about it

 No.12964

Viewing the post history of an IP >>12946 for site administration didn't originate with lefty, lain or vichan, in this family it goes all the way back to Tinyboard.
https://github.com/savetheinternet/Tinyboard/commit/78f3ea783394dba14b51b27f7f2db3974ce8b8b3#diff-e7c25d7d73eaa99b1564b025926e24d835d4322fdb65f4b9473b357f0ef64f44
Reusing the same functionality to allow users to access a read-only view of their own post history might be reasonable on a site that doesn't allow VPNs or Tor, but on a site that does allow them it's probably not a good idea.
https://git.leftypol.org/leftypol/leftypol/src/commit/c5814178aee666b34902665a0bd0b4667758a875/inc/mod/pages.php#L892
https://git.leftypol.org/leftypol/leftypol/src/commit/c5814178aee666b34902665a0bd0b4667758a875/templates/mod/view_ip.html#L204
Here's some harmless fun with localStorage.own_posts:
((sortkeys, link, divide, cites, install, slice, groups) => {
  const own    = JSON.parse (localStorage.own_posts || '{}')
  const boards = sortkeys (Object.keys (own))
  const count  = boards.reduce ((acc, item) => acc + own [item].length, 0)
  const html   = ['own posts: ' + count + ' boards: ' + boards.length]
  boards.forEach (b => {
    const ownb = own [b].reverse ()
    const have = ownb.length
    const [div, mod, left] = divide (have, slice, groups)
    html.push ('board: ' + link ('/' + b + '/index.html', '/' + b + '/') + ' ' + link ('/' + b + '/catalog.html', '&copy;') + ' count: ' + have + ' = ' + div + ' * ' + slice + ' + ' + mod + ' + ' + left)
    for (let k = 0; k < div; k++) {
      html.push (cites (b, ownb, slice, k, slice))
    }
    if (mod) {
      html.push (cites (b, ownb, slice, div, mod))
    }
  })
  install (html)
}) (
  arr => arr.map (s => [s, s.toUpperCase ()]).sort ((a, b) => a [1] < b [1] ? -1 : a [1] > b [1] ? 1 : 0).map (p => p [0]),
  (href, text) => '<a href="' + href + '">' + text + '</a>',
  (have, slice, groups) => {
    const take = Math.min (have, slice * groups)
    const mod  = take % slice
    return [(take - mod) / slice, mod, have - take]
  },
  (board, arr, slice, skip, now) => arr.slice (skip * slice, skip * slice + now).map (s => '>>>/' + board + '/' + s).join (' '),
  html => {
    const old  = document.getElementById ("ownposts-report")
    if (old) { old.remove (); }
    const node = document.createElement ("div")
    node.setAttribute ("id", "ownposts-report")
    node.setAttribute ("style", "border: thin solid;")
    node.innerHTML = html.map (s => '<p>' + s + '</p>').join ("")
    const foot = document.querySelector ('footer')
    if (foot) {
      foot.parentNode.insertBefore (node, foot)
    } else {
      document.body.appendChild (node)
    }
  },
  45, 2
)

 No.12986

>>12964
A page history for a user it's quite simple to make in php, it's just a gimp mod_view_ip and template as well.
I got this ideia from wizchan and works quite good. But that leaves you with one problem, vpn, since tor is easily blocked. But again, in my imageboard vpn and tor isn't allowed.
https://wizchan.org/history.php

 No.12987

>>12986
If you have some influence on the wizchan admin tell him to fix the double escaping in his code tags: https://wizchan.org/meta/res/60390.html#60449 08/24/21.

 No.12988


 No.13004

>>12987
Sorry, I don't even post on wizchan.

 No.13007

>>12776
Thank you writing for the code. It has been tested and is now added to the site. (I made a minor change to put them in a frameset labeled (You)s ).
https://git.leftypol.org/leftypol/leftypol/issues/66
Do you have any issue with me trying to upstream this to vichan and lainchan?

 No.13008

>>13007
>Do you have any issue with me trying to upstream this to vichan and lainchan?
None at all. Use it freely and in good health. Same for the other fixes I post here.

Separately, I'd like to point out that you need to treat show-own-posts.js.txt >>12776 as UTF-8 to get Marcin's last name right.

 No.13068

The database has been changed to a different engine (MyISAM -> InnoDB). Reverted lmao, vichan isn't concurrency-safe so a couple of people got deadlocks so we noped out.
If you notice anything weird/slow/broken, let me know.
We've also upgraded the caching, which will hopefully provide major speed improvements.

I think one of the biggest issues we should focus on for now (high impact, possible easy win) is the large delay between a post appearing on the website and the poster being told their post is successful.

>>13008
Fixed, thanks.

 No.13071


 No.13072

>>13068
https://git.leftypol.org/leftypol/leftypol/commit/e906ac74514a415c73593edfad5b540df9d67ac5?style=split&whitespace=
You are ignoring the state of $noko, which if false, such as by manual nonoko, causes:
https://git.leftypol.org/leftypol/leftypol/src/commit/e906ac74514a415c73593edfad5b540df9d67ac5/post.php#L1429
$redirect = $root . $board['dir'] . $config['file_index'];

so you might want the same buildIndex before fastcgi_finish_request order when $noko is false as for "if ($post['op'])".

 No.13073

>>13071
>>13072
These should now be fixed, thank you.

 No.13100

these mf's using php lmao


Unique IPs: 15

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