add 数据共享开关

This commit is contained in:
jxxghp
2024-05-06 11:54:32 +08:00
parent dd5c0de7b1
commit 90d5a8b0c9
4 changed files with 25 additions and 10 deletions

View File

@ -30,9 +30,10 @@ class PluginHelper(metaclass=Singleton):
def __init__(self):
self.systemconfig = SystemConfigOper()
if not self.systemconfig.get(SystemConfigKey.PluginInstallReport):
if self.install_report():
self.systemconfig.set(SystemConfigKey.PluginInstallReport, "1")
if settings.PLUGIN_STATISTIC_SHARE:
if not self.systemconfig.get(SystemConfigKey.PluginInstallReport):
if self.install_report():
self.systemconfig.set(SystemConfigKey.PluginInstallReport, "1")
@cached(cache=TTLCache(maxsize=1000, ttl=1800))
def get_plugins(self, repo_url: str) -> Dict[str, dict]:
@ -89,6 +90,8 @@ class PluginHelper(metaclass=Singleton):
"""
安装插件统计
"""
if not settings.PLUGIN_STATISTIC_SHARE:
return False
if not pid:
return False
res = RequestUtils(timeout=5).get_res(self._install_reg % pid)
@ -100,6 +103,8 @@ class PluginHelper(metaclass=Singleton):
"""
上报存量插件安装统计
"""
if not settings.PLUGIN_STATISTIC_SHARE:
return False
plugins = self.systemconfig.get(SystemConfigKey.UserInstalledPlugins)
if not plugins:
return False