diff --git a/daemon.py b/daemon.py index 3af1ab12c..f01bbe116 100644 --- a/daemon.py +++ b/daemon.py @@ -15,6 +15,7 @@ from functools import partial # for saving images from hashlib import sha256 from hashlib import sha1 +from shutil import copyfile from session import createSession from webfinger import parseHandle from webfinger import webfingerMeta @@ -5413,7 +5414,8 @@ class PubServer(BaseHTTPRequestHandler): # extract each image type actorChanged = True profileMediaTypes = ('avatar', 'image', - 'banner', 'instanceLogo') + 'banner', 'instanceLogo', + 'customFont') profileMediaTypesUploaded = {} for mType in profileMediaTypes: if self.server.debug: @@ -5435,36 +5437,41 @@ class PubServer(BaseHTTPRequestHandler): # Note: a .temp extension is used here so that at no # time is an image with metadata publicly exposed, # even for a few mS - if mType != 'instanceLogo': + if mType == 'instanceLogo': + filenameBase = \ + self.server.baseDir + '/accounts/login.temp' + elif mType == 'customFont': + filenameBase = \ + self.server.baseDir + '/fonts/' + \ + '/custom.temp' + else: filenameBase = \ self.server.baseDir + '/accounts/' + \ nickname + '@' + self.server.domain + \ '/' + mType + '.temp' - else: - filenameBase = \ - self.server.baseDir + '/accounts/login.temp' filename, attachmentMediaType = \ saveMediaInFormPOST(mediaBytes, self.server.debug, filenameBase) if filename: - if self.server.debug: - print('DEBUG: profile update POST ' + mType + - ' media filename is ' + filename) + print('Profile update POST ' + mType + + ' media filename is ' + filename) else: - if self.server.debug: - print('DEBUG: profile update, no ' + mType + - ' media filename in POST') + print('Profile update, no ' + mType + + ' media filename in POST') continue if self.server.debug: print('DEBUG: POST ' + mType + ' media removing metadata') postImageFilename = filename.replace('.temp', '') - removeMetaData(filename, postImageFilename) + if mType == 'customFont': + copyfile(filename, postImageFilename) + else: + removeMetaData(filename, postImageFilename) if os.path.isfile(postImageFilename): print('profile update POST ' + mType + - ' image saved to ' + postImageFilename) + ' image or font saved to ' + postImageFilename) if mType != 'instanceLogo': lastPartOfImageFilename = \ postImageFilename.split('/')[-1] @@ -5473,7 +5480,7 @@ class PubServer(BaseHTTPRequestHandler): actorChanged = True else: print('ERROR: profile update POST ' + mType + - ' image could not be saved to ' + + ' image or font could not be saved to ' + postImageFilename) fields = \ diff --git a/translations/ar.json b/translations/ar.json index 492f70721..5eb5c82ad 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -222,5 +222,6 @@ "Your Posts": "منشوراتك", "Git Projects": "مشاريع Git", "List of project names that you wish to receive git patches for": "قائمة بأسماء المشاريع التي ترغب في تلقي تصحيحات git لها", - "Show/Hide Buttons": "إظهار / إخفاء الأزرار" + "Show/Hide Buttons": "إظهار / إخفاء الأزرار", + "Custom Font": "خط مخصص" } diff --git a/translations/ca.json b/translations/ca.json index 7ea7e65fe..813ed3166 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -222,5 +222,6 @@ "Your Posts": "Les teves publicacions", "Git Projects": "Git Projectes", "List of project names that you wish to receive git patches for": "Llista de noms de projectes dels quals voleu rebre els pedaços de git", - "Show/Hide Buttons": "Mostra / Oculta els botons" + "Show/Hide Buttons": "Mostra / Oculta els botons", + "Custom Font": "Tipus de lletra personalitzats" } diff --git a/translations/cy.json b/translations/cy.json index 6133591f7..3972d39ef 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -222,5 +222,6 @@ "Your Posts": "Eich Swyddi", "Git Projects": "Prosiectau Git", "List of project names that you wish to receive git patches for": "Rhestr o enwau prosiectau yr ydych yn dymuno derbyn darnau git ar eu cyfer", - "Show/Hide Buttons": "Dangos / Cuddio Botymau" + "Show/Hide Buttons": "Dangos / Cuddio Botymau", + "Custom Font": "Ffont Custom" } diff --git a/translations/de.json b/translations/de.json index 5ae4bb92d..b7e3b5235 100644 --- a/translations/de.json +++ b/translations/de.json @@ -222,5 +222,6 @@ "Your Posts": "Deine Posts", "Git Projects": "Git-Projekte", "List of project names that you wish to receive git patches for": "Liste der Projektnamen, für die Sie Git-Patches erhalten möchten", - "Show/Hide Buttons": "Schaltflächen ein- / ausblenden" + "Show/Hide Buttons": "Schaltflächen ein- / ausblenden", + "Custom Font": "Benutzerdefinierte Schriftart" } diff --git a/translations/en.json b/translations/en.json index 71aca1bff..a16479539 100644 --- a/translations/en.json +++ b/translations/en.json @@ -222,5 +222,6 @@ "Your Posts": "Your Posts", "Git Projects": "Git Projects", "List of project names that you wish to receive git patches for": "List of project names that you wish to receive git patches for", - "Show/Hide Buttons": "Show/Hide Buttons" + "Show/Hide Buttons": "Show/Hide Buttons", + "Custom Font": "Custom Font" } diff --git a/translations/es.json b/translations/es.json index a2b6288d6..ddf47e9e3 100644 --- a/translations/es.json +++ b/translations/es.json @@ -222,5 +222,6 @@ "Your Posts": "Tus publicaciones", "Git Projects": "Proyectos Git", "List of project names that you wish to receive git patches for": "Lista de nombres de proyectos para los que desea recibir parches git", - "Show/Hide Buttons": "Botones Mostrar / Ocultar" + "Show/Hide Buttons": "Botones Mostrar / Ocultar", + "Custom Font": "Fuente personalizada" } diff --git a/translations/fr.json b/translations/fr.json index 147361943..b90b76766 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -222,5 +222,6 @@ "Your Posts": "Vos publications", "Git Projects": "Projets Git", "List of project names that you wish to receive git patches for": "Liste des noms de projets pour lesquels vous souhaitez recevoir des correctifs git", - "Show/Hide Buttons": "Afficher / masquer les boutons" + "Show/Hide Buttons": "Afficher / masquer les boutons", + "Custom Font": "Police personnalisée" } diff --git a/translations/ga.json b/translations/ga.json index 016e249df..41a94cc2a 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -222,5 +222,6 @@ "Your Posts": "Do Phoist", "Git Projects": "Tionscadail Git", "List of project names that you wish to receive git patches for": "Liosta d’ainmneacha tionscadail ar mhaith leat paistí git a fháil dóibh", - "Show/Hide Buttons": "Taispeáin / Folaigh Cnaipí" + "Show/Hide Buttons": "Taispeáin / Folaigh Cnaipí", + "Custom Font": "Cló Saincheaptha" } diff --git a/translations/hi.json b/translations/hi.json index 40836ceda..7f3fa37a2 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -222,5 +222,6 @@ "Your Posts": "आपके पोस्ट", "Git Projects": "गिट परियोजनाओं", "List of project names that you wish to receive git patches for": "उन प्रोजेक्ट नामों की सूची, जिनके लिए आप git पैच प्राप्त करना चाहते हैं", - "Show/Hide Buttons": "बटन दिखाएँ / छिपाएँ" + "Show/Hide Buttons": "बटन दिखाएँ / छिपाएँ", + "Custom Font": "कस्टम फ़ॉन्ट" } diff --git a/translations/it.json b/translations/it.json index 8761699be..a47a89c14 100644 --- a/translations/it.json +++ b/translations/it.json @@ -222,5 +222,6 @@ "Your Posts": "I tuoi post", "Git Projects": "Git Projects", "List of project names that you wish to receive git patches for": "Elenco di nomi di progetti per i quali si desidera ricevere patch git", - "Show/Hide Buttons": "Mostra / Nascondi pulsanti" + "Show/Hide Buttons": "Mostra / Nascondi pulsanti", + "Custom Font": "Carattere personalizzato" } diff --git a/translations/ja.json b/translations/ja.json index 784299248..2f9bafda6 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -222,5 +222,6 @@ "Your Posts": "あなたの投稿", "Git Projects": "Gitプロジェクト", "List of project names that you wish to receive git patches for": "gitパッチを受け取りたいプロジェクト名のリスト", - "Show/Hide Buttons": "ボタンの表示/非表示" + "Show/Hide Buttons": "ボタンの表示/非表示", + "Custom Font": "カスタムフォント" } diff --git a/translations/oc.json b/translations/oc.json index 826c4c3ee..40348ed7a 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -218,5 +218,6 @@ "Your Posts": "Your Posts", "Git Projects": "Git Projects", "List of project names that you wish to receive git patches for": "List of project names that you wish to receive git patches for", - "Show/Hide Buttons": "Show/Hide Buttons" + "Show/Hide Buttons": "Show/Hide Buttons", + "Custom Font": "Custom Font" } diff --git a/translations/pt.json b/translations/pt.json index 57791e6e1..d5069728a 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -222,5 +222,6 @@ "Your Posts": "Seus posts", "Git Projects": "Projetos Git", "List of project names that you wish to receive git patches for": "Lista de nomes de projetos para os quais você deseja receber patches git", - "Show/Hide Buttons": "Botões Mostrar / Ocultar" + "Show/Hide Buttons": "Botões Mostrar / Ocultar", + "Custom Font": "Fonte Personalizada" } diff --git a/translations/ru.json b/translations/ru.json index 7919cb132..191dea238 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -222,5 +222,6 @@ "Your Posts": "Ваши сообщения", "Git Projects": "Git Projects", "List of project names that you wish to receive git patches for": "Список имен проектов, для которых вы хотите получать git-патчи", - "Show/Hide Buttons": "Показать / Скрыть кнопки" + "Show/Hide Buttons": "Показать / Скрыть кнопки", + "Custom Font": "Пользовательский шрифт" } diff --git a/translations/zh.json b/translations/zh.json index 66c9b5caf..9d616d52b 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -221,5 +221,6 @@ "Your Posts": "您的帖子", "Git Projects": "Git项目", "List of project names that you wish to receive git patches for": "您希望收到git补丁的项目名称列表", - "Show/Hide Buttons": "显示/隐藏按钮" + "Show/Hide Buttons": "显示/隐藏按钮", + "Custom Font": "自定义字体" } diff --git a/webinterface.py b/webinterface.py index 3e96d93e3..6c584ad1a 100644 --- a/webinterface.py +++ b/webinterface.py @@ -938,6 +938,7 @@ def htmlEditProfile(translate: {}, baseDir: str, path: str, """Shows the edit profile screen """ imageFormats = '.png, .jpg, .jpeg, .gif, .webp' + fontFormats = '.woff, .woff2, .ttf, .otf' pathOriginal = path path = path.replace('/inbox', '').replace('/outbox', '') path = path.replace('/shares', '') @@ -1119,6 +1120,12 @@ def htmlEditProfile(translate: {}, baseDir: str, path: str, instanceStr += \ ' ' + instanceStr += \ + ' ' + instanceStr += \ + ' ' instanceStr += '' moderators = ''