Save blogs to a separate box

main
Bob Mottram 2020-02-24 22:07:13 +00:00
parent b1aa16017c
commit fd24aee2fc
3 changed files with 10 additions and 6 deletions

View File

@ -888,7 +888,7 @@ class PubServer(BaseHTTPRequestHandler):
if not userEnding2[1].isdigit(): if not userEnding2[1].isdigit():
return None,None return None,None
# check for blog posts # check for blog posts
blogIndexFilename=baseDir+'/accounts/'+nickname+'@'+domain+'/outbox.index' blogIndexFilename=baseDir+'/accounts/'+nickname+'@'+domain+'/tlblogs.index'
if not os.path.isfile(blogIndexFilename): if not os.path.isfile(blogIndexFilename):
return None,None return None,None
if '#'+userEnding2[1]+'.' not in open(blogIndexFilename).read(): if '#'+userEnding2[1]+'.' not in open(blogIndexFilename).read():

View File

@ -22,6 +22,7 @@ from media import replaceYouTube
from media import getMediaPath from media import getMediaPath
from media import createMediaDirs from media import createMediaDirs
from inbox import inboxUpdateIndex from inbox import inboxUpdateIndex
from inbox import isBlogPost
from announce import outboxAnnounce from announce import outboxAnnounce
from follow import outboxUndoFollow from follow import outboxUndoFollow
from roles import outboxDelegate from roles import outboxDelegate
@ -156,20 +157,24 @@ def postMessageToOutbox(messageJson: {},postToNickname: str, \
if debug: if debug:
print('DEBUG: savePostToBox') print('DEBUG: savePostToBox')
if messageJson['type']!='Upgrade': if messageJson['type']!='Upgrade':
outboxName='outbox'
if messageJson['type']=='Article':
outboxName='tlblogs'
savedFilename= \ savedFilename= \
savePostToBox(baseDir, \ savePostToBox(baseDir, \
httpPrefix, \ httpPrefix, \
postId, \ postId, \
postToNickname, \ postToNickname, \
domainFull,messageJson,'outbox') domainFull,messageJson,outboxName)
if messageJson['type']=='Create' or \ if messageJson['type']=='Create' or \
messageJson['type']=='Question' or \ messageJson['type']=='Question' or \
messageJson['type']=='Note' or \ messageJson['type']=='Note' or \
messageJson['type']=='Article' or \ messageJson['type']=='Article' or \
messageJson['type']=='Announce': messageJson['type']=='Announce':
inboxUpdateIndex('outbox',baseDir, \ inboxUpdateIndex(outboxName,baseDir, \
postToNickname+'@'+domain, \ postToNickname+'@'+domain, \
savedFilename,debug) savedFilename,debug)
if outboxAnnounce(recentPostsCache, \ if outboxAnnounce(recentPostsCache, \
baseDir,messageJson,debug): baseDir,messageJson,debug):
if debug: if debug:

View File

@ -279,8 +279,7 @@ def locatePost(baseDir: str,nickname: str,domain: str,postUrl: str,replies=False
if os.path.isfile(postFilename): if os.path.isfile(postFilename):
return postFilename return postFilename
# if this post in the inbox of the person? boxName='tlblogs'
boxName='inbox'
postFilename=baseDir+'/accounts/'+nickname+'@'+domain+'/'+boxName+'/'+postUrl+'.'+extension postFilename=baseDir+'/accounts/'+nickname+'@'+domain+'/'+boxName+'/'+postUrl+'.'+extension
if os.path.isfile(postFilename): if os.path.isfile(postFilename):
return postFilename return postFilename