From 21179101d6d2e4b41163f97ea9df43ad5814b550 Mon Sep 17 00:00:00 2001 From: Cai <62058454+ACaiCat@users.noreply.github.com> Date: Thu, 20 Jun 2024 12:34:27 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=96=87=E6=A1=A3=EF=BC=9A=E4=B8=BB?= =?UTF-8?q?=E9=A1=B5=E6=96=87=E6=A1=A3=E5=BC=95=E5=AF=BC=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 9619e2028..ea17801c3 100644 --- a/README.md +++ b/README.md @@ -17,12 +17,19 @@ - 我们将持续收集优质的 `TShock` 插件,进行及时的更新。并跟进`TShock`的最新版本。 - 如果你也想加入我们,请按照下方`开发者注意事项`的规定对本仓库`Pull Request`。 + ## 使用者注意事项 - 注意有些插件可能需要前置,请查看下方列表安装前置插件。 - 每个插件都有一个使用说明,在下方列表点击超链查看具体说明事项。 - 听说喜欢给仓库点星星的人,插件都不容易报错 +## 下载 + +- 国内镜像: [Plugins.zip](https://github.moeyy.xyz/https://github.com/Controllerdestiny/TShockPlugin/releases/download/V1.0.0.0/Plugins.zip) +- 本仓库: [Plugins.zip](https://github.com/Controllerdestiny/TShockPlugin/releases/tag/V1.0.0.0) + + ## 开发者注意事项 > 代码规范 From 89e59abb2a8676a5ebea5579a08fcc0c532be766 Mon Sep 17 00:00:00 2001 From: Cai <62058454+ACaiCat@users.noreply.github.com> Date: Thu, 20 Jun 2024 14:22:34 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E6=B5=81=EF=BC=9A?= =?UTF-8?q?=E6=94=AF=E6=8C=81TRHUB=E5=92=8CBBSTR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ForumHelper.py | 154 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 151 insertions(+), 3 deletions(-) diff --git a/ForumHelper.py b/ForumHelper.py index 777a06589..c279f04c9 100644 --- a/ForumHelper.py +++ b/ForumHelper.py @@ -10,6 +10,9 @@ print(f"论坛自动更新脚本 (by Cai😘)") print(f"登录名: {name}") print(f"密码: {password}") + + +# tr.monika.love # 创建会话 session = rq.Session() resp = session.get("https://tr.monika.love/") @@ -71,9 +74,154 @@ resp = session.post("https://tr.monika.love/resources/104/edit",data=data) res = resp.json() if res['status'] == 'ok': - print(f"修改成功: {res}") + print(f"[MONIKA]修改成功: {res}") + else: + print(f"[MONIKA]修改失败: {res}") +except: + print(f"[MONIKA]修改失败!{resp.text}") + +# trhub.cn +# 创建会话 +session = rq.Session() +resp = session.get("https://trhub.cn/") + +# 获取xf_token +soup = BeautifulSoup(resp.text, 'html.parser') +data_csrf = soup.html['data-csrf'] + +# 模拟登录 +data = { + "_xfToken": data_csrf, + "login":name, + "password": password, + "remember": 0, + "_xfRedirect": "https://trhub.cn/", +} +session.post("https://trhub.cn/login/login",data=data,allow_redirects=True) + +# 使用GithubAPI转换MD到Html +with open('README.md', 'r',encoding='utf-8') as file: + md = file.read() +headers = { + "Accept": "application/vnd.github+json", + #"Authorization": "Bearer ", + "X-GitHub-Api-Version": "2022-11-28" +} + +# 修复插件列表路径 +md = re.sub(r'\b[^(\[]*\/README.md\b', lambda x: "https://gitee.com/kksjsj/TShockPlugin/blob/master/" + x.group(), md) + +# 编辑论坛仓库帖子 +data = { + "text": md +} +html = rq.post("https://api.github.com/markdown", headers=headers, data=json.dumps(data)).text +data = { + "_xfToken": data_csrf, + "prefix_id": 0, + "title": "TShock插件收集仓库(自动更新版)", + "message_html": f"{html}", + # "attachment_hash": "291d0c03815801596ec54fa208a79bfb", + # "attachment_hash_combined": { + # "type": "resource_update", + # "context": { + # "resource_update_id": 130 + # }, + # "hash": "291d0c03815801596ec54fa208a79bfb" + # }, + "_xfRequestUri": "/threads/github-action-test.43/", + "_xfWithData": 1, + "_xfResponseType": "json" +} +try: + resp = session.post("https://trhub.cn/posts/107/edit",data=data) + res = resp.json() + if res['status'] == 'ok': + print(f"[TRHUB]修改成功: {res}") + else: + print(f"[TRHUB]修改失败: {res}") +except: + print(f"[TRHUB]修改失败!{resp.text}") + +# BBSTR +name = "Cai233" +# 创建会话 +session = rq.Session() +resp = session.get("https://tr.lizigo.cn/") + +# 获取xf_token +soup = BeautifulSoup(resp.text, 'html.parser') +data_csrf = soup.html['data-csrf'] + + +# 模拟登录 +data = { + "_xfToken": data_csrf, + "login":name, + "password": password, + "remember": 0, + "_xfRedirect": "https://tr.lizigo.cn/", +} +session.post("https://tr.lizigo.cn/login/login",data=data,allow_redirects=True) + + +# 使用GithubAPI转换MD到Html +with open('README.md', 'r',encoding='utf-8') as file: + md = file.read() +headers = { + "Accept": "application/vnd.github+json", + #"Authorization": "Bearer ", + "X-GitHub-Api-Version": "2022-11-28" +} + +# 修复插件列表路径 +md = re.sub(r'\b[^(\[]*\/README.md\b', lambda x: "https://gitee.com/kksjsj/TShockPlugin/blob/master/" + x.group(), md) + +# 编辑论坛仓库帖子 +data = { + "text": md +} +html = rq.post("https://api.github.com/markdown", headers=headers, data=json.dumps(data)).text +data = { + "title": "Shock插件收集仓库(自动更新版)", + "tag_line": "此帖会自动更新插件列表", + "custom_fields[1]": "TShock Chinese Plugins Collection", + "custom_fields[2]": "TShock插件收集仓库", + "custom_fields[3]": "2", + "custom_fields[4]": "0", + "custom_fields[5][]": "0", + "custom_fields[5][]": "1", + "custom_fields[5][]": "2", + "custom_fields[5][]": "3", + "custom_fields[5][]": "4", + "custom_fields[5][]": "5", + "custom_fields[5][]": "6", + "custom_fields[5][]": "7", + "custom_fields[6][]": "0", + "custom_fields[7][]": "6", + "custom_fields[8]": "看情况", + "custom_fields[9]": "https://github.com/Controllerdestiny/TShockPlugin/", + "custom_fields[10]": "https://github.com/Controllerdestiny/TShockPlugin/", + "custom_fields[11]": "TShock最新版本", + "description_html": html, + "external_url": "https://github.moeyy.xyz/https://github.com/Controllerdestiny/TShockPlugin/releases/download/V1.0.0.0/Plugins.zip", + "alt_support_url": "", + "icon_action": "custom", + "_xfToken": data_csrf, + "_xfRequestUri": "/resources/167/edit", + "_xfWithData": "1", + "_xfResponseType": "json" +} + + + +try: + resp = session.post("https://tr.lizigo.cn/resources/167/edit",data=data) + res = resp.json() + if res['status'] == 'ok': + print(f"[BBSTR]修改成功: {res}") else: - print(f"修改失败: {res}") + print(f"[BBSTR]修改失败: {res}") except: - print(f"修改失败!{resp.text}") + print(f"[BBSTR]修改失败!{resp.text}") From d8618f57bd836bbee9e3980c0346722dea824919 Mon Sep 17 00:00:00 2001 From: Cai <62058454+ACaiCat@users.noreply.github.com> Date: Thu, 20 Jun 2024 14:23:17 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E6=B5=81=EF=BC=9A?= =?UTF-8?q?=E5=BF=BD=E7=95=A5=E6=9B=B4=E6=96=B0=E8=AE=BA=E5=9D=9B=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/plugins_publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/plugins_publish.yml b/.github/workflows/plugins_publish.yml index 3584369e0..c04553b8a 100644 --- a/.github/workflows/plugins_publish.yml +++ b/.github/workflows/plugins_publish.yml @@ -71,6 +71,7 @@ jobs: sudo pip install beautifulsoup4 - name: 更新论坛 + continue-on-error: true env: PYTHONIOENCODING: 'utf-8' run: