From 4833ee66757a2b611fe88c00a27f1d8ca51dd1ae Mon Sep 17 00:00:00 2001 From: AragonSnow Date: Sun, 31 May 2020 08:41:42 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9B=86=E6=88=90=E4=BA=86=E6=AD=A3=E5=88=99?= =?UTF-8?q?=E8=A1=A8=E8=BE=BE=E5=BC=8F=E3=80=81=E5=AD=97=E7=AC=A6=E4=B8=B2?= =?UTF-8?q?=E6=9B=BF=E6=8D=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/Build Image.yml | 2 +- README.md | 2 ++ web/handlers/util.py | 38 +++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/.github/workflows/Build Image.yml b/.github/workflows/Build Image.yml index fb995e04b92..2314087e2d4 100644 --- a/.github/workflows/Build Image.yml +++ b/.github/workflows/Build Image.yml @@ -15,6 +15,6 @@ jobs: publish: true imageName: asdaragon/qiandao # dockerid/imageName platform: linux/arm64,linux/amd64 # 你准备构建的镜像平台 - tag: 20200526,latest + tag: 20200531,latest dockerHubUser: ${{ secrets.DOCKER_USERNAME }} # docker hub userid 在setting创建secrets name=DOCKER_USERNAME value=dockerid dockerHubPassword: ${{ secrets.DOCKER_PASSWORD }} # docker hub password,在setting创建secrets name=DOCKER_PASSWORD value=dockerpassword \ No newline at end of file diff --git a/README.md b/README.md index 49e7a743ec9..bc8d97266e3 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ docker部署命令:``` docker run -d --name qiandao -p 12345:80 -v $(pwd)/qian ## 2020.5.31 更新 1. 修复定时 ‘day out of month’ 的BUG 2. 取消定时界面的今日运行选项,自动判断当前时间是今天还是第二天 +3. 集成了时间戳获取、unicode转换、url转换功能(By [gxitm](https://github.com/gxitm)) +4. 集成了正则表达式、字符串替换功能。 ## 2020.5.30 更新 1. 修改 任务失败时 推送的消息内容为 任务日志; diff --git a/web/handlers/util.py b/web/handlers/util.py index 9dc57764594..1a5d88d9f1a 100644 --- a/web/handlers/util.py +++ b/web/handlers/util.py @@ -84,10 +84,48 @@ def get(self): self.set_header('Content-Type', 'application/json; charset=UTF-8') self.write(json.dumps(Rtv, ensure_ascii=False, indent=4)) +class UtilRegexHandler(BaseHandler): + @gen.coroutine + def get(self): + Rtv = {} + try: + data = self.get_argument("data", "") + p = self.get_argument("p", "") + temp = {} + ds = re.findall(p, data, re.IGNORECASE) + for cnt in range (0, len(ds)): + temp[cnt+1] = ds[cnt] + Rtv[u"数据"] = temp + Rtv[u"状态"] = "OK" + except Exception as e: + Rtv[u"状态"] = str(e) + + self.set_header('Content-Type', 'application/json; charset=UTF-8') + self.write(json.dumps(Rtv, ensure_ascii=False, indent=4)) + +class UtilStrReplaceHandler(BaseHandler): + @gen.coroutine + def get(self): + Rtv = {} + try: + s = self.get_argument("s", "") + p = self.get_argument("p", "") + t = self.get_argument("t", "") + Rtv[u"原始字符串"] = s + Rtv[u"处理后字符串"] = re.sub(p, t, s) + Rtv[u"状态"] = "OK" + except Exception as e: + Rtv["状态"] = str(e) + + self.set_header('Content-Type', 'application/json; charset=UTF-8') + self.write(json.dumps(Rtv, ensure_ascii=False, indent=4)) + handlers = [ ('/util/delay/(\d+)', UtilDelayHandler), ('/util/timestamp', TimeStampHandler), ('/util/unicode', UniCodeHandler), ('/util/urldecode', UrlDecodeHandler), + ('/util/regex', UtilRegexHandler), + ('/util/string/replace', UtilStrReplaceHandler), ]