diff --git a/webinterface.py b/webinterface.py index 7b16d089f..c126f1479 100644 --- a/webinterface.py +++ b/webinterface.py @@ -6092,15 +6092,16 @@ def htmlNewswireMobile(cssCache: {}, baseDir: str, nickname: str, return htmlStr -def getBannerFile(baseDir: str, nickname: str, domain: str) -> (str, str): +def getImageFile(baseDir: str, name: str, + nickname: str, domain: str) -> (str, str): """ - returns the banner filename + returns the filenames for an image with the given name """ bannerExtensions = ('png', 'jpg', 'jpeg', 'gif', 'avif', 'webp') bannerFile = '' bannerFilename = '' for ext in bannerExtensions: - bannerFile = 'banner.' + ext + bannerFile = name + '.' + ext bannerFilename = baseDir + '/accounts/' + \ nickname + '@' + domain + '/' + bannerFile if os.path.isfile(bannerFilename): @@ -6108,21 +6109,14 @@ def getBannerFile(baseDir: str, nickname: str, domain: str) -> (str, str): return bannerFile, bannerFilename +def getBannerFile(baseDir: str, + nickname: str, domain: str) -> (str, str): + return getImageFile(baseDir, 'banner', nickname, domain) + + def getSearchBannerFile(baseDir: str, nickname: str, domain: str) -> (str, str): - """ - returns the search banner filename - """ - bannerExtensions = ('png', 'jpg', 'jpeg', 'gif', 'avif', 'webp') - bannerFile = '' - bannerFilename = '' - for ext in bannerExtensions: - bannerFile = 'search_banner.' + ext - bannerFilename = baseDir + '/accounts/' + \ - nickname + '@' + domain + '/' + bannerFile - if os.path.isfile(bannerFilename): - break - return bannerFile, bannerFilename + return getImageFile(baseDir, 'search_banner', nickname, domain) def headerButtonsFrontScreen(translate: {},