Remove option to follow new actor

It wasn't implemented, and doing so could create an oprn relay situation where the authenticity of posts becomes obscured
alt-html-css
Bob Mottram 2020-12-26 10:22:56 +00:00
parent 0e47940eee
commit b3bb866f69
5 changed files with 18 additions and 43 deletions

View File

@ -2237,8 +2237,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cachedWebfingers, self.server.cachedWebfingers,
self.server.personCache, self.server.personCache,
debug, debug,
self.server.projectVersion, self.server.projectVersion)
self.server.allowNewsFollowers)
if callingDomain.endswith('.onion') and onionDomain: if callingDomain.endswith('.onion') and onionDomain:
originPathStr = 'http://' + onionDomain + usersPath originPathStr = 'http://' + onionDomain + usersPath
elif (callingDomain.endswith('.i2p') and i2pDomain): elif (callingDomain.endswith('.i2p') and i2pDomain):
@ -13364,7 +13363,6 @@ def runDaemon(sendThreadsTimeoutMins: int,
fullWidthTimelineButtonHeader: bool, fullWidthTimelineButtonHeader: bool,
showPublishAsIcon: bool, showPublishAsIcon: bool,
maxFollowers: int, maxFollowers: int,
allowNewsFollowers: bool,
maxNewsPosts: int, maxNewsPosts: int,
maxMirroredArticles: int, maxMirroredArticles: int,
maxNewswireFeedSizeKb: int, maxNewswireFeedSizeKb: int,
@ -13515,9 +13513,6 @@ def runDaemon(sendThreadsTimeoutMins: int,
# maximum number of posts in the news timeline/outbox # maximum number of posts in the news timeline/outbox
httpd.maxNewsPosts = maxNewsPosts httpd.maxNewsPosts = maxNewsPosts
# whether or not to allow followers of the news account
httpd.allowNewsFollowers = allowNewsFollowers
# The maximum number of tags per post which can be # The maximum number of tags per post which can be
# attached to RSS feeds pulled in via the newswire # attached to RSS feeds pulled in via the newswire
httpd.maxTags = 32 httpd.maxTags = 32
@ -13704,7 +13699,6 @@ def runDaemon(sendThreadsTimeoutMins: int,
httpd.translate, unitTest, httpd.translate, unitTest,
httpd.YTReplacementDomain, httpd.YTReplacementDomain,
httpd.showPublishedDateOnly, httpd.showPublishedDateOnly,
httpd.allowNewsFollowers,
httpd.maxFollowers, httpd.maxFollowers,
httpd.allowLocalNetworkAccess, httpd.allowLocalNetworkAccess,
httpd.peertubeInstances), daemon=True) httpd.peertubeInstances), daemon=True)

View File

@ -243,11 +243,6 @@ parser.add_argument("--fullWidthTimelineButtonHeader",
help="Whether to show the timeline " + help="Whether to show the timeline " +
"button header containing inbox and outbox " + "button header containing inbox and outbox " +
"as the full width of the screen") "as the full width of the screen")
parser.add_argument("--allowNewsFollowers",
dest='allowNewsFollowers',
type=str2bool, nargs='?',
const=True, default=False,
help="Whether to allow the news account to be followed")
parser.add_argument("--iconsAsButtons", parser.add_argument("--iconsAsButtons",
dest='iconsAsButtons', dest='iconsAsButtons',
type=str2bool, nargs='?', type=str2bool, nargs='?',
@ -2095,11 +2090,6 @@ sendThreadsTimeoutMins = \
if sendThreadsTimeoutMins is not None: if sendThreadsTimeoutMins is not None:
args.sendThreadsTimeoutMins = int(sendThreadsTimeoutMins) args.sendThreadsTimeoutMins = int(sendThreadsTimeoutMins)
allowNewsFollowers = \
getConfigParam(baseDir, 'allowNewsFollowers')
if allowNewsFollowers is not None:
args.allowNewsFollowers = bool(allowNewsFollowers)
showPublishAsIcon = \ showPublishAsIcon = \
getConfigParam(baseDir, 'showPublishAsIcon') getConfigParam(baseDir, 'showPublishAsIcon')
if showPublishAsIcon is not None: if showPublishAsIcon is not None:
@ -2154,7 +2144,6 @@ if __name__ == "__main__":
args.fullWidthTimelineButtonHeader, args.fullWidthTimelineButtonHeader,
args.showPublishAsIcon, args.showPublishAsIcon,
args.maxFollowers, args.maxFollowers,
args.allowNewsFollowers,
args.maxNewsPosts, args.maxNewsPosts,
args.maxMirroredArticles, args.maxMirroredArticles,
args.maxNewswireFeedSizeKb, args.maxNewswireFeedSizeKb,

View File

@ -68,14 +68,9 @@ def createInitialLastSeen(baseDir: str, httpPrefix: str) -> None:
def _preApprovedFollower(baseDir: str, def _preApprovedFollower(baseDir: str,
nickname: str, domain: str, nickname: str, domain: str,
approveHandle: str, approveHandle: str) -> bool:
allowNewsFollowers: bool) -> bool:
"""Is the given handle an already manually approved follower? """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 handle = nickname + '@' + domain
accountDir = baseDir + '/accounts/' + handle accountDir = baseDir + '/accounts/' + handle
approvedFilename = accountDir + '/approved.txt' approvedFilename = accountDir + '/approved.txt'
@ -460,13 +455,12 @@ def getFollowingFeed(baseDir: str, domain: str, port: int, path: str,
def _followApprovalRequired(baseDir: str, nicknameToFollow: str, def _followApprovalRequired(baseDir: str, nicknameToFollow: str,
domainToFollow: str, debug: bool, domainToFollow: str, debug: bool,
followRequestHandle: str, followRequestHandle: str) -> bool:
allowNewsFollowers: bool) -> bool:
""" Returns the policy for follower approvals """ Returns the policy for follower approvals
""" """
# has this handle already been manually approved? # has this handle already been manually approved?
if _preApprovedFollower(baseDir, nicknameToFollow, domainToFollow, if _preApprovedFollower(baseDir, nicknameToFollow, domainToFollow,
followRequestHandle, allowNewsFollowers): followRequestHandle):
return False return False
manuallyApproveFollows = False manuallyApproveFollows = False
@ -600,7 +594,6 @@ def receiveFollowRequest(session, baseDir: str, httpPrefix: str,
cachedWebfingers: {}, personCache: {}, cachedWebfingers: {}, personCache: {},
messageJson: {}, federationList: [], messageJson: {}, federationList: [],
debug: bool, projectVersion: str, debug: bool, projectVersion: str,
allowNewsFollowers: bool,
maxFollowers: int) -> bool: maxFollowers: int) -> bool:
"""Receives a follow request within the POST section of HTTPServer """Receives a follow request within the POST section of HTTPServer
""" """
@ -651,11 +644,10 @@ def receiveFollowRequest(session, baseDir: str, httpPrefix: str,
'nickname for the account followed') 'nickname for the account followed')
return True return True
if isSystemAccount(nicknameToFollow): if isSystemAccount(nicknameToFollow):
if not (nicknameToFollow == 'news' and allowNewsFollowers): if debug:
if debug: print('DEBUG: Cannot follow system account - ' +
print('DEBUG: Cannot follow system account - ' + nicknameToFollow)
nicknameToFollow) return True
return True
if maxFollowers > 0: if maxFollowers > 0:
if _getNoOfFollowers(baseDir, if _getNoOfFollowers(baseDir,
nicknameToFollow, domainToFollow, nicknameToFollow, domainToFollow,
@ -683,8 +675,7 @@ def receiveFollowRequest(session, baseDir: str, httpPrefix: str,
# what is the followers policy? # what is the followers policy?
approveHandle = nickname + '@' + domainFull approveHandle = nickname + '@' + domainFull
if _followApprovalRequired(baseDir, nicknameToFollow, if _followApprovalRequired(baseDir, nicknameToFollow,
domainToFollow, debug, approveHandle, domainToFollow, debug, approveHandle):
allowNewsFollowers):
print('Follow approval is required') print('Follow approval is required')
if domain.endswith('.onion'): if domain.endswith('.onion'):
if _noOfFollowRequests(baseDir, if _noOfFollowRequests(baseDir,
@ -877,7 +868,7 @@ def sendFollowRequest(session, baseDir: str,
clientToServer: bool, federationList: [], clientToServer: bool, federationList: [],
sendThreads: [], postLog: [], cachedWebfingers: {}, sendThreads: [], postLog: [], cachedWebfingers: {},
personCache: {}, debug: bool, personCache: {}, debug: bool,
projectVersion: str, allowNewsFollowers: bool) -> {}: projectVersion: str) -> {}:
"""Gets the json object for sending a follow request """Gets the json object for sending a follow request
""" """
if not domainPermitted(followDomain, federationList): if not domainPermitted(followDomain, federationList):
@ -910,7 +901,7 @@ def sendFollowRequest(session, baseDir: str,
} }
if _followApprovalRequired(baseDir, nickname, domain, debug, if _followApprovalRequired(baseDir, nickname, domain, debug,
followHandle, allowNewsFollowers): followHandle):
# Remove any follow requests rejected for the account being followed. # Remove any follow requests rejected for the account being followed.
# It's assumed that if you are following someone then you are # It's assumed that if you are following someone then you are
# ok with them following back. If this isn't the case then a rejected # ok with them following back. If this isn't the case then a rejected

View File

@ -2449,7 +2449,6 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
maxEmoji: int, translate: {}, unitTest: bool, maxEmoji: int, translate: {}, unitTest: bool,
YTReplacementDomain: str, YTReplacementDomain: str,
showPublishedDateOnly: bool, showPublishedDateOnly: bool,
allowNewsFollowers: bool,
maxFollowers: int, allowLocalNetworkAccess: bool, maxFollowers: int, allowLocalNetworkAccess: bool,
peertubeInstances: []) -> None: peertubeInstances: []) -> None:
"""Processes received items and moves them to the appropriate """Processes received items and moves them to the appropriate
@ -2739,7 +2738,6 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
queueJson['post'], queueJson['post'],
federationList, federationList,
debug, projectVersion, debug, projectVersion,
allowNewsFollowers,
maxFollowers): maxFollowers):
if os.path.isfile(queueFilename): if os.path.isfile(queueFilename):
os.remove(queueFilename) os.remove(queueFilename)

View File

@ -322,11 +322,12 @@ def createServerAlice(path: str, domain: str, port: int,
maxNewswirePosts = 20 maxNewswirePosts = 20
dormantMonths = 3 dormantMonths = 3
sendThreadsTimeoutMins = 30 sendThreadsTimeoutMins = 30
maxFollowers = 10
print('Server running: Alice') print('Server running: Alice')
runDaemon(sendThreadsTimeoutMins, runDaemon(sendThreadsTimeoutMins,
dormantMonths, maxNewswirePosts, dormantMonths, maxNewswirePosts,
allowLocalNetworkAccess, allowLocalNetworkAccess,
2048, False, True, False, False, True, 10, False, 2048, False, True, False, False, True, maxFollowers,
0, 100, 1024, 5, False, 0, 100, 1024, 5, False,
0, False, 1, False, False, False, 0, False, 1, False, False, False,
5, True, True, 'en', __version__, 5, True, True, 'en', __version__,
@ -418,11 +419,12 @@ def createServerBob(path: str, domain: str, port: int,
maxNewswirePosts = 20 maxNewswirePosts = 20
dormantMonths = 3 dormantMonths = 3
sendThreadsTimeoutMins = 30 sendThreadsTimeoutMins = 30
maxFollowers = 10
print('Server running: Bob') print('Server running: Bob')
runDaemon(sendThreadsTimeoutMins, runDaemon(sendThreadsTimeoutMins,
dormantMonths, maxNewswirePosts, dormantMonths, maxNewswirePosts,
allowLocalNetworkAccess, allowLocalNetworkAccess,
2048, False, True, False, False, True, 10, False, 2048, False, True, False, False, True, maxFollowers,
0, 100, 1024, 5, False, 0, 0, 100, 1024, 5, False, 0,
False, 1, False, False, False, False, 1, False, False, False,
5, True, True, 'en', __version__, 5, True, True, 'en', __version__,
@ -464,11 +466,12 @@ def createServerEve(path: str, domain: str, port: int, federationList: [],
maxNewswirePosts = 20 maxNewswirePosts = 20
dormantMonths = 3 dormantMonths = 3
sendThreadsTimeoutMins = 30 sendThreadsTimeoutMins = 30
maxFollowers = 10
print('Server running: Eve') print('Server running: Eve')
runDaemon(sendThreadsTimeoutMins, runDaemon(sendThreadsTimeoutMins,
dormantMonths, maxNewswirePosts, dormantMonths, maxNewswirePosts,
allowLocalNetworkAccess, allowLocalNetworkAccess,
2048, False, True, False, False, True, 10, False, 2048, False, True, False, False, True, maxFollowers,
0, 100, 1024, 5, False, 0, 0, 100, 1024, 5, False, 0,
False, 1, False, False, False, False, 1, False, False, False,
5, True, True, 'en', __version__, 5, True, True, 'en', __version__,
@ -851,7 +854,7 @@ def testFollowBetweenServers():
clientToServer, federationList, clientToServer, federationList,
aliceSendThreads, alicePostLog, aliceSendThreads, alicePostLog,
aliceCachedWebfingers, alicePersonCache, aliceCachedWebfingers, alicePersonCache,
True, __version__, False) True, __version__)
print('sendResult: ' + str(sendResult)) print('sendResult: ' + str(sendResult))
for t in range(16): for t in range(16):