mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 23:47:41 +08:00
fix(http): require 200 for share reporting requests
This commit is contained in:
@@ -146,7 +146,7 @@ class PluginHelper(metaclass=WeakSingleton):
|
|||||||
if not settings.PLUGIN_STATISTIC_SHARE:
|
if not settings.PLUGIN_STATISTIC_SHARE:
|
||||||
return {}
|
return {}
|
||||||
res = RequestUtils(proxies=settings.PROXY, timeout=10).get_res(self._install_statistic)
|
res = RequestUtils(proxies=settings.PROXY, timeout=10).get_res(self._install_statistic)
|
||||||
if res and res.status_code == 200:
|
if res is not None and res.status_code == 200:
|
||||||
return res.json()
|
return res.json()
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
@@ -167,7 +167,7 @@ class PluginHelper(metaclass=WeakSingleton):
|
|||||||
"plugin_id": pid,
|
"plugin_id": pid,
|
||||||
"repo_url": repo_url
|
"repo_url": repo_url
|
||||||
})
|
})
|
||||||
if res and res.status_code == 200:
|
if res is not None and res.status_code == 200:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -192,7 +192,7 @@ class PluginHelper(metaclass=WeakSingleton):
|
|||||||
content_type="application/json",
|
content_type="application/json",
|
||||||
timeout=5).post(self._install_report,
|
timeout=5).post(self._install_report,
|
||||||
json={"plugins": payload_plugins})
|
json={"plugins": payload_plugins})
|
||||||
return True if res else False
|
return bool(res is not None and res.status_code == 200)
|
||||||
|
|
||||||
def install(self, pid: str, repo_url: str, package_version: Optional[str] = None, force_install: bool = False) \
|
def install(self, pid: str, repo_url: str, package_version: Optional[str] = None, force_install: bool = False) \
|
||||||
-> Tuple[bool, str]:
|
-> Tuple[bool, str]:
|
||||||
@@ -1002,7 +1002,7 @@ class PluginHelper(metaclass=WeakSingleton):
|
|||||||
if not settings.PLUGIN_STATISTIC_SHARE:
|
if not settings.PLUGIN_STATISTIC_SHARE:
|
||||||
return {}
|
return {}
|
||||||
res = await AsyncRequestUtils(proxies=settings.PROXY, timeout=10).get_res(self._install_statistic)
|
res = await AsyncRequestUtils(proxies=settings.PROXY, timeout=10).get_res(self._install_statistic)
|
||||||
if res and res.status_code == 200:
|
if res is not None and res.status_code == 200:
|
||||||
return res.json()
|
return res.json()
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
@@ -1023,7 +1023,7 @@ class PluginHelper(metaclass=WeakSingleton):
|
|||||||
"plugin_id": pid,
|
"plugin_id": pid,
|
||||||
"repo_url": repo_url
|
"repo_url": repo_url
|
||||||
})
|
})
|
||||||
if res and res.status_code == 200:
|
if res is not None and res.status_code == 200:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -1048,7 +1048,7 @@ class PluginHelper(metaclass=WeakSingleton):
|
|||||||
content_type="application/json",
|
content_type="application/json",
|
||||||
timeout=5).post(self._install_report,
|
timeout=5).post(self._install_report,
|
||||||
json={"plugins": payload_plugins})
|
json={"plugins": payload_plugins})
|
||||||
return True if res else False
|
return bool(res is not None and res.status_code == 200)
|
||||||
|
|
||||||
async def __async_get_file_list(self, pid: str, user_repo: str, package_version: Optional[str] = None) -> \
|
async def __async_get_file_list(self, pid: str, user_repo: str, package_version: Optional[str] = None) -> \
|
||||||
Tuple[Optional[list], Optional[str]]:
|
Tuple[Optional[list], Optional[str]]:
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ class SubscribeHelper(metaclass=WeakSingleton):
|
|||||||
return False, "连接MoviePilot服务器失败"
|
return False, "连接MoviePilot服务器失败"
|
||||||
|
|
||||||
# 检查响应状态
|
# 检查响应状态
|
||||||
if res and res.status_code == 200:
|
if res.status_code == 200:
|
||||||
# 清除缓存
|
# 清除缓存
|
||||||
if clear_cache:
|
if clear_cache:
|
||||||
self.get_shares.cache_clear()
|
self.get_shares.cache_clear()
|
||||||
@@ -126,7 +126,7 @@ class SubscribeHelper(metaclass=WeakSingleton):
|
|||||||
"""
|
"""
|
||||||
处理返回List的HTTP响应
|
处理返回List的HTTP响应
|
||||||
"""
|
"""
|
||||||
if res and res.status_code == 200:
|
if res is not None and res.status_code == 200:
|
||||||
return res.json()
|
return res.json()
|
||||||
return []
|
return []
|
||||||
|
|
||||||
@@ -202,7 +202,7 @@ class SubscribeHelper(metaclass=WeakSingleton):
|
|||||||
res = RequestUtils(proxies=settings.PROXY, timeout=5, headers={
|
res = RequestUtils(proxies=settings.PROXY, timeout=5, headers={
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
}).post_res(self._sub_reg, json=sub)
|
}).post_res(self._sub_reg, json=sub)
|
||||||
if res and res.status_code == 200:
|
if res is not None and res.status_code == 200:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -216,7 +216,7 @@ class SubscribeHelper(metaclass=WeakSingleton):
|
|||||||
res = await AsyncRequestUtils(proxies=settings.PROXY, timeout=5, headers={
|
res = await AsyncRequestUtils(proxies=settings.PROXY, timeout=5, headers={
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
}).post_res(self._sub_reg, json=sub)
|
}).post_res(self._sub_reg, json=sub)
|
||||||
if res and res.status_code == 200:
|
if res is not None and res.status_code == 200:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -267,7 +267,7 @@ class SubscribeHelper(metaclass=WeakSingleton):
|
|||||||
sub.to_dict() for sub in subscribes
|
sub.to_dict() for sub in subscribes
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
return True if res else False
|
return bool(res is not None and res.status_code == 200)
|
||||||
|
|
||||||
def sub_share(self, subscribe_id: int,
|
def sub_share(self, subscribe_id: int,
|
||||||
share_title: str, share_comment: str, share_user: str) -> Tuple[bool, str]:
|
share_title: str, share_comment: str, share_user: str) -> Tuple[bool, str]:
|
||||||
|
|||||||
Reference in New Issue
Block a user