mirror of https://gitlab.com/bashrc2/epicyon
Add debug
parent
f734456c62
commit
28d72cb83c
13
daemon.py
13
daemon.py
|
@ -5359,9 +5359,10 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,13)
|
self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,13)
|
||||||
|
|
||||||
# edit blog post
|
# edit blog post
|
||||||
if authorized and self.path.endswith('/tlblogs?editblogpost'):
|
if authorized and '/tlblogs?editblogpost' in self.path:
|
||||||
pageNumber=1
|
pageNumber=1
|
||||||
|
|
||||||
|
print('Edit blog 1')
|
||||||
length = int(self.headers['Content-length'])
|
length = int(self.headers['Content-length'])
|
||||||
if length>self.server.maxPostLength:
|
if length>self.server.maxPostLength:
|
||||||
print('POST size too large')
|
print('POST size too large')
|
||||||
|
@ -5371,6 +5372,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
optionsConfirmParams= \
|
optionsConfirmParams= \
|
||||||
self.rfile.read(length).decode('utf-8').replace('%40','@').replace('%3A',':').replace('%23','#').replace('%2F','/').replace('%3F','')
|
self.rfile.read(length).decode('utf-8').replace('%40','@').replace('%3A',':').replace('%23','#').replace('%2F','/').replace('%3F','')
|
||||||
|
print('Edit blog 2: '+optionsConfirmParams)
|
||||||
postUrl=None
|
postUrl=None
|
||||||
if 'postUrl=' in optionsConfirmParams:
|
if 'postUrl=' in optionsConfirmParams:
|
||||||
postUrl=optionsConfirmParams.split('postUrl=')[1]
|
postUrl=optionsConfirmParams.split('postUrl=')[1]
|
||||||
|
@ -5379,6 +5381,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
originPathStr= \
|
originPathStr= \
|
||||||
self.server.httpPrefix+'://'+self.server.domainFull+ \
|
self.server.httpPrefix+'://'+self.server.domainFull+ \
|
||||||
self.path.split('?')[0]
|
self.path.split('?')[0]
|
||||||
|
print('Edit blog 3: '+str(postUrl))
|
||||||
|
print('Edit blog 4: '+originPathStr)
|
||||||
if postUrl:
|
if postUrl:
|
||||||
titleStr=''
|
titleStr=''
|
||||||
if 'subject=' in optionsConfirmParams:
|
if 'subject=' in optionsConfirmParams:
|
||||||
|
@ -5392,6 +5396,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if '&' in contentStr:
|
if '&' in contentStr:
|
||||||
contentStr=contentStr.split('&')[0]
|
contentStr=contentStr.split('&')[0]
|
||||||
contentStr=contentStr.replace('%26','&')
|
contentStr=contentStr.replace('%26','&')
|
||||||
|
print('Edit blog 5: '+titleStr)
|
||||||
|
print('Edit blog 6: '+contentStr)
|
||||||
#editNickname=getNicknameFromActor(originPathStr)
|
#editNickname=getNicknameFromActor(originPathStr)
|
||||||
# page number to return to
|
# page number to return to
|
||||||
if 'pageNumber=' in optionsConfirmParams:
|
if 'pageNumber=' in optionsConfirmParams:
|
||||||
|
@ -5400,14 +5406,17 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
pageNumberStr=pageNumberStr.split('&')[0]
|
pageNumberStr=pageNumberStr.split('&')[0]
|
||||||
if pageNumberStr.isdigit():
|
if pageNumberStr.isdigit():
|
||||||
pageNumber=int(pageNumberStr)
|
pageNumber=int(pageNumberStr)
|
||||||
|
print('Edit blog 7: '+str(pageNumber))
|
||||||
nickname= \
|
nickname= \
|
||||||
getNicknameFromActor(originPathStr)
|
getNicknameFromActor(originPathStr)
|
||||||
postFilename= \
|
postFilename= \
|
||||||
locatePost(self.server.baseDir, \
|
locatePost(self.server.baseDir, \
|
||||||
nickname,self.server.domain, \
|
nickname,self.server.domain, \
|
||||||
postUrl)
|
postUrl)
|
||||||
|
print('Edit blog 8: '+str(postFilename))
|
||||||
if postFilename and titleStr and contentStr:
|
if postFilename and titleStr and contentStr:
|
||||||
postJsonObject=loadJson(postFilename)
|
postJsonObject=loadJson(postFilename)
|
||||||
|
print('Edit blog 9: '+str(postJsonObject))
|
||||||
if postJsonObject:
|
if postJsonObject:
|
||||||
# remove any previous cached html
|
# remove any previous cached html
|
||||||
cacheFilename= \
|
cacheFilename= \
|
||||||
|
@ -5418,10 +5427,12 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
os.remove(cacheFilename)
|
os.remove(cacheFilename)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
print('Edit blog 10')
|
||||||
# save the new blog post
|
# save the new blog post
|
||||||
postJsonObject['object']['summary']=titleStr
|
postJsonObject['object']['summary']=titleStr
|
||||||
postJsonObject['object']['content']=contentStr
|
postJsonObject['object']['content']=contentStr
|
||||||
saveJson(postJsonObject,postFilename)
|
saveJson(postJsonObject,postFilename)
|
||||||
|
print('Edit blog 11')
|
||||||
self.server.POSTbusy=False
|
self.server.POSTbusy=False
|
||||||
self._redirect_headers(originPathStr+ \
|
self._redirect_headers(originPathStr+ \
|
||||||
'?page='+str(pageNumber),cookie)
|
'?page='+str(pageNumber),cookie)
|
||||||
|
|
Loading…
Reference in New Issue