mirror of https://gitlab.com/bashrc2/epicyon
Show new account status on recently created profiles
This may help with detecting spammers or trollsmain
parent
4e78dcf9fe
commit
a6eb5ae044
11
utils.py
11
utils.py
|
@ -3493,6 +3493,17 @@ def media_file_mime_type(filename: str) -> str:
|
||||||
return extensions[file_ext]
|
return extensions[file_ext]
|
||||||
|
|
||||||
|
|
||||||
|
def time_days_ago(datestr: str) -> int:
|
||||||
|
"""returns the number of days ago for the given date
|
||||||
|
"""
|
||||||
|
date1 = \
|
||||||
|
date_from_string_format(datestr,
|
||||||
|
["%Y-%m-%dT%H:%M:%S%z"])
|
||||||
|
if not date1:
|
||||||
|
return 0
|
||||||
|
return (date1 - date_epoch()).days
|
||||||
|
|
||||||
|
|
||||||
def is_recent_post(post_json_object: {}, max_days: int) -> bool:
|
def is_recent_post(post_json_object: {}, max_days: int) -> bool:
|
||||||
""" Is the given post recent?
|
""" Is the given post recent?
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -10,6 +10,7 @@ __module_group__ = "Web Interface"
|
||||||
import os
|
import os
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
from webfinger import webfinger_handle
|
from webfinger import webfinger_handle
|
||||||
|
from utils import time_days_ago
|
||||||
from utils import uninvert_text
|
from utils import uninvert_text
|
||||||
from utils import get_attributed_to
|
from utils import get_attributed_to
|
||||||
from utils import get_url_from_post
|
from utils import get_url_from_post
|
||||||
|
@ -662,8 +663,11 @@ def _get_profile_header(base_dir: str, http_prefix: str, nickname: str,
|
||||||
' <p><b>@' + nickname + '@' + domain_full + \
|
' <p><b>@' + nickname + '@' + domain_full + \
|
||||||
actor_proxied + acct_blog_str + '</b><br>\n'
|
actor_proxied + acct_blog_str + '</b><br>\n'
|
||||||
if joined_date:
|
if joined_date:
|
||||||
|
joined_str = translate['Joined']
|
||||||
|
if time_days_ago(joined_date) < 7:
|
||||||
|
joined_str = '<b>' + translate['New account'] + '</b>'
|
||||||
html_str += \
|
html_str += \
|
||||||
' <p>' + translate['Joined'] + ' ' + \
|
' <p>' + joined_str + ' ' + \
|
||||||
joined_date.split('T')[0] + '<br>\n'
|
joined_date.split('T')[0] + '<br>\n'
|
||||||
if moved_to:
|
if moved_to:
|
||||||
new_nickname = get_nickname_from_actor(moved_to)
|
new_nickname = get_nickname_from_actor(moved_to)
|
||||||
|
@ -816,7 +820,10 @@ def _get_profile_header_after_search(base_dir: str,
|
||||||
' <p><b>@' + search_nickname + '@' + search_domain_full + \
|
' <p><b>@' + search_nickname + '@' + search_domain_full + \
|
||||||
actor_proxied + '</b><br>\n'
|
actor_proxied + '</b><br>\n'
|
||||||
if joined_date:
|
if joined_date:
|
||||||
html_str += ' <p>' + translate['Joined'] + ' ' + \
|
joined_str = translate['Joined']
|
||||||
|
if time_days_ago(joined_date) < 7:
|
||||||
|
joined_str = '<b>' + translate['New account'] + '</b>'
|
||||||
|
html_str += ' <p>' + joined_str + ' ' + \
|
||||||
joined_date.split('T')[0] + '</p>\n'
|
joined_date.split('T')[0] + '</p>\n'
|
||||||
if follows_you:
|
if follows_you:
|
||||||
if not you_follow:
|
if not you_follow:
|
||||||
|
|
Loading…
Reference in New Issue