6
6
; ; Keywords: extensions, tools
7
7
; ; URL: https://github.com/kaiwk/leetcode.el
8
8
; ; Package-Requires: ((emacs "26") (dash "2.16.0") (graphql "0.1.1") (spinner "1.7.3") (aio "1.0") (log4e "0.3.3"))
9
- ; ; Version: 0.1.16
9
+ ; ; Version: 0.1.17
10
10
11
11
; ; This program is free software; you can redistribute it and/or modify
12
12
; ; it under the terms of the GNU General Public License as published by
@@ -224,11 +224,12 @@ VALUE should be the referer."
224
224
(" filename" . " " )
225
225
(" content-type" . " " )))
226
226
227
- (defun leetcode--login ()
227
+ (aio- defun leetcode--login ()
228
228
" Steal LeetCode login session from local browser.
229
229
It also cleans LeetCode cookies in `url-cookie-file' ."
230
230
(leetcode--loading-mode t )
231
231
(ignore-errors (url-cookie-delete-cookies leetcode--domain))
232
+ (aio-await (leetcode--csrf-token)) ; knock knock, whisper me the mysterious information
232
233
(let* ((my-cookies (executable-find " my_cookies" ))
233
234
(my-cookies-output (shell-command-to-string my-cookies))
234
235
(cookies-list (seq-filter
@@ -239,7 +240,8 @@ It also cleans LeetCode cookies in `url-cookie-file'."
239
240
cookies-list))
240
241
(leetcode-session (cadr (assoc " LEETCODE_SESSION" cookies-pairs)))
241
242
(leetcode-csrftoken (cadr (assoc " csrftoken" cookies-pairs))))
242
- (leetcode--debug " login: %s" my-cookies-output)
243
+ (leetcode--debug " login session: %s" leetcode-session)
244
+ (leetcode--debug " login csrftoken: %s" leetcode-csrftoken)
243
245
(url-cookie-store " LEETCODE_SESSION" leetcode-session nil leetcode--domain " /" t )
244
246
(url-cookie-store " csrftoken" leetcode-csrftoken nil leetcode--domain " /" t ))
245
247
(leetcode--loading-mode -1 ))
@@ -546,7 +548,7 @@ Return a list of rows, each row is a vector:
546
548
(if (get-buffer leetcode--buffer-name)
547
549
(switch-to-buffer leetcode--buffer-name)
548
550
(unless (leetcode--login-p)
549
- (leetcode--login))
551
+ (aio-await ( leetcode--login) ))
550
552
(aio-await (leetcode-refresh-fetch))
551
553
(switch-to-buffer leetcode--buffer-name)))
552
554
0 commit comments