From c175362563a5fe4c6643e1965a33f115a20c2c8d Mon Sep 17 00:00:00 2001 From: Junior Date: Tue, 6 May 2025 15:11:40 -0400 Subject: [PATCH] Add rewrite rule and a bit of JS tweaking to make book download URLs more clean --- .htaccess | 5 +++++ js/books.js | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.htaccess b/.htaccess index 4beb0cf..8f92ac4 100644 --- a/.htaccess +++ b/.htaccess @@ -1 +1,6 @@ php_flag opcache.enable off + + + RewriteEngine on + RewriteRule ^book/([0-9]+)/.*$ download.php?id=$1 + diff --git a/js/books.js b/js/books.js index 2180ac8..d400818 100644 --- a/js/books.js +++ b/js/books.js @@ -54,6 +54,10 @@ function redirectToLogin() { window.location.replace("index.php"); } +function basename(str) { + return str.substr(str.lastIndexOf("/") + 1); +} + function getContents() { if ( searchTimeout ) clearTimeout(searchTimeout); var data = {}; @@ -88,9 +92,9 @@ function getContents() { if ( item.folder == true ) { contents += '
' + item.displayname + "
"; } else { - contents += '