Topic: [Question] Why does the blacklists use a cookie?

Posted under e621 Tools and Applications

I would like to apologize ahead of time for not posting this question in the other forum that exists, but I didn't want to search for hours on end.

I noticed that in the other forum, someone had mentioned that E621 uses a cookie in the browser to store a user's blacklist. This is obviously working out great, but limits how many tags a single user can store due to cookie size restrictions. Have admins considered using the browser's persistent storage instead? I believe it's a lot bigger, and it would allow people to add as many tags as they needed.

Since I'm not even approaching my limit of characters in my blacklist, I'm not really concerned for myself, but rather for those who are.

Updated by Lance Armstrong

Old tech before html 5 was a thing(it was but not majorly supported, even browsers that did only had minimal support for html 5 stuff). Only way for JavaScript to do persistent storage back in the day was document.cookie.
It will very likely be moved over to localStorage in the future. Especially because sending 3000 unused bytes to the server per request isn't all that efficient.

Updated by anonymous

I believe the reason is to allow non-logged-in users to use a blacklist. Can anyone confirm?

Updated by anonymous

Lance_Armstrong said:
I believe the reason is to allow non-logged-in users to use a blacklist. Can anyone confirm?

YES!

I messaged Para about that, thinking it was a bug and had (entertainingly) experienced it. She knew about it, and I believe it is supposed to be that way. My logic is: it is on your personal computer or device. Your blacklist on your PC/device.

Updated by anonymous

Testing while logged out.

On the posts index there is a Blacklist link at the top of the page that does not appear when you are logged in. Click it, and a blacklist window pops up and allows you to edit the blacklist cookie.

This bug report is related: forum #203231

Maybe logged-in users would like the cookie cleared when they log out. But I don't see the point.

Updated by anonymous

Lance_Armstrong said:
I believe the reason is to allow non-logged-in users to use a blacklist. Can anyone confirm?

Can confirm. There is code written to move them into the page body(no localstorage/no cookies) but I need to figure out a good place to test it and nail it down so it's flawless before deploying it. I don't want any edge cases like last time.

Updated by anonymous

Faux-Pa said:
This is obviously working out great, but limits how many tags a single user can store due to cookie size restrictions. Have admins considered using the browser's persistent storage instead? I believe it's a lot bigger, and it would allow people to add as many tags as they needed.

Since I'm not even approaching my limit of characters in my blacklist, I'm not really concerned for myself, but rather for those who are.

A cookie should be able to store roughly 4093 bytes/characters:

http://browsercookielimits.squawky.net/

The blacklist limit is 3900 bytes, less than the cookie size. Japanese characters take up 3 bytes, so if you are blacklisting Japanese artists then you might have a bigger problem.

Your blacklist should easily fit 150-200 tags. If you need more than that, maybe this site contains too many triggers for you. If you use the Clean button, it will remove some aliases for you.

Updated by anonymous

  • 1