merge-requests/30/head
Bob Mottram 2022-12-31 23:47:53 +00:00
commit 20d0fab413
10 changed files with 16632 additions and 49 deletions

File diff suppressed because one or more lines are too long

BIN
emoji/paywall.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -62,6 +62,10 @@ body, html {
image-rendering: var(--rendering);
}
form {
background-color: var(--main-bg-color);
}
a, u {
color: var(--main-fg-color);
}

View File

@ -74,6 +74,10 @@ body, html {
image-rendering: var(--rendering);
}
form {
background-color: var(--options-bg-color);
}
a, u {
color: var(--options-fg-color);
}

View File

@ -1758,7 +1758,7 @@ h3 {
color: var(--time-color);
margin: var(--time-vertical-align) 20px;
}
input[type=text], input[type=password], select, textarea {
input[type=text], input[type=search], input[type=password], select, textarea {
width: 100%;
padding: 12px;
border: 1px solid #ccc;
@ -2557,7 +2557,7 @@ h3 {
color: var(--time-color);
margin: var(--time-vertical-align-mobile) 20px;
}
input[type=text], input[type=password], select, textarea {
input[type=text], input[type=search], input[type=password], select, textarea {
width: 100%;
padding: 12px;
border: 1px solid #ccc;
@ -3354,7 +3354,7 @@ h3 {
color: var(--time-color);
margin: var(--time-vertical-align-tiny) 20px;
}
input[type=text], input[type=password], select, textarea {
input[type=text], input[type=search], input[type=password], select, textarea {
width: 100%;
padding: 12px;
border: 1px solid #ccc;

File diff suppressed because one or more lines are too long

View File

@ -99,7 +99,7 @@ def html_conversation_view(post_id: str,
minimize_all_images, None)
if post_str:
# check for "HTTP/1.1 303 See Other Server"
if not post_str.startswith('HTTP/'):
if 'X-AP-Instance-ID' not in post_str:
conv_str += text_mode_separator + separator_str + post_str
conv_str += text_mode_separator + html_footer()

View File

@ -24,6 +24,7 @@ from utils import get_currencies
from utils import get_category_types
from utils import get_account_timezone
from utils import get_supported_languages
from webapp_utils import html_following_data_list
from webapp_utils import html_common_emoji
from webapp_utils import begin_edit_section
from webapp_utils import end_edit_section
@ -39,48 +40,6 @@ from maps import get_map_preferences_coords
from maps import get_location_from_tags
def _html_following_data_list(base_dir: str, nickname: str,
domain: str, domain_full: str) -> str:
"""Returns a datalist of handles being followed
"""
list_str = '<datalist id="followingHandles">\n'
following_filename = \
acct_dir(base_dir, nickname, domain) + '/following.txt'
msg = None
if os.path.isfile(following_filename):
with open(following_filename, 'r',
encoding='utf-8') as following_file:
msg = following_file.read()
# add your own handle, so that you can send DMs
# to yourself as reminders
msg += nickname + '@' + domain_full + '\n'
if msg:
# include petnames
petnames_filename = \
acct_dir(base_dir, nickname, domain) + '/petnames.txt'
if os.path.isfile(petnames_filename):
following_list = []
with open(petnames_filename, 'r',
encoding='utf-8') as petnames_file:
pet_str = petnames_file.read()
# extract each petname and append it
petnames_list = pet_str.split('\n')
for pet in petnames_list:
following_list.append(pet.split(' ')[0])
# add the following.txt entries
following_list += msg.split('\n')
else:
# no petnames list exists - just use following.txt
following_list = msg.split('\n')
following_list.sort()
if following_list:
for following_address in following_list:
if following_address:
list_str += '<option>@' + following_address + '</option>\n'
list_str += '</datalist>\n'
return list_str
def _html_new_post_drop_down(scope_icon: str, scope_description: str,
reply_str: str,
translate: {},
@ -1066,7 +1025,8 @@ def html_new_post(edit_post_params: {},
' <input type="text" name="mentions" ' + \
'list="followingHandles" value="' + mentions_str + '" selected>\n'
new_post_form += \
_html_following_data_list(base_dir, nickname, domain, domain_full)
html_following_data_list(base_dir, nickname, domain, domain_full,
'following', True)
new_post_form += ''
selected_str = ''

View File

@ -63,6 +63,7 @@ from filters import is_filtered
from follow import is_follower_of_person
from follow import get_follower_domains
from webapp_frontscreen import html_front_screen
from webapp_utils import html_following_data_list
from webapp_utils import edit_number_field
from webapp_utils import html_keyboard_navigation
from webapp_utils import html_hide_from_screen_reader
@ -1098,6 +1099,28 @@ def html_profile(signing_priv_key_pem: str,
profile_str += ' </center>'
profile_str += '</div>'
# search for following or followers
if authorized:
if selected in ('following', 'followers'):
follow_search_str = '<div class="container">\n'
follow_search_str += \
'<form method="POST" action="' + users_path + \
'/searchhandle?page=1">\n'
follow_search_str += \
' <input type="hidden" ' + \
'name="actor" value="' + actor + '">\n'
follow_search_str += \
' <input type="search" name="searchtext" ' + \
'list="' + selected + 'Handles" placeholder="🔎">\n'
follow_search_str += \
html_following_data_list(base_dir, nickname, domain,
domain_full, selected, False)
follow_search_str += \
' <button type="submit" class="button" ' + \
'name="submitSearch">' + translate['Search'] + '</button>\n'
follow_search_str += '</form>\n</div>\n'
profile_str += follow_search_str
# start of #timeline
profile_str += '<div id="timeline">\n'

View File

@ -1967,3 +1967,52 @@ def get_default_path(media_instance: bool, blogs_instance: bool,
else:
path = '/users/' + nickname + '/inbox'
return path
def html_following_data_list(base_dir: str, nickname: str,
domain: str, domain_full: str,
following_type: str,
use_petnames: bool) -> str:
"""Returns a datalist of handles being followed
followingHandles, followersHandles
"""
list_str = '<datalist id="' + following_type + 'Handles">\n'
following_filename = \
acct_dir(base_dir, nickname, domain) + '/' + following_type + '.txt'
msg = None
if os.path.isfile(following_filename):
with open(following_filename, 'r',
encoding='utf-8') as following_file:
msg = following_file.read()
# add your own handle, so that you can send DMs
# to yourself as reminders
msg += nickname + '@' + domain_full + '\n'
if msg:
# include petnames
petnames_filename = \
acct_dir(base_dir, nickname, domain) + '/petnames.txt'
if use_petnames and os.path.isfile(petnames_filename):
following_list = []
with open(petnames_filename, 'r',
encoding='utf-8') as petnames_file:
pet_str = petnames_file.read()
# extract each petname and append it
petnames_list = pet_str.split('\n')
for pet in petnames_list:
following_list.append(pet.split(' ')[0])
# add the following.txt entries
following_list += msg.split('\n')
else:
# no petnames list exists - just use following.txt
following_list = msg.split('\n')
following_list.sort()
if following_list:
for following_address in following_list:
if not following_address:
continue
if '@' not in following_address and \
'://' not in following_address:
continue
list_str += '<option>@' + following_address + '</option>\n'
list_str += '</datalist>\n'
return list_str