This commit is contained in:
Womsxd 2022-10-27 16:25:53 +08:00
parent 7061102879
commit ab1d834698
No known key found for this signature in database
GPG Key ID: 0FE76418EE689B68

View File

@ -85,6 +85,7 @@ def save_config(p_path=None, p_config=None):
return None return None
if not p_path: if not p_path:
p_path = config_Path p_path = config_Path
if not p_config:
p_config = config p_config = config
with open(p_path, "w+") as f: with open(p_path, "w+") as f:
try: try:
@ -102,26 +103,16 @@ def save_config(p_path=None, p_config=None):
def clear_cookies(): def clear_cookies():
global config global config
global serverless
if serverless: if serverless:
log.info("云函数执行,无法保存") log.info("云函数执行,无法保存")
return None return None
with open(config_Path, "r+") as f: config["enable"] = False
config["enable"] = False config["account"]["login_ticket"] = ""
config["account"]["login_ticket"] = "" config["account"]["stuid"] = ""
config["account"]["stuid"] = "" config["account"]["stoken"] = ""
config["account"]["stoken"] = "" config["account"]["cookie"] = "CookieError"
config["account"]["cookie"] = "CookieError" log.info("Cookie已删除")
try: save_config()
f.seek(0)
f.truncate()
f.write(yaml.dump(config, Dumper=yaml.Dumper, sort_keys=False))
f.flush()
except OSError:
serverless = True
log.info("Cookie删除失败")
else:
log.info("Cookie删除完毕")
def clear_cookie_cloudgame(): def clear_cookie_cloudgame():
@ -146,5 +137,4 @@ if __name__ == "__main__":
# pass # pass
# save_config() # save_config()
# update_config() # update_config()
load_config()
pass pass