mirror of https://gitlab.com/bashrc2/epicyon
Setting custom backgrounds
parent
5207a2ab3c
commit
17e08b2136
|
@ -51,8 +51,6 @@ def htmlCalendarDeleteConfirm(cssCache: {}, translate: {}, baseDir: str,
|
|||
if not postJsonObject:
|
||||
return None
|
||||
|
||||
setCustomBackground(baseDir, 'delete-background')
|
||||
|
||||
deletePostStr = None
|
||||
cssFilename = baseDir + '/epicyon-profile.css'
|
||||
if os.path.isfile(baseDir + '/epicyon.css'):
|
||||
|
@ -284,7 +282,7 @@ def htmlCalendar(personCache: {}, cssCache: {}, translate: {},
|
|||
|
||||
nickname = getNicknameFromActor(actor)
|
||||
|
||||
setCustomBackground(baseDir, 'calendar-background')
|
||||
setCustomBackground(baseDir, 'calendar-background', 'calendar-background')
|
||||
|
||||
months = ('January', 'February', 'March', 'April',
|
||||
'May', 'June', 'July', 'August', 'September',
|
||||
|
|
|
@ -55,8 +55,6 @@ def htmlConfirmDelete(cssCache: {},
|
|||
if not postJsonObject:
|
||||
return None
|
||||
|
||||
setCustomBackground(baseDir, 'delete-background')
|
||||
|
||||
deletePostStr = None
|
||||
cssFilename = baseDir + '/epicyon-profile.css'
|
||||
if os.path.isfile(baseDir + '/epicyon.css'):
|
||||
|
@ -132,7 +130,7 @@ def htmlConfirmRemoveSharedItem(cssCache: {}, translate: {}, baseDir: str,
|
|||
if sharesJson[itemID].get('imageUrl'):
|
||||
sharedItemImageUrl = sharesJson[itemID]['imageUrl']
|
||||
|
||||
setCustomBackground(baseDir, 'shares-background')
|
||||
setCustomBackground(baseDir, 'shares-background', 'follow-background')
|
||||
|
||||
cssFilename = baseDir + '/epicyon-follow.css'
|
||||
if os.path.isfile(baseDir + '/follow.css'):
|
||||
|
@ -273,7 +271,7 @@ def htmlConfirmUnblock(cssCache: {}, translate: {}, baseDir: str,
|
|||
"""
|
||||
blockDomain, port = getDomainFromActor(blockActor)
|
||||
|
||||
setCustomBackground(baseDir, 'block-background')
|
||||
setCustomBackground(baseDir, 'block-background', 'follow-background')
|
||||
|
||||
cssFilename = baseDir + '/epicyon-follow.css'
|
||||
if os.path.isfile(baseDir + '/follow.css'):
|
||||
|
|
|
@ -201,7 +201,7 @@ def htmlSearchHashtagCategory(cssCache: {}, translate: {},
|
|||
categoryStr = path.split('/category/')[1].strip()
|
||||
searchNickname = getNicknameFromActor(actor)
|
||||
|
||||
backgroundExt = setCustomBackground(baseDir, 'search-background')
|
||||
setCustomBackground(baseDir, 'search-background', 'follow-background')
|
||||
|
||||
cssFilename = baseDir + '/epicyon-search.css'
|
||||
if os.path.isfile(baseDir + '/search.css'):
|
||||
|
@ -210,11 +210,6 @@ def htmlSearchHashtagCategory(cssCache: {}, translate: {},
|
|||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
htmlStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
if backgroundExt:
|
||||
if backgroundExt != 'jpg':
|
||||
htmlStr = htmlStr.replace('"follow-background.jpg"',
|
||||
'"follow-background.' +
|
||||
backgroundExt + '"')
|
||||
|
||||
# show a banner above the search box
|
||||
searchBannerFile, searchBannerFilename = \
|
||||
|
|
|
@ -93,7 +93,7 @@ def htmlLogin(cssCache: {}, translate: {},
|
|||
textModeLogo = getTextModeLogo(baseDir)
|
||||
textModeLogoHtml = htmlKeyboardNavigation(textModeLogo, {}, {})
|
||||
|
||||
backgroundExt = setCustomBackground(baseDir, 'login-background-custom')
|
||||
setCustomBackground(baseDir, 'login-background-custom', 'login-background')
|
||||
|
||||
if accounts > 0:
|
||||
loginText = \
|
||||
|
@ -153,10 +153,6 @@ def htmlLogin(cssCache: {}, translate: {},
|
|||
htmlHeaderWithWebsiteMarkup(cssFilename, instanceTitle,
|
||||
httpPrefix, domain,
|
||||
systemLanguage)
|
||||
if backgroundExt:
|
||||
loginForm = loginForm.replace('"login-background.jpg"',
|
||||
'"login-background-custom.' +
|
||||
backgroundExt + '"')
|
||||
|
||||
nicknamePattern = getNicknameValidationPattern()
|
||||
instanceTitle = getConfigParam(baseDir, 'instanceTitle')
|
||||
|
|
|
@ -328,7 +328,7 @@ def htmlSearchEmojiTextEntry(cssCache: {}, translate: {},
|
|||
actor = path.replace('/search', '')
|
||||
domain, port = getDomainFromActor(actor)
|
||||
|
||||
backgroundExt = setCustomBackground(baseDir, 'search-background')
|
||||
setCustomBackground(baseDir, 'search-background', 'follow-background')
|
||||
|
||||
cssFilename = baseDir + '/epicyon-follow.css'
|
||||
if os.path.isfile(baseDir + '/follow.css'):
|
||||
|
@ -337,11 +337,6 @@ def htmlSearchEmojiTextEntry(cssCache: {}, translate: {},
|
|||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
emojiStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
if backgroundExt:
|
||||
if backgroundExt != 'jpg':
|
||||
emojiStr = emojiStr.replace('"follow-background.jpg"',
|
||||
'"follow-background.' +
|
||||
backgroundExt + '"')
|
||||
emojiStr += '<div class="follow">\n'
|
||||
emojiStr += ' <div class="followAvatar">\n'
|
||||
emojiStr += ' <center>\n'
|
||||
|
@ -373,7 +368,7 @@ def htmlSearch(cssCache: {}, translate: {},
|
|||
actor = path.replace('/search', '')
|
||||
searchNickname = getNicknameFromActor(actor)
|
||||
|
||||
backgroundExt = setCustomBackground(baseDir, 'search-background')
|
||||
setCustomBackground(baseDir, 'search-background', 'follow-background')
|
||||
|
||||
cssFilename = baseDir + '/epicyon-search.css'
|
||||
if os.path.isfile(baseDir + '/search.css'):
|
||||
|
@ -381,11 +376,6 @@ def htmlSearch(cssCache: {}, translate: {},
|
|||
|
||||
instanceTitle = getConfigParam(baseDir, 'instanceTitle')
|
||||
followStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
if backgroundExt:
|
||||
if backgroundExt != 'jpg':
|
||||
followStr = followStr.replace('"follow-background.jpg"',
|
||||
'"follow-background.' +
|
||||
backgroundExt + '"')
|
||||
|
||||
# show a banner above the search box
|
||||
searchBannerFile, searchBannerFilename = \
|
||||
|
|
|
@ -1458,16 +1458,18 @@ def htmlShowShare(baseDir: str, domain: str, nickname: str,
|
|||
shareStr + htmlFooter()
|
||||
|
||||
|
||||
def setCustomBackground(baseDir: str, background: str) -> str:
|
||||
def setCustomBackground(baseDir: str, background: str,
|
||||
newBackground: str) -> str:
|
||||
"""Sets a custom background
|
||||
Returns the extension, if found
|
||||
"""
|
||||
extensions = getImageExtensions()
|
||||
for ext in extensions:
|
||||
if os.path.isfile(baseDir + '/img/' + background + '.' + ext):
|
||||
if not os.path.isfile(baseDir + '/accounts/' +
|
||||
background + '.' + ext):
|
||||
copyfile(baseDir + '/img/' + background + '.' + ext,
|
||||
baseDir + '/accounts/' + background + '.' + ext)
|
||||
return ext
|
||||
ext = 'jpg'
|
||||
if os.path.isfile(baseDir + '/img/' + background + '.' + ext):
|
||||
if not newBackground:
|
||||
newBackground = background
|
||||
if not os.path.isfile(baseDir + '/accounts/' +
|
||||
newBackground + '.' + ext):
|
||||
copyfile(baseDir + '/img/' + background + '.' + ext,
|
||||
baseDir + '/accounts/' + newBackground + '.' + ext)
|
||||
return ext
|
||||
return None
|
||||
|
|
Loading…
Reference in New Issue