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

Allow options to be customized per directory #696

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Daniel15
Copy link
Contributor

This adds the ability to customize options on a per-directory basis. My main use case is to use the "icons" view as the default view just for certain directories (directories containing pictures), while using the "details" view for everything else.

This needed some changes:

  • In addition to the per-directory header and footer files (eg. _h5ai.header.html), also look for a JSON file called _h5ai.options.json. It will look from the current directory all the way up to the root directory, merging all the configs together (child directories inherit the config from their ancestors, and can override individual fields)
  • Don't persist mode and size to local storage. Currently, h5ai immediately writes the default mode to local storage as soon as you load it. However, this means that we can't tell if the user has customized the view, or if they're just using the default settings. It also means that changing the default view won't be reflected on page load (as the old default will be persisted to local storage) I want to use the per-directory defaults if the user has not customized the setting, but use their custom setting if they have changed it. I'm instead only writing to local storage if the user changes the selection, and the read path is what selects the default if needed

Closes #668

@Ghabry
Copy link

Ghabry commented Feb 27, 2019

thanks for these patches!
Just yesterday I was trying to figure out how to restrict the "download as tar" feature to certain directories 👍

@RomeSilvanus
Copy link

This may be overkill here, but since you are apparently the only person working on this. Here's a few suggestions for good and useful features:

Themes:

#666 Dark Theme
#353 More flexible themes
#658 Please integrate PDF.js and add a dark theme.

Button/switch at the top bar to switch light/dark them would be nice. Along with a URI setting to load in this theme when sharing the url. (e.g. somesite.com/h5ai/folder?theme=dark)

File types

#658 Please integrate PDF.js and add a dark theme.
#579 In browser PDF viewer?

Downloading

#613 Zip files crashes new connection for everyone
#326 Shell-Zip only 1 connection allowed
#593 Download different folders using php-tar at the same time
#609 Filesystem API download instead of archive
#341 Linkable Preview?

Backend

#648 Pre-generate thumbnails in public/cache
#663 Too many layers for crumbbar to display
#503 Allow tree view to be resized manually in the browser
#642 How should i change the title correctly?
#575 Custom Footer has no Javascript support?
#543 Display default files when showing directory
#570 Suggestion: Display the sort-bar in every view & set a custom name for the root folder.
#485 Folder icon as album art (etc.)
#565 Thumbnail generation for short (<2sec) video files.
#554 Thumbnail generation as background process.
#460 ffmpegthumbnailer support.
#432 two headers
#401 Pagination Request

@Ghabry
Copy link

Ghabry commented Feb 27, 2019

#326 Shell-Zip only 1 connection allowed
#593 Download different folders using php-tar at the same time

These two are issues with the server configuration. I use nginx and had to use the amount of childs available in php-fpm, then it worked. The problem is that php generates this on-the-fly and keeps the connection open, so you need multiple php-processes to dispatch that stuff.

@Daniel15
Copy link
Contributor Author

Daniel15 commented Mar 1, 2019

@RomeSilvanus I don't have enough free time to work on all that stuff :D

Having said that, I was thinking of adding some sort of proper themeing system. My idea was that you could put CSS files in a particular directory, and it'd show all the themes in a list in the UI somewhere.

@badda71
Copy link

badda71 commented Mar 8, 2019

I don't think this repository is maintained anymore. I would have a couple of PRs, too. Will you take over?

@Ghabry
Copy link

Ghabry commented Mar 8, 2019

I will be on vacation for 2 weeks but if by then nobody else wants to handle this I can do a fork and get all the open PRs in.

@hartmark
Copy link

hartmark commented Sep 8, 2019

+1 for creating a fork

I found this project when I wanted some simple way of hosting my pictures.

I have a docker-compose file that I can share too if anyone is interested. I was thinking of putting that on a separate repo but perhaps it's nice to keep it in the same repo as this.

I have a small bugfix I can create a PR for if people are interested. It seems that if you have h5ai for one subfolder for example "/pictures" and not for the root, the root still gets read when creating the tree view. One way to fix it is to add a .htaccess file in the root for the directories you want to exclude. Then you'll get permission denied class-filesize.php. One quick and dirty way of fixing it is to change the line 27 to this "if (is_dir($path) && readfile($path))

The folders that cannot be read is still shown but they are empty, I think someone better php-coder may get a better solution, I have never programmed php before :)

It's a bit sad when there are people having PRs that are just left without any merging.

@hartmark
Copy link

I have one more feature request, auto rotate images using the EXIF data

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

Successfully merging this pull request may close these issues.

Default view mode for particular folder
6 participants