Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better directorylisting with h5ai #5

Open
MaStr opened this issue Feb 27, 2014 · 13 comments
Open

Better directorylisting with h5ai #5

MaStr opened this issue Feb 27, 2014 · 13 comments

Comments

@MaStr
Copy link
Contributor

MaStr commented Feb 27, 2014

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

http://larsjung.de/h5ai/

@WorldsBlankiestBlank
Copy link

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

@cdsmythe
Copy link

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

@cdsmythe
Copy link

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
Copy link
Contributor Author

MaStr commented May 22, 2014

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

Can you provide any details about:

  • How did you configure hai5?
  • Where did you place the files?
  • What configuration changes did you do?

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

@cdsmythe
Copy link

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

@cdsmythe
Copy link

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
Copy link

silvyn commented Nov 27, 2014

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
Copy link
Contributor

griffey commented Nov 28, 2014

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 [email protected]
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
#5 (comment)
.

@mbklein
Copy link

mbklein commented Aug 20, 2015

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. 😄

@MaStr
Copy link
Contributor Author

MaStr commented Aug 21, 2015

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

  • Did you included the download counter display?
  • Did you included the redirect to count downloads?
  • How does it perform on OpenWrt devices? Are the CPU intensive functions already disabled, or has the LibraryBox team tweak on it? @silvyn managed to get it working with some performance, AFAIK

@mbklein
Copy link

mbklein commented Aug 22, 2015

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
Copy link

kirkdwilson commented Apr 19, 2016

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
Copy link
Contributor Author

MaStr commented May 15, 2017

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

MaStr added a commit that referenced this issue May 15, 2017
 - Basic h5ai support based on work from @kirkdwilson
      https://github.com/kirkdwilson/LibraryBox-h5ai-Interface
 - Does not display download counts
 - Can count downloads using the LibraryBox features
 - Counter can be disabled in  /opt/piratebox/www/_h5ai/conf/options.json
 - To be enabled in /opt/piratebox/conf/lighttpd/lighttpd.conf
    (exchange # before index includes)

Closes #5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants