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