Edit ActivityPub specification
54
daemon.py
|
@ -174,6 +174,7 @@ from webapp_utils import get_pwa_theme_colors
|
||||||
from webapp_calendar import html_calendar_delete_confirm
|
from webapp_calendar import html_calendar_delete_confirm
|
||||||
from webapp_calendar import html_calendar
|
from webapp_calendar import html_calendar
|
||||||
from webapp_about import html_about
|
from webapp_about import html_about
|
||||||
|
from webapp_specification import html_specification
|
||||||
from webapp_accesskeys import html_access_keys
|
from webapp_accesskeys import html_access_keys
|
||||||
from webapp_accesskeys import load_access_keys_for_accounts
|
from webapp_accesskeys import load_access_keys_for_accounts
|
||||||
from webapp_confirm import html_confirm_delete
|
from webapp_confirm import html_confirm_delete
|
||||||
|
@ -4782,6 +4783,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
links_filename = base_dir + '/accounts/links.txt'
|
links_filename = base_dir + '/accounts/links.txt'
|
||||||
about_filename = base_dir + '/accounts/about.md'
|
about_filename = base_dir + '/accounts/about.md'
|
||||||
tos_filename = base_dir + '/accounts/tos.md'
|
tos_filename = base_dir + '/accounts/tos.md'
|
||||||
|
specification_filename = base_dir + '/accounts/activitypub.md'
|
||||||
|
|
||||||
# extract all of the text fields into a dict
|
# extract all of the text fields into a dict
|
||||||
fields = \
|
fields = \
|
||||||
|
@ -4860,6 +4862,25 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
print('EX: _links_update unable to delete ' +
|
print('EX: _links_update unable to delete ' +
|
||||||
tos_filename)
|
tos_filename)
|
||||||
|
|
||||||
|
if fields.get('editedSpecification'):
|
||||||
|
specification_str = fields['editedSpecification']
|
||||||
|
if not dangerous_markup(specification_str,
|
||||||
|
allow_local_network_access):
|
||||||
|
try:
|
||||||
|
with open(specification_filename, 'w+',
|
||||||
|
encoding='utf-8') as specificationfile:
|
||||||
|
specificationfile.write(specification_str)
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write specification ' +
|
||||||
|
specification_filename)
|
||||||
|
else:
|
||||||
|
if os.path.isfile(specification_filename):
|
||||||
|
try:
|
||||||
|
os.remove(specification_filename)
|
||||||
|
except OSError:
|
||||||
|
print('EX: _links_update unable to delete ' +
|
||||||
|
specification_filename)
|
||||||
|
|
||||||
# redirect back to the default timeline
|
# redirect back to the default timeline
|
||||||
self._redirect_headers(actor_str + '/' + default_timeline,
|
self._redirect_headers(actor_str + '/' + default_timeline,
|
||||||
cookie, calling_domain)
|
cookie, calling_domain)
|
||||||
|
@ -16274,6 +16295,39 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.debug)
|
self.server.debug)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if self.path in ('/specification', '/protocol', '/activitypub'):
|
||||||
|
if calling_domain.endswith('.onion'):
|
||||||
|
msg = \
|
||||||
|
html_specification(self.server.css_cache,
|
||||||
|
self.server.base_dir, 'http',
|
||||||
|
self.server.onion_domain,
|
||||||
|
None, self.server.translate,
|
||||||
|
self.server.system_language)
|
||||||
|
elif calling_domain.endswith('.i2p'):
|
||||||
|
msg = \
|
||||||
|
html_specification(self.server.css_cache,
|
||||||
|
self.server.base_dir, 'http',
|
||||||
|
self.server.i2p_domain,
|
||||||
|
None, self.server.translate,
|
||||||
|
self.server.system_language)
|
||||||
|
else:
|
||||||
|
msg = \
|
||||||
|
html_specification(self.server.css_cache,
|
||||||
|
self.server.base_dir,
|
||||||
|
self.server.http_prefix,
|
||||||
|
self.server.domain_full,
|
||||||
|
self.server.onion_domain,
|
||||||
|
self.server.translate,
|
||||||
|
self.server.system_language)
|
||||||
|
msg = msg.encode('utf-8')
|
||||||
|
msglen = len(msg)
|
||||||
|
self._login_headers('text/html', msglen, calling_domain)
|
||||||
|
self._write(msg)
|
||||||
|
fitness_performance(getreq_start_time, self.server.fitness,
|
||||||
|
'_GET', 'show specification screen',
|
||||||
|
self.server.debug)
|
||||||
|
return
|
||||||
|
|
||||||
if html_getreq and users_in_path and authorized and \
|
if html_getreq and users_in_path and authorized and \
|
||||||
self.path.endswith('/accesskeys'):
|
self.path.endswith('/accesskeys'):
|
||||||
nickname = self.path.split('/users/')[1]
|
nickname = self.path.split('/users/')[1]
|
||||||
|
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 55 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
@ -564,5 +564,6 @@
|
||||||
"Save": "يحفظ",
|
"Save": "يحفظ",
|
||||||
"Switch to moderation view": "قم بالتبديل إلى عرض الاعتدال",
|
"Switch to moderation view": "قم بالتبديل إلى عرض الاعتدال",
|
||||||
"Minimize attached images": "تصغير الصور المرفقة",
|
"Minimize attached images": "تصغير الصور المرفقة",
|
||||||
"SHOW MEDIA": "عرض الوسائط"
|
"SHOW MEDIA": "عرض الوسائط",
|
||||||
|
"ActivityPub Specification": "مواصفات ActivityPub"
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,5 +564,6 @@
|
||||||
"Save": "সংরক্ষণ",
|
"Save": "সংরক্ষণ",
|
||||||
"Switch to moderation view": "সংযম দৃশ্যে স্যুইচ করুন",
|
"Switch to moderation view": "সংযম দৃশ্যে স্যুইচ করুন",
|
||||||
"Minimize attached images": "সংযুক্ত ছবি ছোট করুন",
|
"Minimize attached images": "সংযুক্ত ছবি ছোট করুন",
|
||||||
"SHOW MEDIA": "মিডিয়া দেখান"
|
"SHOW MEDIA": "মিডিয়া দেখান",
|
||||||
|
"ActivityPub Specification": "ActivityPub স্পেসিফিকেশন"
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,5 +564,6 @@
|
||||||
"Save": "Desa",
|
"Save": "Desa",
|
||||||
"Switch to moderation view": "Canvia a la visualització de moderació",
|
"Switch to moderation view": "Canvia a la visualització de moderació",
|
||||||
"Minimize attached images": "Minimitzar les imatges adjuntes",
|
"Minimize attached images": "Minimitzar les imatges adjuntes",
|
||||||
"SHOW MEDIA": "MOSTRA ELS MITJANS"
|
"SHOW MEDIA": "MOSTRA ELS MITJANS",
|
||||||
|
"ActivityPub Specification": "Especificació d'ActivityPub"
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,5 +564,6 @@
|
||||||
"Save": "Arbed",
|
"Save": "Arbed",
|
||||||
"Switch to moderation view": "Newid i wedd safoni",
|
"Switch to moderation view": "Newid i wedd safoni",
|
||||||
"Minimize attached images": "Lleihau delweddau sydd ynghlwm",
|
"Minimize attached images": "Lleihau delweddau sydd ynghlwm",
|
||||||
"SHOW MEDIA": "DANGOS CYFRYNGAU"
|
"SHOW MEDIA": "DANGOS CYFRYNGAU",
|
||||||
|
"ActivityPub Specification": "Manyleb GweithgareddPub"
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,5 +564,6 @@
|
||||||
"Save": "Speichern",
|
"Save": "Speichern",
|
||||||
"Switch to moderation view": "Wechseln Sie zur Moderationsansicht",
|
"Switch to moderation view": "Wechseln Sie zur Moderationsansicht",
|
||||||
"Minimize attached images": "Angehängte Bilder minimieren",
|
"Minimize attached images": "Angehängte Bilder minimieren",
|
||||||
"SHOW MEDIA": "MEDIEN ZEIGEN"
|
"SHOW MEDIA": "MEDIEN ZEIGEN",
|
||||||
|
"ActivityPub Specification": "ActivityPub-Spezifikation"
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,5 +564,6 @@
|
||||||
"Save": "Αποθηκεύσετε",
|
"Save": "Αποθηκεύσετε",
|
||||||
"Switch to moderation view": "Μετάβαση σε προβολή εποπτείας",
|
"Switch to moderation view": "Μετάβαση σε προβολή εποπτείας",
|
||||||
"Minimize attached images": "Ελαχιστοποιήστε τις συνημμένες εικόνες",
|
"Minimize attached images": "Ελαχιστοποιήστε τις συνημμένες εικόνες",
|
||||||
"SHOW MEDIA": "ΔΕΙΤΕ ΜΕΣΑ"
|
"SHOW MEDIA": "ΔΕΙΤΕ ΜΕΣΑ",
|
||||||
|
"ActivityPub Specification": "Προδιαγραφές ActivityPub"
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,5 +564,6 @@
|
||||||
"Save": "Save",
|
"Save": "Save",
|
||||||
"Switch to moderation view": "Switch to moderation view",
|
"Switch to moderation view": "Switch to moderation view",
|
||||||
"Minimize attached images": "Minimize attached images",
|
"Minimize attached images": "Minimize attached images",
|
||||||
"SHOW MEDIA": "SHOW MEDIA"
|
"SHOW MEDIA": "SHOW MEDIA",
|
||||||
|
"ActivityPub Specification": "ActivityPub Specification"
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,5 +564,6 @@
|
||||||
"Save": "Ahorrar",
|
"Save": "Ahorrar",
|
||||||
"Switch to moderation view": "Cambiar a la vista de moderación",
|
"Switch to moderation view": "Cambiar a la vista de moderación",
|
||||||
"Minimize attached images": "Minimizar imágenes adjuntas",
|
"Minimize attached images": "Minimizar imágenes adjuntas",
|
||||||
"SHOW MEDIA": "MOSTRAR MEDIOS"
|
"SHOW MEDIA": "MOSTRAR MEDIOS",
|
||||||
|
"ActivityPub Specification": "Especificación de ActivityPub"
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,5 +564,6 @@
|
||||||
"Save": "Sauvegarder",
|
"Save": "Sauvegarder",
|
||||||
"Switch to moderation view": "Passer en mode modération",
|
"Switch to moderation view": "Passer en mode modération",
|
||||||
"Minimize attached images": "Réduire les images jointes",
|
"Minimize attached images": "Réduire les images jointes",
|
||||||
"SHOW MEDIA": "AFFICHER LES MÉDIAS"
|
"SHOW MEDIA": "AFFICHER LES MÉDIAS",
|
||||||
|
"ActivityPub Specification": "Spécification ActivityPub"
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,5 +564,6 @@
|
||||||
"Save": "Sábháil",
|
"Save": "Sábháil",
|
||||||
"Switch to moderation view": "Athraigh go dtí an t-amharc modhnóireachta",
|
"Switch to moderation view": "Athraigh go dtí an t-amharc modhnóireachta",
|
||||||
"Minimize attached images": "Íoslaghdaigh íomhánna ceangailte",
|
"Minimize attached images": "Íoslaghdaigh íomhánna ceangailte",
|
||||||
"SHOW MEDIA": "Taispeáin MEÁIN"
|
"SHOW MEDIA": "Taispeáin MEÁIN",
|
||||||
|
"ActivityPub Specification": "Sonraíocht ActivityPub"
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,5 +564,6 @@
|
||||||
"Save": "बचाना",
|
"Save": "बचाना",
|
||||||
"Switch to moderation view": "मॉडरेशन दृश्य पर स्विच करें",
|
"Switch to moderation view": "मॉडरेशन दृश्य पर स्विच करें",
|
||||||
"Minimize attached images": "संलग्न छवियों को छोटा करें",
|
"Minimize attached images": "संलग्न छवियों को छोटा करें",
|
||||||
"SHOW MEDIA": "मीडिया दिखाएं"
|
"SHOW MEDIA": "मीडिया दिखाएं",
|
||||||
|
"ActivityPub Specification": "गतिविधिपब विशिष्टता"
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,5 +564,6 @@
|
||||||
"Save": "Salva",
|
"Save": "Salva",
|
||||||
"Switch to moderation view": "Passa alla visualizzazione moderazione",
|
"Switch to moderation view": "Passa alla visualizzazione moderazione",
|
||||||
"Minimize attached images": "Riduci al minimo le immagini allegate",
|
"Minimize attached images": "Riduci al minimo le immagini allegate",
|
||||||
"SHOW MEDIA": "MOSTRA MEDIA"
|
"SHOW MEDIA": "MOSTRA MEDIA",
|
||||||
|
"ActivityPub Specification": "Specifica ActivityPub"
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,5 +564,6 @@
|
||||||
"Save": "保存",
|
"Save": "保存",
|
||||||
"Switch to moderation view": "モデレートビューに切り替えます",
|
"Switch to moderation view": "モデレートビューに切り替えます",
|
||||||
"Minimize attached images": "添付画像を最小限に抑える",
|
"Minimize attached images": "添付画像を最小限に抑える",
|
||||||
"SHOW MEDIA": "メディアを表示"
|
"SHOW MEDIA": "メディアを表示",
|
||||||
|
"ActivityPub Specification": "ActivityPubの仕様"
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,5 +564,6 @@
|
||||||
"Save": "구하다",
|
"Save": "구하다",
|
||||||
"Switch to moderation view": "검토 보기로 전환",
|
"Switch to moderation view": "검토 보기로 전환",
|
||||||
"Minimize attached images": "첨부된 이미지 최소화",
|
"Minimize attached images": "첨부된 이미지 최소화",
|
||||||
"SHOW MEDIA": "미디어 표시"
|
"SHOW MEDIA": "미디어 표시",
|
||||||
|
"ActivityPub Specification": "ActivityPub 사양"
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,5 +564,6 @@
|
||||||
"Save": "Rizgarkirin",
|
"Save": "Rizgarkirin",
|
||||||
"Switch to moderation view": "Biguherîne bo dîtina moderatoriyê",
|
"Switch to moderation view": "Biguherîne bo dîtina moderatoriyê",
|
||||||
"Minimize attached images": "Wêneyên pêvekirî kêm bikin",
|
"Minimize attached images": "Wêneyên pêvekirî kêm bikin",
|
||||||
"SHOW MEDIA": "MEDYA NÎŞAN DE"
|
"SHOW MEDIA": "MEDYA NÎŞAN DE",
|
||||||
|
"ActivityPub Specification": "Specification ActivityPub"
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,5 +564,6 @@
|
||||||
"Save": "Opslaan",
|
"Save": "Opslaan",
|
||||||
"Switch to moderation view": "Overschakelen naar moderatieweergave",
|
"Switch to moderation view": "Overschakelen naar moderatieweergave",
|
||||||
"Minimize attached images": "Bijgevoegde afbeeldingen minimaliseren",
|
"Minimize attached images": "Bijgevoegde afbeeldingen minimaliseren",
|
||||||
"SHOW MEDIA": "TOON MEDIA"
|
"SHOW MEDIA": "TOON MEDIA",
|
||||||
|
"ActivityPub Specification": "ActivityPub-specificatie"
|
||||||
}
|
}
|
||||||
|
|
|
@ -560,5 +560,6 @@
|
||||||
"Save": "Save",
|
"Save": "Save",
|
||||||
"Switch to moderation view": "Switch to moderation view",
|
"Switch to moderation view": "Switch to moderation view",
|
||||||
"Minimize attached images": "Minimize attached images",
|
"Minimize attached images": "Minimize attached images",
|
||||||
"SHOW MEDIA": "SHOW MEDIA"
|
"SHOW MEDIA": "SHOW MEDIA",
|
||||||
|
"ActivityPub Specification": "ActivityPub Specification"
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,5 +564,6 @@
|
||||||
"Save": "Ratować",
|
"Save": "Ratować",
|
||||||
"Switch to moderation view": "Przełącz na widok moderacji",
|
"Switch to moderation view": "Przełącz na widok moderacji",
|
||||||
"Minimize attached images": "Zminimalizuj załączone obrazy",
|
"Minimize attached images": "Zminimalizuj załączone obrazy",
|
||||||
"SHOW MEDIA": "POKAŻ MEDIA"
|
"SHOW MEDIA": "POKAŻ MEDIA",
|
||||||
|
"ActivityPub Specification": "Specyfikacja ActivityPub"
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,5 +564,6 @@
|
||||||
"Save": "Salvar",
|
"Save": "Salvar",
|
||||||
"Switch to moderation view": "Mudar para a visualização de moderação",
|
"Switch to moderation view": "Mudar para a visualização de moderação",
|
||||||
"Minimize attached images": "Minimizar imagens anexadas",
|
"Minimize attached images": "Minimizar imagens anexadas",
|
||||||
"SHOW MEDIA": "MOSTRAR MÍDIA"
|
"SHOW MEDIA": "MOSTRAR MÍDIA",
|
||||||
|
"ActivityPub Specification": "Especificação do ActivityPub"
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,5 +564,6 @@
|
||||||
"Save": "Сохранять",
|
"Save": "Сохранять",
|
||||||
"Switch to moderation view": "Перейти в режим модерации",
|
"Switch to moderation view": "Перейти в режим модерации",
|
||||||
"Minimize attached images": "Свернуть прикрепленные изображения",
|
"Minimize attached images": "Свернуть прикрепленные изображения",
|
||||||
"SHOW MEDIA": "ПОКАЗАТЬ МЕДИА"
|
"SHOW MEDIA": "ПОКАЗАТЬ МЕДИА",
|
||||||
|
"ActivityPub Specification": "Спецификация ActivityPub"
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,5 +564,6 @@
|
||||||
"Save": "Hifadhi",
|
"Save": "Hifadhi",
|
||||||
"Switch to moderation view": "Badili hadi mwonekano wa udhibiti",
|
"Switch to moderation view": "Badili hadi mwonekano wa udhibiti",
|
||||||
"Minimize attached images": "Punguza picha zilizoambatishwa",
|
"Minimize attached images": "Punguza picha zilizoambatishwa",
|
||||||
"SHOW MEDIA": "ONESHA VYOMBO VYA HABARI"
|
"SHOW MEDIA": "ONESHA VYOMBO VYA HABARI",
|
||||||
|
"ActivityPub Specification": "Vipimo vya ActivityPub"
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,5 +564,6 @@
|
||||||
"Save": "Kaydetmek",
|
"Save": "Kaydetmek",
|
||||||
"Switch to moderation view": "Denetleme görünümüne geç",
|
"Switch to moderation view": "Denetleme görünümüne geç",
|
||||||
"Minimize attached images": "Ekli resimleri simge durumuna küçült",
|
"Minimize attached images": "Ekli resimleri simge durumuna küçült",
|
||||||
"SHOW MEDIA": "MEDYA GÖSTER"
|
"SHOW MEDIA": "MEDYA GÖSTER",
|
||||||
|
"ActivityPub Specification": "ActivityPub Spesifikasyonu"
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,5 +564,6 @@
|
||||||
"Save": "Зберегти",
|
"Save": "Зберегти",
|
||||||
"Switch to moderation view": "Перейти до режиму модерації",
|
"Switch to moderation view": "Перейти до режиму модерації",
|
||||||
"Minimize attached images": "Мінімізуйте вкладені зображення",
|
"Minimize attached images": "Мінімізуйте вкладені зображення",
|
||||||
"SHOW MEDIA": "ПОКАЗАТИ ЗМІ"
|
"SHOW MEDIA": "ПОКАЗАТИ ЗМІ",
|
||||||
|
"ActivityPub Specification": "Специфікація ActivityPub"
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,5 +564,6 @@
|
||||||
"Save": "היט",
|
"Save": "היט",
|
||||||
"Switch to moderation view": "באַשטימען צו מאַדעריישאַן מיינונג",
|
"Switch to moderation view": "באַשטימען צו מאַדעריישאַן מיינונג",
|
||||||
"Minimize attached images": "מינאַמייז אַטאַטשט בילדער",
|
"Minimize attached images": "מינאַמייז אַטאַטשט בילדער",
|
||||||
"SHOW MEDIA": "ווייַז מעדיע"
|
"SHOW MEDIA": "ווייַז מעדיע",
|
||||||
|
"ActivityPub Specification": "ActivityPub באַשרייַבונג"
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,5 +564,6 @@
|
||||||
"Save": "节省",
|
"Save": "节省",
|
||||||
"Switch to moderation view": "切换到审核视图",
|
"Switch to moderation view": "切换到审核视图",
|
||||||
"Minimize attached images": "最小化附加图像",
|
"Minimize attached images": "最小化附加图像",
|
||||||
"SHOW MEDIA": "展示媒体"
|
"SHOW MEDIA": "展示媒体",
|
||||||
|
"ActivityPub Specification": "ActivityPub 规范"
|
||||||
}
|
}
|
||||||
|
|
|
@ -505,7 +505,7 @@ def html_edit_links(css_cache: {}, translate: {}, base_dir: str, path: str,
|
||||||
edit_links_form += \
|
edit_links_form += \
|
||||||
'</div>'
|
'</div>'
|
||||||
|
|
||||||
# the admin can edit terms of service and about text
|
# the admin can edit terms of service, about and specification text
|
||||||
admin_nickname = get_config_param(base_dir, 'admin')
|
admin_nickname = get_config_param(base_dir, 'admin')
|
||||||
if admin_nickname:
|
if admin_nickname:
|
||||||
if nickname == admin_nickname:
|
if nickname == admin_nickname:
|
||||||
|
@ -547,5 +547,25 @@ def html_edit_links(css_cache: {}, translate: {}, base_dir: str, path: str,
|
||||||
edit_links_form += \
|
edit_links_form += \
|
||||||
'</div>'
|
'</div>'
|
||||||
|
|
||||||
|
specification_filename = base_dir + '/accounts/activitypub.md'
|
||||||
|
specification_str = ''
|
||||||
|
if os.path.isfile(specification_filename):
|
||||||
|
with open(specification_filename, 'r',
|
||||||
|
encoding='utf-8') as fp_specification:
|
||||||
|
specification_str = fp_specification.read()
|
||||||
|
|
||||||
|
edit_links_form += \
|
||||||
|
'<div class="container">'
|
||||||
|
edit_links_form += \
|
||||||
|
' ' + \
|
||||||
|
translate['ActivityPub Specification'] + \
|
||||||
|
'<br>'
|
||||||
|
edit_links_form += \
|
||||||
|
' <textarea id="message" name="editedSpecification" ' + \
|
||||||
|
'style="height:1000vh" spellcheck="true" ' + \
|
||||||
|
'autocomplete="on">' + specification_str + '</textarea>'
|
||||||
|
edit_links_form += \
|
||||||
|
'</div>'
|
||||||
|
|
||||||
edit_links_form += html_footer()
|
edit_links_form += html_footer()
|
||||||
return edit_links_form
|
return edit_links_form
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
__filename__ = "webapp_about.py"
|
||||||
|
__author__ = "Bob Mottram"
|
||||||
|
__license__ = "AGPL3+"
|
||||||
|
__version__ = "1.3.0"
|
||||||
|
__maintainer__ = "Bob Mottram"
|
||||||
|
__email__ = "bob@libreserver.org"
|
||||||
|
__status__ = "Production"
|
||||||
|
__module_group__ = "Web Interface"
|
||||||
|
|
||||||
|
import os
|
||||||
|
from shutil import copyfile
|
||||||
|
from utils import get_config_param
|
||||||
|
from webapp_utils import html_header_with_website_markup
|
||||||
|
from webapp_utils import html_footer
|
||||||
|
from markdown import markdown_to_html
|
||||||
|
|
||||||
|
|
||||||
|
def html_specification(css_cache: {}, base_dir: str, http_prefix: str,
|
||||||
|
domain_full: str, onion_domain: str, translate: {},
|
||||||
|
system_language: str) -> str:
|
||||||
|
"""Show the specification screen
|
||||||
|
"""
|
||||||
|
admin_nickname = get_config_param(base_dir, 'admin')
|
||||||
|
if not os.path.isfile(base_dir + '/accounts/activitypub.md'):
|
||||||
|
copyfile(base_dir + '/specification/activitypub.md',
|
||||||
|
base_dir + '/accounts/activitypub.md')
|
||||||
|
|
||||||
|
if os.path.isfile(base_dir + '/accounts/login-background-custom.jpg'):
|
||||||
|
if not os.path.isfile(base_dir + '/accounts/login-background.jpg'):
|
||||||
|
copyfile(base_dir + '/accounts/login-background-custom.jpg',
|
||||||
|
base_dir + '/accounts/login-background.jpg')
|
||||||
|
|
||||||
|
specification_text = 'ActivityPub Protocol Specification.'
|
||||||
|
if os.path.isfile(base_dir + '/accounts/activitypub.md'):
|
||||||
|
with open(base_dir + '/accounts/activitypub.md', 'r',
|
||||||
|
encoding='utf-8') as fp_specification:
|
||||||
|
specification_text = markdown_to_html(fp_specification.read())
|
||||||
|
|
||||||
|
specification_form = ''
|
||||||
|
css_filename = base_dir + '/epicyon-profile.css'
|
||||||
|
if os.path.isfile(base_dir + '/epicyon.css'):
|
||||||
|
css_filename = base_dir + '/epicyon.css'
|
||||||
|
|
||||||
|
instance_title = \
|
||||||
|
get_config_param(base_dir, 'instanceTitle')
|
||||||
|
specification_form = \
|
||||||
|
html_header_with_website_markup(css_filename, instance_title,
|
||||||
|
http_prefix, domain_full,
|
||||||
|
system_language)
|
||||||
|
specification_form += \
|
||||||
|
'<div class="container">' + specification_text + '</div>'
|
||||||
|
if onion_domain:
|
||||||
|
specification_form += \
|
||||||
|
'<div class="container"><center>\n' + \
|
||||||
|
'<p class="administeredby">' + \
|
||||||
|
'http://' + onion_domain + '</p>\n</center></div>\n'
|
||||||
|
if admin_nickname:
|
||||||
|
admin_actor = '/users/' + admin_nickname
|
||||||
|
specification_form += \
|
||||||
|
'<div class="container"><center>\n' + \
|
||||||
|
'<p class="administeredby">' + \
|
||||||
|
translate['Administered by'] + ' <a href="' + \
|
||||||
|
admin_actor + '">' + admin_nickname + '</a>. ' + \
|
||||||
|
translate['Version'] + ' ' + __version__ + \
|
||||||
|
'</p>\n</center></div>\n'
|
||||||
|
specification_form += html_footer()
|
||||||
|
return specification_form
|