From effc93b56d060da5e2b7395b87090f9a42e976ad Mon Sep 17 00:00:00 2001 From: Ching Date: Sat, 22 Jan 2022 21:34:31 +0800 Subject: [PATCH 01/10] =?UTF-8?q?feat(dodo):=20=E5=A2=9E=E5=8A=A0=E9=A3=9E?= =?UTF-8?q?=E4=B9=A6=20dodo=20=E9=83=A8=E7=BD=B2=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加飞书 dodo 部署逻辑 Signed-off-by: Ching --- .vscode/settings.json | 4 +++- develop_requirements.txt | 1 + scripts/dodo.py | 5 +++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 6b8fa15..a07a049 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -9,5 +9,7 @@ "editor.formatOnSave": true, "editor.rulers": [ 120 - ] + ], + "editor.bracketPairColorization.enabled": true, + "editor.guides.bracketPairs": "active" } diff --git a/develop_requirements.txt b/develop_requirements.txt index 89452a9..c71d62c 100644 --- a/develop_requirements.txt +++ b/develop_requirements.txt @@ -31,3 +31,4 @@ user-agents==2.2.0 wcwidth==0.2.5 zipp==3.5.0 redis==4.1.0 +black diff --git a/scripts/dodo.py b/scripts/dodo.py index b3628a5..13eb0cf 100644 --- a/scripts/dodo.py +++ b/scripts/dodo.py @@ -224,6 +224,11 @@ class RequestHandler(BaseHTTPRequestHandler): subprocess.call("/root/deploy/dsite_prepare.sh") subprocess.run(["supervisorctl", "restart", "dsite"]) self.msg_compoment(access_token, open_id, '🎉 %s 部署成功 🎉' % site_) + if site_ == 'dodo': + self.msg_compoment(access_token, open_id, '🚧 %s 开始部署 🚧' % site_) + subprocess.run(["git", "pull"]) + subprocess.run(["supervisorctl", "restart", "dodo"]) + self.msg_compoment(access_token, open_id, '🎉 %s 部署成功 🎉' % site_) else: self.msg_compoment(access_token, open_id, '⚠️ %s 不存在 ⚠️' % site_) elif orig_text.startswith('/菜谱 '): From 86fdc14b56971125c3e8f492f4318724fe41394f Mon Sep 17 00:00:00 2001 From: Ching Date: Sun, 23 Jan 2022 23:38:50 +0800 Subject: [PATCH 02/10] =?UTF-8?q?fix(dodo):=20=E4=BF=AE=E5=A4=8D=20dodo=20?= =?UTF-8?q?=E9=83=A8=E7=BD=B2=E6=88=90=E5=8A=9F=E6=B6=88=E6=81=AF=E6=B2=A1?= =?UTF-8?q?=E5=8F=91=E9=80=81=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复 dodo 部署成功消息没发送的问题 Signed-off-by: Ching --- scripts/dodo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/dodo.py b/scripts/dodo.py index 13eb0cf..3decf5e 100644 --- a/scripts/dodo.py +++ b/scripts/dodo.py @@ -227,8 +227,8 @@ class RequestHandler(BaseHTTPRequestHandler): if site_ == 'dodo': self.msg_compoment(access_token, open_id, '🚧 %s 开始部署 🚧' % site_) subprocess.run(["git", "pull"]) - subprocess.run(["supervisorctl", "restart", "dodo"]) self.msg_compoment(access_token, open_id, '🎉 %s 部署成功 🎉' % site_) + subprocess.run(["supervisorctl", "restart", "dodo"]) else: self.msg_compoment(access_token, open_id, '⚠️ %s 不存在 ⚠️' % site_) elif orig_text.startswith('/菜谱 '): From 219e7be4a6b408684ea44b7d44c6972814398040 Mon Sep 17 00:00:00 2001 From: Ching Date: Thu, 3 Feb 2022 00:49:49 +0800 Subject: [PATCH 03/10] =?UTF-8?q?feat(scripts):=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E9=87=8D=E5=90=AFdodo=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加重启dodo脚本 Signed-off-by: Ching --- scripts/restart_dodo.sh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 scripts/restart_dodo.sh diff --git a/scripts/restart_dodo.sh b/scripts/restart_dodo.sh new file mode 100644 index 0000000..9b484cb --- /dev/null +++ b/scripts/restart_dodo.sh @@ -0,0 +1,5 @@ +#!/bin/bash +supervisorctl restart dodo && \ +curl -X POST -H "Content-Type: application/json" \ + -d '{"msg_type":"text","content":{"text":"🎉 dodo 部署成功 🎉"}}' \ + https://open.feishu.cn/open-apis/bot/v2/hook/57cfa603-6154-4055-a739-210028171d10 From 9b115417d38588fbbcca2b12616eb89b67cb2660 Mon Sep 17 00:00:00 2001 From: Ching Date: Thu, 3 Feb 2022 01:21:24 +0800 Subject: [PATCH 04/10] =?UTF-8?q?feat(recipe=20mobile):=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E8=8F=9C=E8=B0=B1=E5=90=8E=E5=BC=B9=E5=87=BA=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改菜谱后弹出成功提示 Signed-off-by: Ching --- .../components/recipe-mobile/recipe-edit.vue | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/recipe-mobile/recipe-edit.vue b/frontend/src/components/recipe-mobile/recipe-edit.vue index 4c90b7e..a6d284f 100644 --- a/frontend/src/components/recipe-mobile/recipe-edit.vue +++ b/frontend/src/components/recipe-mobile/recipe-edit.vue @@ -59,7 +59,16 @@ @@ -128,5 +168,6 @@ export default { diff --git a/frontend/src/components/recipe-mobile/recipe-edit.vue b/frontend/src/components/recipe-mobile/recipe-edit.vue index a6d284f..d7a01ee 100644 --- a/frontend/src/components/recipe-mobile/recipe-edit.vue +++ b/frontend/src/components/recipe-mobile/recipe-edit.vue @@ -43,17 +43,47 @@ />
- 提交 + + + 提交 + + + 提交 + + + 删除 + +
@@ -68,6 +98,8 @@ import { Rate, Button, Toast, + Col, + Row, } from 'vant'; import axios from 'axios'; import config from '@/config/index'; @@ -90,6 +122,8 @@ export default { [RadioGroup.name]: RadioGroup, [Rate.name]: Rate, [Button.name]: Button, + [Col.name]: Col, + [Row.name]: Row, }, data() { return { @@ -137,6 +171,20 @@ export default { ); } }, + onSubmitDelete(recipe_id) { + if (!this.form.name) { + return; + } + this.loading = true; + axios.delete(config.publicPath + '/recipe/recipe/' + recipe_id).then( + (Toast.success({ + message: '删除成功', + forbidClick: true, + duration: 500, + }), + (this.loading = false)) + ); + }, }, }; @@ -144,4 +192,7 @@ export default { .recipe-create { margin: 20px 16px; } +.submit-button { + width: 100%; +} diff --git a/recipe/views.py b/recipe/views.py index e958f5f..436402b 100644 --- a/recipe/views.py +++ b/recipe/views.py @@ -18,7 +18,7 @@ class RecipeAPI(rest_framework.generics.RetrieveUpdateDestroyAPIView): # authentication.SessionAuthentication, # authentication.BasicAuthentication) # permission_classes = (permissions.IsAuthenticated,) - queryset = recipe.models.Recipe.objects.exclude(status=const.RECIPE_STATUS_DELETED) + queryset = recipe.models.Recipe.objects.all() serializer_class = recipe.serializers.RecipeSerializer def perform_destroy(self, instance): From 844ce1bfd585f50608134abbae25def6a212664c Mon Sep 17 00:00:00 2001 From: Ching Date: Sat, 5 Feb 2022 02:23:07 +0800 Subject: [PATCH 08/10] =?UTF-8?q?feat(scripts):=20=E5=A2=9E=E5=8A=A0=20dsi?= =?UTF-8?q?te=20=E9=83=A8=E7=BD=B2=E8=84=9A=E6=9C=AC=EF=BC=9B=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=98=9F=E5=98=9F=E6=9C=BA=E9=83=A8=E7=BD=B2=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E6=9C=89=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加 dsite 部署脚本;修复嘟嘟机部署提示有误的问题 Signed-off-by: Ching --- scripts/dodo.py | 2 +- scripts/dsite_prepare.sh | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 scripts/dsite_prepare.sh diff --git a/scripts/dodo.py b/scripts/dodo.py index 3decf5e..c0783be 100644 --- a/scripts/dodo.py +++ b/scripts/dodo.py @@ -224,7 +224,7 @@ class RequestHandler(BaseHTTPRequestHandler): subprocess.call("/root/deploy/dsite_prepare.sh") subprocess.run(["supervisorctl", "restart", "dsite"]) self.msg_compoment(access_token, open_id, '🎉 %s 部署成功 🎉' % site_) - if site_ == 'dodo': + elif site_ == 'dodo': self.msg_compoment(access_token, open_id, '🚧 %s 开始部署 🚧' % site_) subprocess.run(["git", "pull"]) self.msg_compoment(access_token, open_id, '🎉 %s 部署成功 🎉' % site_) diff --git a/scripts/dsite_prepare.sh b/scripts/dsite_prepare.sh new file mode 100644 index 0000000..f3a14aa --- /dev/null +++ b/scripts/dsite_prepare.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +/root/.pyenv/versions/py37/bin/pip install -r /root/deploy/dsite/develop_requirements.txt +/root/.pyenv/versions/py37/bin/python /root/deploy/dsite/manage.py collectstatic --noinput +/root/.pyenv/versions/py37/bin/python /root/deploy/dsite/manage.py migrate From b26000205bdc5cbfa71cc7fc496034be27ddfe52 Mon Sep 17 00:00:00 2001 From: Ching Date: Thu, 10 Feb 2022 22:35:57 +0800 Subject: [PATCH 09/10] =?UTF-8?q?fix(scripts):=20=E4=BF=AE=E5=A4=8D=20bitw?= =?UTF-8?q?arden=20=E5=A4=87=E4=BB=BD=E6=95=B0=E6=8D=AE=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E6=9C=89=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复 bitwarden 备份数据路径有误的问题 Signed-off-by: Ching --- scripts/bitwarden_backup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/bitwarden_backup.py b/scripts/bitwarden_backup.py index 4881b97..31f501a 100644 --- a/scripts/bitwarden_backup.py +++ b/scripts/bitwarden_backup.py @@ -78,6 +78,6 @@ def send_email(file_name): if __name__ == '__main__': - file_name = './backup/bitwarden-%s.tar.gz' % localtime.strftime('%Y-%m-%d') + file_name = '/root/develop/vaultwarden/backup/bitwarden-%s.tar.gz' % localtime.strftime('%Y-%m-%d') if make_targz(file_name, '/root/develop/vaultwarden/vw-data'): send_email(file_name) From e7a579e168992b8d3fa32f4645a952968c2dc2b5 Mon Sep 17 00:00:00 2001 From: Ching Date: Thu, 10 Feb 2022 22:38:12 +0800 Subject: [PATCH 10/10] =?UTF-8?q?fix(recipe=20models):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E9=80=9A=E8=BF=87=E5=98=9F=E5=98=9F=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E8=8F=9C=E8=B0=B1=E6=97=B6=E6=B2=A1=E6=9C=89=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=20status=20=E5=AF=BC=E8=87=B4=E5=88=9B=E5=BB=BA=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复通过嘟嘟创建菜谱时没有设置 status 导致创建失败的问题 Signed-off-by: Ching --- recipe/models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recipe/models.py b/recipe/models.py index 94c2dd1..52b566f 100644 --- a/recipe/models.py +++ b/recipe/models.py @@ -55,7 +55,9 @@ class Recipe(models.Model): difficulty = 0 else: difficulty = 0 - recipe = cls.objects.create(name=name, recipe_type=recipe_type, rate=rate, difficulty=difficulty) + recipe = cls.objects.create( + name=name, recipe_type=recipe_type, rate=rate, difficulty=difficulty, status=const.RECIPE_STATUS_ACTIVE + ) return recipe @property