From d6b23608604047f5b4781e798abcc8e3e57d8a94 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 23 Oct 2020 20:29:19 +0100 Subject: [PATCH] Optionally allow news account to be followed without request accept --- follow.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/follow.py b/follow.py index 117c15b2..b8cdf1a9 100644 --- a/follow.py +++ b/follow.py @@ -29,9 +29,14 @@ from session import postJson def preApprovedFollower(baseDir: str, nickname: str, domain: str, - approveHandle: str) -> bool: + approveHandle: str, + allowNewsFollowers: bool) -> bool: """Is the given handle an already manually approved follower? """ + # optionally allow the news account to be followed + if nickname == 'news' and allowNewsFollowers: + return True + handle = nickname + '@' + domain accountDir = baseDir + '/accounts/' + handle approvedFilename = accountDir + '/approved.txt' @@ -395,12 +400,13 @@ def getFollowingFeed(baseDir: str, domain: str, port: int, path: str, def followApprovalRequired(baseDir: str, nicknameToFollow: str, domainToFollow: str, debug: bool, - followRequestHandle: str) -> bool: + followRequestHandle: str, + allowNewsFollowers: bool) -> bool: """ Returns the policy for follower approvals """ # has this handle already been manually approved? if preApprovedFollower(baseDir, nicknameToFollow, domainToFollow, - followRequestHandle): + followRequestHandle, allowNewsFollowers): return False manuallyApproveFollows = False @@ -602,7 +608,8 @@ def receiveFollowRequest(session, baseDir: str, httpPrefix: str, # what is the followers policy? approveHandle = nickname + '@' + domainFull if followApprovalRequired(baseDir, nicknameToFollow, - domainToFollow, debug, approveHandle): + domainToFollow, debug, approveHandle, + allowNewsFollowers): print('Follow approval is required') if domain.endswith('.onion'): if noOfFollowRequests(baseDir,