mirror of https://gitlab.com/bashrc2/epicyon
Upload custom font
parent
bd0daec672
commit
c2fe5c3ade
35
daemon.py
35
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 = \
|
||||
|
|
|
@ -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": "خط مخصص"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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": "कस्टम फ़ॉन्ट"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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": "カスタムフォント"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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": "Пользовательский шрифт"
|
||||
}
|
||||
|
|
|
@ -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": "自定义字体"
|
||||
}
|
||||
|
|
|
@ -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 += \
|
||||
' <input type="file" id="instanceLogo" name="instanceLogo"'
|
||||
instanceStr += ' accept="' + imageFormats + '">'
|
||||
instanceStr += \
|
||||
' <label class="labels">' + \
|
||||
translate['Custom Font'] + '</label>'
|
||||
instanceStr += \
|
||||
' <input type="file" id="customFont" name="customFont"'
|
||||
instanceStr += ' accept="' + fontFormats + '">'
|
||||
instanceStr += '</div>'
|
||||
|
||||
moderators = ''
|
||||
|
|
Loading…
Reference in New Issue