mirror of https://gitlab.com/bashrc2/epicyon
Allow book listings without cover images
parent
00d69e31d2
commit
0757a281f4
115
daemon.py
115
daemon.py
|
@ -108,6 +108,7 @@ from posts import undo_pinned_post
|
|||
from posts import is_moderator
|
||||
from posts import create_question_post
|
||||
from posts import create_public_post
|
||||
from posts import create_reading_post
|
||||
from posts import create_blog_post
|
||||
from posts import create_report_post
|
||||
from posts import create_unlisted_post
|
||||
|
@ -22830,13 +22831,127 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if not fields.get('readingupdatetype'):
|
||||
print(post_type + ' no readingupdatetype')
|
||||
return -1
|
||||
if fields['readingupdatetype'] not in ('readingupdatewant',
|
||||
'readingupdateread',
|
||||
'readingupdatefinished',
|
||||
'readingupdaterating'):
|
||||
print(post_type + ' not recognised ' +
|
||||
fields['readingupdatetype'])
|
||||
return -1
|
||||
if not fields.get('booktitle'):
|
||||
print(post_type + ' no booktitle')
|
||||
return -1
|
||||
if not fields.get('bookurl'):
|
||||
print(post_type + ' no bookurl')
|
||||
return -1
|
||||
book_rating = 0.0
|
||||
if fields.get('bookrating'):
|
||||
if isinstance(fields['bookrating'], float) or \
|
||||
isinstance(fields['bookrating'], int):
|
||||
book_rating = fields['bookrating']
|
||||
# TODO reading status
|
||||
msg_str = fields['readingupdatetype']
|
||||
message_json = \
|
||||
create_reading_post(self.server.base_dir,
|
||||
nickname,
|
||||
self.server.domain,
|
||||
self.server.port,
|
||||
self.server.http_prefix,
|
||||
mentions_str, msg_str,
|
||||
fields['booktitle'],
|
||||
fields['bookurl'],
|
||||
book_rating,
|
||||
False, False, comments_enabled,
|
||||
filename, attachment_media_type,
|
||||
fields['imageDescription'],
|
||||
video_transcript,
|
||||
city, None, None,
|
||||
fields['subject'],
|
||||
fields['schedulePost'],
|
||||
fields['eventDate'],
|
||||
fields['eventTime'],
|
||||
fields['eventEndTime'],
|
||||
fields['location'], False,
|
||||
fields['languagesDropdown'],
|
||||
conversation_id,
|
||||
self.server.low_bandwidth,
|
||||
self.server.content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood,
|
||||
self.server.translate, buy_url,
|
||||
chat_url)
|
||||
if message_json:
|
||||
if edited_postid:
|
||||
recent_posts_cache = self.server.recent_posts_cache
|
||||
allow_local_network_access = \
|
||||
self.server.allow_local_network_access
|
||||
signing_priv_key_pem = \
|
||||
self.server.signing_priv_key_pem
|
||||
twitter_replacement_domain = \
|
||||
self.server.twitter_replacement_domain
|
||||
show_published_date_only = \
|
||||
self.server.show_published_date_only
|
||||
min_images_for_accounts = \
|
||||
self.server.min_images_for_accounts
|
||||
peertube_instances = \
|
||||
self.server.peertube_instances
|
||||
self._update_edited_post(self.server.base_dir,
|
||||
nickname, self.server.domain,
|
||||
message_json,
|
||||
edited_published,
|
||||
edited_postid,
|
||||
recent_posts_cache,
|
||||
'outbox',
|
||||
self.server.max_mentions,
|
||||
self.server.max_emoji,
|
||||
allow_local_network_access,
|
||||
self.server.debug,
|
||||
self.server.system_language,
|
||||
self.server.http_prefix,
|
||||
self.server.domain_full,
|
||||
self.server.person_cache,
|
||||
signing_priv_key_pem,
|
||||
self.server.max_recent_posts,
|
||||
self.server.translate,
|
||||
curr_session,
|
||||
self.server.cached_webfingers,
|
||||
self.server.port,
|
||||
self.server.allow_deletion,
|
||||
self.server.yt_replace_domain,
|
||||
twitter_replacement_domain,
|
||||
show_published_date_only,
|
||||
peertube_instances,
|
||||
self.server.theme_name,
|
||||
self.server.max_like_count,
|
||||
self.server.cw_lists,
|
||||
self.server.dogwhistles,
|
||||
min_images_for_accounts,
|
||||
self.server.max_hashtags,
|
||||
self.server.buy_sites)
|
||||
print('DEBUG: sending edited reading status post ' +
|
||||
str(message_json))
|
||||
if fields['schedulePost']:
|
||||
return 1
|
||||
if pin_to_profile:
|
||||
sys_language = self.server.system_language
|
||||
content_str = \
|
||||
get_base_content_from_post(message_json,
|
||||
sys_language)
|
||||
pin_post(self.server.base_dir,
|
||||
nickname, self.server.domain, content_str)
|
||||
return 1
|
||||
if self._post_to_outbox(message_json,
|
||||
self.server.project_version,
|
||||
nickname,
|
||||
curr_session, proxy_type):
|
||||
populate_replies(self.server.base_dir,
|
||||
self.server.http_prefix,
|
||||
self.server.domain_full,
|
||||
message_json,
|
||||
self.server.max_replies,
|
||||
self.server.debug)
|
||||
return 1
|
||||
return -1
|
||||
elif post_type in ('newshare', 'newwanted'):
|
||||
if not fields.get('itemQty'):
|
||||
print(post_type + ' no itemQty')
|
||||
|
|
68
posts.py
68
posts.py
|
@ -2152,6 +2152,74 @@ def create_public_post(base_dir: str,
|
|||
chat_url)
|
||||
|
||||
|
||||
def create_reading_post(base_dir: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
http_prefix: str,
|
||||
mentions_str: str, reading_update_type: str,
|
||||
book_title: str, book_url: str, book_rating: float,
|
||||
save_to_file: bool,
|
||||
client_to_server: bool, comments_enabled: bool,
|
||||
attach_image_filename: str, media_type: str,
|
||||
image_description: str, video_transcript: str,
|
||||
city: str, in_reply_to: str,
|
||||
in_reply_to_atom_uri: str, subject: str,
|
||||
schedule_post: bool,
|
||||
event_date: str, event_time: str, event_end_time: str,
|
||||
location: str, is_article: bool, system_language: str,
|
||||
conversation_id: str, low_bandwidth: bool,
|
||||
content_license_url: str,
|
||||
media_license_url: str, media_creator: str,
|
||||
languages_understood: [], translate: {},
|
||||
buy_url: str, chat_url: str) -> {}:
|
||||
""" TODO reading status post
|
||||
"""
|
||||
content = ''
|
||||
if mentions_str:
|
||||
if not mentions_str.endswith(' '):
|
||||
mentions_str += ' '
|
||||
if reading_update_type == 'readingupdatewant':
|
||||
content = mentions_str + translate['wants to read'] + \
|
||||
' <a href="' + book_url + \
|
||||
'"><i>' + book_title + '</i></a>'
|
||||
elif reading_update_type == 'readingupdateread':
|
||||
content = mentions_str + translate['reading'] + \
|
||||
' <a href="' + book_url + \
|
||||
'"><i>' + book_title + '</i></a>'
|
||||
elif reading_update_type == 'readingupdatefinished':
|
||||
content = mentions_str + translate['finished reading'] + \
|
||||
' <a href="' + book_url + \
|
||||
'"><i>' + book_title + '</i></a>'
|
||||
elif reading_update_type == 'readingupdaterating' and book_rating > 0:
|
||||
content = translate['rated'] + ' <a href="' + book_url + \
|
||||
'"><i>' + book_title + '</i></a>'
|
||||
if not content:
|
||||
return None
|
||||
post_json_object = \
|
||||
create_public_post(base_dir,
|
||||
nickname, domain, port, http_prefix,
|
||||
content, save_to_file,
|
||||
client_to_server, comments_enabled,
|
||||
attach_image_filename, media_type,
|
||||
image_description, video_transcript,
|
||||
city, in_reply_to,
|
||||
in_reply_to_atom_uri, subject,
|
||||
schedule_post,
|
||||
event_date, event_time, event_end_time,
|
||||
location, is_article, system_language,
|
||||
conversation_id, low_bandwidth,
|
||||
content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate,
|
||||
buy_url, chat_url)
|
||||
if post_json_object:
|
||||
post_json_object['tag'] = [{
|
||||
'href': book_url,
|
||||
'name': book_title,
|
||||
'type': 'Edition'
|
||||
}]
|
||||
return post_json_object
|
||||
|
||||
|
||||
def _append_citations_to_blog_post(base_dir: str,
|
||||
nickname: str, domain: str,
|
||||
blog_json: {}) -> None:
|
||||
|
|
18
reading.py
18
reading.py
|
@ -473,20 +473,22 @@ def html_profile_book_list(base_dir: str, actor: str, no_of_books: int,
|
|||
book_wanted = True
|
||||
elif event_type == 'finished':
|
||||
book_finished = True
|
||||
if book_title and book_image_url:
|
||||
if book_title:
|
||||
book_title = remove_html(book_title)
|
||||
html_str += ' <li class="book_event">\n'
|
||||
html_str += ' <span class="book_span">\n'
|
||||
html_str += ' <div class="book_span_div">\n'
|
||||
|
||||
# book image
|
||||
html_str += ' <a href="' + book_url + \
|
||||
'" target="_blank" rel="nofollow noopener noreferrer">\n'
|
||||
html_str += ' <div class="book_image_div">\n'
|
||||
html_str += ' <img src="' + book_image_url + '" ' + \
|
||||
'alt="' + book_title + '">\n'
|
||||
html_str += ' </div>\n'
|
||||
html_str += ' </a>\n'
|
||||
if book_image_url:
|
||||
html_str += ' <a href="' + book_url + \
|
||||
'" target="_blank" rel="nofollow noopener noreferrer">\n'
|
||||
html_str += ' <div class="book_image_div">\n'
|
||||
html_str += ' <img src="' + \
|
||||
book_image_url + '" ' + \
|
||||
'alt="' + book_title + '">\n'
|
||||
html_str += ' </div>\n'
|
||||
html_str += ' </a>\n'
|
||||
|
||||
# book details
|
||||
html_str += ' <div class="book_details_div">\n'
|
||||
|
|
|
@ -652,5 +652,6 @@
|
|||
"am reading": "أنا أقرأ",
|
||||
"Update type": "نوع التحديث",
|
||||
"add a rating": "إضافة تقييم",
|
||||
"Rating": "تقييم"
|
||||
"Rating": "تقييم",
|
||||
"reading": "قراءة"
|
||||
}
|
||||
|
|
|
@ -652,5 +652,6 @@
|
|||
"am reading": "পড়ছি",
|
||||
"Update type": "আপডেটের ধরন",
|
||||
"add a rating": "একটি রেটিং যোগ করুন",
|
||||
"Rating": "রেটিং"
|
||||
"Rating": "রেটিং",
|
||||
"reading": "পড়া"
|
||||
}
|
||||
|
|
|
@ -652,5 +652,6 @@
|
|||
"am reading": "estic llegint",
|
||||
"Update type": "Tipus d'actualització",
|
||||
"add a rating": "afegir una qualificació",
|
||||
"Rating": "Valoració"
|
||||
"Rating": "Valoració",
|
||||
"reading": "lectura"
|
||||
}
|
||||
|
|
|
@ -652,5 +652,6 @@
|
|||
"am reading": "rwy'n darllen",
|
||||
"Update type": "Math o ddiweddariad",
|
||||
"add a rating": "ychwanegu sgôr",
|
||||
"Rating": "Graddio"
|
||||
"Rating": "Graddio",
|
||||
"reading": "darllen"
|
||||
}
|
||||
|
|
|
@ -652,5 +652,6 @@
|
|||
"am reading": "Ich lese",
|
||||
"Update type": "Update-Typ",
|
||||
"add a rating": "Fügen Sie eine Bewertung hinzu",
|
||||
"Rating": "Bewertung"
|
||||
"Rating": "Bewertung",
|
||||
"reading": "lektüre"
|
||||
}
|
||||
|
|
|
@ -652,5 +652,6 @@
|
|||
"am reading": "διαβάζω",
|
||||
"Update type": "Τύπος ενημέρωσης",
|
||||
"add a rating": "προσθέστε μια βαθμολογία",
|
||||
"Rating": "Εκτίμηση"
|
||||
"Rating": "Εκτίμηση",
|
||||
"reading": "ΑΝΑΓΝΩΣΗ"
|
||||
}
|
||||
|
|
|
@ -652,5 +652,6 @@
|
|||
"am reading": "am reading",
|
||||
"Update type": "Update type",
|
||||
"add a rating": "add a rating",
|
||||
"Rating": "Rating"
|
||||
"Rating": "Rating",
|
||||
"reading": "reading"
|
||||
}
|
||||
|
|
|
@ -652,5 +652,6 @@
|
|||
"am reading": "Estoy leyendo",
|
||||
"Update type": "Tipo de actualización",
|
||||
"add a rating": "agregar una calificación",
|
||||
"Rating": "Clasificación"
|
||||
"Rating": "Clasificación",
|
||||
"reading": "lectura"
|
||||
}
|
||||
|
|
|
@ -652,5 +652,6 @@
|
|||
"am reading": "دارم میخونم",
|
||||
"Update type": "نوع به روز رسانی",
|
||||
"add a rating": "امتیاز اضافه کنید",
|
||||
"Rating": "رتبه بندی"
|
||||
"Rating": "رتبه بندی",
|
||||
"reading": "خواندن"
|
||||
}
|
||||
|
|
|
@ -652,5 +652,6 @@
|
|||
"am reading": "Je suis en train de lire",
|
||||
"Update type": "Type de mise à jour",
|
||||
"add a rating": "ajouter une note",
|
||||
"Rating": "Notation"
|
||||
"Rating": "Notation",
|
||||
"reading": "en lisant"
|
||||
}
|
||||
|
|
|
@ -652,5 +652,6 @@
|
|||
"am reading": "táim ag léamh",
|
||||
"Update type": "Cineál nuashonraithe",
|
||||
"add a rating": "cuir rátáil",
|
||||
"Rating": "Rátáil"
|
||||
"Rating": "Rátáil",
|
||||
"reading": "ag léamh"
|
||||
}
|
||||
|
|
|
@ -652,5 +652,6 @@
|
|||
"am reading": "אני קורא",
|
||||
"Update type": "סוג עדכון",
|
||||
"add a rating": "להוסיף דירוג",
|
||||
"Rating": "דֵרוּג"
|
||||
"Rating": "דֵרוּג",
|
||||
"reading": "קריאה"
|
||||
}
|
||||
|
|
|
@ -652,5 +652,6 @@
|
|||
"am reading": "पढ़ रहा हूं",
|
||||
"Update type": "अद्यतन प्रकार",
|
||||
"add a rating": "एक रेटिंग जोड़ें",
|
||||
"Rating": "रेटिंग"
|
||||
"Rating": "रेटिंग",
|
||||
"reading": "पढ़ना"
|
||||
}
|
||||
|
|
|
@ -652,5 +652,6 @@
|
|||
"am reading": "sto leggendo",
|
||||
"Update type": "Tipo di aggiornamento",
|
||||
"add a rating": "aggiungi una valutazione",
|
||||
"Rating": "Valutazione"
|
||||
"Rating": "Valutazione",
|
||||
"reading": "lettura"
|
||||
}
|
||||
|
|
|
@ -652,5 +652,6 @@
|
|||
"am reading": "読んでいます",
|
||||
"Update type": "更新タイプ",
|
||||
"add a rating": "評価を追加する",
|
||||
"Rating": "評価"
|
||||
"Rating": "評価",
|
||||
"reading": "読む"
|
||||
}
|
||||
|
|
|
@ -652,5 +652,6 @@
|
|||
"am reading": "읽고 있어요",
|
||||
"Update type": "업데이트 유형",
|
||||
"add a rating": "평점 추가",
|
||||
"Rating": "평가"
|
||||
"Rating": "평가",
|
||||
"reading": "독서"
|
||||
}
|
||||
|
|
|
@ -652,5 +652,6 @@
|
|||
"am reading": "ez dixwînim",
|
||||
"Update type": "Cureyê nûve bike",
|
||||
"add a rating": "rêjeyek zêde bike",
|
||||
"Rating": "Rating"
|
||||
"Rating": "Rating",
|
||||
"reading": "xwendinî"
|
||||
}
|
||||
|
|
|
@ -652,5 +652,6 @@
|
|||
"am reading": "aan het lezen",
|
||||
"Update type": "Updatetype",
|
||||
"add a rating": "een beoordeling toevoegen",
|
||||
"Rating": "Beoordeling"
|
||||
"Rating": "Beoordeling",
|
||||
"reading": "lezing"
|
||||
}
|
||||
|
|
|
@ -648,5 +648,6 @@
|
|||
"am reading": "am reading",
|
||||
"Update type": "Update type",
|
||||
"add a rating": "add a rating",
|
||||
"Rating": "Rating"
|
||||
"Rating": "Rating",
|
||||
"reading": "reading"
|
||||
}
|
||||
|
|
|
@ -652,5 +652,6 @@
|
|||
"am reading": "czytam",
|
||||
"Update type": "Typ aktualizacji",
|
||||
"add a rating": "dodaj ocenę",
|
||||
"Rating": "Ocena"
|
||||
"Rating": "Ocena",
|
||||
"reading": "czytanie"
|
||||
}
|
||||
|
|
|
@ -652,5 +652,6 @@
|
|||
"am reading": "estou lendo",
|
||||
"Update type": "Tipo de atualização",
|
||||
"add a rating": "adicionar uma classificação",
|
||||
"Rating": "Avaliação"
|
||||
"Rating": "Avaliação",
|
||||
"reading": "leitura"
|
||||
}
|
||||
|
|
|
@ -652,5 +652,6 @@
|
|||
"am reading": "читаю",
|
||||
"Update type": "Тип обновления",
|
||||
"add a rating": "добавить оценку",
|
||||
"Rating": "Рейтинг"
|
||||
"Rating": "Рейтинг",
|
||||
"reading": "чтение"
|
||||
}
|
||||
|
|
|
@ -652,5 +652,6 @@
|
|||
"am reading": "ninasoma",
|
||||
"Update type": "Aina ya sasisho",
|
||||
"add a rating": "ongeza ukadiriaji",
|
||||
"Rating": "Ukadiriaji"
|
||||
"Rating": "Ukadiriaji",
|
||||
"reading": "kusoma"
|
||||
}
|
||||
|
|
|
@ -652,5 +652,6 @@
|
|||
"am reading": "Okuyorum",
|
||||
"Update type": "Güncelleme türü",
|
||||
"add a rating": "derecelendirme ekle",
|
||||
"Rating": "Değerlendirme"
|
||||
"Rating": "Değerlendirme",
|
||||
"reading": "okuma"
|
||||
}
|
||||
|
|
|
@ -652,5 +652,6 @@
|
|||
"am reading": "я читаю",
|
||||
"Update type": "Тип оновлення",
|
||||
"add a rating": "додати оцінку",
|
||||
"Rating": "Рейтинг"
|
||||
"Rating": "Рейтинг",
|
||||
"reading": "читання"
|
||||
}
|
||||
|
|
|
@ -652,5 +652,6 @@
|
|||
"am reading": "בין לייענען",
|
||||
"Update type": "דערהייַנטיקן טיפּ",
|
||||
"add a rating": "לייגן אַ ראַנג",
|
||||
"Rating": "שאַץ"
|
||||
"Rating": "שאַץ",
|
||||
"reading": "לייענען"
|
||||
}
|
||||
|
|
|
@ -652,5 +652,6 @@
|
|||
"am reading": "正在阅读",
|
||||
"Update type": "更新类型",
|
||||
"add a rating": "添加评级",
|
||||
"Rating": "评分"
|
||||
"Rating": "评分",
|
||||
"reading": "阅读"
|
||||
}
|
||||
|
|
|
@ -828,7 +828,7 @@ def html_new_post(edit_post_params: {},
|
|||
translate['am reading'] + '</option>\n'
|
||||
extra_fields += ' <option value="readingupdatefinished">' + \
|
||||
translate['finished reading'] + '</option>\n'
|
||||
extra_fields += ' <option value="readingupdatefinished">' + \
|
||||
extra_fields += ' <option value="readingupdaterating">' + \
|
||||
translate['add a rating'] + '</option>\n'
|
||||
extra_fields += ' </select><br>\n'
|
||||
|
||||
|
|
Loading…
Reference in New Issue