Merge pull request #307 from thsrite/main
This commit is contained in:
commit
6a34c7196c
29
alembic/versions/52ab4930be04_1_0_3.py
Normal file
29
alembic/versions/52ab4930be04_1_0_3.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
"""1_0_3
|
||||||
|
|
||||||
|
Revision ID: 52ab4930be04
|
||||||
|
Revises: ec5fb51fc300
|
||||||
|
Create Date: 2023-08-28 13:21:45.152012
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '52ab4930be04'
|
||||||
|
down_revision = 'ec5fb51fc300'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade() -> None:
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.execute("delete from systemconfig where key = 'RssSites';")
|
||||||
|
op.execute("insert into systemconfig(key, value) VALUES('RssSites', (select value from systemconfig where key= 'IndexerSites'));")
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade() -> None:
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
pass
|
||||||
|
# ### end Alembic commands ###
|
@ -118,6 +118,7 @@ def cookie_cloud_sync(db: Session = Depends(get_db),
|
|||||||
"""
|
"""
|
||||||
Site.reset(db)
|
Site.reset(db)
|
||||||
SystemConfigOper(db).set(SystemConfigKey.IndexerSites, [])
|
SystemConfigOper(db).set(SystemConfigKey.IndexerSites, [])
|
||||||
|
SystemConfigOper(db).set(SystemConfigKey.RssSites, [])
|
||||||
CookieCloudChain(db).process(manual=True)
|
CookieCloudChain(db).process(manual=True)
|
||||||
# 插件站点删除
|
# 插件站点删除
|
||||||
EventManager().send_event(EventType.SiteDeleted,
|
EventManager().send_event(EventType.SiteDeleted,
|
||||||
@ -227,6 +228,23 @@ def read_site_by_domain(
|
|||||||
return site
|
return site
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/rss", summary="所有订阅站点", response_model=List[schemas.Site])
|
||||||
|
def read_rss_sites(db: Session = Depends(get_db)) -> List[dict]:
|
||||||
|
"""
|
||||||
|
获取站点列表
|
||||||
|
"""
|
||||||
|
# 选中的rss站点
|
||||||
|
rss_sites = SystemConfigOper(db).get(SystemConfigKey.RssSites)
|
||||||
|
# 所有站点
|
||||||
|
all_site = Site.list_order_by_pri(db)
|
||||||
|
if not rss_sites or not all_site:
|
||||||
|
return []
|
||||||
|
|
||||||
|
# 选中的rss站点
|
||||||
|
rss_sites = [site for site in all_site if site and site.id in rss_sites]
|
||||||
|
return rss_sites
|
||||||
|
|
||||||
|
|
||||||
@router.get("/{site_id}", summary="站点详情", response_model=schemas.Site)
|
@router.get("/{site_id}", summary="站点详情", response_model=schemas.Site)
|
||||||
def read_site(
|
def read_site(
|
||||||
site_id: int,
|
site_id: int,
|
||||||
|
@ -52,8 +52,8 @@ class TorrentsChain(ChainBase):
|
|||||||
|
|
||||||
# 所有站点索引
|
# 所有站点索引
|
||||||
indexers = self.siteshelper.get_indexers()
|
indexers = self.siteshelper.get_indexers()
|
||||||
# 配置的索引站点
|
# 配置的Rss站点
|
||||||
config_indexers = [str(sid) for sid in self.systemconfig.get(SystemConfigKey.IndexerSites) or []]
|
config_indexers = [str(sid) for sid in self.systemconfig.get(SystemConfigKey.RssSites) or []]
|
||||||
# 遍历站点缓存资源
|
# 遍历站点缓存资源
|
||||||
for indexer in indexers:
|
for indexer in indexers:
|
||||||
# 未开启的站点不搜索
|
# 未开启的站点不搜索
|
||||||
|
@ -50,6 +50,8 @@ class SystemConfigKey(Enum):
|
|||||||
SearchResults = "SearchResults"
|
SearchResults = "SearchResults"
|
||||||
# 索引站点范围
|
# 索引站点范围
|
||||||
IndexerSites = "IndexerSites"
|
IndexerSites = "IndexerSites"
|
||||||
|
# 订阅站点范围
|
||||||
|
RssSites = "RssSites"
|
||||||
# 种子优先级规则
|
# 种子优先级规则
|
||||||
TorrentsPriority = "TorrentsPriority"
|
TorrentsPriority = "TorrentsPriority"
|
||||||
# 通知消息渠道设置
|
# 通知消息渠道设置
|
||||||
|
Loading…
x
Reference in New Issue
Block a user