From 8d5be63d1e26e107c7d5ba828b57df71d251cb58 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Sun, 12 Nov 2023 08:13:07 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E8=B1=86=E7=93=A3=E6=A6=9C=E5=8D=95?= =?UTF-8?q?=E8=AE=A2=E9=98=85=E6=94=AF=E6=8C=81=E4=BD=BF=E7=94=A8=E4=BB=A3?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- plugins/chatgpt/__init__.py | 2 +- plugins/doubanrank/__init__.py | 29 +++++++++++++++++++++++++---- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 030d79d..fd3d6dd 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "DoubanRank": { "name": "豆瓣榜单订阅", "description": "监控豆瓣热门榜单,自动添加订阅。", - "version": "1.1", + "version": "1.2", "icon": "movie.jpg", "color": "#01B3E3", "author": "jxxghp", diff --git a/plugins/chatgpt/__init__.py b/plugins/chatgpt/__init__.py index 51fb1bd..c91a2c2 100644 --- a/plugins/chatgpt/__init__.py +++ b/plugins/chatgpt/__init__.py @@ -96,7 +96,7 @@ class ChatGPT(_PluginBase): 'component': 'VSwitch', 'props': { 'model': 'proxy', - 'label': '使用代理', + 'label': '使用代理服务器', } } ] diff --git a/plugins/doubanrank/__init__.py b/plugins/doubanrank/__init__.py index 78f6a30..173d390 100644 --- a/plugins/doubanrank/__init__.py +++ b/plugins/doubanrank/__init__.py @@ -29,7 +29,7 @@ class DoubanRank(_PluginBase): # 主题色 plugin_color = "#01B3E3" # 插件版本 - plugin_version = "1.1" + plugin_version = "1.2" # 插件作者 plugin_author = "jxxghp" # 作者主页 @@ -64,6 +64,7 @@ class DoubanRank(_PluginBase): _vote = 0 _clear = False _clearflag = False + _proxy = False def init_plugin(self, config: dict = None): self.downloadchain = DownloadChain() @@ -72,6 +73,7 @@ class DoubanRank(_PluginBase): if config: self._enabled = config.get("enabled") self._cron = config.get("cron") + self._proxy = config.get("proxy") self._onlyonce = config.get("onlyonce") self._vote = float(config.get("vote")) if config.get("vote") else 0 rss_addrs = config.get("rss_addrs") @@ -163,6 +165,22 @@ class DoubanRank(_PluginBase): } ] }, + { + 'component': 'VCol', + 'props': { + 'cols': 12, + 'md': 6 + }, + 'content': [ + { + 'component': 'VSwitch', + 'props': { + 'model': 'proxy', + 'label': '使用代理服务器', + } + } + ] + }, { 'component': 'VCol', 'props': { @@ -292,6 +310,7 @@ class DoubanRank(_PluginBase): ], { "enabled": False, "cron": "", + "proxy": False, "onlyonce": False, "vote": "", "ranks": [], @@ -529,13 +548,15 @@ class DoubanRank(_PluginBase): self._clearflag = False logger.info(f"所有榜单RSS刷新完成") - @staticmethod - def __get_rss_info(addr) -> List[dict]: + def __get_rss_info(self, addr) -> List[dict]: """ 获取RSS """ try: - ret = RequestUtils().get_res(addr) + if self._proxy: + ret = RequestUtils(proxies=settings.PROXY).get_res(addr) + else: + ret = RequestUtils().get_res(addr) if not ret: return [] ret_xml = ret.text