From 7288d5bdbae595d295508d4cb6ae3151956d9498 Mon Sep 17 00:00:00 2001 From: AkashiCoin Date: Tue, 3 Sep 2024 15:43:09 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E6=B7=BB=E5=8A=A0=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E7=9B=AE=E5=BD=95=E5=A4=9A=E8=8E=B7=E5=8F=96=E6=B8=A0?= =?UTF-8?q?=E9=81=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin_store/test_add_plugin.py | 25 +- tests/builtin_plugins/plugin_store/utils.py | 18 +- .../zhenxun_bot_plugins_tree.json | 1372 +++++++++++++++++ ....json => zhenxun_github_sub_metadata.json} | 0 .../plugin_store/zhenxun_github_sub_tree.json | 38 + .../builtin_plugins/plugin_store/config.py | 5 + .../plugin_store/data_source.py | 132 +- .../builtin_plugins/plugin_store/models.py | 183 ++- 8 files changed, 1644 insertions(+), 129 deletions(-) create mode 100644 tests/response/plugin_store/zhenxun_bot_plugins_tree.json rename tests/response/plugin_store/{github_sub_plugin_metadata.json => zhenxun_github_sub_metadata.json} (100%) create mode 100644 tests/response/plugin_store/zhenxun_github_sub_tree.json diff --git a/tests/builtin_plugins/plugin_store/test_add_plugin.py b/tests/builtin_plugins/plugin_store/test_add_plugin.py index a4abb327..c062895a 100644 --- a/tests/builtin_plugins/plugin_store/test_add_plugin.py +++ b/tests/builtin_plugins/plugin_store/test_add_plugin.py @@ -2,6 +2,7 @@ from typing import cast from pathlib import Path from collections.abc import Callable +import pytest from nonebug import App from respx import MockRouter from pytest_mock import MockerFixture @@ -14,7 +15,9 @@ from tests.config import BotId, UserId, GroupId, MessageId from tests.builtin_plugins.plugin_store.utils import init_mocked_api +@pytest.mark.parametrize("package_api", ["jsd", "gh"]) async def test_add_plugin_basic( + package_api: str, app: App, mocker: MockerFixture, mocked_api: MockRouter, @@ -32,6 +35,11 @@ async def test_add_plugin_basic( new=tmp_path / "zhenxun", ) + if package_api != "jsd": + mocked_api["zhenxun_bot_plugins_metadata"].respond(404) + if package_api != "gh": + mocked_api["zhenxun_bot_plugins_tree"].respond(404) + plugin_id = 1 async with app.test_matcher(_matcher) as ctx: @@ -61,12 +69,13 @@ async def test_add_plugin_basic( ) assert mocked_api["basic_plugins"].called assert mocked_api["extra_plugins"].called - assert mocked_api["zhenxun_bot_plugins_metadata"].called assert mocked_api["search_image_plugin_file_init"].called assert (mock_base_path / "plugins" / "search_image" / "__init__.py").is_file() +@pytest.mark.parametrize("package_api", ["jsd", "gh"]) async def test_add_plugin_basic_is_not_dir( + package_api: str, app: App, mocker: MockerFixture, mocked_api: MockRouter, @@ -84,6 +93,11 @@ async def test_add_plugin_basic_is_not_dir( new=tmp_path / "zhenxun", ) + if package_api != "jsd": + mocked_api["zhenxun_bot_plugins_metadata"].respond(404) + if package_api != "gh": + mocked_api["zhenxun_bot_plugins_tree"].respond(404) + plugin_id = 0 async with app.test_matcher(_matcher) as ctx: @@ -113,12 +127,13 @@ async def test_add_plugin_basic_is_not_dir( ) assert mocked_api["basic_plugins"].called assert mocked_api["extra_plugins"].called - assert mocked_api["zhenxun_bot_plugins_metadata"].called assert mocked_api["jitang_plugin_file"].called assert (mock_base_path / "plugins" / "alapi" / "jitang.py").is_file() +@pytest.mark.parametrize("package_api", ["jsd", "gh"]) async def test_add_plugin_extra( + package_api: str, app: App, mocker: MockerFixture, mocked_api: MockRouter, @@ -136,6 +151,11 @@ async def test_add_plugin_extra( new=tmp_path / "zhenxun", ) + if package_api != "jsd": + mocked_api["zhenxun_github_sub_metadata"].respond(404) + if package_api != "gh": + mocked_api["zhenxun_github_sub_tree"].respond(404) + plugin_id = 3 async with app.test_matcher(_matcher) as ctx: @@ -165,7 +185,6 @@ async def test_add_plugin_extra( ) assert mocked_api["basic_plugins"].called assert mocked_api["extra_plugins"].called - assert mocked_api["github_sub_plugin_metadata"].called assert mocked_api["github_sub_plugin_file_init"].called assert (mock_base_path / "plugins" / "github_sub" / "__init__.py").is_file() diff --git a/tests/builtin_plugins/plugin_store/utils.py b/tests/builtin_plugins/plugin_store/utils.py index 8792e980..4271d15f 100644 --- a/tests/builtin_plugins/plugin_store/utils.py +++ b/tests/builtin_plugins/plugin_store/utils.py @@ -17,14 +17,24 @@ def get_content_bytes(file: str) -> bytes: def init_mocked_api(mocked_api: MockRouter) -> None: - mocked_api.get( - "https://data.jsdelivr.com/v1/packages/gh/xuanerwa/zhenxun_github_sub@main", - name="github_sub_plugin_metadata", - ).respond(json=get_response_json("github_sub_plugin_metadata.json")) mocked_api.get( "https://data.jsdelivr.com/v1/packages/gh/zhenxun-org/zhenxun_bot_plugins@main", name="zhenxun_bot_plugins_metadata", ).respond(json=get_response_json("zhenxun_bot_plugins_metadata.json")) + mocked_api.get( + "https://data.jsdelivr.com/v1/packages/gh/xuanerwa/zhenxun_github_sub@main", + name="zhenxun_github_sub_metadata", + ).respond(json=get_response_json("zhenxun_github_sub_metadata.json")) + + mocked_api.get( + "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/main?recursive=1", + name="zhenxun_bot_plugins_tree", + ).respond(json=get_response_json("zhenxun_bot_plugins_tree.json")) + mocked_api.get( + "https://api.github.com/repos/xuanerwa/zhenxun_github_sub/git/trees/main?recursive=1", + name="zhenxun_github_sub_tree", + ).respond(json=get_response_json("zhenxun_github_sub_tree.json")) + mocked_api.head( "https://raw.githubusercontent.com/zhenxun-org/zhenxun_bot_plugins/main/plugins.json", name="head_basic_plugins", diff --git a/tests/response/plugin_store/zhenxun_bot_plugins_tree.json b/tests/response/plugin_store/zhenxun_bot_plugins_tree.json new file mode 100644 index 00000000..8924c488 --- /dev/null +++ b/tests/response/plugin_store/zhenxun_bot_plugins_tree.json @@ -0,0 +1,1372 @@ +{ + "sha": "af93a5425c039ee176207d0aceeeb43221a06e46", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/af93a5425c039ee176207d0aceeeb43221a06e46", + "tree": [ + { + "path": ".gitignore", + "mode": "100644", + "type": "blob", + "sha": "98bf2bb61a79b9b0cd4a51aea8bd21243b1b5fe2", + "size": 2967, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/98bf2bb61a79b9b0cd4a51aea8bd21243b1b5fe2" + }, + { + "path": "LICENSE", + "mode": "100644", + "type": "blob", + "sha": "0ad25db4bd1d86c452db3f9602ccdbe172438f52", + "size": 34523, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/0ad25db4bd1d86c452db3f9602ccdbe172438f52" + }, + { + "path": "README.md", + "mode": "100644", + "type": "blob", + "sha": "68498670cab18fb7c7beac28fa3aa917d772479b", + "size": 195, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/68498670cab18fb7c7beac28fa3aa917d772479b" + }, + { + "path": "plugins.json", + "mode": "100644", + "type": "blob", + "sha": "dcd858cc97fc06469b08b67d932fa143fd96275d", + "size": 23533, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/dcd858cc97fc06469b08b67d932fa143fd96275d" + }, + { + "path": "plugins", + "mode": "040000", + "type": "tree", + "sha": "780cade2ac406cd7ea33e1ed3915dfdc03151655", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/780cade2ac406cd7ea33e1ed3915dfdc03151655" + }, + { + "path": "plugins/ai", + "mode": "040000", + "type": "tree", + "sha": "60d1ed567fef497e99db3068f579812850e4f6a2", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/60d1ed567fef497e99db3068f579812850e4f6a2" + }, + { + "path": "plugins/ai/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "fec808b3349843eb3964d243a7574a52e13e5ae7", + "size": 2810, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/fec808b3349843eb3964d243a7574a52e13e5ae7" + }, + { + "path": "plugins/ai/data_source.py", + "mode": "100644", + "type": "blob", + "sha": "8c813c7d6428e3bf09b4f3f85c4ebf241527f780", + "size": 7401, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/8c813c7d6428e3bf09b4f3f85c4ebf241527f780" + }, + { + "path": "plugins/ai/utils.py", + "mode": "100644", + "type": "blob", + "sha": "e22d1fde9481cb8813abf80dc8768ffb196b870d", + "size": 5511, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/e22d1fde9481cb8813abf80dc8768ffb196b870d" + }, + { + "path": "plugins/alapi", + "mode": "040000", + "type": "tree", + "sha": "55ebd3fffa5b6830baf020901d7ccfdd1153064e", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/55ebd3fffa5b6830baf020901d7ccfdd1153064e" + }, + { + "path": "plugins/alapi/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "3efe41132d09b3195c32f0a31487eb8e4037cdcb", + "size": 284, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/3efe41132d09b3195c32f0a31487eb8e4037cdcb" + }, + { + "path": "plugins/alapi/_data_source.py", + "mode": "100644", + "type": "blob", + "sha": "61037ab9c96c7d8ab67f784903071426c18faa12", + "size": 919, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/61037ab9c96c7d8ab67f784903071426c18faa12" + }, + { + "path": "plugins/alapi/comments_163.py", + "mode": "100644", + "type": "blob", + "sha": "d05a5aa97fec302a5c863bbc4c09500279321c93", + "size": 1593, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/d05a5aa97fec302a5c863bbc4c09500279321c93" + }, + { + "path": "plugins/alapi/cover.py", + "mode": "100644", + "type": "blob", + "sha": "e26bf79cfd181ebe29ef07e89776d7a9b64dfa62", + "size": 1438, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/e26bf79cfd181ebe29ef07e89776d7a9b64dfa62" + }, + { + "path": "plugins/alapi/jitang.py", + "mode": "100644", + "type": "blob", + "sha": "63dc93e29ede6397f3cb445c28deac71e9671fac", + "size": 1411, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/63dc93e29ede6397f3cb445c28deac71e9671fac" + }, + { + "path": "plugins/alapi/poetry.py", + "mode": "100644", + "type": "blob", + "sha": "4d35949805e5c4b271fe077ba7df293ac2436b75", + "size": 1530, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/4d35949805e5c4b271fe077ba7df293ac2436b75" + }, + { + "path": "plugins/bilibili_sub", + "mode": "040000", + "type": "tree", + "sha": "236b6a8ce846884fb7dbb10aab58f95782844c27", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/236b6a8ce846884fb7dbb10aab58f95782844c27" + }, + { + "path": "plugins/bilibili_sub/README.md", + "mode": "100644", + "type": "blob", + "sha": "b05b281b72dc1276e176411f7167f5c7c52d90bb", + "size": 853, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/b05b281b72dc1276e176411f7167f5c7c52d90bb" + }, + { + "path": "plugins/bilibili_sub/Wbi.py", + "mode": "100644", + "type": "blob", + "sha": "7ee68e789125b110a5796eab05f1a3cf0b32e481", + "size": 2503, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/7ee68e789125b110a5796eab05f1a3cf0b32e481" + }, + { + "path": "plugins/bilibili_sub/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "2eec6bd0c8208e4026b0fe1400838c161ac826c4", + "size": 14302, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/2eec6bd0c8208e4026b0fe1400838c161ac826c4" + }, + { + "path": "plugins/bilibili_sub/auth.py", + "mode": "100644", + "type": "blob", + "sha": "0bf48390942a71070d8a176414e8131820ad60b4", + "size": 2490, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/0bf48390942a71070d8a176414e8131820ad60b4" + }, + { + "path": "plugins/bilibili_sub/data_source.py", + "mode": "100644", + "type": "blob", + "sha": "2140347d5338f945829a3c7ecf2931d059a2cf33", + "size": 15101, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/2140347d5338f945829a3c7ecf2931d059a2cf33" + }, + { + "path": "plugins/bilibili_sub/model.py", + "mode": "100644", + "type": "blob", + "sha": "3df5e9a4b180fa014daf5338a5de05f1f42fb514", + "size": 6855, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/3df5e9a4b180fa014daf5338a5de05f1f42fb514" + }, + { + "path": "plugins/bilibili_sub/utils.py", + "mode": "100644", + "type": "blob", + "sha": "6852ac0b05eb9e716e2eef3d0dcc35dd30992d6f", + "size": 7695, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/6852ac0b05eb9e716e2eef3d0dcc35dd30992d6f" + }, + { + "path": "plugins/black_word", + "mode": "040000", + "type": "tree", + "sha": "8e2b6575f72316ae549999d32c82781dff8dbfbb", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/8e2b6575f72316ae549999d32c82781dff8dbfbb" + }, + { + "path": "plugins/black_word/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "3b45b804e6504536bb50589c777bb429be61d487", + "size": 465, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/3b45b804e6504536bb50589c777bb429be61d487" + }, + { + "path": "plugins/black_word/black_watch.py", + "mode": "100644", + "type": "blob", + "sha": "133352a648f859c4ad9e95afe803744dd49cd016", + "size": 2116, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/133352a648f859c4ad9e95afe803744dd49cd016" + }, + { + "path": "plugins/black_word/black_word.py", + "mode": "100644", + "type": "blob", + "sha": "8164851f0cf4f9075fa6cea9525d44847739b7bc", + "size": 7451, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/8164851f0cf4f9075fa6cea9525d44847739b7bc" + }, + { + "path": "plugins/black_word/data_source.py", + "mode": "100644", + "type": "blob", + "sha": "e985facc2bd751061cb7e28de7b0160d7aa7ac26", + "size": 2818, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/e985facc2bd751061cb7e28de7b0160d7aa7ac26" + }, + { + "path": "plugins/black_word/model.py", + "mode": "100644", + "type": "blob", + "sha": "ef81c0ba751390cf9d500dfcb4c1a19a1c4944fe", + "size": 4754, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/ef81c0ba751390cf9d500dfcb4c1a19a1c4944fe" + }, + { + "path": "plugins/black_word/utils.py", + "mode": "100644", + "type": "blob", + "sha": "53526bd0d12466c9694835d28dcc3ec7c95bf713", + "size": 12896, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/53526bd0d12466c9694835d28dcc3ec7c95bf713" + }, + { + "path": "plugins/bt", + "mode": "040000", + "type": "tree", + "sha": "662f698152b52f405f4e4eae2ae3ae829df6d84e", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/662f698152b52f405f4e4eae2ae3ae829df6d84e" + }, + { + "path": "plugins/bt/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "3aff4f8b1e77c80324240d0c1d602fb5cf594c90", + "size": 2390, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/3aff4f8b1e77c80324240d0c1d602fb5cf594c90" + }, + { + "path": "plugins/bt/data_source.py", + "mode": "100644", + "type": "blob", + "sha": "ad02a5d5961ada54e018f56c90f6842a598b912a", + "size": 1786, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/ad02a5d5961ada54e018f56c90f6842a598b912a" + }, + { + "path": "plugins/check", + "mode": "040000", + "type": "tree", + "sha": "a334ab1bd11e8205294b054939bb08a3612ff627", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/a334ab1bd11e8205294b054939bb08a3612ff627" + }, + { + "path": "plugins/check/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "ee63b50dbee98d0bbfcad936fc8f2f688899b464", + "size": 1112, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/ee63b50dbee98d0bbfcad936fc8f2f688899b464" + }, + { + "path": "plugins/check/data_source.py", + "mode": "100644", + "type": "blob", + "sha": "78fbe7bae7c06cd2cd91bbc8cd47cfb83ec40833", + "size": 2612, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/78fbe7bae7c06cd2cd91bbc8cd47cfb83ec40833" + }, + { + "path": "plugins/coser.py", + "mode": "100644", + "type": "blob", + "sha": "90062d517b634456dd62bfdd9bab6fc5f65e14a7", + "size": 2803, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/90062d517b634456dd62bfdd9bab6fc5f65e14a7" + }, + { + "path": "plugins/dialogue", + "mode": "040000", + "type": "tree", + "sha": "612a62e9b02aa50821fb200d8c537720b5f05c2e", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/612a62e9b02aa50821fb200d8c537720b5f05c2e" + }, + { + "path": "plugins/dialogue/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "a99bc055851cb7b3c7f31fdb96d996d00ad0210a", + "size": 6551, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/a99bc055851cb7b3c7f31fdb96d996d00ad0210a" + }, + { + "path": "plugins/dialogue/_data_source.py", + "mode": "100644", + "type": "blob", + "sha": "440c8176ffed65e190afc6f51e363a586743d5af", + "size": 1098, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/440c8176ffed65e190afc6f51e363a586743d5af" + }, + { + "path": "plugins/draw_card", + "mode": "040000", + "type": "tree", + "sha": "e2d536d70d4f6290a0a4574c381715f5d581ee43", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/e2d536d70d4f6290a0a4574c381715f5d581ee43" + }, + { + "path": "plugins/draw_card/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "2aeeb30eb145b75fb6a0db9858e9be660e783849", + "size": 9788, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/2aeeb30eb145b75fb6a0db9858e9be660e783849" + }, + { + "path": "plugins/draw_card/config.py", + "mode": "100644", + "type": "blob", + "sha": "0aff3ef8b44f4489ec6a5e2caac2216e41e675c5", + "size": 5303, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/0aff3ef8b44f4489ec6a5e2caac2216e41e675c5" + }, + { + "path": "plugins/draw_card/count_manager.py", + "mode": "100644", + "type": "blob", + "sha": "7768b057c2ea57f272d792b8de59ca922f919e84", + "size": 4303, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/7768b057c2ea57f272d792b8de59ca922f919e84" + }, + { + "path": "plugins/draw_card/handles", + "mode": "040000", + "type": "tree", + "sha": "4ac777c06c5e9d6f238da1060c5afb52c3d7a330", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/4ac777c06c5e9d6f238da1060c5afb52c3d7a330" + }, + { + "path": "plugins/draw_card/handles/azur_handle.py", + "mode": "100644", + "type": "blob", + "sha": "67242a774fe7fd30f2e3c490b687bf1492c7d689", + "size": 12045, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/67242a774fe7fd30f2e3c490b687bf1492c7d689" + }, + { + "path": "plugins/draw_card/handles/ba_handle.py", + "mode": "100644", + "type": "blob", + "sha": "d347504af4911bb5d641d439e22cae3cde55a333", + "size": 5424, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/d347504af4911bb5d641d439e22cae3cde55a333" + }, + { + "path": "plugins/draw_card/handles/base_handle.py", + "mode": "100644", + "type": "blob", + "sha": "3483d246ed23aced34bab2873d2b2d08d898c4ed", + "size": 10314, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/3483d246ed23aced34bab2873d2b2d08d898c4ed" + }, + { + "path": "plugins/draw_card/handles/fgo_handle.py", + "mode": "100644", + "type": "blob", + "sha": "5acb8c5f7480ffffa013d7131f27d6f146250f23", + "size": 8350, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/5acb8c5f7480ffffa013d7131f27d6f146250f23" + }, + { + "path": "plugins/draw_card/handles/genshin_handle.py", + "mode": "100644", + "type": "blob", + "sha": "61edcf30f6657fc65675fab39dfe33d200ef6d58", + "size": 18911, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/61edcf30f6657fc65675fab39dfe33d200ef6d58" + }, + { + "path": "plugins/draw_card/handles/guardian_handle.py", + "mode": "100644", + "type": "blob", + "sha": "517f126d91c2f23e2f6dbbb8fd8c9e493c9ad76d", + "size": 15892, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/517f126d91c2f23e2f6dbbb8fd8c9e493c9ad76d" + }, + { + "path": "plugins/draw_card/handles/onmyoji_handle.py", + "mode": "100644", + "type": "blob", + "sha": "25d05c3889d364edd4ed469cba04f41dd3804422", + "size": 6342, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/25d05c3889d364edd4ed469cba04f41dd3804422" + }, + { + "path": "plugins/draw_card/handles/pcr_handle.py", + "mode": "100644", + "type": "blob", + "sha": "666a684267ff5c99ae0c4c97a6f51e4e96994824", + "size": 5474, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/666a684267ff5c99ae0c4c97a6f51e4e96994824" + }, + { + "path": "plugins/draw_card/handles/pretty_handle.py", + "mode": "100644", + "type": "blob", + "sha": "535e2b19dc34ec9d700e42463b41226b3d064b7a", + "size": 16883, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/535e2b19dc34ec9d700e42463b41226b3d064b7a" + }, + { + "path": "plugins/draw_card/handles/prts_handle.py", + "mode": "100644", + "type": "blob", + "sha": "18a86fc3aae1b7fade1fba0207a6b3bc8eab8314", + "size": 14831, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/18a86fc3aae1b7fade1fba0207a6b3bc8eab8314" + }, + { + "path": "plugins/draw_card/rule.py", + "mode": "100644", + "type": "blob", + "sha": "49746d95b6a26ac507717cddf1559b552dcbcbe2", + "size": 233, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/49746d95b6a26ac507717cddf1559b552dcbcbe2" + }, + { + "path": "plugins/draw_card/util.py", + "mode": "100644", + "type": "blob", + "sha": "d0cefc91cb0eb3cb85e89f11434d4507ef0c6d89", + "size": 1736, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/d0cefc91cb0eb3cb85e89f11434d4507ef0c6d89" + }, + { + "path": "plugins/epic", + "mode": "040000", + "type": "tree", + "sha": "a19b3af1c3af1f91f66eb9180678ecb39f5a2046", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/a19b3af1c3af1f91f66eb9180678ecb39f5a2046" + }, + { + "path": "plugins/epic/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "23c084aad72b9a550afb8d0a5235b1af43678235", + "size": 1442, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/23c084aad72b9a550afb8d0a5235b1af43678235" + }, + { + "path": "plugins/epic/data_source.py", + "mode": "100644", + "type": "blob", + "sha": "583221fe8fae749209fd621be12cb9e548798ad1", + "size": 9035, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/583221fe8fae749209fd621be12cb9e548798ad1" + }, + { + "path": "plugins/fudu.py", + "mode": "100644", + "type": "blob", + "sha": "4b08ae12ce0c6b0a40f4e98505f114a8ec187a0a", + "size": 4779, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/4b08ae12ce0c6b0a40f4e98505f114a8ec187a0a" + }, + { + "path": "plugins/gold_redbag", + "mode": "040000", + "type": "tree", + "sha": "b70f26667d85b8a3c5d9c604092864a698ab09c0", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/b70f26667d85b8a3c5d9c604092864a698ab09c0" + }, + { + "path": "plugins/gold_redbag/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "7e6a1c28536e05a8b90740df579125c1eeaabcb4", + "size": 12756, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/7e6a1c28536e05a8b90740df579125c1eeaabcb4" + }, + { + "path": "plugins/gold_redbag/config.py", + "mode": "100644", + "type": "blob", + "sha": "da8c0d396f330478b1ac97e80b1ff9037466f119", + "size": 12223, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/da8c0d396f330478b1ac97e80b1ff9037466f119" + }, + { + "path": "plugins/gold_redbag/data_source.py", + "mode": "100644", + "type": "blob", + "sha": "ecc7dd3808bc78ec581cfb3d96bbb662821b9a0f", + "size": 8240, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/ecc7dd3808bc78ec581cfb3d96bbb662821b9a0f" + }, + { + "path": "plugins/gold_redbag/model.py", + "mode": "100644", + "type": "blob", + "sha": "a8e9359a4a3233fb4b1f3731965108a14bcae6cd", + "size": 1995, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/a8e9359a4a3233fb4b1f3731965108a14bcae6cd" + }, + { + "path": "plugins/group_welcome_msg.py", + "mode": "100644", + "type": "blob", + "sha": "7148e8e9bfe6900911af1a3a8ac730365f7042bf", + "size": 1950, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/7148e8e9bfe6900911af1a3a8ac730365f7042bf" + }, + { + "path": "plugins/image_management", + "mode": "040000", + "type": "tree", + "sha": "cc09c37a1e4e5b6b49b931b79ab4577c279e141b", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/cc09c37a1e4e5b6b49b931b79ab4577c279e141b" + }, + { + "path": "plugins/image_management/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "f6fdde85f99dad6ab35a82e198b883d6ec862b37", + "size": 1968, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/f6fdde85f99dad6ab35a82e198b883d6ec862b37" + }, + { + "path": "plugins/image_management/_config.py", + "mode": "100644", + "type": "blob", + "sha": "d5e01f587db050fc9c7d1aac91adcdcea55fd200", + "size": 215, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/d5e01f587db050fc9c7d1aac91adcdcea55fd200" + }, + { + "path": "plugins/image_management/_data_source.py", + "mode": "100644", + "type": "blob", + "sha": "bc26b74f7133dc428cf03bee4a391bc1600bb560", + "size": 6322, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/bc26b74f7133dc428cf03bee4a391bc1600bb560" + }, + { + "path": "plugins/image_management/delete_image.py", + "mode": "100644", + "type": "blob", + "sha": "6cabb8e9df848690a4b81e79ffaf7754d0388b96", + "size": 3506, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/6cabb8e9df848690a4b81e79ffaf7754d0388b96" + }, + { + "path": "plugins/image_management/image_management_log.py", + "mode": "100644", + "type": "blob", + "sha": "756e58f25053ed4adeb2402e53eed69f10f54fce", + "size": 895, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/756e58f25053ed4adeb2402e53eed69f10f54fce" + }, + { + "path": "plugins/image_management/move_image.py", + "mode": "100644", + "type": "blob", + "sha": "6c1ec5e95fad95e4d728185345bde3873b529b42", + "size": 4697, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/6c1ec5e95fad95e4d728185345bde3873b529b42" + }, + { + "path": "plugins/image_management/send_image.py", + "mode": "100644", + "type": "blob", + "sha": "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "size": 0, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + }, + { + "path": "plugins/image_management/upload_image.py", + "mode": "100644", + "type": "blob", + "sha": "b69281a4f9eb781dd81324f5e6401c78ea211e81", + "size": 6690, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/b69281a4f9eb781dd81324f5e6401c78ea211e81" + }, + { + "path": "plugins/luxun.py", + "mode": "100644", + "type": "blob", + "sha": "1c1ab09c1353560e6dd4f092e45016076a34f648", + "size": 2254, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/1c1ab09c1353560e6dd4f092e45016076a34f648" + }, + { + "path": "plugins/mute", + "mode": "040000", + "type": "tree", + "sha": "04f58a6a69988418d0dbff1d8acbe2601fe51875", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/04f58a6a69988418d0dbff1d8acbe2601fe51875" + }, + { + "path": "plugins/mute/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "a11d4d39357fcf680d2c17cac8c49a2464a1b08b", + "size": 468, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/a11d4d39357fcf680d2c17cac8c49a2464a1b08b" + }, + { + "path": "plugins/mute/_data_source.py", + "mode": "100644", + "type": "blob", + "sha": "13c1cadf965c8d5c246480ac96c15e9e4187140d", + "size": 3891, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/13c1cadf965c8d5c246480ac96c15e9e4187140d" + }, + { + "path": "plugins/mute/mute_message.py", + "mode": "100644", + "type": "blob", + "sha": "e6946cd8440ea843fadbce348e3bb8064de3c46b", + "size": 2320, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/e6946cd8440ea843fadbce348e3bb8064de3c46b" + }, + { + "path": "plugins/mute/mute_setting.py", + "mode": "100644", + "type": "blob", + "sha": "b7947ed69035869b887ab1e90afb0c1732a00dd9", + "size": 4043, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/b7947ed69035869b887ab1e90afb0c1732a00dd9" + }, + { + "path": "plugins/nbnhhsh.py", + "mode": "100644", + "type": "blob", + "sha": "7ab78aaaddf9b75516520aac0f74f7014df63118", + "size": 1918, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/7ab78aaaddf9b75516520aac0f74f7014df63118" + }, + { + "path": "plugins/one_friend", + "mode": "040000", + "type": "tree", + "sha": "95c53cea06ec2bf1126704b5a9bd573838a27a9f", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/95c53cea06ec2bf1126704b5a9bd573838a27a9f" + }, + { + "path": "plugins/one_friend/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "7fa7c8bfd373f23fd515dee758c72244c6a2a307", + "size": 2952, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/7fa7c8bfd373f23fd515dee758c72244c6a2a307" + }, + { + "path": "plugins/open_cases", + "mode": "040000", + "type": "tree", + "sha": "d85300068342d8725fa60a5bd3fbd1918124be73", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/d85300068342d8725fa60a5bd3fbd1918124be73" + }, + { + "path": "plugins/open_cases/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "2798942e805c62437ed5f424c6fe509fd56a3db1", + "size": 11529, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/2798942e805c62437ed5f424c6fe509fd56a3db1" + }, + { + "path": "plugins/open_cases/build_image.py", + "mode": "100644", + "type": "blob", + "sha": "8b8db8e2e4518c2689a8870ce3454fc015370ed4", + "size": 6798, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/8b8db8e2e4518c2689a8870ce3454fc015370ed4" + }, + { + "path": "plugins/open_cases/command.py", + "mode": "100644", + "type": "blob", + "sha": "ea86c2fc65b4f04ede6200fda8a8f140845190de", + "size": 1913, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/ea86c2fc65b4f04ede6200fda8a8f140845190de" + }, + { + "path": "plugins/open_cases/config.py", + "mode": "100644", + "type": "blob", + "sha": "cefa7384d4dd783b6d6221238b072c4609d56e8b", + "size": 7343, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/cefa7384d4dd783b6d6221238b072c4609d56e8b" + }, + { + "path": "plugins/open_cases/models", + "mode": "040000", + "type": "tree", + "sha": "803a0682b01de9c453383a12ab24237e9657203d", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/803a0682b01de9c453383a12ab24237e9657203d" + }, + { + "path": "plugins/open_cases/models/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", + "size": 0, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" + }, + { + "path": "plugins/open_cases/models/buff_prices.py", + "mode": "100644", + "type": "blob", + "sha": "9f53de0e666453847d658a5a409696592292ef44", + "size": 536, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/9f53de0e666453847d658a5a409696592292ef44" + }, + { + "path": "plugins/open_cases/models/buff_skin.py", + "mode": "100644", + "type": "blob", + "sha": "7f51221a40d9d88344a31b814c68a46bbdc21e1c", + "size": 4211, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/7f51221a40d9d88344a31b814c68a46bbdc21e1c" + }, + { + "path": "plugins/open_cases/models/buff_skin_log.py", + "mode": "100644", + "type": "blob", + "sha": "ac9fec952ca30d4cb2691820936c9c35b662debc", + "size": 1531, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/ac9fec952ca30d4cb2691820936c9c35b662debc" + }, + { + "path": "plugins/open_cases/models/open_cases_log.py", + "mode": "100644", + "type": "blob", + "sha": "0c4f87bb6e061a19b039bc783fa8de0a72cc39f9", + "size": 1414, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/0c4f87bb6e061a19b039bc783fa8de0a72cc39f9" + }, + { + "path": "plugins/open_cases/models/open_cases_user.py", + "mode": "100644", + "type": "blob", + "sha": "3ed439372782ce4106c9b846ac29cda5c79d8e7c", + "size": 2160, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/3ed439372782ce4106c9b846ac29cda5c79d8e7c" + }, + { + "path": "plugins/open_cases/open_cases_c.py", + "mode": "100644", + "type": "blob", + "sha": "f56aa9fef6d1c2ec098017a065c999639add45b2", + "size": 17693, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/f56aa9fef6d1c2ec098017a065c999639add45b2" + }, + { + "path": "plugins/open_cases/utils.py", + "mode": "100644", + "type": "blob", + "sha": "6fda2265c909c5ac5e9bc8f94bcb9651fa92fd11", + "size": 24033, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/6fda2265c909c5ac5e9bc8f94bcb9651fa92fd11" + }, + { + "path": "plugins/parse_bilibili", + "mode": "040000", + "type": "tree", + "sha": "f5cfedda6a64b13e02c16eff90ed61c23be168c7", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/f5cfedda6a64b13e02c16eff90ed61c23be168c7" + }, + { + "path": "plugins/parse_bilibili/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "dc43ec611c931c41176126a0a59e7d87791adab8", + "size": 7975, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/dc43ec611c931c41176126a0a59e7d87791adab8" + }, + { + "path": "plugins/parse_bilibili/get_image.py", + "mode": "100644", + "type": "blob", + "sha": "3b8c70c86aee56f7c33e070d4b7f8c7a62f2beda", + "size": 3958, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/3b8c70c86aee56f7c33e070d4b7f8c7a62f2beda" + }, + { + "path": "plugins/parse_bilibili/information_container.py", + "mode": "100644", + "type": "blob", + "sha": "ddb685f8bcd9b5becd06dca6a4f07b7d63f40167", + "size": 1221, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/ddb685f8bcd9b5becd06dca6a4f07b7d63f40167" + }, + { + "path": "plugins/parse_bilibili/parse_url.py", + "mode": "100644", + "type": "blob", + "sha": "b4e2a1fe4a63a79270be39d29462c11b11295111", + "size": 2249, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/b4e2a1fe4a63a79270be39d29462c11b11295111" + }, + { + "path": "plugins/pid_search.py", + "mode": "100644", + "type": "blob", + "sha": "97fc4d40f18877f7896471001d6f3b4a2cec2300", + "size": 4661, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/97fc4d40f18877f7896471001d6f3b4a2cec2300" + }, + { + "path": "plugins/pix_gallery", + "mode": "040000", + "type": "tree", + "sha": "aaa0152da0e592c4ef2e2971f5745754a71bb5c8", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/aaa0152da0e592c4ef2e2971f5745754a71bb5c8" + }, + { + "path": "plugins/pix_gallery/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "7dd5fa99506d5948d58301d3648ea94f974889e1", + "size": 2129, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/7dd5fa99506d5948d58301d3648ea94f974889e1" + }, + { + "path": "plugins/pix_gallery/_data_source.py", + "mode": "100644", + "type": "blob", + "sha": "7e9db22194708c254bb8378f5d081ded231bd65f", + "size": 14012, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/7e9db22194708c254bb8378f5d081ded231bd65f" + }, + { + "path": "plugins/pix_gallery/_model", + "mode": "040000", + "type": "tree", + "sha": "a4736e1bf36097384def6dae4bf4688567c168d7", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/a4736e1bf36097384def6dae4bf4688567c168d7" + }, + { + "path": "plugins/pix_gallery/_model/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "8b137891791fe96927ad78e64b0aad7bded08bdc", + "size": 1, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/8b137891791fe96927ad78e64b0aad7bded08bdc" + }, + { + "path": "plugins/pix_gallery/_model/omega_pixiv_illusts.py", + "mode": "100644", + "type": "blob", + "sha": "17e2156c4dda0b6d883b690a65449348cc91ad47", + "size": 2655, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/17e2156c4dda0b6d883b690a65449348cc91ad47" + }, + { + "path": "plugins/pix_gallery/_model/pixiv.py", + "mode": "100644", + "type": "blob", + "sha": "3451781df41ed3de925be513c2600c96c3c19e14", + "size": 2608, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/3451781df41ed3de925be513c2600c96c3c19e14" + }, + { + "path": "plugins/pix_gallery/_model/pixiv_keyword_user.py", + "mode": "100644", + "type": "blob", + "sha": "5de544a5d5360dc33ec236b89e2f23f7b28775e4", + "size": 1717, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/5de544a5d5360dc33ec236b89e2f23f7b28775e4" + }, + { + "path": "plugins/pix_gallery/pix.py", + "mode": "100644", + "type": "blob", + "sha": "2f8d25c386012dcb2d56fc109e1df8d6f8b75e3a", + "size": 8915, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/2f8d25c386012dcb2d56fc109e1df8d6f8b75e3a" + }, + { + "path": "plugins/pix_gallery/pix_add_keyword.py", + "mode": "100644", + "type": "blob", + "sha": "452213e3bcc501f31b1454a061a6048f39921f2b", + "size": 4722, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/452213e3bcc501f31b1454a061a6048f39921f2b" + }, + { + "path": "plugins/pix_gallery/pix_pass_del_keyword.py", + "mode": "100644", + "type": "blob", + "sha": "9a8f2ea774446880612edc21d72c1502439f66ee", + "size": 7558, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/9a8f2ea774446880612edc21d72c1502439f66ee" + }, + { + "path": "plugins/pix_gallery/pix_show_info.py", + "mode": "100644", + "type": "blob", + "sha": "cb1cbf2a9efc5ff23d0f798124b7faf0a6125943", + "size": 3172, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/cb1cbf2a9efc5ff23d0f798124b7faf0a6125943" + }, + { + "path": "plugins/pix_gallery/pix_update.py", + "mode": "100644", + "type": "blob", + "sha": "b0f209dc016d610a5fb51c3fbbd6a47c251b9e3c", + "size": 8134, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/b0f209dc016d610a5fb51c3fbbd6a47c251b9e3c" + }, + { + "path": "plugins/pixiv_rank_search", + "mode": "040000", + "type": "tree", + "sha": "17665e6505c0255a9d4d4c1371641127b9a83eb9", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/17665e6505c0255a9d4d4c1371641127b9a83eb9" + }, + { + "path": "plugins/pixiv_rank_search/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "01945cd85acb629a20c08a9ac75030aa0865bba5", + "size": 7377, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/01945cd85acb629a20c08a9ac75030aa0865bba5" + }, + { + "path": "plugins/pixiv_rank_search/data_source.py", + "mode": "100644", + "type": "blob", + "sha": "761a93f20eba886122c134c7e6d2df884a0d9dc7", + "size": 5585, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/761a93f20eba886122c134c7e6d2df884a0d9dc7" + }, + { + "path": "plugins/poke", + "mode": "040000", + "type": "tree", + "sha": "88decde53947fc3cae4d95b7ec9105e4c8bb37f8", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/88decde53947fc3cae4d95b7ec9105e4c8bb37f8" + }, + { + "path": "plugins/poke/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "38dafc82466013c5f3fa00d3609c55f000afd2cf", + "size": 3319, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/38dafc82466013c5f3fa00d3609c55f000afd2cf" + }, + { + "path": "plugins/quotations.py", + "mode": "100644", + "type": "blob", + "sha": "e213ee04d6196c5b34892c7699851e7477cafcb1", + "size": 1112, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/e213ee04d6196c5b34892c7699851e7477cafcb1" + }, + { + "path": "plugins/roll.py", + "mode": "100644", + "type": "blob", + "sha": "1c21421b648123a3bbe29c093c63bddf9523cdb6", + "size": 2217, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/1c21421b648123a3bbe29c093c63bddf9523cdb6" + }, + { + "path": "plugins/russian", + "mode": "040000", + "type": "tree", + "sha": "a284de1ceeaa4c483a5e61e328d2722f15eb37bf", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/a284de1ceeaa4c483a5e61e328d2722f15eb37bf" + }, + { + "path": "plugins/russian/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "d91323c73ca65d6380d4556d542a2399c9da4728", + "size": 7545, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/d91323c73ca65d6380d4556d542a2399c9da4728" + }, + { + "path": "plugins/russian/command.py", + "mode": "100644", + "type": "blob", + "sha": "de9d186cbad0316cac75e39d68526aa1605bf4b9", + "size": 2259, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/de9d186cbad0316cac75e39d68526aa1605bf4b9" + }, + { + "path": "plugins/russian/data_source.py", + "mode": "100644", + "type": "blob", + "sha": "73cdb078bd700ecf5744eb73c1cdee5ce0839192", + "size": 20332, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/73cdb078bd700ecf5744eb73c1cdee5ce0839192" + }, + { + "path": "plugins/russian/model.py", + "mode": "100644", + "type": "blob", + "sha": "0fab9298c9ad713dac6292da0bec68c96ce883cc", + "size": 3633, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/0fab9298c9ad713dac6292da0bec68c96ce883cc" + }, + { + "path": "plugins/search_anime", + "mode": "040000", + "type": "tree", + "sha": "b65e7639bc2dc2e4b5383333af10034161b10388", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/b65e7639bc2dc2e4b5383333af10034161b10388" + }, + { + "path": "plugins/search_anime/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "d12ad03ecf39f9897aace7235ed2cf918f1e4540", + "size": 2291, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/d12ad03ecf39f9897aace7235ed2cf918f1e4540" + }, + { + "path": "plugins/search_anime/data_source.py", + "mode": "100644", + "type": "blob", + "sha": "59d0ac6159e429f1a31450559ab072d8ef8e483f", + "size": 1810, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/59d0ac6159e429f1a31450559ab072d8ef8e483f" + }, + { + "path": "plugins/search_buff_skin_price", + "mode": "040000", + "type": "tree", + "sha": "36b3f5e8a80056bc3e334f72640fec1c0af39418", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/36b3f5e8a80056bc3e334f72640fec1c0af39418" + }, + { + "path": "plugins/search_buff_skin_price/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "ca2a320fa66a8cb7a7ca9b91a1a061d3fa459a09", + "size": 3387, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/ca2a320fa66a8cb7a7ca9b91a1a061d3fa459a09" + }, + { + "path": "plugins/search_buff_skin_price/data_source.py", + "mode": "100644", + "type": "blob", + "sha": "8dbe6a596286e8db8b9e026a1c81cf076c4b5448", + "size": 2188, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/8dbe6a596286e8db8b9e026a1c81cf076c4b5448" + }, + { + "path": "plugins/search_image", + "mode": "040000", + "type": "tree", + "sha": "53a699804e22730f01ae09b8cc8a1ebe1398c28d", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/53a699804e22730f01ae09b8cc8a1ebe1398c28d" + }, + { + "path": "plugins/search_image/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "38e86de0caafe6c3e88d973fb5c4bc9d1430d213", + "size": 3010, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/38e86de0caafe6c3e88d973fb5c4bc9d1430d213" + }, + { + "path": "plugins/send_setu_", + "mode": "040000", + "type": "tree", + "sha": "113028d9c4100b30b2996c39c0324d05b242464f", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/113028d9c4100b30b2996c39c0324d05b242464f" + }, + { + "path": "plugins/send_setu_/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "eb35e275dae8dab8d2bc4145146ee3f1fe5c1b78", + "size": 101, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/eb35e275dae8dab8d2bc4145146ee3f1fe5c1b78" + }, + { + "path": "plugins/send_setu_/_model.py", + "mode": "100644", + "type": "blob", + "sha": "865af7d13c368cfaf8a90e0747652ad912519810", + "size": 2580, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/865af7d13c368cfaf8a90e0747652ad912519810" + }, + { + "path": "plugins/send_setu_/send_setu", + "mode": "040000", + "type": "tree", + "sha": "e68acc01dbf796c0f1eee93e4d9992dfc09cbe36", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/e68acc01dbf796c0f1eee93e4d9992dfc09cbe36" + }, + { + "path": "plugins/send_setu_/send_setu/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "fea1ad41ef615c6d1cabd06a49c412075560cf4d", + "size": 8491, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/fea1ad41ef615c6d1cabd06a49c412075560cf4d" + }, + { + "path": "plugins/send_setu_/send_setu/_data_source.py", + "mode": "100644", + "type": "blob", + "sha": "a860aa0629678e7f774b7ef74951458c328ee81e", + "size": 12839, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/a860aa0629678e7f774b7ef74951458c328ee81e" + }, + { + "path": "plugins/send_setu_/update_setu", + "mode": "040000", + "type": "tree", + "sha": "ddcc0dfe51ba6a7a0c34c6acbbedb175c2cf8c6c", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/ddcc0dfe51ba6a7a0c34c6acbbedb175c2cf8c6c" + }, + { + "path": "plugins/send_setu_/update_setu/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "2b5b6ae93d952646fdbf271b64212018d6da7ce6", + "size": 1854, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/2b5b6ae93d952646fdbf271b64212018d6da7ce6" + }, + { + "path": "plugins/send_setu_/update_setu/data_source.py", + "mode": "100644", + "type": "blob", + "sha": "07d217d6ed53e7e9ad7ba69c560bb1196d74d5f3", + "size": 7551, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/07d217d6ed53e7e9ad7ba69c560bb1196d74d5f3" + }, + { + "path": "plugins/send_voice", + "mode": "040000", + "type": "tree", + "sha": "9ebdbf817f193e02f99bfd40206cad3603749168", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/9ebdbf817f193e02f99bfd40206cad3603749168" + }, + { + "path": "plugins/send_voice/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "eb35e275dae8dab8d2bc4145146ee3f1fe5c1b78", + "size": 101, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/eb35e275dae8dab8d2bc4145146ee3f1fe5c1b78" + }, + { + "path": "plugins/send_voice/dinggong.py", + "mode": "100644", + "type": "blob", + "sha": "a01129ca1d0a6081df09e4411a7babc6f3c44a1a", + "size": 1595, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/a01129ca1d0a6081df09e4411a7babc6f3c44a1a" + }, + { + "path": "plugins/translate", + "mode": "040000", + "type": "tree", + "sha": "44d79a31ab9a00d2ea01801968bff5192bc81976", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/44d79a31ab9a00d2ea01801968bff5192bc81976" + }, + { + "path": "plugins/translate/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "372a57740d2341e9aa460e74d09548ebf317ae09", + "size": 3067, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/372a57740d2341e9aa460e74d09548ebf317ae09" + }, + { + "path": "plugins/translate/data_source.py", + "mode": "100644", + "type": "blob", + "sha": "a7a3018d0d75379b6a5d74d5b8d808f1b2b39350", + "size": 2049, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/a7a3018d0d75379b6a5d74d5b8d808f1b2b39350" + }, + { + "path": "plugins/wbtop", + "mode": "040000", + "type": "tree", + "sha": "d87a6fab1133ca86eeade93cdd149a279385fcab", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/d87a6fab1133ca86eeade93cdd149a279385fcab" + }, + { + "path": "plugins/wbtop/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "fce1b99540d3b81903f356b9157b97fbe166c287", + "size": 1906, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/fce1b99540d3b81903f356b9157b97fbe166c287" + }, + { + "path": "plugins/wbtop/data_source.py", + "mode": "100644", + "type": "blob", + "sha": "e9c206273fd1f46ceb6d2b1e276d80f0e97ad145", + "size": 2203, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/e9c206273fd1f46ceb6d2b1e276d80f0e97ad145" + }, + { + "path": "plugins/what_anime", + "mode": "040000", + "type": "tree", + "sha": "a43f876cccb0e60c5360b5382ce9f6311d924c3c", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/a43f876cccb0e60c5360b5382ce9f6311d924c3c" + }, + { + "path": "plugins/what_anime/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "d3b918760566cebae8685022923ee9cfdafa4d91", + "size": 1825, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/d3b918760566cebae8685022923ee9cfdafa4d91" + }, + { + "path": "plugins/what_anime/data_source.py", + "mode": "100644", + "type": "blob", + "sha": "15801f624f6298e33b6f5423c68d1d7110be4a6f", + "size": 1883, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/15801f624f6298e33b6f5423c68d1d7110be4a6f" + }, + { + "path": "plugins/word_bank", + "mode": "040000", + "type": "tree", + "sha": "9437ca1b8da4360fb24aac46c037f98fdcc768ef", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/9437ca1b8da4360fb24aac46c037f98fdcc768ef" + }, + { + "path": "plugins/word_bank/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "519a269a7aa377a0be8755142e9223aeff96d5fd", + "size": 724, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/519a269a7aa377a0be8755142e9223aeff96d5fd" + }, + { + "path": "plugins/word_bank/_command.py", + "mode": "100644", + "type": "blob", + "sha": "7dae391a25b418530c539f16c61baa18f415d7ae", + "size": 1122, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/7dae391a25b418530c539f16c61baa18f415d7ae" + }, + { + "path": "plugins/word_bank/_config.py", + "mode": "100644", + "type": "blob", + "sha": "72c4c584f01e158e4d9f6b250ccf8078abf8abae", + "size": 763, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/72c4c584f01e158e4d9f6b250ccf8078abf8abae" + }, + { + "path": "plugins/word_bank/_data_source.py", + "mode": "100644", + "type": "blob", + "sha": "03bc28709c2c38408d130c218775f7f82ae02458", + "size": 9712, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/03bc28709c2c38408d130c218775f7f82ae02458" + }, + { + "path": "plugins/word_bank/_model.py", + "mode": "100644", + "type": "blob", + "sha": "eb00610d6863cc02dbf0390753213e2cd4fe3816", + "size": 20494, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/eb00610d6863cc02dbf0390753213e2cd4fe3816" + }, + { + "path": "plugins/word_bank/_rule.py", + "mode": "100644", + "type": "blob", + "sha": "f64daa75fe7b200c65af02b98f6198f5d1f492ba", + "size": 1979, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/f64daa75fe7b200c65af02b98f6198f5d1f492ba" + }, + { + "path": "plugins/word_bank/message_handle.py", + "mode": "100644", + "type": "blob", + "sha": "07a4b518f18a3c58076eb2e307d56ecb6e829722", + "size": 959, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/07a4b518f18a3c58076eb2e307d56ecb6e829722" + }, + { + "path": "plugins/word_bank/read_word_bank.py", + "mode": "100644", + "type": "blob", + "sha": "bc655e5d298c49a57079e49a5441b2ab4a4d1448", + "size": 2863, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/bc655e5d298c49a57079e49a5441b2ab4a4d1448" + }, + { + "path": "plugins/word_bank/word_handle.py", + "mode": "100644", + "type": "blob", + "sha": "4917229f3a71138b43b9d27a49144f0afcb404e3", + "size": 11914, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/4917229f3a71138b43b9d27a49144f0afcb404e3" + }, + { + "path": "plugins/word_clouds", + "mode": "040000", + "type": "tree", + "sha": "26ae75043fdc51b1e570d3db2df617e1f0e8540e", + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/trees/26ae75043fdc51b1e570d3db2df617e1f0e8540e" + }, + { + "path": "plugins/word_clouds/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "c9873adef7c988847bb23e95d0b0361eb336ef1c", + "size": 6787, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/c9873adef7c988847bb23e95d0b0361eb336ef1c" + }, + { + "path": "plugins/word_clouds/command.py", + "mode": "100644", + "type": "blob", + "sha": "3b03044fd1027cc52849e82ac0f5585f6268b184", + "size": 933, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/3b03044fd1027cc52849e82ac0f5585f6268b184" + }, + { + "path": "plugins/word_clouds/data_source.py", + "mode": "100644", + "type": "blob", + "sha": "fd6fda73fcece4f552c12bf639b3f10460befeab", + "size": 4089, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/fd6fda73fcece4f552c12bf639b3f10460befeab" + }, + { + "path": "plugins/word_clouds/requirement.txt", + "mode": "100644", + "type": "blob", + "sha": "8e022688417114d01ea440354dea9c60e1c50799", + "size": 30, + "url": "https://api.github.com/repos/zhenxun-org/zhenxun_bot_plugins/git/blobs/8e022688417114d01ea440354dea9c60e1c50799" + } + ], + "truncated": false +} diff --git a/tests/response/plugin_store/github_sub_plugin_metadata.json b/tests/response/plugin_store/zhenxun_github_sub_metadata.json similarity index 100% rename from tests/response/plugin_store/github_sub_plugin_metadata.json rename to tests/response/plugin_store/zhenxun_github_sub_metadata.json diff --git a/tests/response/plugin_store/zhenxun_github_sub_tree.json b/tests/response/plugin_store/zhenxun_github_sub_tree.json new file mode 100644 index 00000000..75c38a54 --- /dev/null +++ b/tests/response/plugin_store/zhenxun_github_sub_tree.json @@ -0,0 +1,38 @@ +{ + "sha": "438298b9e88f9dafa7020e99d7c7b4c98f93aea6", + "url": "https://api.github.com/repos/xuanerwa/zhenxun_github_sub/git/trees/438298b9e88f9dafa7020e99d7c7b4c98f93aea6", + "tree": [ + { + "path": "LICENSE", + "mode": "100644", + "type": "blob", + "sha": "f288702d2fa16d3cdf0035b15a9fcbc552cd88e7", + "size": 35149, + "url": "https://api.github.com/repos/xuanerwa/zhenxun_github_sub/git/blobs/f288702d2fa16d3cdf0035b15a9fcbc552cd88e7" + }, + { + "path": "README.md", + "mode": "100644", + "type": "blob", + "sha": "e974cfc9b973d4a041f03e693ea20563a933b7ca", + "size": 955, + "url": "https://api.github.com/repos/xuanerwa/zhenxun_github_sub/git/blobs/e974cfc9b973d4a041f03e693ea20563a933b7ca" + }, + { + "path": "github_sub", + "mode": "040000", + "type": "tree", + "sha": "0f7d76bcf472e2ab0610fa542b067633d6e3ae7e", + "url": "https://api.github.com/repos/xuanerwa/zhenxun_github_sub/git/trees/0f7d76bcf472e2ab0610fa542b067633d6e3ae7e" + }, + { + "path": "github_sub/__init__.py", + "mode": "100644", + "type": "blob", + "sha": "7d17fd49fe82fa3897afcef61b2c694ed93a4ba3", + "size": 7551, + "url": "https://api.github.com/repos/xuanerwa/zhenxun_github_sub/git/blobs/7d17fd49fe82fa3897afcef61b2c694ed93a4ba3" + } + ], + "truncated": false +} diff --git a/zhenxun/builtin_plugins/plugin_store/config.py b/zhenxun/builtin_plugins/plugin_store/config.py index e7424d8e..94922b09 100644 --- a/zhenxun/builtin_plugins/plugin_store/config.py +++ b/zhenxun/builtin_plugins/plugin_store/config.py @@ -20,3 +20,8 @@ JSD_PACKAGE_API_FORMAT = ( "https://data.jsdelivr.com/v1/packages/gh/{owner}/{repo}@{branch}" ) """jsdelivr包地址格式""" + +GIT_API_TREES_FORMAT = ( + "https://api.github.com/repos/{owner}/{repo}/git/trees/{branch}?recursive=1" +) +"""git api trees地址格式""" diff --git a/zhenxun/builtin_plugins/plugin_store/data_source.py b/zhenxun/builtin_plugins/plugin_store/data_source.py index 38bb69b4..fa043b86 100644 --- a/zhenxun/builtin_plugins/plugin_store/data_source.py +++ b/zhenxun/builtin_plugins/plugin_store/data_source.py @@ -12,18 +12,13 @@ from zhenxun.utils.image_utils import RowStyle, BuildImage, ImageTemplate from zhenxun.builtin_plugins.auto_update.config import REQ_TXT_FILE_STRING from zhenxun.builtin_plugins.plugin_store.models import ( FileInfo, - FileType, RepoInfo, - JsdPackageInfo, + TreesInfo, + PackageApi, StorePluginInfo, ) -from .config import ( - BASE_PATH, - EXTRA_GITHUB_URL, - DEFAULT_GITHUB_URL, - JSD_PACKAGE_API_FORMAT, -) +from .config import BASE_PATH, EXTRA_GITHUB_URL, DEFAULT_GITHUB_URL def row_style(column: str, text: str) -> RowStyle: @@ -42,67 +37,6 @@ def row_style(column: str, text: str) -> RowStyle: return style -def full_files_path( - jsd_package_info: JsdPackageInfo, module_path: str, is_dir: bool = True -) -> list[FileInfo]: - """ - 获取文件路径 - - 参数: - jsd_package_info: JsdPackageInfo - module_path: 模块路径 - is_dir: 是否为目录 - - 返回: - list[FileInfo]: 文件路径 - """ - paths: list[str] = module_path.split(".") - cur_files: list[FileInfo] = jsd_package_info.files - for path in paths: - for cur_file in cur_files: - if ( - cur_file.type == FileType.DIR - and cur_file.name == path - and cur_file.files - and (is_dir or path != paths[-1]) - ): - cur_files = cur_file.files - break - if not is_dir and path == paths[-1] and cur_file.name.split(".")[0] == path: - return cur_files - else: - raise ValueError(f"模块路径 {module_path} 不存在") - return cur_files - - -def recurrence_files( - files: list[FileInfo], dir_path: str, is_dir: bool = True -) -> list[str]: - """ - 递归获取文件路径 - - 参数: - files: 文件列表 - dir_path: 目录路径 - is_dir: 是否为目录 - - 返回: - list[str]: 文件路径 - """ - paths = [] - for file in files: - if is_dir and file.type == FileType.DIR and file.files: - paths.extend( - recurrence_files(file.files, f"{dir_path}/{file.name}", is_dir) - ) - elif file.type == FileType.FILE: - if dir_path.endswith(file.name): - paths.append(dir_path) - elif is_dir: - paths.append(f"{dir_path}/{file.name}") - return paths - - def install_requirement(plugin_path: Path): requirement_files = ["requirement.txt", "requirements.txt"] requirement_paths = [plugin_path / file for file in requirement_files] @@ -274,40 +208,30 @@ class ShopManage: ) return f"插件 {plugin_key} 安装成功! 重启后生效" - @classmethod - async def get_repo_package_info_of_jsd(cls, repo_info: RepoInfo) -> JsdPackageInfo: - """获取插件包信息 - - 参数: - repo_info: 仓库信息 - - 返回: - JsdPackageInfo: 插件包信息 - """ - jsd_package_url: str = JSD_PACKAGE_API_FORMAT.format( - owner=repo_info.owner, repo=repo_info.repo, branch=repo_info.branch - ) - res = await AsyncHttpx.get(url=jsd_package_url) - if res.status_code != 200: - raise ValueError(f"下载错误, code: {res.status_code}") - return JsdPackageInfo(**res.json()) - @classmethod async def install_plugin_with_repo( cls, github_url: str, module_path: str, is_dir: bool, is_external: bool = False ): + package_api: PackageApi + files: list[str] + package_info: FileInfo | TreesInfo repo_info = RepoInfo.parse_github_url(github_url) logger.debug(f"成功获取仓库信息: {repo_info}", "插件管理") - jsd_package_info: JsdPackageInfo = await cls.get_repo_package_info_of_jsd( - repo_info=repo_info + for package_api in PackageApi: + try: + package_info = await package_api.value.parse_repo_info(repo_info) + break + except Exception as e: + logger.warning( + f"获取插件文件失败: {e} | API类型: {package_api.value}", "插件管理" + ) + continue + else: + raise ValueError("所有API获取插件文件失败,请检查网络连接") + files = package_info.get_files( + module_path=module_path.replace(".", "/") + ("" if is_dir else ".py"), + is_dir=is_dir, ) - files = full_files_path(jsd_package_info, module_path, is_dir) - files = recurrence_files( - files, - module_path.replace(".", "/") + ("" if is_dir else ".py"), - is_dir, - ) - logger.debug(f"获取插件文件列表: {files}", "插件管理") download_urls = [ await repo_info.get_download_url_with_path(file) for file in files ] @@ -321,12 +245,8 @@ class ShopManage: else: # 安装依赖 plugin_path = base_path / "/".join(module_path.split(".")) - req_files = recurrence_files( - jsd_package_info.files, REQ_TXT_FILE_STRING, False - ) - req_files.extend( - recurrence_files(jsd_package_info.files, "requirement.txt", False) - ) + req_files = package_info.get_files(REQ_TXT_FILE_STRING, False) + req_files.extend(package_info.get_files("requirement.txt", False)) logger.debug(f"获取插件依赖文件列表: {req_files}", "插件管理") req_download_urls = [ await repo_info.get_download_url_with_path(file) for file in req_files @@ -357,11 +277,11 @@ class ShopManage: 返回: str: 返回消息 """ - data = await cls.__get_data() + data: dict[str, StorePluginInfo] = await cls.__get_data() if plugin_id < 0 or plugin_id >= len(data): return "插件ID不存在..." plugin_key = list(data.keys())[plugin_id] - plugin_info = data[plugin_key] + plugin_info = data[plugin_key] # type: ignore path = BASE_PATH if plugin_info.github_url: path = BASE_PATH / "plugins" @@ -388,7 +308,7 @@ class ShopManage: 返回: BuildImage | str: 返回消息 """ - data = await cls.__get_data() + data: dict[str, StorePluginInfo] = await cls.__get_data() plugin_list = await cls.get_loaded_plugins("module", "version") suc_plugin = {p[0]: (p[1] or "Unknown") for p in plugin_list} filtered_data = [ @@ -431,7 +351,7 @@ class ShopManage: 返回: str: 返回消息 """ - data = await cls.__get_data() + data: dict[str, StorePluginInfo] = await cls.__get_data() if plugin_id < 0 or plugin_id >= len(data): return "插件ID不存在..." plugin_key = list(data.keys())[plugin_id] diff --git a/zhenxun/builtin_plugins/plugin_store/models.py b/zhenxun/builtin_plugins/plugin_store/models.py index 8f59827d..6cd016ba 100644 --- a/zhenxun/builtin_plugins/plugin_store/models.py +++ b/zhenxun/builtin_plugins/plugin_store/models.py @@ -1,11 +1,18 @@ +from enum import Enum +from abc import ABC, abstractmethod + from aiocache import cached from strenum import StrEnum -from pydantic import BaseModel, validator +from pydantic import BaseModel from zhenxun.utils.enum import PluginType from zhenxun.utils.http_utils import AsyncHttpx -from .config import GITHUB_REPO_URL_PATTERN +from .config import ( + GIT_API_TREES_FORMAT, + JSD_PACKAGE_API_FORMAT, + GITHUB_REPO_URL_PATTERN, +) type2name: dict[str, str] = { "NORMAL": "普通插件", @@ -40,11 +47,7 @@ class RepoInfo(BaseModel): owner: str repo: str - branch: str | None - - @validator("branch", pre=True, always=True) - def _set_default_branch(cls, v): - return "main" if v is None else v + branch: str = "main" async def get_download_url_with_path(self, path: str): url_format = await self.get_fastest_format() @@ -53,7 +56,7 @@ class RepoInfo(BaseModel): @classmethod def parse_github_url(cls, github_url: str) -> "RepoInfo": if matched := GITHUB_REPO_URL_PATTERN.match(github_url): - return RepoInfo(**matched.groupdict()) + return RepoInfo(**{k: v for k, v in matched.groupdict().items() if v}) raise ValueError("github地址格式错误") @classmethod @@ -83,20 +86,168 @@ class FileType(StrEnum): FILE = "file" DIR = "directory" + PACKAGE = "gh" -class FileInfo(BaseModel): +class BaseInfo(BaseModel, ABC): + """基础信息类""" + + @classmethod + @abstractmethod + async def parse_repo_info(cls, repo_info: RepoInfo) -> "BaseInfo": ... + + @abstractmethod + def get_files(cls, module_path: str, is_dir) -> list[str]: ... + + +class FileInfo(BaseInfo): """文件信息""" type: FileType name: str - files: list["FileInfo"] | None + files: list["FileInfo"] = [] + + def recurrence_files(self, dir_path: str, is_dir: bool = True) -> list[str]: + """ + 递归获取文件路径 + + 参数: + files: 文件列表 + dir_path: 目录路径 + is_dir: 是否为目录 + + 返回: + list[str]: 文件路径 + """ + if not is_dir and dir_path.endswith(self.name): + return [dir_path] + if self.files is None: + raise ValueError("文件列表为空") + paths = [] + for file in self.files: + if is_dir and file.type == FileType.DIR and file.files: + paths.extend(self.recurrence_files(f"{dir_path}/{file.name}", is_dir)) + elif file.type == FileType.FILE: + if is_dir: + paths.append(f"{dir_path}/{file.name}") + elif dir_path.endswith(file.name): + paths.append(dir_path) + return paths + + def full_files_path(self, module_path: str, is_dir: bool = True) -> "FileInfo": + """ + 获取文件路径 + + 参数: + module_path: 模块路径 + is_dir: 是否为目录 + + 返回: + list[FileInfo]: 文件路径 + """ + paths: list[str] = module_path.split("/") + if not is_dir: + paths = paths[:-1] + cur_file: FileInfo = self + + for path in paths: + for file in cur_file.files: + if file.type == FileType.DIR and file.name == path and file.files: + cur_file = file + break + else: + raise ValueError(f"模块路径 {module_path} 不存在") + return cur_file + + @classmethod + async def parse_repo_info(cls, repo_info: RepoInfo) -> "FileInfo": + """解析仓库信息""" + + """获取插件包信息 + + 参数: + repo_info: 仓库信息 + + 返回: + FileInfo: 插件包信息 + """ + jsd_package_url: str = JSD_PACKAGE_API_FORMAT.format( + owner=repo_info.owner, repo=repo_info.repo, branch=repo_info.branch + ) + res = await AsyncHttpx.get(url=jsd_package_url) + if res.status_code != 200: + raise ValueError(f"下载错误, code: {res.status_code}") + return FileInfo(**res.json()) + + def get_files(self, module_path: str, is_dir: bool = True) -> list[str]: + """获取文件路径""" + + file = self.full_files_path(module_path, is_dir) + files = file.recurrence_files( + module_path, + is_dir, + ) + return files -class JsdPackageInfo(BaseModel): - """jsd包信息""" +class TreeType(StrEnum): + """树类型""" - type: str - name: str - version: str - files: list[FileInfo] + FILE = "blob" + DIR = "tree" + + +class Tree(BaseModel): + """树""" + + path: str + mode: str + type: TreeType + sha: str + size: int | None + url: str + + +class TreesInfo(BaseInfo): + """树信息""" + + sha: str + url: str + tree: list[Tree] + + def export_files(self, module_path: str) -> list[str]: + """导出文件路径""" + return [ + file.path + for file in self.tree + if file.type == TreeType.FILE and file.path.startswith(module_path) + ] + + @classmethod + async def parse_repo_info(cls, repo_info: RepoInfo) -> "TreesInfo": + """获取仓库树 + + 参数: + repo_info: 仓库信息 + + 返回: + TreesInfo: 仓库树信息 + """ + git_tree_url: str = GIT_API_TREES_FORMAT.format( + owner=repo_info.owner, repo=repo_info.repo, branch=repo_info.branch + ) + res = await AsyncHttpx.get(url=git_tree_url) + if res.status_code != 200: + raise ValueError(f"下载错误, code: {res.status_code}") + return TreesInfo(**res.json()) + + def get_files(self, module_path: str, is_dir: bool = True) -> list[str]: + """获取文件路径""" + return self.export_files(module_path) + + +class PackageApi(Enum): + """插件包接口""" + + GITHUB = TreesInfo + JSDELIVR = FileInfo