Skip to content

Commit

Permalink
fix: 修复数据统计部分站点显示问题
Browse files Browse the repository at this point in the history
  • Loading branch information
linyuan0213 committed Nov 18, 2024
1 parent fbe7d83 commit 0de5aab
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/sites/sites.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def init_config(self):
"brush_enable": brush_enable,
"statistic_enable": statistic_enable,
"uses": uses,
"ua": site_note.get("ua"),
"ua": site_note.get("ua") or Config().get_ua(),
"headers": site_note.get("headers"),
"parse": True if site_note.get("parse") == "Y" else False,
"unread_msg_notify": True if site_note.get("message") == "Y" else False,
Expand Down
10 changes: 7 additions & 3 deletions app/sites/siteuserinfo/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,13 @@ def _get_page_content(self, url, params=None, headers=None):

if isinstance(self._ua, str):
req_headers.update({
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
"User-Agent": f"{self._ua}",
"referer": urljoin(self._base_url, self._user_detail_page)
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8,ja;q=0.7",
"user-agent": f"{self._ua}",
"referer": urljoin(self._base_url, self._user_detail_page),
"sec-fetch-dest": "document",
"sec-fetch-mode": "navigate",
"sec-fetch-site": "same-origin"
})
else:
req_headers.update(self._ua)
Expand Down
5 changes: 5 additions & 0 deletions web/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -4465,6 +4465,11 @@ def get_site_user_statistics(data):
sort_on = data.get("sort_on")
site_hash = data.get("site_hash")
statistics = SiteUserInfo().get_site_user_statistics(sites=sites, encoding=encoding)
# 修复馒头站点显示
for item in statistics:
if 'm-team' in item.get('url'):
site_info = Sites().get_sites(siteurl=item.get('url'))
item['url'] = site_info.get('signurl')
if sort_by and sort_on in ["asc", "desc"]:
if sort_on == "asc":
statistics.sort(key=lambda x: x[sort_by])
Expand Down

0 comments on commit 0de5aab

Please sign in to comment.