forked from indymedia/epicyon
debug
parent
102837bcc2
commit
13a58150ff
43
epicyon.py
43
epicyon.py
|
@ -37,6 +37,7 @@ import os
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
import requests
|
import requests
|
||||||
|
import time
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
from tests import testHttpsig
|
from tests import testHttpsig
|
||||||
from daemon import runDaemon
|
from daemon import runDaemon
|
||||||
|
@ -179,8 +180,8 @@ parser.add_argument('--favorite','--like', dest='like', type=str,default=None, \
|
||||||
help='Like a url')
|
help='Like a url')
|
||||||
parser.add_argument('--undolike','--unlike', dest='undolike', type=str,default=None, \
|
parser.add_argument('--undolike','--unlike', dest='undolike', type=str,default=None, \
|
||||||
help='Undo a like of a url')
|
help='Undo a like of a url')
|
||||||
parser.add_argument('--sendto', nargs='+',dest='sendto', \
|
parser.add_argument('--sendto', dest='sendto', type=str,default=None, \
|
||||||
help='List of post recipients')
|
help='Address to send a post to')
|
||||||
parser.add_argument('--attach', dest='attach', type=str,default=None, \
|
parser.add_argument('--attach', dest='attach', type=str,default=None, \
|
||||||
help='File to attach to a post')
|
help='File to attach to a post')
|
||||||
parser.add_argument('--imagedescription', dest='imageDescription', type=str,default=None, \
|
parser.add_argument('--imagedescription', dest='imageDescription', type=str,default=None, \
|
||||||
|
@ -276,6 +277,10 @@ if baseDir.endswith('/'):
|
||||||
print("--path option should not end with '/'")
|
print("--path option should not end with '/'")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
if args.domain:
|
||||||
|
domain=args.domain
|
||||||
|
setConfigParam(baseDir,'domain',domain)
|
||||||
|
|
||||||
# get domain name from configuration
|
# get domain name from configuration
|
||||||
configDomain=getConfigParam(baseDir,'domain')
|
configDomain=getConfigParam(baseDir,'domain')
|
||||||
if configDomain:
|
if configDomain:
|
||||||
|
@ -316,7 +321,7 @@ if domain.endswith('.onion'):
|
||||||
useTor=True
|
useTor=True
|
||||||
|
|
||||||
if args.message:
|
if args.message:
|
||||||
if not nickname:
|
if not args.nickname:
|
||||||
print('Specify a nickname with the --nickname option')
|
print('Specify a nickname with the --nickname option')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
@ -365,11 +370,11 @@ if args.message:
|
||||||
cachedWebfingers={}
|
cachedWebfingers={}
|
||||||
subject=args.subject
|
subject=args.subject
|
||||||
attach=args.attach
|
attach=args.attach
|
||||||
replyTo=args.replyTo
|
replyTo=args.replyto
|
||||||
followersOnly=False
|
followersOnly=False
|
||||||
print('Sending post to '+args.sendto)
|
print('Sending post to '+args.sendto)
|
||||||
|
|
||||||
sendPostViaServer(session,nickname,args.password, \
|
sendPostViaServer(session,args.nickname,args.password, \
|
||||||
domain,port, \
|
domain,port, \
|
||||||
toNickname,toDomain,toPort,ccUrl, \
|
toNickname,toDomain,toPort,ccUrl, \
|
||||||
httpPrefix,sendMessage,followersOnly, \
|
httpPrefix,sendMessage,followersOnly, \
|
||||||
|
@ -382,7 +387,7 @@ if args.message:
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
if args.announce:
|
if args.announce:
|
||||||
if not nickname:
|
if not args.nickname:
|
||||||
print('Specify a nickname with the --nickname option')
|
print('Specify a nickname with the --nickname option')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
@ -395,7 +400,7 @@ if args.announce:
|
||||||
cachedWebfingers={}
|
cachedWebfingers={}
|
||||||
print('Sending announce/repeat of '+args.announce)
|
print('Sending announce/repeat of '+args.announce)
|
||||||
|
|
||||||
sendAnnounceViaServer(session,nickname,args.password,
|
sendAnnounceViaServer(session,args.nickname,args.password,
|
||||||
domain,port, \
|
domain,port, \
|
||||||
httpPrefix,args.announce, \
|
httpPrefix,args.announce, \
|
||||||
cachedWebfingers,personCache, \
|
cachedWebfingers,personCache, \
|
||||||
|
@ -406,7 +411,7 @@ if args.announce:
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
if args.like:
|
if args.like:
|
||||||
if not nickname:
|
if not args.nickname:
|
||||||
print('Specify a nickname with the --nickname option')
|
print('Specify a nickname with the --nickname option')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
@ -419,7 +424,7 @@ if args.like:
|
||||||
cachedWebfingers={}
|
cachedWebfingers={}
|
||||||
print('Sending like of '+args.like)
|
print('Sending like of '+args.like)
|
||||||
|
|
||||||
sendLikeViaServer(session,nickname,args.password,
|
sendLikeViaServer(session,args.nickname,args.password,
|
||||||
domain,port, \
|
domain,port, \
|
||||||
httpPrefix,args.like, \
|
httpPrefix,args.like, \
|
||||||
cachedWebfingers,personCache, \
|
cachedWebfingers,personCache, \
|
||||||
|
@ -430,7 +435,7 @@ if args.like:
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
if args.undolike:
|
if args.undolike:
|
||||||
if not nickname:
|
if not args.nickname:
|
||||||
print('Specify a nickname with the --nickname option')
|
print('Specify a nickname with the --nickname option')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
@ -443,7 +448,7 @@ if args.undolike:
|
||||||
cachedWebfingers={}
|
cachedWebfingers={}
|
||||||
print('Sending undo like of '+args.undolike)
|
print('Sending undo like of '+args.undolike)
|
||||||
|
|
||||||
sendUndoLikeViaServer(session,nickname,args.password,
|
sendUndoLikeViaServer(session,args.nickname,args.password,
|
||||||
domain,port, \
|
domain,port, \
|
||||||
httpPrefix,args.undolike, \
|
httpPrefix,args.undolike, \
|
||||||
cachedWebfingers,personCache, \
|
cachedWebfingers,personCache, \
|
||||||
|
@ -454,7 +459,7 @@ if args.undolike:
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
if args.delete:
|
if args.delete:
|
||||||
if not nickname:
|
if not args.nickname:
|
||||||
print('Specify a nickname with the --nickname option')
|
print('Specify a nickname with the --nickname option')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
@ -467,7 +472,7 @@ if args.delete:
|
||||||
cachedWebfingers={}
|
cachedWebfingers={}
|
||||||
print('Sending delete request of '+args.delete)
|
print('Sending delete request of '+args.delete)
|
||||||
|
|
||||||
sendDeleteViaServer(session,nickname,args.password,
|
sendDeleteViaServer(session,args.nickname,args.password,
|
||||||
domain,port, \
|
domain,port, \
|
||||||
httpPrefix,args.delete, \
|
httpPrefix,args.delete, \
|
||||||
cachedWebfingers,personCache, \
|
cachedWebfingers,personCache, \
|
||||||
|
@ -482,11 +487,11 @@ if args.follow:
|
||||||
if '.' not in args.follow:
|
if '.' not in args.follow:
|
||||||
print("This doesn't look like a fediverse handle")
|
print("This doesn't look like a fediverse handle")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
if not nickname:
|
if not args.nickname:
|
||||||
print('Please specify the nickname for the account with --nickname')
|
print('Please specify the nickname for the account with --nickname')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
if not args.password:
|
if not args.password:
|
||||||
print('Please specify the password for '+nickname+' on '+domain)
|
print('Please specify the password for '+args.nickname+' on '+domain)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
followNickname=getNicknameFromActor(args.follow)
|
followNickname=getNicknameFromActor(args.follow)
|
||||||
|
@ -499,7 +504,7 @@ if args.follow:
|
||||||
if args.follow.startswith('https'):
|
if args.follow.startswith('https'):
|
||||||
followHttpPrefix='https'
|
followHttpPrefix='https'
|
||||||
|
|
||||||
sendFollowRequestViaServer(session,nickname,args.password, \
|
sendFollowRequestViaServer(session,args.nickname,args.password, \
|
||||||
domain,port, \
|
domain,port, \
|
||||||
followNickname,followDomain,followPort, \
|
followNickname,followDomain,followPort, \
|
||||||
httpPrefix, \
|
httpPrefix, \
|
||||||
|
@ -516,11 +521,11 @@ if args.unfollow:
|
||||||
if '.' not in args.follow:
|
if '.' not in args.follow:
|
||||||
print("This doesn't look like a fediverse handle")
|
print("This doesn't look like a fediverse handle")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
if not nickname:
|
if not args.nickname:
|
||||||
print('Please specify the nickname for the account with --nickname')
|
print('Please specify the nickname for the account with --nickname')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
if not args.password:
|
if not args.password:
|
||||||
print('Please specify the password for '+nickname+' on '+domain)
|
print('Please specify the password for '+args.nickname+' on '+domain)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
followNickname=getNicknameFromActor(args.unfollow)
|
followNickname=getNicknameFromActor(args.unfollow)
|
||||||
|
@ -533,7 +538,7 @@ if args.unfollow:
|
||||||
if args.follow.startswith('https'):
|
if args.follow.startswith('https'):
|
||||||
followHttpPrefix='https'
|
followHttpPrefix='https'
|
||||||
|
|
||||||
sendUnfollowRequestViaServer(session,nickname,args.password, \
|
sendUnfollowRequestViaServer(session,args.nickname,args.password, \
|
||||||
domain,port, \
|
domain,port, \
|
||||||
followNickname,followDomain,followPort, \
|
followNickname,followDomain,followPort, \
|
||||||
httpPrefix, \
|
httpPrefix, \
|
||||||
|
|
6
posts.py
6
posts.py
|
@ -478,7 +478,8 @@ def createPostBase(baseDir: str,nickname: str, domain: str, port: int, \
|
||||||
if ccUrl:
|
if ccUrl:
|
||||||
if len(ccUrl)>0:
|
if len(ccUrl)>0:
|
||||||
newPost['cc']=ccUrl
|
newPost['cc']=ccUrl
|
||||||
newPost['object']['cc']=ccUrl
|
if newPost.get('object'):
|
||||||
|
newPost['object']['cc']=ccUrl
|
||||||
if saveToFile:
|
if saveToFile:
|
||||||
savePostToBox(baseDir,httpPrefix,newPostId, \
|
savePostToBox(baseDir,httpPrefix,newPostId, \
|
||||||
nickname,domain,newPost,'outbox')
|
nickname,domain,newPost,'outbox')
|
||||||
|
@ -961,12 +962,15 @@ def sendToNamedAddresses(session,baseDir: str, \
|
||||||
recipients=[]
|
recipients=[]
|
||||||
recipientType=['to','cc']
|
recipientType=['to','cc']
|
||||||
for rType in recipientType:
|
for rType in recipientType:
|
||||||
|
print('==== rType: '+rType)
|
||||||
for address in recipientsObject[rType]:
|
for address in recipientsObject[rType]:
|
||||||
|
print('==== address: '+address)
|
||||||
if address.endswith('#Public'):
|
if address.endswith('#Public'):
|
||||||
continue
|
continue
|
||||||
if address.endswith('/followers'):
|
if address.endswith('/followers'):
|
||||||
continue
|
continue
|
||||||
recipients.append(address)
|
recipients.append(address)
|
||||||
|
print('==== recipients: '+str(recipients))
|
||||||
if not recipients:
|
if not recipients:
|
||||||
return
|
return
|
||||||
if debug:
|
if debug:
|
||||||
|
|
Loading…
Reference in New Issue