mirror of https://gitlab.com/bashrc2/epicyon
Add support for pixelfed channel within profile
parent
72518caa38
commit
4893a7f0c6
|
|
@ -83,6 +83,8 @@ from pronouns import get_pronouns
|
||||||
from pronouns import set_pronouns
|
from pronouns import set_pronouns
|
||||||
from youtube import get_youtube
|
from youtube import get_youtube
|
||||||
from youtube import set_youtube
|
from youtube import set_youtube
|
||||||
|
from pixelfed import get_pixelfed
|
||||||
|
from pixelfed import set_pixelfed
|
||||||
from peertube import get_peertube
|
from peertube import get_peertube
|
||||||
from peertube import set_peertube
|
from peertube import set_peertube
|
||||||
from xmpp import get_xmpp_address
|
from xmpp import get_xmpp_address
|
||||||
|
|
@ -2003,6 +2005,23 @@ def _profile_post_youtube(actor_json: {}, fields: {},
|
||||||
return actor_changed
|
return actor_changed
|
||||||
|
|
||||||
|
|
||||||
|
def _profile_post_pixelfed(actor_json: {}, fields: {},
|
||||||
|
actor_changed: bool) -> bool:
|
||||||
|
""" HTTP POST change pixelfed channel address
|
||||||
|
"""
|
||||||
|
current_pixelfed = get_pixelfed(actor_json)
|
||||||
|
if fields.get('pixelfedChannel'):
|
||||||
|
if fields['pixelfedChannel'] != current_pixelfed:
|
||||||
|
set_pixelfed(actor_json,
|
||||||
|
fields['pixelfedChannel'])
|
||||||
|
actor_changed = True
|
||||||
|
else:
|
||||||
|
if current_pixelfed:
|
||||||
|
set_pixelfed(actor_json, '')
|
||||||
|
actor_changed = True
|
||||||
|
return actor_changed
|
||||||
|
|
||||||
|
|
||||||
def _profile_post_peertube(actor_json: {}, fields: {},
|
def _profile_post_peertube(actor_json: {}, fields: {},
|
||||||
actor_changed: bool) -> bool:
|
actor_changed: bool) -> bool:
|
||||||
""" HTTP POST change peertube channel address
|
""" HTTP POST change peertube channel address
|
||||||
|
|
@ -2010,8 +2029,8 @@ def _profile_post_peertube(actor_json: {}, fields: {},
|
||||||
current_peertube = get_peertube(actor_json)
|
current_peertube = get_peertube(actor_json)
|
||||||
if fields.get('peertubeChannel'):
|
if fields.get('peertubeChannel'):
|
||||||
if fields['peertubeChannel'] != current_peertube:
|
if fields['peertubeChannel'] != current_peertube:
|
||||||
set_youtube(actor_json,
|
set_peertube(actor_json,
|
||||||
fields['peertubeChannel'])
|
fields['peertubeChannel'])
|
||||||
actor_changed = True
|
actor_changed = True
|
||||||
else:
|
else:
|
||||||
if current_peertube:
|
if current_peertube:
|
||||||
|
|
@ -2887,6 +2906,10 @@ def profile_edit(self, calling_domain: str, cookie: str,
|
||||||
_profile_post_xmpp_address(actor_json, fields,
|
_profile_post_xmpp_address(actor_json, fields,
|
||||||
actor_changed)
|
actor_changed)
|
||||||
|
|
||||||
|
actor_changed = \
|
||||||
|
_profile_post_pixelfed(actor_json, fields,
|
||||||
|
actor_changed)
|
||||||
|
|
||||||
actor_changed = \
|
actor_changed = \
|
||||||
_profile_post_youtube(actor_json, fields,
|
_profile_post_youtube(actor_json, fields,
|
||||||
actor_changed)
|
actor_changed)
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ from donate import get_website
|
||||||
from donate import get_gemini_link
|
from donate import get_gemini_link
|
||||||
from pronouns import get_pronouns
|
from pronouns import get_pronouns
|
||||||
from youtube import get_youtube
|
from youtube import get_youtube
|
||||||
|
from pixelfed import get_pixelfed
|
||||||
from peertube import get_peertube
|
from peertube import get_peertube
|
||||||
from xmpp import get_xmpp_address
|
from xmpp import get_xmpp_address
|
||||||
from matrix import get_matrix_address
|
from matrix import get_matrix_address
|
||||||
|
|
@ -658,6 +659,7 @@ def show_person_options(self, calling_domain: str, path: str,
|
||||||
pgp_pub_key = None
|
pgp_pub_key = None
|
||||||
pgp_fingerprint = None
|
pgp_fingerprint = None
|
||||||
pronouns = None
|
pronouns = None
|
||||||
|
pixelfed = None
|
||||||
youtube = None
|
youtube = None
|
||||||
peertube = None
|
peertube = None
|
||||||
xmpp_address = None
|
xmpp_address = None
|
||||||
|
|
@ -689,6 +691,7 @@ def show_person_options(self, calling_domain: str, path: str,
|
||||||
website_url = get_website(actor_json, self.server.translate)
|
website_url = get_website(actor_json, self.server.translate)
|
||||||
gemini_link = get_gemini_link(actor_json)
|
gemini_link = get_gemini_link(actor_json)
|
||||||
pronouns = get_pronouns(actor_json)
|
pronouns = get_pronouns(actor_json)
|
||||||
|
pixelfed = get_pixelfed(actor_json)
|
||||||
youtube = get_youtube(actor_json)
|
youtube = get_youtube(actor_json)
|
||||||
peertube = get_peertube(actor_json)
|
peertube = get_peertube(actor_json)
|
||||||
xmpp_address = get_xmpp_address(actor_json)
|
xmpp_address = get_xmpp_address(actor_json)
|
||||||
|
|
@ -764,7 +767,7 @@ def show_person_options(self, calling_domain: str, path: str,
|
||||||
self.server.blocked_cache,
|
self.server.blocked_cache,
|
||||||
repo_url,
|
repo_url,
|
||||||
self.server.sites_unavailable,
|
self.server.sites_unavailable,
|
||||||
youtube, peertube)
|
youtube, peertube, pixelfed)
|
||||||
if msg:
|
if msg:
|
||||||
msg = msg.encode('utf-8')
|
msg = msg.encode('utf-8')
|
||||||
msglen = len(msg)
|
msglen = len(msg)
|
||||||
|
|
|
||||||
9
pgp.py
9
pgp.py
|
|
@ -27,6 +27,7 @@ from posts import get_person_box
|
||||||
from auth import create_basic_auth_header
|
from auth import create_basic_auth_header
|
||||||
from session import post_json
|
from session import post_json
|
||||||
from pronouns import get_pronouns
|
from pronouns import get_pronouns
|
||||||
|
from pixelfed import get_pixelfed
|
||||||
from youtube import get_youtube
|
from youtube import get_youtube
|
||||||
from peertube import get_peertube
|
from peertube import get_peertube
|
||||||
from xmpp import get_xmpp_address
|
from xmpp import get_xmpp_address
|
||||||
|
|
@ -743,6 +744,9 @@ def actor_to_vcard(actor: {}, domain: str) -> str:
|
||||||
blog_address = get_blog_address(actor)
|
blog_address = get_blog_address(actor)
|
||||||
if blog_address:
|
if blog_address:
|
||||||
vcard_str += 'SOCIALPROFILE;SERVICE-TYPE=Blog:' + blog_address + '\n'
|
vcard_str += 'SOCIALPROFILE;SERVICE-TYPE=Blog:' + blog_address + '\n'
|
||||||
|
pixelfed = get_pixelfed(actor)
|
||||||
|
if pixelfed:
|
||||||
|
vcard_str += 'SOCIALPROFILE;SERVICE-TYPE=Pixelfed:' + pixelfed + '\n'
|
||||||
youtube = get_youtube(actor)
|
youtube = get_youtube(actor)
|
||||||
if youtube:
|
if youtube:
|
||||||
vcard_str += 'SOCIALPROFILE;SERVICE-TYPE=YouTube:' + youtube + '\n'
|
vcard_str += 'SOCIALPROFILE;SERVICE-TYPE=YouTube:' + youtube + '\n'
|
||||||
|
|
@ -821,6 +825,11 @@ def actor_to_vcard_xml(actor: {}, domain: str) -> str:
|
||||||
pronouns = get_pronouns(actor)
|
pronouns = get_pronouns(actor)
|
||||||
if pronouns:
|
if pronouns:
|
||||||
vcard_str += ' <pronouns><text>' + pronouns + '</text></pronouns>\n'
|
vcard_str += ' <pronouns><text>' + pronouns + '</text></pronouns>\n'
|
||||||
|
pixelfed = get_pixelfed(actor)
|
||||||
|
if pixelfed:
|
||||||
|
vcard_str += ' <url>' + \
|
||||||
|
'<parameters><type><text>pixelfed</text></type></parameters>' + \
|
||||||
|
'<uri>' + pixelfed + '</uri></url>\n'
|
||||||
youtube = get_youtube(actor)
|
youtube = get_youtube(actor)
|
||||||
if youtube:
|
if youtube:
|
||||||
vcard_str += ' <url>' + \
|
vcard_str += ' <url>' + \
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,8 @@ def html_person_options(default_timeline: str,
|
||||||
blocked_cache: [],
|
blocked_cache: [],
|
||||||
repo_url: str,
|
repo_url: str,
|
||||||
sites_unavailable: [],
|
sites_unavailable: [],
|
||||||
youtube: str, peertube: str) -> str:
|
youtube: str, peertube: str,
|
||||||
|
pixelfed: str) -> str:
|
||||||
"""Show options for a person: view/follow/block/report
|
"""Show options for a person: view/follow/block/report
|
||||||
"""
|
"""
|
||||||
options_link_str = ''
|
options_link_str = ''
|
||||||
|
|
@ -437,6 +438,11 @@ def html_person_options(default_timeline: str,
|
||||||
' <p class="imText">Blog: <a href="' + \
|
' <p class="imText">Blog: <a href="' + \
|
||||||
remove_html(blog_address) + '">' + \
|
remove_html(blog_address) + '">' + \
|
||||||
remove_html(blog_address) + '</a></p>\n'
|
remove_html(blog_address) + '</a></p>\n'
|
||||||
|
if pixelfed:
|
||||||
|
options_str += \
|
||||||
|
' <p class="imText">Pixelfed' + \
|
||||||
|
': <a href="' + remove_html(pixelfed) + '">' + \
|
||||||
|
pixelfed + '</a></p>\n'
|
||||||
if youtube:
|
if youtube:
|
||||||
options_str += \
|
options_str += \
|
||||||
' <p class="imText">YouTube' + \
|
' <p class="imText">YouTube' + \
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ from donate import get_donation_url
|
||||||
from donate import get_website
|
from donate import get_website
|
||||||
from donate import get_gemini_link
|
from donate import get_gemini_link
|
||||||
from pronouns import get_pronouns
|
from pronouns import get_pronouns
|
||||||
|
from pixelfed import get_pixelfed
|
||||||
from youtube import get_youtube
|
from youtube import get_youtube
|
||||||
from peertube import get_peertube
|
from peertube import get_peertube
|
||||||
from xmpp import get_xmpp_address
|
from xmpp import get_xmpp_address
|
||||||
|
|
@ -1097,6 +1098,7 @@ def html_profile(signing_priv_key_pem: str,
|
||||||
pgp_fingerprint = get_pgp_fingerprint(profile_json)
|
pgp_fingerprint = get_pgp_fingerprint(profile_json)
|
||||||
email_address = get_email_address(profile_json)
|
email_address = get_email_address(profile_json)
|
||||||
pronouns = get_pronouns(profile_json)
|
pronouns = get_pronouns(profile_json)
|
||||||
|
pixelfed = get_pixelfed(profile_json)
|
||||||
youtube = get_youtube(profile_json)
|
youtube = get_youtube(profile_json)
|
||||||
peertube = get_peertube(profile_json)
|
peertube = get_peertube(profile_json)
|
||||||
xmpp_address = get_xmpp_address(profile_json)
|
xmpp_address = get_xmpp_address(profile_json)
|
||||||
|
|
@ -1108,9 +1110,9 @@ def html_profile(signing_priv_key_pem: str,
|
||||||
verified_site_checkmark = '✔'
|
verified_site_checkmark = '✔'
|
||||||
premium = is_premium_account(base_dir, nickname, domain)
|
premium = is_premium_account(base_dir, nickname, domain)
|
||||||
if donate_url or website_url or repo_url or pronouns or youtube or \
|
if donate_url or website_url or repo_url or pronouns or youtube or \
|
||||||
xmpp_address or matrix_address or ssb_address or tox_address or \
|
peertube or pixelfed or xmpp_address or matrix_address or \
|
||||||
briar_address or cwtch_address or pgp_pub_key or enigma_pub_key or \
|
ssb_address or tox_address or briar_address or cwtch_address or \
|
||||||
pgp_fingerprint or email_address:
|
pgp_pub_key or enigma_pub_key or pgp_fingerprint or email_address:
|
||||||
donate_section = '<div class="container">\n'
|
donate_section = '<div class="container">\n'
|
||||||
donate_section += ' <center>\n'
|
donate_section += ' <center>\n'
|
||||||
if donate_url and not is_system_account(nickname):
|
if donate_url and not is_system_account(nickname):
|
||||||
|
|
@ -1174,10 +1176,18 @@ def html_profile(signing_priv_key_pem: str,
|
||||||
donate_section += \
|
donate_section += \
|
||||||
'<p>' + translate['XMPP'] + ': <a href="xmpp:' + \
|
'<p>' + translate['XMPP'] + ': <a href="xmpp:' + \
|
||||||
xmpp_address + '" tabindex="1">' + xmpp_address + '</a></p>\n'
|
xmpp_address + '" tabindex="1">' + xmpp_address + '</a></p>\n'
|
||||||
|
if pixelfed:
|
||||||
|
donate_section += \
|
||||||
|
'<p>Pixelfed: <a href="' + \
|
||||||
|
pixelfed + '" tabindex="1">' + pixelfed + '</a></p>\n'
|
||||||
if youtube:
|
if youtube:
|
||||||
donate_section += \
|
donate_section += \
|
||||||
'<p>YouTube: <a href="' + \
|
'<p>YouTube: <a href="' + \
|
||||||
youtube + '" tabindex="1">' + youtube + '</a></p>\n'
|
youtube + '" tabindex="1">' + youtube + '</a></p>\n'
|
||||||
|
if peertube:
|
||||||
|
donate_section += \
|
||||||
|
'<p>PeerTube: <a href="' + \
|
||||||
|
peertube + '" tabindex="1">' + peertube + '</a></p>\n'
|
||||||
if matrix_address:
|
if matrix_address:
|
||||||
donate_section += \
|
donate_section += \
|
||||||
'<p>' + translate['Matrix'] + ': ' + matrix_address + '</p>\n'
|
'<p>' + translate['Matrix'] + ': ' + matrix_address + '</p>\n'
|
||||||
|
|
@ -2724,7 +2734,8 @@ def _html_edit_profile_contact_info(email_address: str,
|
||||||
cwtch_address: str,
|
cwtch_address: str,
|
||||||
translate: {},
|
translate: {},
|
||||||
youtube: str,
|
youtube: str,
|
||||||
peertube: str) -> str:
|
peertube: str,
|
||||||
|
pixelfed: str) -> str:
|
||||||
"""Contact Information section of edit profile screen
|
"""Contact Information section of edit profile screen
|
||||||
"""
|
"""
|
||||||
edit_profile_form = begin_edit_section(translate['Contact Details'])
|
edit_profile_form = begin_edit_section(translate['Contact Details'])
|
||||||
|
|
@ -2743,7 +2754,9 @@ def _html_edit_profile_contact_info(email_address: str,
|
||||||
edit_profile_form += edit_text_field('YouTube', 'youtubeChannel',
|
edit_profile_form += edit_text_field('YouTube', 'youtubeChannel',
|
||||||
youtube)
|
youtube)
|
||||||
edit_profile_form += edit_text_field('PeerTube', 'peertubeChannel',
|
edit_profile_form += edit_text_field('PeerTube', 'peertubeChannel',
|
||||||
youtube)
|
peertube)
|
||||||
|
edit_profile_form += edit_text_field('Pixelfed', 'pixelfedChannel',
|
||||||
|
pixelfed)
|
||||||
edit_profile_form += end_edit_section()
|
edit_profile_form += end_edit_section()
|
||||||
return edit_profile_form
|
return edit_profile_form
|
||||||
|
|
||||||
|
|
@ -3189,9 +3202,9 @@ def html_edit_profile(server, translate: {},
|
||||||
blogs_instance_str = news_instance_str = moved_to = twitter_str = ''
|
blogs_instance_str = news_instance_str = moved_to = twitter_str = ''
|
||||||
bio_str = donate_url = website_url = gemini_link = ''
|
bio_str = donate_url = website_url = gemini_link = ''
|
||||||
email_address = featured_hashtags = pgp_pub_key = enigma_pub_key = ''
|
email_address = featured_hashtags = pgp_pub_key = enigma_pub_key = ''
|
||||||
pgp_fingerprint = pronouns = peertube = youtube = xmpp_address = ''
|
pgp_fingerprint = pronouns = peertube = youtube = pixelfed = ''
|
||||||
ssb_address = blog_address = matrix_address = tox_address = ''
|
ssb_address = blog_address = matrix_address = tox_address = ''
|
||||||
cwtch_address = briar_address = ''
|
cwtch_address = briar_address = xmpp_address = ''
|
||||||
manually_approves_followers = reject_spam_actors = ''
|
manually_approves_followers = reject_spam_actors = ''
|
||||||
|
|
||||||
actor_json = load_json(actor_filename)
|
actor_json = load_json(actor_filename)
|
||||||
|
|
@ -3203,6 +3216,7 @@ def html_edit_profile(server, translate: {},
|
||||||
website_url = get_website(actor_json, translate)
|
website_url = get_website(actor_json, translate)
|
||||||
gemini_link = get_gemini_link(actor_json)
|
gemini_link = get_gemini_link(actor_json)
|
||||||
pronouns = get_pronouns(actor_json)
|
pronouns = get_pronouns(actor_json)
|
||||||
|
pixelfed = get_pixelfed(actor_json)
|
||||||
youtube = get_youtube(actor_json)
|
youtube = get_youtube(actor_json)
|
||||||
peertube = get_peertube(actor_json)
|
peertube = get_peertube(actor_json)
|
||||||
xmpp_address = get_xmpp_address(actor_json)
|
xmpp_address = get_xmpp_address(actor_json)
|
||||||
|
|
@ -3424,7 +3438,7 @@ def html_edit_profile(server, translate: {},
|
||||||
ssb_address, tox_address,
|
ssb_address, tox_address,
|
||||||
briar_address,
|
briar_address,
|
||||||
cwtch_address, translate,
|
cwtch_address, translate,
|
||||||
youtube, peertube)
|
youtube, peertube, pixelfed)
|
||||||
|
|
||||||
# notification settings
|
# notification settings
|
||||||
edit_profile_form += \
|
edit_profile_form += \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue