mirror of https://gitlab.com/bashrc2/epicyon
Remove tracking from profile links
parent
7d60b1ae5d
commit
07fb70688b
4
blog.py
4
blog.py
|
@ -16,6 +16,7 @@ from webapp_utils import html_footer
|
|||
from webapp_utils import get_post_attachments_as_html
|
||||
from webapp_utils import edit_text_area
|
||||
from webapp_media import add_embedded_elements
|
||||
from utils import remove_link_tracking
|
||||
from utils import get_url_from_post
|
||||
from utils import date_from_string_format
|
||||
from utils import get_attributed_to
|
||||
|
@ -959,7 +960,8 @@ def get_blog_address(actor_json: {}) -> str:
|
|||
result = get_actor_property_url(actor_json, 'Blog')
|
||||
if not result:
|
||||
result = get_actor_property_url(actor_json, 'My Blog')
|
||||
return remove_html(result)
|
||||
url = remove_html(result)
|
||||
return remove_link_tracking(url)
|
||||
|
||||
|
||||
def account_has_blog(base_dir: str, nickname: str, domain: str) -> bool:
|
||||
|
|
10
content.py
10
content.py
|
@ -15,6 +15,7 @@ import email.parser
|
|||
import urllib.parse
|
||||
from shutil import copyfile
|
||||
from dateutil.parser import parse
|
||||
from utils import remove_link_tracking
|
||||
from utils import string_contains
|
||||
from utils import string_ends_with
|
||||
from utils import is_account_dir
|
||||
|
@ -684,15 +685,6 @@ def remove_link_trackers_from_content(content: str) -> str:
|
|||
return new_content
|
||||
|
||||
|
||||
def remove_link_tracking(url: str) -> str:
|
||||
""" Removes any web link tracking, such as utm_medium, utm_campaign
|
||||
or utm_source
|
||||
"""
|
||||
if '?utm_' not in url:
|
||||
return url
|
||||
return url.split('?utm_')[0]
|
||||
|
||||
|
||||
def add_web_links(content: str) -> str:
|
||||
"""Adds markup for web links
|
||||
"""
|
||||
|
|
|
@ -10,6 +10,7 @@ __module_group__ = "Profile Metadata"
|
|||
|
||||
from utils import get_attachment_property_value
|
||||
from utils import remove_html
|
||||
from utils import remove_link_tracking
|
||||
|
||||
|
||||
def _get_donation_types() -> []:
|
||||
|
@ -61,7 +62,8 @@ def get_donation_url(actor_json: {}) -> str:
|
|||
donate_url = property_value[prop_value_name].split('<a href="')[1]
|
||||
if '"' in donate_url:
|
||||
donate_url = donate_url.split('"')[0]
|
||||
return remove_html(donate_url)
|
||||
donate_url = remove_html(donate_url)
|
||||
return remove_link_tracking(donate_url)
|
||||
return ''
|
||||
|
||||
|
||||
|
@ -99,7 +101,7 @@ def get_website(actor_json: {}, translate: {}) -> str:
|
|||
if 'https://' not in value_str and \
|
||||
'http://' not in value_str:
|
||||
continue
|
||||
return value_str
|
||||
return remove_link_tracking(value_str)
|
||||
return ''
|
||||
|
||||
|
||||
|
@ -127,7 +129,8 @@ def get_gemini_link(actor_json: {}) -> str:
|
|||
continue
|
||||
if not property_value['type'].endswith('PropertyValue'):
|
||||
continue
|
||||
return remove_html(property_value[prop_value_name])
|
||||
url = remove_html(property_value[prop_value_name])
|
||||
return remove_link_tracking(url)
|
||||
return ''
|
||||
|
||||
|
||||
|
|
4
git.py
4
git.py
|
@ -9,6 +9,7 @@ __module_group__ = "Profile Metadata"
|
|||
|
||||
import os
|
||||
import html
|
||||
from utils import remove_link_tracking
|
||||
from utils import acct_dir
|
||||
from utils import has_object_string_type
|
||||
from utils import text_in_file
|
||||
|
@ -260,5 +261,6 @@ def get_repo_url(actor_json: {}) -> str:
|
|||
repo_url = property_value[prop_value_name]
|
||||
if '.' not in repo_url:
|
||||
continue
|
||||
return remove_html(repo_url)
|
||||
repo_url = remove_html(repo_url)
|
||||
return remove_link_tracking(repo_url)
|
||||
return ''
|
||||
|
|
2
tests.py
2
tests.py
|
@ -56,6 +56,7 @@ from follow import clear_followers
|
|||
from follow import send_follow_request_via_server
|
||||
from follow import send_unfollow_request_via_server
|
||||
from siteactive import site_is_active
|
||||
from utils import remove_link_tracking
|
||||
from utils import uninvert_text
|
||||
from utils import get_url_from_post
|
||||
from utils import date_from_string_format
|
||||
|
@ -148,7 +149,6 @@ from inbox import valid_inbox_filenames
|
|||
from inbox import cache_svg_images
|
||||
from categories import guess_hashtag_category
|
||||
from content import remove_link_trackers_from_content
|
||||
from content import remove_link_tracking
|
||||
from content import format_mixed_right_to_left
|
||||
from content import replace_remote_hashtags
|
||||
from content import add_name_emojis_to_tags
|
||||
|
|
9
utils.py
9
utils.py
|
@ -5351,3 +5351,12 @@ def string_contains(text: str, possible_substrings: []) -> bool:
|
|||
if substring in text:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def remove_link_tracking(url: str) -> str:
|
||||
""" Removes any web link tracking, such as utm_medium, utm_campaign
|
||||
or utm_source
|
||||
"""
|
||||
if '?utm_' not in url:
|
||||
return url
|
||||
return url.split('?utm_')[0]
|
||||
|
|
Loading…
Reference in New Issue