Skip to content

Commit

Permalink
ref(sitelist): 优化站点资源页面显示 - 去除插件的站点
Browse files Browse the repository at this point in the history
  • Loading branch information
xuyanling committed Jan 8, 2024
1 parent fd13847 commit 04172f1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/indexer/client/builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def get_status(self):
"""
return True

def get_indexers(self, check=True, indexer_id=None, public=True):
def get_indexers(self, check=True, indexer_id=None, public=True, plugin=True):
ret_indexers = []
# 选中站点配置
indexer_sites = SystemConfig().get(SystemConfigKey.UserIndexerSites) or []
Expand Down Expand Up @@ -107,7 +107,7 @@ def get_indexers(self, check=True, indexer_id=None, public=True):
_indexer_domains.append(indexer.get("domain"))
ret_indexers.append(IndexerConf(datas=indexer))
# 获取插件站点
if PluginsSpider.get_indexers():
if plugin:
for indexer in PluginsSpider.get_indexers():
if indexer:
if check and (not indexer_sites or indexer.get("id") not in indexer_sites):
Expand Down
13 changes: 9 additions & 4 deletions app/indexer/indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,24 @@ def __build_class(self, ctype, conf):
return None

@staticmethod
def get_builtin_indexers(check=True, public=True, indexer_id=None):
def get_builtin_indexers(check=True, public=True, plugin=True, indexer_id=None):
"""
获取内置索引器的索引站点
"""
return BuiltinIndexer().get_indexers(check=check, public=public, indexer_id=indexer_id)
return BuiltinIndexer().get_indexers(
check=check,
public=public,
plugin=plugin,
indexer_id=indexer_id
)

def get_indexers(self, check=False, public=True):
def get_indexers(self, check=False, public=True, plugin=True):
"""
获取当前索引器的索引站点
"""
if not self._client:
return []
return self._client.get_indexers(check=check, public=public)
return self._client.get_indexers(check=check, public=public, plugin=plugin)

def get_user_indexer_dict(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion web/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ def sites():
@App.route('/sitelist', methods=['POST', 'GET'])
@login_required
def sitelist():
IndexerSites = Indexer().get_indexers(check=False)
IndexerSites = Indexer().get_indexers(check=False, plugin=False)
return render_template("site/sitelist.html",
Sites=IndexerSites,
Count=len(IndexerSites))
Expand Down

0 comments on commit 04172f1

Please sign in to comment.