Add a user to handle news items

main
Bob Mottram 2020-10-07 17:01:45 +01:00
parent f9517367bb
commit a7e22c7590
2 changed files with 18 additions and 0 deletions

View File

@ -54,6 +54,7 @@ from person import registerAccount
from person import personLookup
from person import personBoxJson
from person import createSharedInbox
from person import createNewsInbox
from person import suspendAccount
from person import unsuspendAccount
from person import removeAccount
@ -1229,6 +1230,11 @@ class PubServer(BaseHTTPRequestHandler):
loginNickname, loginPassword, register = \
htmlGetLoginCredentials(loginParams, self.server.lastLoginTime)
if loginNickname:
if loginNickname == 'news' or loginNickname == 'inbox':
print('Invalid username login: ' + loginNickname)
self._clearLoginDetails(loginNickname, callingDomain)
self.server.POSTbusy = False
return
self.server.lastLoginTime = int(time.time())
if register:
if not registerAccount(baseDir, httpPrefix, domain, port,
@ -11455,6 +11461,10 @@ def runDaemon(newsInstance: bool,
print('Creating shared inbox: inbox@' + domain)
createSharedInbox(baseDir, 'inbox', domain, port, httpPrefix)
if not os.path.isdir(baseDir + '/accounts/news@' + domain):
print('Creating news inbox: news@' + domain)
createNewsInbox(baseDir, domain, port, httpPrefix)
if not os.path.isdir(baseDir + '/cache'):
os.mkdir(baseDir + '/cache')
if not os.path.isdir(baseDir + '/cache/actors'):

View File

@ -504,6 +504,14 @@ def createSharedInbox(baseDir: str, nickname: str, domain: str, port: int,
True, True, None)
def createNewsInbox(baseDir: str, domain: str, port: int,
httpPrefix: str) -> (str, str, {}, {}):
"""Generates the news inbox
"""
return createPersonBase(baseDir, 'news', domain, port, httpPrefix,
True, True, None)
def personUpgradeActor(baseDir: str, personJson: {},
handle: str, filename: str) -> None:
"""Alter the actor to add any new properties