A Neovim plugin enabling you to solve LeetCode problems.
| 1 | local Cookie = require("leetcode.cache.cookie") |
| 2 | local config = require("leetcode.config") |
| 3 | |
| 4 | local headers = {} |
| 5 | |
| 6 | |
| 7 | local cookie = Cookie.get() |
| 8 | |
| 9 | return vim.tbl_extend("force", { |
| 10 | ["User-Agent"] = "Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0", |
| 11 | ["Referer"] = ("https://leetcode.%s"):format(config.domain), |
| 12 | ["Origin"] = ("https://leetcode.%s/"):format(config.domain), |
| 13 | ["Content-Type"] = "application/json", |
| 14 | ["Accept"] = "application/json", |
| 15 | ["Host"] = ("leetcode.%s"):format(config.domain), |
| 16 | -- ["X-Requested-With"] = "XMLHttpRequest", |
| 17 | }, cookie and { |
| 18 | ["Cookie"] = cookie.str, |
| 19 | ["x-csrftoken"] = cookie.csrftoken, |
| 20 | } or {}) |
| 21 | end |
| 22 | |
| 23 | return headers |