forked from indymedia/epicyon
Federation lists for individual accounts
parent
bf3ef893aa
commit
08233c0dff
|
@ -49,6 +49,10 @@ def isBlocked(baseDir: str,nickname: str,domain: str, \
|
||||||
blockNickname: str,blockDomain: str) -> bool:
|
blockNickname: str,blockDomain: str) -> bool:
|
||||||
"""Is the given nickname blocked?
|
"""Is the given nickname blocked?
|
||||||
"""
|
"""
|
||||||
|
allowFilename=baseDir+'/accounts/'+nickname+'@'+domain+'/allowedinstances.txt'
|
||||||
|
if os.path.isfile(allowFilename):
|
||||||
|
if blockDomain not in open(allowFilename).read():
|
||||||
|
return True
|
||||||
blockingFilename=baseDir+'/accounts/'+nickname+'@'+domain+'/blocking.txt'
|
blockingFilename=baseDir+'/accounts/'+nickname+'@'+domain+'/blocking.txt'
|
||||||
blockHandle=blockNickname+'@'+blockDomain
|
blockHandle=blockNickname+'@'+blockDomain
|
||||||
if os.path.isfile(blockingFilename):
|
if os.path.isfile(blockingFilename):
|
||||||
|
|
|
@ -1743,6 +1743,14 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
else:
|
else:
|
||||||
if os.path.isfile(blockedFilename):
|
if os.path.isfile(blockedFilename):
|
||||||
os.remove(blockedFilename)
|
os.remove(blockedFilename)
|
||||||
|
# save allowed instances list
|
||||||
|
allowedInstancesFilename=self.server.baseDir+'/accounts/'+nickname+'@'+self.server.domain+'/allowedinstances.txt'
|
||||||
|
if fields.get('allowedInstances'):
|
||||||
|
with open(allowedInstancesFilename, "w") as allowedInstancesFile:
|
||||||
|
allowedInstancesFile.write(fields['allowedInstances'])
|
||||||
|
else:
|
||||||
|
if os.path.isfile(allowedInstancesFilename):
|
||||||
|
os.remove(allowedInstancesFilename)
|
||||||
# save actor json file within accounts
|
# save actor json file within accounts
|
||||||
if actorChanged:
|
if actorChanged:
|
||||||
with open(actorFilename, 'w') as fp:
|
with open(actorFilename, 'w') as fp:
|
||||||
|
|
|
@ -68,6 +68,12 @@ def htmlEditProfile(baseDir: str,path: str,domain: str,port: int) -> str:
|
||||||
with open(blockedFilename, 'r') as blockedfile:
|
with open(blockedFilename, 'r') as blockedfile:
|
||||||
blockedStr=blockedfile.read()
|
blockedStr=blockedfile.read()
|
||||||
|
|
||||||
|
allowedInstancesStr=''
|
||||||
|
allowedInstancesFilename=baseDir+'/accounts/'+nickname+'@'+domain+'/allowedinstances.txt'
|
||||||
|
if os.path.isfile(allowedInstancesFilename):
|
||||||
|
with open(allowedInstancesFilename, 'r') as allowedInstancesFile:
|
||||||
|
allowedInstancesStr=allowedInstancesFile.read()
|
||||||
|
|
||||||
with open(baseDir+'/epicyon-profile.css', 'r') as cssFile:
|
with open(baseDir+'/epicyon-profile.css', 'r') as cssFile:
|
||||||
newPostCSS = cssFile.read()
|
newPostCSS = cssFile.read()
|
||||||
|
|
||||||
|
@ -93,10 +99,15 @@ def htmlEditProfile(baseDir: str,path: str,domain: str,port: int) -> str:
|
||||||
' </div>' \
|
' </div>' \
|
||||||
' <div class="container">' \
|
' <div class="container">' \
|
||||||
' <input type="checkbox" class=profilecheckbox" name="approveFollowers" '+manuallyApprovesFollowers+'>Approve follower requests<br>' \
|
' <input type="checkbox" class=profilecheckbox" name="approveFollowers" '+manuallyApprovesFollowers+'>Approve follower requests<br>' \
|
||||||
' <br>Filtered words' \
|
' <br><b>Filtered words</b>' \
|
||||||
' <textarea id="message" name="filteredWords" placeholder="Filtered words or phrases (one per line)" style="height:200px">'+filterStr+'</textarea>' \
|
' <br>One per line' \
|
||||||
' <br>Blocked accounts' \
|
' <textarea id="message" name="filteredWords" placeholder="" style="height:200px">'+filterStr+'</textarea>' \
|
||||||
' <textarea id="message" name="blocked" placeholder="Blocked accounts, one per line, in the form nickname@domain or *@blockeddomain" style="height:200px">'+blockedStr+'</textarea>' \
|
' <br><b>Blocked accounts</b>' \
|
||||||
|
' <br>Blocked accounts, one per line, in the form <i>nickname@domain</i> or <i>*@blockeddomain</i>' \
|
||||||
|
' <textarea id="message" name="blocked" placeholder="" style="height:200px">'+blockedStr+'</textarea>' \
|
||||||
|
' <br><b>Allowed instances</b>' \
|
||||||
|
' <br>Federate only with a defined set of instances. One domain name per line.' \
|
||||||
|
' <textarea id="message" name="allowedInstances" placeholder="" style="height:200px">'+allowedInstancesStr+'</textarea>' \
|
||||||
' </div>' \
|
' </div>' \
|
||||||
' <div class="container">' \
|
' <div class="container">' \
|
||||||
' <input type="submit" name="submitProfile" value="Submit">' \
|
' <input type="submit" name="submitProfile" value="Submit">' \
|
||||||
|
|
Loading…
Reference in New Issue