From 0449763c6a4bf1e4680e733101a2a0edc0aca5b0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 5 Aug 2022 10:38:05 +0000 Subject: [PATCH 1/2] Bump actions/checkout from 2 to 3 Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/codeql-analysis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index fd6d03b..58b3eb5 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -39,7 +39,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL From 15f78f9a4aac7d396fecb63240227e4b633e0316 Mon Sep 17 00:00:00 2001 From: Admirepowered <1204844044@qq.com> Date: Sat, 6 Aug 2022 01:46:31 +0800 Subject: [PATCH 2/2] fix mod switching & add log set --- README.md | 6 +++--- server.py | 40 +++++++++++++++++++++++++++++++--------- 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 05e2fad..a3e8252 100644 --- a/README.md +++ b/README.md @@ -112,8 +112,8 @@ docker-compose logs -f >mod x: mod 1为单用户模式 mod 2为多用户模式 >add 'yourcookie': 直接 add cookie 添加Cookie,根据提示输入用户存档名称 >time x: 设置任务巡查时间,默认720分钟(12小时) - -set user enable true(设置user.json 的enable属性为true) + >set user enable true(设置user.json 的enable属性为true) + >show true/false: 开启/关闭20秒的倒计时提示 ## 使用云函数运行 @@ -184,4 +184,4 @@ crontab: [github](https://github.com/josiahcarlson/parse-crontab) [pypi](https:/ ## 鸣谢 -[JetBrains](https://jb.gg/OpenSource) +[JetBrains](https://jb.gg/OpenSource) \ No newline at end of file diff --git a/server.py b/server.py index b126884..7345db6 100644 --- a/server.py +++ b/server.py @@ -10,7 +10,7 @@ time_interval=720 #默认签到间隔时间,单位minute(分钟) mod=1 #单用户模式/自动判断 def runingtime(): return int(time.time()) -def control(time_interval,mod,event): +def control(time_interval,mod,event,detal): last_time=runingtime() while True: now_time=runingtime() @@ -30,12 +30,17 @@ def control(time_interval,mod,event): if event.is_set(): log.info("Stoping threading") break - log.info("The Next check time is {}s".format(last_time-now_time+time_interval*60)) + if(detal.is_set()): + log.info("The Next check time is {}s".format(last_time-now_time+time_interval*60)) time.sleep(20) -def command(): +def command(detal): global mod global time_interval - help="command windows\nstop:stop server\nreload:reload config and refish tiem\nsingle:test single config\nmulit:test mulit conifg\nmod x:x is refer single or multi 1 is single 2 is multi\nadd 'yourcookie'\nset user attribute value: such set username(*.json) enable(attribute) Ture(value)\ntime x:set interval time (minute)" + global show + show=False #显示倒计时信息 + if show: + detal.set() + help="command windows\nstop:stop server\nreload:reload config and refish tiem\nsingle:test single config\nmulit:test mulit conifg\nmod x:x is refer single or multi 1 is single 2 is multi\nadd 'yourcookie'\nset user attribute value: such set username(*.json) enable(attribute) Ture(value)\ntime x:set interval time (minute)\nshow true/false:show the time count" log.info(help) while True: command=input() @@ -71,12 +76,28 @@ def command(): return True if command[i]=="mod": if len(command)==2: - - if mod >2 or mod <0: + mod_new=int(command[1]) + if mod_new >2 or mod_new <1: log.info("error mod") else: - mod=int(command[1]) + mod=mod_new log.info("switching mod to {}".format(mod)) + else: + log.info("Error Command") + if command[i]=="show": + if len(command)==2: + + if command[1]=="true": + show=True + detal.set() + log.info("switching to detail mod") + + if command[1]=="false": + detal.unset() + show=False + log.info("switching to slient mod") + + else: log.info("Error Command") if command[i]=="add": @@ -156,10 +177,11 @@ if __name__=='__main__': while True: log.info("switching to mod {}".format(mod)) t1_stop = threading.Event() - thread1 = threading.Thread(name='time_check',target= control,args=(time_interval,mod,t1_stop)) + detal = threading.Event() + thread1 = threading.Thread(name='time_check',target= control,args=(time_interval,mod,t1_stop,detal)) thread1.start() try: - if command(): + if command(detal): t1_stop.set() continue else: