mirror of https://gitlab.com/bashrc2/epicyon
Move function out of daemon
parent
a9f7d38513
commit
2eb101823d
13
daemon.py
13
daemon.py
|
@ -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()
|
||||
|
|
11
utils.py
11
utils.py
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue