clear
This commit is contained in:
parent
7061102879
commit
ab1d834698
16
config.py
16
config.py
@ -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"
|
||||||
try:
|
log.info("Cookie已删除")
|
||||||
f.seek(0)
|
save_config()
|
||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user