diff --git a/daemon.py b/daemon.py index 04abd8e45..dd669485c 100644 --- a/daemon.py +++ b/daemon.py @@ -183,6 +183,7 @@ from webapp_hashtagswarm import getHashtagCategoriesFeed from webapp_hashtagswarm import htmlSearchHashtagCategory from webapp_welcome import htmlWelcomeScreen from webapp_welcome import isWelcomeScreenComplete +from webapp_welcome_profile import htmlWelcomeProfile from shares import getSharesFeedForPerson from shares import addShare from shares import removeShare @@ -10695,6 +10696,32 @@ class PubServer(BaseHTTPRequestHandler): else: self.path = self.path.replace('/welcome', '') + if htmlGET and authorized and \ + '/users/' in self.path and self.path.endswith('/welcome_profile'): + nickname = self.path.split('/users/')[1] + if '/' in nickname: + nickname = nickname.split('/')[0] + if not isWelcomeScreenComplete(self.server.baseDir, + nickname, + self.server.domain): + msg = \ + htmlWelcomeProfile(self.server.baseDir, nickname, + self.server.domain, + self.server.httpPrefix, + self.server.domainFull, + self.server.systemLanguage, + self.server.translate) + msg = msg.encode('utf-8') + msglen = len(msg) + self._login_headers('text/html', msglen, callingDomain) + self._write(msg) + self._benchmarkGETtimings(GETstartTime, GETtimings, + 'show welcome screen', + 'show welcome profile screen') + return + else: + self.path = self.path.replace('/welcome_profile', '') + # if not authorized then show the login screen if htmlGET and self.path != '/login' and \ not self._pathIsImage(self.path) and \ diff --git a/defaultwelcome/profile_en.md b/defaultwelcome/profile_en.md index 4f00d8ae1..4487c20da 100644 --- a/defaultwelcome/profile_en.md +++ b/defaultwelcome/profile_en.md @@ -1,3 +1,3 @@ -# Account Setup +## Account Setup -Add your avatar image, name and description. Use a small avatar image (eg. 128x128 pixels) so that it's quick to download. +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. diff --git a/webapp_welcome.py b/webapp_welcome.py index b3acadd31..a7ed00635 100644 --- a/webapp_welcome.py +++ b/webapp_welcome.py @@ -24,19 +24,20 @@ def isWelcomeScreenComplete(baseDir: str, nickname: str, domain: str) -> bool: return os.path.isfile(completeFilename) -def welcomeScreenIsComplete(baseDir: str, nickname: str, domain: str) -> None: - """Indicates that the welcome screen has been shown for a given account - """ - accountPath = baseDir + '/accounts/' + nickname + '@' + domain - if not os.path.isdir(accountPath): - return - completeFilename = accountPath + '/.welcome_complete' - completeFile = open(completeFilename, 'w+') - if completeFile: - completeFile.write('\n') - completeFile.close() - - +# def welcomeScreenIsComplete(baseDir: str, +# nickname: str, domain: str) -> None: +# """Indicates that the welcome screen has been shown for a given account +# """ +# accountPath = baseDir + '/accounts/' + nickname + '@' + domain +# if not os.path.isdir(accountPath): +# return +# completeFilename = accountPath + '/.welcome_complete' +# completeFile = open(completeFilename, 'w+') +# if completeFile: +# completeFile.write('\n') +# completeFile.close() +# +# def htmlWelcomeScreen(baseDir: str, language: str, translate: {}, currScreen='welcome', diff --git a/webapp_welcome_profile.py b/webapp_welcome_profile.py index 901fe5555..e0ca34da4 100644 --- a/webapp_welcome_profile.py +++ b/webapp_welcome_profile.py @@ -8,8 +8,10 @@ __status__ = "Production" import os from shutil import copyfile +from utils import loadJson from utils import getConfigParam from utils import getImageExtensions +from utils import getImageFormats from webapp_utils import htmlHeaderWithExternalStyle from webapp_utils import htmlFooter from webapp_utils import markdownToHtml @@ -17,8 +19,7 @@ from webapp_utils import markdownToHtml def htmlWelcomeProfile(baseDir: str, nickname: str, domain: str, httpPrefix: str, domainFull: str, - language: str, translate: {}, - prevScreen='welcome') -> str: + language: str, translate: {}) -> str: """Returns the welcome profile screen to set avatar and bio """ # set a custom background for the welcome screen @@ -58,16 +59,46 @@ def htmlWelcomeProfile(baseDir: str, nickname: str, domain: str, httpPrefix + '://' + domainFull + \ '/users/' + nickname + '/avatar.' + ext + imageFormats = getImageFormats() + profileForm += \ + '
\n' profileForm += htmlFooter() return profileForm