oupala / apaxy

a simple, customisable theme for your apache directory listing
https://oupala.github.io/apaxy/
GNU General Public License v3.0
1.86k stars 256 forks source link

Improve UI & UX #155

Closed NovA-80 closed 3 weeks ago

NovA-80 commented 1 year ago

fixes #

proposed changes

oupala commented 1 year ago

Thank you for this interesting merge request. I'll have a look at it and will test it soon.

Meanwhile, can you please update your commit messages in order to fulfil the commit message convention "conventional changelog" as stated the CONTRIBUTING.md guide.

NovA-80 commented 1 year ago

Meanwhile, can you please update your commit messages in order to fulfil the commit message convention "conventional changelog" as stated the CONTRIBUTING.md guide.

I've force pushed the commits with corrected messages.

oupala commented 1 year ago

I've tested your merge request with an apache 2.4 and an apache 2.2 (thanks to Docker), and it seems to work.

I plan to make some more tests before merging.

oupala commented 1 year ago

I talked with some friends and it appear that apache 2.2 is no longer supported:

Apache httpd 2.2 End-of-Life 2018-01-01

As previously announced, the Apache HTTP Server Project has discontinued all development and patch review of the 2.2.x series of releases.

The Apache HTTP Server Project had long committed to provide maintenance releases of the 2.2.x flavor through June of 2017. The final release 2.2.34 was published in July 2017, and no further evaluation of bug reports or security risks will be considered or published for 2.2.x releases.

I can understand that some people do not have the choice of the version of apache they are running. On the other side, I think that it is not a wise choice to offer a version of apaxy that is adapted for a version of apache that is no longer supported and has multiple vulnerabilities that won't ever be fixed.

Apache httpd 2.2 is End-of-Life since December 2017 and should not be used. This page only lists security issues that occurred before the End-of-Life. Subsequent issues may have affected 2.2 but will not be investigated or listed here. Users are advised to upgrade to the currently supported released version to address known issues.

Hence I propose you to remove the changes in this merge request that are related to apache 2.2 so that this merge request contains only changes related to the following items:

  • Rendering on small mobile screens (too wide icons column, overflow of breadcrumbs line)
  • Showing of HEIC files in LightGallery.

And the changes related to apache 2.2 could be posted as a git patch in an issue for those who are hardly obliged to use an unsupported version of apache.

NovA-80 commented 1 year ago

I can understand that some people do not have the choice of the version of apache they are running. On the other side, I think that it is not a wise choice to offer a version of apaxy that is adapted for a version of apache that is no longer supported and has multiple vulnerabilities that won't ever be fixed.

Actually, most of the Apaxy CSS selectors still work with Apache-2.2. The Apache-2.4 dependency have been introduced in a couple of places via recent commits. If there is a wish to drop apache-2.2 requirement completely, other places in Apaxy should be possibly cleaned up to take advantage of named CSS-classes... This PR doesn't address this.

Hence I propose you to remove the changes in this merge request that are related to apache 2.2 so that this merge request contains only changes related to the following items:

  • Rendering on small mobile screens (too wide icons column, overflow of breadcrumbs line)
  • Showing of HEIC files in LightGallery.

I've removed the commits concerning Apache-2.2 from this PR, and also changed the README accordingly (it was referencing apache-2.2 as requirement).

And the changes related to apache 2.2 could be posted as a git patch in an issue for those who are hardly obliged to use an unsupported version of apache.

I've made the patch against the HEAD of this branch. The contents is bellow. But it can also be posted in a new issue after this PR will be merged.

Fix: support for Apache 2.2

Module autoindex in Apache-2.2 generates table not specifying any CSS classes (they were appeared in Apache-2.4). Rewrite Apaxy CSS selectors to not reference that.
---
 apaxy/theme/apaxy-lightgallery.js | 16 ++++++++--------
 apaxy/theme/style.css             |  8 ++++----
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/apaxy/theme/apaxy-lightgallery.js b/apaxy/theme/apaxy-lightgallery.js
index 4e5ba24..61c4446 100644
--- a/apaxy/theme/apaxy-lightgallery.js
+++ b/apaxy/theme/apaxy-lightgallery.js
@@ -1,14 +1,14 @@
 var imageSelector = [
-    'tr:not(.parent) td.indexcolname a[href$=".jpg"]',
-    'tr:not(.parent) td.indexcolname a[href$=".JPG"]',
-    'tr:not(.parent) td.indexcolname a[href$=".heic"]',
-    'tr:not(.parent) td.indexcolname a[href$=".HEIC"]',
-    'tr:not(.parent) td.indexcolname a[href$=".png"]',
-    'tr:not(.parent) td.indexcolname a[href$=".PNG"]',
-    'tr:not(.parent) td.indexcolname a[href$=".gif"]'
+    'tr:not(.parent) td+td a[href$=".jpg"]',
+    'tr:not(.parent) td+td a[href$=".JPG"]',
+    'tr:not(.parent) td+td a[href$=".heic"]',
+    'tr:not(.parent) td+td a[href$=".HEIC"]',
+    'tr:not(.parent) td+td a[href$=".png"]',
+    'tr:not(.parent) td+td a[href$=".PNG"]',
+    'tr:not(.parent) td+td a[href$=".gif"]'
 ].join(', ');

-lightGallery(document.getElementById('indexlist'), {
+lightGallery(document.getElementsByTagName('table')[0], {
     selector: imageSelector,
     mode: 'lg-slide',
     hideBarsDelay: 2000,
diff --git a/apaxy/theme/style.css b/apaxy/theme/style.css
index d597313..0c5b681 100644
--- a/apaxy/theme/style.css
+++ b/apaxy/theme/style.css
@@ -133,11 +133,11 @@ table {
   }
 }

-.odd {
+tr:nth-child(odd) {
   background-color: rgb(244, 244, 244);
 }
 @media (prefers-color-scheme: dark) {
-  .odd {
+  tr:nth-child(odd) {
     background-color: rgb(50, 50, 50);
   }
 }
@@ -230,9 +230,9 @@ tr.parent a[href^="/"] {
     padding: 10px;
   }
   /* 2nd Column: Filename */
-  .indexcolname { width: 95%; }
+  th + th { width: 95%; }
   /* 3rd Column: Last Modified */
-  .indexcollastmod { display: none; }
+  td:nth-child(3), th:nth-child(3) { display: none; }
   .wrapper { max-width: 100%; }
 }
oupala commented 3 weeks ago

And I apologize for the long delay for the final merge... I'm veeery sorry for that.