forked from indymedia/epicyon
Set the news avatar if it exists
parent
9c442d0a0c
commit
d25be97de0
|
@ -195,6 +195,7 @@ from media import removeMetaData
|
|||
from cache import storePersonInCache
|
||||
from cache import getPersonFromCache
|
||||
from httpsig import verifyPostHeaders
|
||||
from theme import setNewsAvatar
|
||||
from theme import setTheme
|
||||
from theme import getTheme
|
||||
from theme import enableGrayscale
|
||||
|
@ -3412,6 +3413,11 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
setTheme(baseDir,
|
||||
fields['themeDropdown'],
|
||||
domain)
|
||||
setNewsAvatar(baseDir,
|
||||
fields['themeDropdown'],
|
||||
httpPrefix,
|
||||
domain,
|
||||
domainFull)
|
||||
|
||||
# change email address
|
||||
currentEmailAddress = getEmailAddress(actorJson)
|
||||
|
|
10
epicyon.py
10
epicyon.py
|
@ -69,6 +69,7 @@ from shares import sendShareViaServer
|
|||
from shares import sendUndoShareViaServer
|
||||
from shares import addShare
|
||||
from theme import setTheme
|
||||
from theme import setNewsAvatar
|
||||
from announce import sendAnnounceViaServer
|
||||
from socnet import instancesGraph
|
||||
import argparse
|
||||
|
@ -1937,6 +1938,15 @@ if YTDomain:
|
|||
if setTheme(baseDir, themeName, domain):
|
||||
print('Theme set to ' + themeName)
|
||||
|
||||
domainFull = domain
|
||||
if port != 80 and port != 443:
|
||||
domainFull = domain + ':' + str(port)
|
||||
setNewsAvatar(baseDir,
|
||||
themeName,
|
||||
httpPrefix,
|
||||
domain,
|
||||
domainFull)
|
||||
|
||||
if __name__ == "__main__":
|
||||
runDaemon(args.dateonly,
|
||||
args.votingtime,
|
||||
|
|
21
theme.py
21
theme.py
|
@ -1008,6 +1008,27 @@ def setThemeImages(baseDir: str, name: str) -> None:
|
|||
pass
|
||||
|
||||
|
||||
def setNewsAvatar(baseDir: str, name: str,
|
||||
httpPrefix: str,
|
||||
domain: str, domainFull: str) -> None:
|
||||
"""Sets the avatar for the news account
|
||||
"""
|
||||
nickname = 'news'
|
||||
newFilename = baseDir + '/img/icons/' + name + '/avatar_news.png'
|
||||
if not os.path.isfile(newFilename):
|
||||
return
|
||||
filename = baseDir + 'cache/avatars/' + \
|
||||
httpPrefix + '://' + domainFull + '/users/' + nickname + \
|
||||
'.png'
|
||||
if os.path.isfile(filename):
|
||||
os.remove(filename)
|
||||
if os.path.isdir(baseDir + 'cache/avatars'):
|
||||
copyfile(newFilename, filename)
|
||||
copyfile(newFilename,
|
||||
baseDir + '/accounts/' +
|
||||
nickname + '@' + domain + '/avatar.png')
|
||||
|
||||
|
||||
def setTheme(baseDir: str, name: str, domain: str) -> bool:
|
||||
result = False
|
||||
|
||||
|
|
Loading…
Reference in New Issue