LibraryBox-Dev / LibraryBox-core

PirateBox Core scripts modification and build stuff to turn it into a LibraryBox
http://www.librarybox.us
GNU General Public License v3.0
66 stars 34 forks source link

Better directorylisting with h5ai #5

Open MaStr opened 10 years ago

MaStr commented 10 years ago

Check, test and if it works integrate the download-counter display.

http://larsjung.de/h5ai/

WorldsBlankiestBlank commented 10 years ago

Oh yes, please implement this! LibraryBox would look so much better with something like h5ai!

cdsmythe commented 10 years ago

Yeah this looks really good. Ive been thinking on how this could be achieved! Great find, well done!

cdsmythe commented 10 years ago

Ive installed h5ai on a MR3040 but modified the 'options.json' file so none of the fancy features are on. Doing testing now. It seems to be running really well so far without making it a slow user experience.

MaStr commented 10 years ago

Thanks for your feedback! (Something like that was my intuition.

Can you provide any details about:

Did you figure out, how it is possible to integrate the download-counter display and the counting itself?

cdsmythe commented 10 years ago

Ok will do. But I forgot all about the download counter.......will get onto that now! ;)

cdsmythe commented 10 years ago

Heres a list of instructions on installing h5ai, but NOTE that after doing this the Download-counter function doesnt work.

Download the http://biblebox.org/BB/installing_h5ai.zip file which includes the _h5ai 0.24.1 folder, and 2 files - "mime.types" and "lighttpd.conf".

This download of _h5ai from BibleBox.org contains an "options.json" file with options already set for use on the TP MR3040 router.

NOTE: testing various options in the options.json file of _h5ai lead to the modified settings in this file. If you want to modify it yourself go ahead, but know that showing file previews, enabling selected downloads as packages, displaying folder trees, all makes browsing files on the BibleBox S......L....O.....W)

Unzip the "installing_h5ai.zip" file and copy the contents to the root folder on your USB

Plug the USB into your MR3040 and power it on Connect the MR3040 ethernet to your computer (remember to manually set an IP address on your computer as 192.168.1.2) Connect to the MR3040 using SSH After logging in, from PuTTY or Terminal (OS X) run the following commands: cd /mnt/usb/ cp -fr _h5ai /opt/piratebox/www/ (this copies the _h5ai folder to the root www folder on the MR3040) cp -f mime.types /opt/piratebox/conf/lighttpd/ cp -f lighttpd.conf /opt/piratebox/conf/lighttpd/ reboot -f (this command will reboot the MR3040)

You can then put the USB back into your computer and delete the _h5ai folder, mime.types file and lighttpd.conf file from the root folder on the USB as they have all been copied to the MR3040 itself.

I had forgotten about File Download count though...... h5ai looks good, but I really need the counter to be working also. Am on it.

silvyn commented 10 years ago

Succeed with latest h5ai 0.26.1, but had to install php5-mod-session IPK packages.

Blog post I've wrote in french on BiblioBox.net : http://bibliobox.net/blog/post/2014/11/20/installer-h5ai-v0261-sur-une-librarybox

griffey commented 10 years ago

Appreciate the work on h5ai gang. It's weird timing, as we already have code in the 2.1beta to handle a pretty directory listing (i got it working some time back, just working on bug fixes), but h5ai is a great system as well. :-/ Unsure whether to stick with our existing solution or wait until we get h5ai working and tested for the 2.1 beta release...

Jason

On Thu Nov 27 2014 at 4:46:02 PM Sylvain Naudin notifications@github.com wrote:

Succeed with latest h5ai 0.26.1, but had to install php5-mod-session IPK packages.

Blog post I've wrote in french on BiblioBox.net : http://bibliobox.net/blog/post/2014/11/20/installer-h5ai-v0261-sur-une-librarybox

— Reply to this email directly or view it on GitHub https://github.com/LibraryBox-Dev/LibraryBox-core/issues/5#issuecomment-64835380 .

mbklein commented 9 years ago

I've added _h5ai support to the image build in my fork, and I love the way it's working. I'll hold off on a polished PR unless/until @griffey expresses interest, but I'm happy with it so far. :smile:

MaStr commented 9 years ago

@mbklein thank you. I like h5ai, too. I used it for two other webpage-project until now. These questions about h5ai is important:

mbklein commented 9 years ago

I didn't do anything with the download counters, but it doesn't look difficult. I'll try to find some time to work on it next week.

kirkdwilson commented 8 years ago

We have fixed the download counters. It is based on a change as follows, update "client/js/scripts.js" at the section w=function(e,f){e.attr(:href:,t.absHref)... which in un-obfuscated code is: setLink = function ($el,item{ $el.attr("href",item.absHref); Where the 'item.absHref' is the raw URL of the item in question Changing this to:

w=function(e,t){e.attr("href","/dl_statistics_counter.php?DL_URL="+t.absHref)

This updates the download counter when clicking on the files. We've made the change inside the h5ai_installer.tar so that you don't have to edit it on the device post-install. We have made this available on GitHub at: https://github.com/kirkdwilson/LibraryBox-h5ai-Interface for version 0.24.1 The later versions are not working as of yet.

Unfortunately, it also calls 'dl_statistics_counter.php' when clicking on directories and or directories with index.html files in them. However, thankfully , this doesn't seem to actually be reflected in the statistics displayed except that for directories with index.html files it will enter a 'null' file name and count it.

We have updated the java script files-top.js and downloads.js to skip null entry file names:

files-top.js

var $j = jQuery.noConflict();

$j.getJSON("/dl_statistics_display.php?sortBy=counter&sortOrder=DESC&list_type=top&top-max=10&output_type=json" , function(data) { var files_top = $j('p#files-top-default'); var tbl_body = '

" files_top.html(tbl_body);

//Testing
//console.log(data);

});

and download.js:

// $.get( // "/dl_statistics_display.php?sortOrder=DESC&sortBy=counter&list_type=top&top-max=50",

// );

var $j_d = jQuery.noConflict();

$j_d.getJSON("/dl_statistics_display.php?sortBy=counter&sortOrder=DESC&list_type=all&top-max=10&output_type=json" , function(data) { var files_top = $j_d('p#files-top-statspage'); var tbl_body = '

" files_top.html(tbl_body);

//Testing
//console.log(data);

});

MaStr commented 7 years ago

Did some testing with that today... to avoid the counting of directories, the correct way would be: (used on the 0.27 version from @kirkdwilson )

           function h(e, t) {
                var url = t.absHref
                if ( ! t.isFolder() ) {
                    url = "/dl_statistics_counter.php?DL_URL=" + t.absHref
                }
                e.attr("href", url , v ) && t.isFolder() && t.isManaged && e.on("click", function() {
                    return f(t.absHref), !1
                }), g.unmanagedInNewWindow && !t.isManaged && e.attr("target", "_blank")
            }

This avoids the URL change for folders. The next way would be to make that optional vial configuration.

And the Download counts aren't displayed in the listing, but I do not think this is easy to be implemented