Project

General

Profile

[Rejected] Server-side mod_dirlisting sorting, NO javascript

Added by dennisn 24 days ago

Javascript is a contagion, and I'm doing my part to help. This is a continuation of https://redmine.lighttpd.net/issues/613 ... I've improved the patch. My non-js browsers can finally sort dirs again! :p.

Sorting by Type/content_type is a bit kludgey, but not too bad.

(Btw, what did gstrauss mean with his suggestion to use the ## preprocessor directive for "string tokenization"?)

mod_dirlisting.diff (13.8 KB) mod_dirlisting.diff patched against lighttpd-1.4.77

Replies (5)

RE: Server-side mod_dirlisting sorting, NO javascript - Added by gstrauss 23 days ago

Seems like my comments in https://redmine.lighttpd.net/issues/613#note-14 still applies here.

[...], why should (a cleaned up version of) your patch be accepted into lighttpd? If lighttpd mod_dirlisting does not meet your needs, why don't you write your own CGI script to do so, e.g. /index.py run by mod_indexfile and mod_cgi. Alternatively, write you own "mod_dirlisting" by extending lua mod_dirlisting run from mod_magnet.

This question is still waiting for an answer.

Your current patch unnecessarily removes functionality, including the internal javascript sorting and dir-listing.external-js. That is a non-starter. As such, I immediately stopped reviewing the patch posted here.

It also appears that you have not based your patch on the latest lighttpd mod_dirlisting code on lighttpd git master branch. e.g. see recent commits https://github.com/lighttpd/lighttpd1.4/pull/141

(Btw, what did gstrauss mean with his suggestion to use the ## preprocessor directive for "string tokenization"?)

A preprocessor runs on code prior to the C or C++ compiler compiling the code. The preprocessor can be used to turn macros values into strings and to paste tokens together. The resulting code can be clearer than hard-coding magic numbers. See #613

RE: Server-side mod_dirlisting sorting, NO javascript - Added by dennisn 23 days ago

why don't you write your own "mod_dirlisting" by extending lua mod_dirlisting run from mod_magnet

Because I feel like this is core functionality for a web server, and I'm guessing the C implementation would be faster than a lua script? Ever since that original decade+ old patch stopped working, I wasn't able to sort files on my site with most of my non-js browsers! This is unaceptable for a www server.

removes functionality, including the internal javascript sorting and dir-listing.external-js

Javascript is a pervasive insidious virus that's ruining the internet. This is a deep non-obvious rabbit hole. There should be a configure option to remove all mentions of it. But yea those deletions should have been a separate js-removal.patch. My server's dirlist's (the source html for those pages) is so fast and clean and readable now!

the resulting [preprocessed] code can be clearer than hard-coding magic numbers

Yea I understood the general idea, I'm just not sure how specifically you thought they could have been used to avoid ... those old enumerated constants, for example (which I'm not using in this updated patch).

RE: Server-side mod_dirlisting sorting, NO javascript - Added by gstrauss 23 days ago

why don't you write your own "mod_dirlisting" by extending lua mod_dirlisting run from mod_magnet

Because I feel like this is core functionality for a web server, and I'm guessing the C implementation would be faster than a lua script? Ever since that original decade+ old patch stopped working, I wasn't able to sort files on my site with most of my non-js browsers! This is unaceptable for a www server.

Your coding is poor. (Using file-scoped static globals because you apparently do not know how to pass parameters to a function? That would not pass muster for an intro to computer programming class.)

This is unaceptable [sic] for a www server.

Your opinion is unqualified and continues to ignore that I have told you that lighttpd gives you multiple ways to whatever arbitrary thing you want to do with a custom script or lua in mod_magnet

Nobody else has made a request for this feature in the three years since #613. Therefore, one can reasonably conclude your extreme opinion is garbage, similar to your ability to use spell-check on your posts. ("unacceptable")

Javascript is a pervasive insidious virus that's ruining the internet. [...] There should be a configure option to remove all mentions of it.

RTFM. mod_dirlisting dir-listing.auto-layout = "disable" or you can specify a file containing an empty script to dir-listing.external-js = "/path/to/empty.js"


the resulting [preprocessed] code can be clearer than hard-coding magic numbers

Yea I understood the general idea,

You give yourself too much credit. You did not get it; it is a simple concept if you know what a preprocessor is and the basics of how it works.

I'm just not sure how specifically you thought they could have been used to avoid ... those old enumerated constants, for example (which I'm not using in this updated patch).

s=1 s=2 s=3 (in your patch in #613) are hard-coded magic numbers
"<th class=\"n\"><a href=\"?s=1&d="
could have been
"<th class=\"n\"><a href=\"?s=" #SORT_ALPHA "&d="
(and I am not commenting on how the names of the #define could be better, too.)


There was in #613 and continues (here) to be a large gap between your actual coding abilities and your self-assessment of your coding abilities and grandiose opinions.

In this topic, you could have added a feature to extend mod_dirlisting server-side sorting. Instead, you submitted a patch here where you decided that it would be okay to rip out the javascript sorting and BREAK EVERYONE ELSE CURRENTLY RELYING ON THAT BEHAVIOR.

You can easily configure mod_dirlisting with the flexibility that mod_dirlisting provides. (The options are not unlimited.)
You can easily write your own directory listing with a script which runs when the directory is modified and creates a static index.html instead of a dynamic directory listing with mod_dirlisting.
You can easily write a CGI, FastCGI, mod_magnet, or other script to dynamically generate a directory listing as you please.
You are also welcome to continue to maintain your own patch, which strokes your ego and gives you joy.

I would entertain a simple patch to optionally extend mod_dirlisting server-side sorting, but not from you with your attitude.

It is not worth my time to continue posting here.

RE: [Rejected] Server-side mod_dirlisting sorting, NO javascript - Added by dennisn 23 days ago

Your opinion [that server-side dir listing is essential] is unqualified

Wrong, I host websites, which require sorted dirlisting's.

continues to ignore that I have told you lighttpd gives you multiple ways to [sic] whatever arbitrary thing you want to do with a custom script

Did you ignore my concern that scripting might be slower, and that this ought to be CORE functionality? What kind of web server can't do basic sorting of dirlistings, out of the box?

Nobody else has made a request for this feature in the three years since #613.

Fair point, but it was another user that made the patch that I originally started using over 10 years ago, and then you guys broke things and didn't maintain it. Maybe the guy that originally wrote it switched to a friendlier web server - are you aware of any that are resisting the onslaught of Javascript? I thought lighttpd was aligned with that goal, ie. speed and compatibility and security. (Javascript is a mortal enemy to these, especially when looking at the broader context of the leviathan programs that are required to run js today.)

Therefore, one can reasonably conclude your extreme opinion is garbage

That simply does not logically follow. It's one possibility, but I'm pretty confident the reason there isn't more interest is because people have given up - not that they actually want js (literal garbage). Or they switched to another web server - you seem very stubborn, and you don't seem to be aware of your strong biases.

similar to your ability to use spell-check on your posts. ("unacceptable")

You had a few typos in your post too :P. Relax. I refuse to use spell checkers, btw, it's cheating. I'm pretty sure my english is also better than yours, show some humility :), division of labor.

dir-listing.auto-layout ... "When disabled, it will remove the html part lighttpd was automatically outputing as the start of the page"

Uh wtf, obviously I don't want that. Awkward that you'd suggest that.

dir-listing.external-js = "/path/to/empty.js"

Ugly, but thanks for that non-obvious tip. There should be a config option to disable any mention of javascript, globally, maybe even a compile time option. I literally find javascript offensive.

?s= #SORT_ALPHA

Ooooh, I was way overthinking it ... I thought you were suggesting some fancy ## directive for the #define's. Lol. Mystery solved! Yea lol obviously I should have done that.

a large gap between your actual coding abilities and your self-assessment of your coding abilities

I know. This last patch of mine is decent though, except ig for those static int's that I declared. Most importantly, it works fine!

grandiose opinions

I'm assuming you're referring to my opinions on javascript? They really aren't that grandiose, if you think about it - a fast secure grep'able accessible www.

you decided that it would be okay to rip out the javascript sorting

Yea obviously the javascript-ripping should have been a separate patch, sorry for combining them, that was shady ngl. But well intentioned! :)

BREAK EVERYONE ELSE CURRENTLY RELYING ON THAT BEHAVIOR

Imho I'm helping you people - STOP USING JAVASCRIPT FFS! :) I'm serious.

a static index.html instead of a dynamic directory listing with mod_dirlisting

Hm, that might be an interesting idea, but a separate index.html, updated every time the directory changes, for each sort - ie. a permanent cache :p. But the whole point of this patch was to allow for sorting of the other columns.

You can easily write a CGI, FastCGI, mod_magnet, or other script to dynamically
generate a directory listing as you please.

You keep ignoring my points about this: (1) won't this scripting route be slower, and at least with lua, require an additional compilation dependency which I don't currently have enabled :p, and (2) shouldn't sorting be core functionality for a web server?

You are also welcome to continue to maintain your own patch

Yea that was actually my main goal here - hopefully someone else will find my patch useful, just like I found that original one over a decade ago :).

    (1-5/5)