forked from indymedia/epicyon
Exit loop if not authorized
parent
a4f824b02d
commit
db8e703c40
16
daemon.py
16
daemon.py
|
@ -807,7 +807,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.inboxQueue.pop(0)
|
self.server.inboxQueue.pop(0)
|
||||||
timeDiff = str(int((time.time() - cleardownStartTime) * 1000))
|
timeDiff = str(int((time.time() - cleardownStartTime) * 1000))
|
||||||
print('Inbox cleardown took ' + timeDiff + ' mS. Removed ' +
|
print('Inbox cleardown took ' + timeDiff + ' mS. Removed ' +
|
||||||
str(removals) + ' items.')
|
str(removals) + ' items. Queue length is now ' +
|
||||||
|
str(len(self.server.inboxQueue)))
|
||||||
|
|
||||||
def _updateInboxQueue(self, nickname: str, messageJson: {},
|
def _updateInboxQueue(self, nickname: str, messageJson: {},
|
||||||
messageBytes: str) -> int:
|
messageBytes: str) -> int:
|
||||||
|
@ -4896,16 +4897,11 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
return 1
|
return 1
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
def _receiveNewPost(self, authorized: bool, postType: str,
|
def _receiveNewPost(self, postType: str, path: str) -> int:
|
||||||
path: str) -> int:
|
|
||||||
"""A new post has been created
|
"""A new post has been created
|
||||||
This creates a thread to send the new post
|
This creates a thread to send the new post
|
||||||
"""
|
"""
|
||||||
pageNumber = 1
|
pageNumber = 1
|
||||||
if not authorized:
|
|
||||||
print('Not receiving new post for ' + path +
|
|
||||||
' because not authorized')
|
|
||||||
return None
|
|
||||||
|
|
||||||
if '/users/' not in path:
|
if '/users/' not in path:
|
||||||
print('Not receiving new post for ' + path +
|
print('Not receiving new post for ' + path +
|
||||||
|
@ -6715,13 +6711,15 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
"newdm", "newreport", "newshare", "newquestion",
|
"newdm", "newreport", "newshare", "newquestion",
|
||||||
"editblogpost")
|
"editblogpost")
|
||||||
for currPostType in postTypes:
|
for currPostType in postTypes:
|
||||||
|
if not authorized:
|
||||||
|
break
|
||||||
|
|
||||||
if currPostType != 'newshare':
|
if currPostType != 'newshare':
|
||||||
postRedirect = self.server.defaultTimeline
|
postRedirect = self.server.defaultTimeline
|
||||||
else:
|
else:
|
||||||
postRedirect = 'shares'
|
postRedirect = 'shares'
|
||||||
|
|
||||||
pageNumber = self._receiveNewPost(authorized, currPostType,
|
pageNumber = self._receiveNewPost(currPostType, self.path)
|
||||||
self.path)
|
|
||||||
if pageNumber:
|
if pageNumber:
|
||||||
nickname = self.path.split('/users/')[1]
|
nickname = self.path.split('/users/')[1]
|
||||||
if '/' in nickname:
|
if '/' in nickname:
|
||||||
|
|
Loading…
Reference in New Issue