From babedf5d15e7e730e9d42efc7801cda543daf856 Mon Sep 17 00:00:00 2001 From: EstrellaXD Date: Wed, 4 Oct 2023 17:55:19 +0800 Subject: [PATCH 1/6] fix: tg notification --- backend/src/module/network/request_contents.py | 3 +++ backend/src/module/network/request_url.py | 4 ++-- backend/src/module/notification/plugin/telegram.py | 10 ++++++++-- backend/src/module/utils/cache_image.py | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/backend/src/module/network/request_contents.py b/backend/src/module/network/request_contents.py index 9ab927bb..2eff2276 100644 --- a/backend/src/module/network/request_contents.py +++ b/backend/src/module/network/request_contents.py @@ -55,6 +55,9 @@ class RequestContent(RequestURL): def post_data(self, _url, data: dict) -> dict: return self.post_url(_url, data) + def post_form(self, _url, data: dict, files: dict) -> dict: + return self.post_form(_url, data, files) + def get_html(self, _url): return self.get_url(_url).text diff --git a/backend/src/module/network/request_url.py b/backend/src/module/network/request_url.py index 4f813b54..d4e17395 100644 --- a/backend/src/module/network/request_url.py +++ b/backend/src/module/network/request_url.py @@ -72,10 +72,10 @@ class RequestURL: logger.debug(f"[Network] Cannot connect to {url}.") return False - def post_form(self, url: str, data: dict): + def post_form(self, url: str, data: dict, files): try: req = self.session.post( - url=url, headers=self.header, data=data, timeout=5 + url=url, headers=self.header, data=data, files=files, timeout=5 ) req.raise_for_status() return req diff --git a/backend/src/module/notification/plugin/telegram.py b/backend/src/module/notification/plugin/telegram.py index 36e6672e..dbd0c962 100644 --- a/backend/src/module/notification/plugin/telegram.py +++ b/backend/src/module/notification/plugin/telegram.py @@ -2,6 +2,7 @@ import logging from module.models import Notification from module.network import RequestContent +from module.utils import load_image logger = logging.getLogger(__name__) @@ -24,9 +25,14 @@ class TelegramNotification(RequestContent): data = { "chat_id": self.chat_id, "caption": text, - "photo": notify.poster_path, "disable_notification": True, } - resp = self.post_data(self.notification_url, data) + photo = load_image(notify.poster_path) + if photo: + resp = self.post_form( + self.notification_url, data, files={"photo": photo} + ) + else: + resp = self.post_data(self.notification_url, data) logger.debug(f"Telegram notification: {resp.status_code}") return resp.status_code == 200 diff --git a/backend/src/module/utils/cache_image.py b/backend/src/module/utils/cache_image.py index 2753f3e6..2ff8e553 100644 --- a/backend/src/module/utils/cache_image.py +++ b/backend/src/module/utils/cache_image.py @@ -10,5 +10,5 @@ def save_image(img, suffix): def load_image(img_path): - with open(f"data/images/{img_path}", "rb") as f: + with open(f"data/{img_path}", "rb") as f: return f.read() From 3acee793e4efe7d495bd39be80870f9e74bd5d9e Mon Sep 17 00:00:00 2001 From: DDSRem <1448139087@qq.com> Date: Wed, 4 Oct 2023 19:23:20 +0800 Subject: [PATCH 2/6] feat: provide complete program installation package --- .github/workflows/build.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 20374207..7cf0e08b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -226,7 +226,7 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: Download artifact + - name: Download artifact webui uses: actions/download-artifact@v3 with: name: dist @@ -236,6 +236,22 @@ jobs: run: | cd webui && ls -al && tree && zip -r dist.zip dist + - name: Download artifact app + uses: actions/download-artifact@v3 + with: + name: dist + path: backend/src/dist + + - name: Create Version info via tag + working-directory: ./backend/src + run: | + echo ${{ needs.version-info.outputs.version }} + echo "VERSION='${{ needs.version-info.outputs.version }}'" >> module/__version__.py + + - name: Zip app + run: | + cd backend && zip -r app.zip src + - name: Generate Release info id: release-info run: | @@ -257,6 +273,7 @@ jobs: prerelease: ${{ steps.release-info.outputs.pre_release == 'true' }} files: | webui/dist.zip + backend/app.zip env: GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} From d7fa7dd59229e58b3bb098da18cd570d74e62897 Mon Sep 17 00:00:00 2001 From: DDSRem <1448139087@qq.com> Date: Wed, 4 Oct 2023 19:34:34 +0800 Subject: [PATCH 3/6] feat: provide unraid template --- unraid.xml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 unraid.xml diff --git a/unraid.xml b/unraid.xml new file mode 100644 index 00000000..578cab05 --- /dev/null +++ b/unraid.xml @@ -0,0 +1,30 @@ + + + + AutoBangumi + estrellaxd/auto_bangumi:latest + https://registry.hub.docker.com/r/estrellaxd/auto_bangumi + bridge + MediaServer:Video Tools Productivity + + sh + false + https://github.com/EstrellaXD/Auto_Bangumi/issues + + + AutoBangumi 是基于 Mikan Project、qBittorrent 的全自动追番整理下载工具。只需要在 Mikan Project 上订阅番剧,就可以全自动追番。并且整理完成的名称和目录可以直接被 Plex、Jellyfin 等媒体库软件识别,无需二次刮削。 + + + http://[IP]:[PORT:7892]/ + + https://quantil.jsdelivr.net/gh/9bingyin/static@main/images/AutoBangumi.png + --dns 8.8.8.8 --dns 223.5.5.5 + + + + + + 7892 + /mnt/user/appdata/AutoBangumi/config + /mnt/user/appdata/AutoBangumi/data + \ No newline at end of file From 08e47fdbbca07e2ca614997c22cbdbbcade8ae9b Mon Sep 17 00:00:00 2001 From: DDSRem <1448139087@qq.com> Date: Wed, 4 Oct 2023 19:38:57 +0800 Subject: [PATCH 4/6] feat: add version number to app file --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7cf0e08b..6675a1f0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -250,7 +250,7 @@ jobs: - name: Zip app run: | - cd backend && zip -r app.zip src + cd backend && zip -r app-v${{ needs.version-info.outputs.version }}.zip src - name: Generate Release info id: release-info @@ -273,7 +273,7 @@ jobs: prerelease: ${{ steps.release-info.outputs.pre_release == 'true' }} files: | webui/dist.zip - backend/app.zip + backend/app-v${{ needs.version-info.outputs.version }}.zip env: GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} From 78c5ad0b18b0ad40a2fa27684aecb4dc7ff492a6 Mon Sep 17 00:00:00 2001 From: EstrellaXD Date: Wed, 4 Oct 2023 21:00:30 +0800 Subject: [PATCH 5/6] docs: move unraid.xml --- unraid.xml => docs/resource/unraid.xml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename unraid.xml => docs/resource/unraid.xml (100%) diff --git a/unraid.xml b/docs/resource/unraid.xml similarity index 100% rename from unraid.xml rename to docs/resource/unraid.xml From 2fe002bd458650a1f6c1c31bcb311ee545499931 Mon Sep 17 00:00:00 2001 From: DDSRem <1448139087@qq.com> Date: Wed, 4 Oct 2023 21:44:53 +0800 Subject: [PATCH 6/6] feat: add busybox-suid package --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 50925212..af83d197 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,10 +14,11 @@ COPY backend/requirements.txt . RUN set -ex && \ apk add --no-cache \ bash \ + busybox-suid \ python3 \ + py3-aiohttp \ py3-bcrypt \ py3-pip \ - py3-aiohttp \ su-exec \ shadow \ tini \