kawre / leetcode.nvim

A Neovim plugin enabling you to solve LeetCode problems.
MIT License
654 stars 34 forks source link

fix: provide an option for not showing the expired window when gettin… #112

Open fangjunzhou opened 4 days ago

fangjunzhou commented 4 days ago

…g 401/403

This is a suggested temprary fix for http 401/403 error from leetcode.

I found that the current leetcode api only reject some of the requests. It's often the case that leetcode returns 403 for some requests but still accept some other requests after that. Treating all the 403 requests as expired just made the entire plugin unusable.

I added and show_menu_when_expire option to the config template. When setting this flag to false, the system will only pop an error instead of call the cmd.menu() and cmd.cookie_prompt() to send the user all the way back to the main menu.

image

I suspect that most of the 403 we got recently is because of the change of leetcode api. I think reseving this option is also important for leetcode.nvim to handle future api change. Otherwise, a simple api change may disbale the entire plugin.