main
Bob Mottram 2021-02-27 23:05:28 +00:00
commit 838d99ff12
65 changed files with 186 additions and 44 deletions

View File

@ -17,6 +17,9 @@ source:
clean:
rm -f *.*~ *~ *.dot
rm -f orgs/*~
rm -f defaultwelcome/*~
rm -f theme/indymediaclassic/welcome/*~
rm -f theme/indymediamodern/welcome/*~
rm -f website/EN/*~
rm -f gemini/EN/*~
rm -f scripts/*~

View File

@ -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
@ -3898,7 +3899,8 @@ class PubServer(BaseHTTPRequestHandler):
baseDir: str, httpPrefix: str,
domain: str, domainFull: str,
onionDomain: str, i2pDomain: str,
debug: bool, allowLocalNetworkAccess: bool) -> None:
debug: bool, allowLocalNetworkAccess: bool,
systemLanguage: str) -> None:
"""Updates your user profile after editing via the Edit button
on the profile screen
"""
@ -4227,6 +4229,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
@ -4283,7 +4290,7 @@ class PubServer(BaseHTTPRequestHandler):
if fields.get('themeDropdown'):
self.server.themeName = fields['themeDropdown']
setTheme(baseDir, self.server.themeName, domain,
allowLocalNetworkAccess)
allowLocalNetworkAccess, systemLanguage)
self.server.textModeBanner = \
getTextModeBanner(self.server.baseDir)
self.server.iconsCache = {}
@ -4753,7 +4760,8 @@ class PubServer(BaseHTTPRequestHandler):
if currTheme:
self.server.themeName = currTheme
setTheme(baseDir, currTheme, domain,
self.server.allowLocalNetworkAccess)
self.server.allowLocalNetworkAccess,
systemLanguage)
self.server.textModeBanner = \
getTextModeBanner(self.server.baseDir)
self.server.iconsCache = {}
@ -10800,7 +10808,8 @@ class PubServer(BaseHTTPRequestHandler):
msg = \
htmlWelcomeScreen(self.server.baseDir, nickname,
self.server.systemLanguage,
self.server.translate)
self.server.translate,
self.server.themeName)
msg = msg.encode('utf-8')
msglen = len(msg)
self._login_headers('text/html', msglen, callingDomain)
@ -10827,7 +10836,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.httpPrefix,
self.server.domainFull,
self.server.systemLanguage,
self.server.translate)
self.server.translate,
self.server.themeName)
msg = msg.encode('utf-8')
msglen = len(msg)
self._login_headers('text/html', msglen, callingDomain)
@ -10854,7 +10864,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.httpPrefix,
self.server.domainFull,
self.server.systemLanguage,
self.server.translate)
self.server.translate,
self.server.themeName)
msg = msg.encode('utf-8')
msglen = len(msg)
self._login_headers('text/html', msglen, callingDomain)
@ -13534,7 +13545,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.domainFull,
self.server.onionDomain,
self.server.i2pDomain, self.server.debug,
self.server.allowLocalNetworkAccess)
self.server.allowLocalNetworkAccess,
self.server.systemLanguage)
return
if authorized and self.path.endswith('/linksdata'):
@ -14271,14 +14283,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 = {}
@ -14442,6 +14446,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,

View File

@ -0,0 +1,5 @@
This timeline contains any blogs written by you or anyone that you're following.
You can create a new blog post using the **publish** icon at the top of the right column.
Blog posts are different from ordinary fediverse posts. They use the ActivityPub *Article* type, which is intended for long-form writing. They can also have citations, selected from items in the newswire.

View File

@ -2325,7 +2325,8 @@ if YTDomain:
if '.' in YTDomain:
args.YTReplacementDomain = YTDomain
if setTheme(baseDir, themeName, domain, args.allowLocalNetworkAccess):
if setTheme(baseDir, themeName, domain,
args.allowLocalNetworkAccess, args.language):
print('Theme set to ' + themeName)
if __name__ == "__main__":

View File

@ -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
@ -41,6 +50,29 @@ def getThemesList(baseDir: str) -> []:
return themes
def _copyThemeHelpFiles(baseDir: str, themeName: str,
systemLanguage: str) -> None:
"""Copies any theme specific help files from the welcome subdirectory
"""
if not systemLanguage:
systemLanguage = 'en'
themeDir = baseDir + '/theme/' + themeName + '/welcome'
if not os.path.isdir(themeDir):
themeDir = baseDir + '/defaultwelcome'
for subdir, dirs, files in os.walk(themeDir):
for helpMarkdownFile in files:
if not helpMarkdownFile.endswith('_' + systemLanguage + '.md'):
continue
destHelpMarkdownFile = \
helpMarkdownFile.replace('_' + systemLanguage + '.md', '.md')
if destHelpMarkdownFile == 'profile.md' or \
destHelpMarkdownFile == 'final.md':
destHelpMarkdownFile = 'welcome_' + destHelpMarkdownFile
copyfile(themeDir + '/' + helpMarkdownFile,
baseDir + '/accounts/' + destHelpMarkdownFile)
break
def _setThemeInConfig(baseDir: str, name: str) -> bool:
"""Sets the theme with the given name within config.json
"""
@ -633,7 +665,7 @@ def _setClearCacheFlag(baseDir: str) -> None:
def setTheme(baseDir: str, name: str, domain: str,
allowLocalNetworkAccess: bool) -> bool:
allowLocalNetworkAccess: bool, systemLanguage: str) -> bool:
"""Sets the theme with the given name as the current theme
"""
result = False
@ -686,6 +718,7 @@ def setTheme(baseDir: str, name: str, domain: str,
else:
disableGrayscale(baseDir)
_copyThemeHelpFiles(baseDir, name, systemLanguage)
_setThemeInConfig(baseDir, name)
_setClearCacheFlag(baseDir)
return result

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 976 B

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -18,14 +18,14 @@
"main-bg-color-reply": "#030202",
"main-bg-color-report": "#050202",
"main-header-color-roles": "#1f192d",
"cw-color": "#00ff00",
"main-fg-color": "#00ff00",
"login-fg-color": "#00ff00",
"welcome-fg-color": "#00ff00",
"options-fg-color": "#00ff00",
"column-left-fg-color": "#00ff00",
"cw-color": "#9ad791",
"main-fg-color": "#9ad791",
"login-fg-color": "#9ad791",
"welcome-fg-color": "#9ad791",
"options-fg-color": "#9ad791",
"column-left-fg-color": "#9ad791",
"border-color": "#035103",
"main-link-color": "#2fff2f",
"main-link-color": "#9ad791",
"main-link-color-hover": "#afff2f",
"options-main-link-color": "#2fff2f",
"options-main-link-color-hover": "#afff2f",
@ -34,14 +34,14 @@
"options-main-visited-color": "#3c8234",
"button-selected": "#063200",
"button-background-hover": "#a62200",
"button-text-hover": "#00ff00",
"button-text-hover": "#9ad791",
"publish-button-background": "#062200",
"button-background": "#062200",
"button-small-background": "#062200",
"button-text": "#00ff00",
"button-selected-text": "#00ff00",
"publish-button-text": "#00ff00",
"button-small-text": "#00ff00",
"button-text": "#9ad791",
"button-selected-text": "#9ad791",
"publish-button-text": "#9ad791",
"button-small-text": "#9ad791",
"button-corner-radius": "4px",
"timeline-border-radius": "4px",
"header-font": "'Bedstead'",
@ -59,8 +59,8 @@
"title-text": "black",
"title-background": "darkgreen",
"gallery-text-color": "green",
"time-color": "#00ff00",
"place-color": "#00ff00",
"event-color": "#00ff00",
"time-color": "#9ad791",
"place-color": "#9ad791",
"event-color": "#9ad791",
"image-corners": "0%"
}

View File

@ -4,7 +4,7 @@
"time-color": "grey",
"event-color": "white",
"login-bg-color": "#567726",
"welcome-bg-color": "#567726",
"welcome-bg-color": "#ccc",
"login-fg-color": "black",
"welcome-fg-color": "black",
"options-bg-color": "black",

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1 @@

View File

@ -0,0 +1,10 @@
![Journalist image](/helpimages/journalist.jpg)
### You are now a journalist!
Welcome onboard the team. This is a moderated news instance, so please ensure that anything you write is in accordance with our [editorial policy](/terms).
#### Hints
Use the **magnifier** icon 🔍 to search for fediverse handles and follow people.
Selecting the **banner at the top** of the screen switches between timeline view and your profile.
The screen will not automatically refresh when articles arrive, so use **F5** or the **Features** button to refresh.

View File

@ -0,0 +1,3 @@
This timeline contains any articles published by you or anyone that you're following.
You can create a new article using the **publish** icon at the top of the newswire column, or on mobile via the newswire icon.

View File

@ -0,0 +1,2 @@
### Journalist Setup
Select your avatar image and add your name and description. Use a small avatar image (eg. 128x128 pixels) so that it's quick to download.

View File

@ -0,0 +1,7 @@
![Welcome image](/helpimages/welcome.jpg)
### Welcome to INSTANCE
This is an ActivityPub server designed for publishing in the Indymedia network. It can run on low power single board computers or old laptops.
Don't complain about the media. *Be the media*.
Now, lets get going...

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

@ -0,0 +1 @@

View File

@ -0,0 +1,10 @@
![Journalist image](/helpimages/journalist.jpg)
### You are now a journalist!
Welcome onboard the team. This is a moderated news instance, so please ensure that anything you write is in accordance with our [editorial policy](/terms).
#### Hints
Use the **magnifier** icon 🔍 to search for fediverse handles and follow people.
Selecting the **banner at the top** of the screen switches between timeline view and your profile.
The screen will not automatically refresh when articles arrive, so use **F5** or the **Features** button to refresh.

View File

@ -0,0 +1,3 @@
This timeline contains any articles published by you or anyone that you're following.
You can create a new article using the **publish** icon at the top of the newswire column, or on mobile via the newswire icon.

View File

@ -0,0 +1,2 @@
### Journalist Setup
Select your avatar image and add your name and description. Use a small avatar image (eg. 128x128 pixels) so that it's quick to download.

View File

@ -0,0 +1,7 @@
![Welcome image](/helpimages/welcome.jpg)
### Welcome to INSTANCE
This is an ActivityPub server designed for publishing in the Indymedia network. It can run on low power single board computers or old laptops.
Don't complain about the media. *Be the media*.
Now, lets get going...

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

View File

@ -55,9 +55,19 @@ def _getHelpForTimeline(baseDir: str, boxName: str) -> str:
getConfigParam(baseDir, 'language')
if not language:
language = 'en'
defaultFilename = \
baseDir + '/defaultwelcome/' + \
'help_' + boxName + '_' + language + '.md'
themeName = \
getConfigParam(baseDir, 'theme')
defaultFilename = None
if themeName:
defaultFilename = \
baseDir + '/theme/' + themeName + '/welcome/' + \
'help_' + boxName + '_' + language + '.md'
if not os.path.isfile(defaultFilename):
defaultFilename = None
if not defaultFilename:
defaultFilename = \
baseDir + '/defaultwelcome/' + \
'help_' + boxName + '_' + language + '.md'
if not os.path.isfile(defaultFilename):
defaultFilename = \
baseDir + '/defaultwelcome/help_' + boxName + '_en.md'

View File

@ -41,6 +41,7 @@ def welcomeScreenIsComplete(baseDir: str,
def htmlWelcomeScreen(baseDir: str, nickname: str,
language: str, translate: {},
themeName: str,
currScreen='welcome') -> str:
"""Returns the welcome screen
"""
@ -53,8 +54,17 @@ def htmlWelcomeScreen(baseDir: str, nickname: str,
welcomeText = 'Welcome to Epicyon'
welcomeFilename = baseDir + '/accounts/' + currScreen + '.md'
if not os.path.isfile(welcomeFilename):
defaultFilename = \
baseDir + '/defaultwelcome/' + currScreen + '_' + language + '.md'
defaultFilename = None
if themeName:
defaultFilename = \
baseDir + '/theme/' + themeName + '/welcome/' + \
'welcome_' + language + '.md'
if not os.path.isfile(defaultFilename):
defaultFilename = None
if not defaultFilename:
defaultFilename = \
baseDir + '/defaultwelcome/' + \
currScreen + '_' + language + '.md'
if not os.path.isfile(defaultFilename):
defaultFilename = \
baseDir + '/defaultwelcome/' + currScreen + '_en.md'

View File

@ -17,7 +17,8 @@ from webapp_utils import markdownToHtml
def htmlWelcomeFinal(baseDir: str, nickname: str, domain: str,
httpPrefix: str, domainFull: str,
language: str, translate: {}) -> str:
language: str, translate: {},
themeName: str) -> str:
"""Returns the final welcome screen after first login
"""
# set a custom background for the welcome screen
@ -29,8 +30,16 @@ def htmlWelcomeFinal(baseDir: str, nickname: str, domain: str,
finalText = 'Welcome to Epicyon'
finalFilename = baseDir + '/accounts/welcome_final.md'
if not os.path.isfile(finalFilename):
defaultFilename = \
baseDir + '/defaultwelcome/final_' + language + '.md'
defaultFilename = None
if themeName:
defaultFilename = \
baseDir + '/theme/' + themeName + '/welcome/' + \
'final_' + language + '.md'
if not os.path.isfile(defaultFilename):
defaultFilename = None
if not defaultFilename:
defaultFilename = \
baseDir + '/defaultwelcome/final_' + language + '.md'
if not os.path.isfile(defaultFilename):
defaultFilename = baseDir + '/defaultwelcome/final_en.md'
copyfile(defaultFilename, finalFilename)

View File

@ -20,7 +20,8 @@ from webapp_utils import markdownToHtml
def htmlWelcomeProfile(baseDir: str, nickname: str, domain: str,
httpPrefix: str, domainFull: str,
language: str, translate: {}) -> str:
language: str, translate: {},
themeName: str) -> str:
"""Returns the welcome profile screen to set avatar and bio
"""
# set a custom background for the welcome screen
@ -32,8 +33,16 @@ def htmlWelcomeProfile(baseDir: str, nickname: str, domain: str,
profileText = 'Welcome to Epicyon'
profileFilename = baseDir + '/accounts/welcome_profile.md'
if not os.path.isfile(profileFilename):
defaultFilename = \
baseDir + '/defaultwelcome/profile_' + language + '.md'
defaultFilename = None
if themeName:
defaultFilename = \
baseDir + '/theme/' + themeName + '/welcome/' + \
'profile_' + language + '.md'
if not os.path.isfile(defaultFilename):
defaultFilename = None
if not defaultFilename:
defaultFilename = \
baseDir + '/defaultwelcome/profile_' + language + '.md'
if not os.path.isfile(defaultFilename):
defaultFilename = baseDir + '/defaultwelcome/profile_en.md'
copyfile(defaultFilename, profileFilename)