redlib
redlib copied to clipboard
Make subscription and filter cookies split into multiple cookies if they're too large
Basically the title. This would fix https://github.com/redlib-org/redlib/issues/279. Also fixes a problem of empty cookies not being deleted.
This branch currently has subscriptions and filters split into subscriptions, subscriptions1, filters, filters1, etc.
Still left to figure out:
- [x] How to deal with old
subscriptionsandfilterscookies?- Made it start with existing cookie names and then count up from there ~~Currently this only works if you don't have any old cookies. They still function, and if you change anything you'll get the new cookies with correct values. The problem is the old cookies stay and don't get updated. Would it be better to make this new system start with
subscriptionsand then the next cookie would besubscriptions1in order to not break things? I started on it but it seemed like it was going to add more complexity than the next solution. Or would it be better to just convert to the new system and delete the oldsubscriptionscookie if it exists? Seems like code that's eventually useless if we went that direction.~~
- Made it start with existing cookie names and then count up from there ~~Currently this only works if you don't have any old cookies. They still function, and if you change anything you'll get the new cookies with correct values. The problem is the old cookies stay and don't get updated. Would it be better to make this new system start with
- [x] Can the size checking in
join_until_size_limit()be made smarter?- Reddit only allows "normal" characters so we won't have any characters larger than a byte, so this is fine. ~~Characters with accents like ã are more than one byte, but this only checks the length of the string. Are special characters even allowed in subreddit/user names?~~
- [ ] Make restoring cookies function with the new system. Currently doesn't override any existing numbered subscription or filter cookies.