forked from indymedia/epicyon
c2s public posts
parent
0e22f92f48
commit
e753f0cf5c
20
README.md
20
README.md
|
@ -345,7 +345,25 @@ python3 epicyon.py --nickname [yournick] --domain [name] --unfollow othernick@do
|
|||
|
||||
## Sending posts
|
||||
|
||||
To send a post:
|
||||
To make a public post:
|
||||
|
||||
``` bash
|
||||
python3 epicyon.py --nickname [yournick] --domain [name] \
|
||||
--sendto public --message "hello" \
|
||||
--warning "This is a content warning" \
|
||||
--password [mypass]
|
||||
```
|
||||
|
||||
To post to followers only:
|
||||
|
||||
``` bash
|
||||
python3 epicyon.py --nickname [yournick] --domain [name] \
|
||||
--sendto followers --message "hello" \
|
||||
--warning "This is a content warning" \
|
||||
--password [mypass]
|
||||
```
|
||||
|
||||
To send a post to a particular address:
|
||||
|
||||
``` bash
|
||||
python3 epicyon.py --nickname [yournick] --domain [name] \
|
||||
|
|
29
epicyon.py
29
epicyon.py
|
@ -302,15 +302,30 @@ if args.message:
|
|||
if not args.sendto:
|
||||
print('Specify an account to sent to: --sendto [nickname@domain]')
|
||||
sys.exit()
|
||||
if '@' not in args.sendto:
|
||||
if '@' not in args.sendto and \
|
||||
not args.sendto.lower().endswith('public') and \
|
||||
not args.sendto.lower().endswith('followers'):
|
||||
print('syntax: --sendto [nickname@domain]')
|
||||
print(' --sendto public')
|
||||
print(' --sendto followers')
|
||||
sys.exit()
|
||||
toNickname=args.sendto.split('@')[0]
|
||||
toDomain=args.sendto.split('@')[1].replace('\n','')
|
||||
toPort=443
|
||||
if ':' in toDomain:
|
||||
toPort=toDomain.split(':')[1]
|
||||
toDomain=toDomain.split(':')[0]
|
||||
if '@' in args.sendto:
|
||||
toNickname=args.sendto.split('@')[0]
|
||||
toDomain=args.sendto.split('@')[1].replace('\n','')
|
||||
toPort=443
|
||||
if ':' in toDomain:
|
||||
toPort=toDomain.split(':')[1]
|
||||
toDomain=toDomain.split(':')[0]
|
||||
else:
|
||||
if args.sendto.endswith('followers'):
|
||||
toNickname=None
|
||||
toDomain='followers'
|
||||
toPort=port
|
||||
else:
|
||||
toNickname=None
|
||||
toDomain='public'
|
||||
toPort=port
|
||||
|
||||
#ccUrl=httpPrefix+'://'+domain+'/users/'+nickname+'/followers'
|
||||
ccUrl=None
|
||||
sendMessage=args.message
|
||||
|
|
20
posts.py
20
posts.py
|
@ -722,10 +722,22 @@ def sendPostViaServer(session,fromNickname: str,password: str, \
|
|||
# Note that baseDir is set to None
|
||||
saveToFile=False
|
||||
clientToServer=True
|
||||
toDomainFull=toDomain
|
||||
if toPort!=80 and toDomain!=443:
|
||||
toDomainFull=toDomain+':'+str(toPort)
|
||||
toPersonId=httpPrefix+'://'+toDomainFull+'/users/'+toNickname
|
||||
if toDomain.lower().endswith('public'):
|
||||
toPersonId='https://www.w3.org/ns/activitystreams#Public'
|
||||
fromDomainFull=fromDomain
|
||||
if fromPort:
|
||||
if fromPort!=80 and fromPort!=443:
|
||||
fromDomainFull=fromDomain+':'+str(fromPort)
|
||||
cc=httpPrefix+'://'+fromDomainFull+'/users/'+fromNickname+'/followers'
|
||||
else:
|
||||
if toDomain.lower().endswith('followers') or \
|
||||
toDomain.lower().endswith('followersonly'):
|
||||
toPersonId=httpPrefix+'://'+fromDomainFull+'/users/'+fromNickname+'/followers'
|
||||
else:
|
||||
toDomainFull=toDomain
|
||||
if toPort!=80 and toDomain!=443:
|
||||
toDomainFull=toDomain+':'+str(toPort)
|
||||
toPersonId=httpPrefix+'://'+toDomainFull+'/users/'+toNickname
|
||||
postJsonObject = \
|
||||
createPostBase(None, \
|
||||
fromNickname,fromDomain,fromPort, \
|
||||
|
|
Loading…
Reference in New Issue