Skip to content

Commit

Permalink
fix: rrocr
Browse files Browse the repository at this point in the history
  • Loading branch information
mikumifa committed Jun 19, 2024
1 parent 2fe3fab commit 3143907
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tab/login.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import gradio as gr
from loguru import logger

from util.KVDatabase import KVDatabase
from config import main_request, configDB, global_cookieManager
from util.KVDatabase import KVDatabase

names = []

Expand Down Expand Up @@ -38,7 +38,7 @@ def login_tab():

def upload_file(filepath):
main_request.cookieManager.db.delete("cookie")
yield ["已经注销,请选择登录信息文件", gr.update()]
yield ["已经注销,请选择登录信息文件", gr.update(), gr.update()]
try:
configDB.insert("cookie_path", filepath)
global_cookieManager.db = KVDatabase(filepath)
Expand Down
4 changes: 3 additions & 1 deletion util/CookieManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ def _login_and_save_cookies(
logger.info("登录成功, 浏览器退出.")
return self.db.get("cookie")

def get_cookies(self):
def get_cookies(self, force=False):
if force:
return self.db.get("cookie")
if not self.db.contains("cookie"):
return self._login_and_save_cookies()
else:
Expand Down

0 comments on commit 3143907

Please sign in to comment.