caddyserver / caddy

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
https://caddyserver.com
Apache License 2.0
55.45k stars 3.91k forks source link

[file_server browse] Layout setting is not saved #6386

Open trmdi opened 3 weeks ago

trmdi commented 3 weeks ago

When you change the file browser's layout between Grid/List, it's reset when you leave the current page/open other directory. It would be better if the setting remains consistent until the user changes it.

mholt commented 3 weeks ago

Agreed. Can you suggest a good way to do that that doesn't require cookies?

trmdi commented 3 weeks ago

Agreed. Can you suggest a good way to do that that doesn't require cookies?

I don't know what is better, what's wrong with the cookie?

mholt commented 3 weeks ago

Europe's laws make the use of cookies rather unbearable.

aliasgar55 commented 3 weeks ago

Maybe local storage?

trmdi commented 3 weeks ago

Europe's laws make the use of cookies rather unbearable.

Caddy is already using cookies, isn't it? https://github.com/search?q=repo%3Acaddyserver%2Fcaddy%20cookie&type=code So I think the EU's cookie law is not an issue here.

mholt commented 2 weeks ago

The only time we set cookies, AFAIK, are when the user explicitly configures load balancing policy as such. The rest of those results are related to parsing existing cookie headers, not setting.

mholt commented 2 weeks ago

Maybe local storage?

Maybe, but that will be lost when sharing a link. You will be viewing a grid and someone else will see the list.

trmdi commented 2 weeks ago

The only time we set cookies, AFAIK, are when the user explicitly configures load balancing policy as such. The rest of those results are related to parsing existing cookie headers, not setting.

I saw there is a cookie for the Sorting button which is very similar to the Layout button.

mholt commented 2 weeks ago

Oh, interesting. I thought we got rid of those for query string parameters. In fact, I distinctly remember doing this... :thinking: We should probably remove those in favor of the query string.

trmdi commented 2 weeks ago

Maybe local storage?

I think the cookie law is applied to similar types of cookie including localStorage.

trmdi commented 2 weeks ago

Oh, interesting. I thought we got rid of those for query string parameters. In fact, I distinctly remember doing this... 🤔 We should probably remove those in favor of the query string.

Just curious why don't you accept the law? Maybe add an opton for caddy's admin to show/not show the cookie banner? Because we can not avoid storing a user's preference in their browser. Anyway, clicking on the Accept Cookie button is not really a problem.

mholt commented 2 weeks ago

Cookie banners are destroying the Web.

I think we can avoid it with query strings. But it might be a little more involved since it requires changing the links.