This commit is contained in:
jxxghp
2023-09-11 19:10:51 +08:00
parent efe89f59b9
commit 605a7486b3
2 changed files with 7 additions and 3 deletions

View File

@ -77,10 +77,10 @@ class CookieCloudChain(ChainBase):
if site_info:
# 检查站点连通性
status, msg = self.sitechain.test(domain)
# 更新站点Cookie
if status:
logger.info(f"站点【{site_info.name}】连通性正常不同步CookieCloud数据")
# 更新站点rss地址
if not site_info.public and not site_info.rss:
# 自动生成rss地址
rss_url, errmsg = self.rsshelper.get_rss_link(
@ -90,12 +90,13 @@ class CookieCloudChain(ChainBase):
proxy=True if site_info.proxy else False
)
if rss_url:
# 更新站点rss地址
logger.info(f"更新站点 {domain} RSS地址 ...")
self.siteoper.update_rss(domain=domain, rss=rss_url)
else:
logger.warn(errmsg)
continue
# 更新站点Cookie
logger.info(f"更新站点 {domain} Cookie ...")
self.siteoper.update_cookie(domain=domain, cookies=cookie)
_update_count += 1
elif indexer:
@ -120,6 +121,7 @@ class CookieCloudChain(ChainBase):
_fail_count += 1
logger.warn(f"站点 {indexer.get('name')} 连接失败,无法添加站点")
continue
# 获取rss地址
rss_url = None
if not indexer.get("public") and indexer.get("domain"):
# 自动生成rss地址
@ -129,6 +131,7 @@ class CookieCloudChain(ChainBase):
if errmsg:
logger.warn(errmsg)
# 插入数据库
logger.info(f"新增站点 {indexer.get('name')} ...")
self.siteoper.add(name=indexer.get("name"),
url=indexer.get("domain"),
domain=domain,
@ -136,6 +139,7 @@ class CookieCloudChain(ChainBase):
rss=rss_url,
public=1 if indexer.get("public") else 0)
_add_count += 1
# 保存站点图标
if indexer:
site_icon = self.siteiconoper.get_by_domain(domain)

View File

@ -85,4 +85,4 @@ class SiteOper(DbOper):
site.update(self._db, {
"rss": rss
})
return True, "更新站点rss成功"
return True, "更新站点RSS地址成功"