From 148e7e6025d4d193e12a6072f77e4e7e9542e37a Mon Sep 17 00:00:00 2001 From: Womsxd <45663319+Womsxd@users.noreply.github.com> Date: Tue, 26 Apr 2022 15:59:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=91=E5=87=BD=E6=95=B0=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 9 +++++++++ index.py | 3 +++ 2 files changed, 12 insertions(+) diff --git a/config.py b/config.py index bb69489..2eab14a 100644 --- a/config.py +++ b/config.py @@ -2,6 +2,9 @@ import os import json from loghelper import log +# 这个字段现在还没找好塞什么地方好,就先塞config这里了 +serverless = False + # 是否启用config enable = True # 这里的内容会自动获取 @@ -72,6 +75,9 @@ def load_config(): def save_config(): + if not serverless: + log.info("云函数执行,无法保存") + return None with open(config_Path, "r+") as f: data = json.load(f) data["mihoyobbs_Login_ticket"] = login_ticket @@ -87,6 +93,9 @@ def save_config(): def clear_cookies(): + if not serverless: + log.info("云函数执行,无法保存") + return None with open(config_Path, "r+") as f: data = json.load(f) data["enable_Config"] = False diff --git a/index.py b/index.py index 65c202b..d28e258 100644 --- a/index.py +++ b/index.py @@ -2,9 +2,11 @@ import main import push import main_multi from error import CookieError +from config import serverless def main_handler(event: dict, context: dict): + serverless = True try: status_code, push_message = main.main() except CookieError: @@ -15,6 +17,7 @@ def main_handler(event: dict, context: dict): def main_handler_mulit(event: dict, context: dict): + serverless = True # 多用户需要传递True表示自动执行,不需要手动进行确认 main_multi.main_multi(True) print("云函数多用户测试支持!")