Move function out of daemon

merge-requests/30/head
Bob Mottram 2021-06-07 20:18:13 +01:00
parent a9f7d38513
commit 2eb101823d
2 changed files with 13 additions and 11 deletions

View File

@ -205,6 +205,7 @@ from shares import addShare
from shares import removeShare
from shares import expireShares
from categories import setHashtagCategory
from utils import permittedDir
from utils import isAccountDir
from utils import getOccupationSkills
from utils import getOccupationName
@ -1020,16 +1021,6 @@ class PubServer(BaseHTTPRequestHandler):
self._404()
return True
def _permittedDir(self, path: str) -> bool:
"""These are special paths which should not be accessible
directly via GET or POST
"""
if path.startswith('/wfendpoints') or \
path.startswith('/keys') or \
path.startswith('/accounts'):
return False
return True
def _postToOutbox(self, messageJson: {}, version: str,
postToNickname=None) -> bool:
"""post is received by the outbox
@ -11727,7 +11718,7 @@ class PubServer(BaseHTTPRequestHandler):
'avatar background shown done',
'GET busy time')
if not self._permittedDir(self.path):
if not permittedDir(self.path):
if self.server.debug:
print('DEBUG: GET Not permitted')
self._404()

View File

@ -2410,3 +2410,14 @@ def isAccountDir(dirName: str) -> bool:
if 'inbox@' in dirName or 'news@' in dirName:
return False
return True
def permittedDir(path: str) -> bool:
"""These are special paths which should not be accessible
directly via GET or POST
"""
if path.startswith('/wfendpoints') or \
path.startswith('/keys') or \
path.startswith('/accounts'):
return False
return True