mirror of https://gitlab.com/bashrc2/epicyon
Defining news themes
parent
e4b3a22264
commit
99163d66e8
26
daemon.py
26
daemon.py
|
@ -239,6 +239,7 @@ from cache import checkForChangedActor
|
|||
from cache import storePersonInCache
|
||||
from cache import getPersonFromCache
|
||||
from httpsig import verifyPostHeaders
|
||||
from theme import isNewsThemeName
|
||||
from theme import getTextModeBanner
|
||||
from theme import setNewsAvatar
|
||||
from theme import setTheme
|
||||
|
@ -4227,6 +4228,11 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
"mediaInstance",
|
||||
self.server.mediaInstance)
|
||||
|
||||
# is this a news theme?
|
||||
if isNewsThemeName(self.server.baseDir,
|
||||
self.server.themeName):
|
||||
fields['newsInstance'] = 'on'
|
||||
|
||||
# change news instance status
|
||||
if fields.get('newsInstance'):
|
||||
self.server.newsInstance = False
|
||||
|
@ -14274,14 +14280,6 @@ def runDaemon(brochMode: bool,
|
|||
httpd.i2pDomain = i2pDomain
|
||||
httpd.mediaInstance = mediaInstance
|
||||
httpd.blogsInstance = blogsInstance
|
||||
httpd.newsInstance = newsInstance
|
||||
httpd.defaultTimeline = 'inbox'
|
||||
if mediaInstance:
|
||||
httpd.defaultTimeline = 'tlmedia'
|
||||
if blogsInstance:
|
||||
httpd.defaultTimeline = 'tlblogs'
|
||||
if newsInstance:
|
||||
httpd.defaultTimeline = 'tlfeatures'
|
||||
|
||||
# load translations dictionary
|
||||
httpd.translate = {}
|
||||
|
@ -14445,6 +14443,18 @@ def runDaemon(brochMode: bool,
|
|||
httpd.themeName = getConfigParam(baseDir, 'theme')
|
||||
if not httpd.themeName:
|
||||
httpd.themeName = 'default'
|
||||
if isNewsThemeName(baseDir, httpd.themeName):
|
||||
newsInstance = True
|
||||
|
||||
httpd.newsInstance = newsInstance
|
||||
httpd.defaultTimeline = 'inbox'
|
||||
if mediaInstance:
|
||||
httpd.defaultTimeline = 'tlmedia'
|
||||
if blogsInstance:
|
||||
httpd.defaultTimeline = 'tlblogs'
|
||||
if newsInstance:
|
||||
httpd.defaultTimeline = 'tlfeatures'
|
||||
|
||||
setNewsAvatar(baseDir,
|
||||
httpd.themeName,
|
||||
httpPrefix,
|
||||
|
|
9
theme.py
9
theme.py
|
@ -23,6 +23,15 @@ def _getThemeFiles() -> []:
|
|||
'welcome.css')
|
||||
|
||||
|
||||
def isNewsThemeName(baseDir: str, themeName: str) -> bool:
|
||||
"""Returns true if the given theme is a news instance
|
||||
"""
|
||||
themeDir = baseDir + '/theme/' + themeName
|
||||
if os.path.isfile(themeDir + '/is_news_instance'):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def getThemesList(baseDir: str) -> []:
|
||||
"""Returns the list of available themes
|
||||
Note that these should be capitalized, since they're
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1 @@
|
|||
|
Loading…
Reference in New Issue