mirror of https://gitlab.com/bashrc2/epicyon
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 obscuredmerge-requests/30/head
parent
0e47940eee
commit
b3bb866f69
|
@ -2237,8 +2237,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.cachedWebfingers,
|
||||
self.server.personCache,
|
||||
debug,
|
||||
self.server.projectVersion,
|
||||
self.server.allowNewsFollowers)
|
||||
self.server.projectVersion)
|
||||
if callingDomain.endswith('.onion') and onionDomain:
|
||||
originPathStr = 'http://' + onionDomain + usersPath
|
||||
elif (callingDomain.endswith('.i2p') and i2pDomain):
|
||||
|
@ -13364,7 +13363,6 @@ def runDaemon(sendThreadsTimeoutMins: int,
|
|||
fullWidthTimelineButtonHeader: bool,
|
||||
showPublishAsIcon: bool,
|
||||
maxFollowers: int,
|
||||
allowNewsFollowers: bool,
|
||||
maxNewsPosts: int,
|
||||
maxMirroredArticles: int,
|
||||
maxNewswireFeedSizeKb: int,
|
||||
|
@ -13515,9 +13513,6 @@ def runDaemon(sendThreadsTimeoutMins: int,
|
|||
# maximum number of posts in the news timeline/outbox
|
||||
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
|
||||
# attached to RSS feeds pulled in via the newswire
|
||||
httpd.maxTags = 32
|
||||
|
@ -13704,7 +13699,6 @@ def runDaemon(sendThreadsTimeoutMins: int,
|
|||
httpd.translate, unitTest,
|
||||
httpd.YTReplacementDomain,
|
||||
httpd.showPublishedDateOnly,
|
||||
httpd.allowNewsFollowers,
|
||||
httpd.maxFollowers,
|
||||
httpd.allowLocalNetworkAccess,
|
||||
httpd.peertubeInstances), daemon=True)
|
||||
|
|
11
epicyon.py
11
epicyon.py
|
@ -243,11 +243,6 @@ parser.add_argument("--fullWidthTimelineButtonHeader",
|
|||
help="Whether to show the timeline " +
|
||||
"button header containing inbox and outbox " +
|
||||
"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",
|
||||
dest='iconsAsButtons',
|
||||
type=str2bool, nargs='?',
|
||||
|
@ -2095,11 +2090,6 @@ sendThreadsTimeoutMins = \
|
|||
if sendThreadsTimeoutMins is not None:
|
||||
args.sendThreadsTimeoutMins = int(sendThreadsTimeoutMins)
|
||||
|
||||
allowNewsFollowers = \
|
||||
getConfigParam(baseDir, 'allowNewsFollowers')
|
||||
if allowNewsFollowers is not None:
|
||||
args.allowNewsFollowers = bool(allowNewsFollowers)
|
||||
|
||||
showPublishAsIcon = \
|
||||
getConfigParam(baseDir, 'showPublishAsIcon')
|
||||
if showPublishAsIcon is not None:
|
||||
|
@ -2154,7 +2144,6 @@ if __name__ == "__main__":
|
|||
args.fullWidthTimelineButtonHeader,
|
||||
args.showPublishAsIcon,
|
||||
args.maxFollowers,
|
||||
args.allowNewsFollowers,
|
||||
args.maxNewsPosts,
|
||||
args.maxMirroredArticles,
|
||||
args.maxNewswireFeedSizeKb,
|
||||
|
|
29
follow.py
29
follow.py
|
@ -68,14 +68,9 @@ def createInitialLastSeen(baseDir: str, httpPrefix: str) -> None:
|
|||
|
||||
def _preApprovedFollower(baseDir: str,
|
||||
nickname: str, domain: str,
|
||||
approveHandle: str,
|
||||
allowNewsFollowers: bool) -> bool:
|
||||
approveHandle: str) -> 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'
|
||||
|
@ -460,13 +455,12 @@ def getFollowingFeed(baseDir: str, domain: str, port: int, path: str,
|
|||
|
||||
def _followApprovalRequired(baseDir: str, nicknameToFollow: str,
|
||||
domainToFollow: str, debug: bool,
|
||||
followRequestHandle: str,
|
||||
allowNewsFollowers: bool) -> bool:
|
||||
followRequestHandle: str) -> bool:
|
||||
""" Returns the policy for follower approvals
|
||||
"""
|
||||
# has this handle already been manually approved?
|
||||
if _preApprovedFollower(baseDir, nicknameToFollow, domainToFollow,
|
||||
followRequestHandle, allowNewsFollowers):
|
||||
followRequestHandle):
|
||||
return False
|
||||
|
||||
manuallyApproveFollows = False
|
||||
|
@ -600,7 +594,6 @@ def receiveFollowRequest(session, baseDir: str, httpPrefix: str,
|
|||
cachedWebfingers: {}, personCache: {},
|
||||
messageJson: {}, federationList: [],
|
||||
debug: bool, projectVersion: str,
|
||||
allowNewsFollowers: bool,
|
||||
maxFollowers: int) -> bool:
|
||||
"""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')
|
||||
return True
|
||||
if isSystemAccount(nicknameToFollow):
|
||||
if not (nicknameToFollow == 'news' and allowNewsFollowers):
|
||||
if debug:
|
||||
print('DEBUG: Cannot follow system account - ' +
|
||||
nicknameToFollow)
|
||||
return True
|
||||
if debug:
|
||||
print('DEBUG: Cannot follow system account - ' +
|
||||
nicknameToFollow)
|
||||
return True
|
||||
if maxFollowers > 0:
|
||||
if _getNoOfFollowers(baseDir,
|
||||
nicknameToFollow, domainToFollow,
|
||||
|
@ -683,8 +675,7 @@ def receiveFollowRequest(session, baseDir: str, httpPrefix: str,
|
|||
# what is the followers policy?
|
||||
approveHandle = nickname + '@' + domainFull
|
||||
if _followApprovalRequired(baseDir, nicknameToFollow,
|
||||
domainToFollow, debug, approveHandle,
|
||||
allowNewsFollowers):
|
||||
domainToFollow, debug, approveHandle):
|
||||
print('Follow approval is required')
|
||||
if domain.endswith('.onion'):
|
||||
if _noOfFollowRequests(baseDir,
|
||||
|
@ -877,7 +868,7 @@ def sendFollowRequest(session, baseDir: str,
|
|||
clientToServer: bool, federationList: [],
|
||||
sendThreads: [], postLog: [], cachedWebfingers: {},
|
||||
personCache: {}, debug: bool,
|
||||
projectVersion: str, allowNewsFollowers: bool) -> {}:
|
||||
projectVersion: str) -> {}:
|
||||
"""Gets the json object for sending a follow request
|
||||
"""
|
||||
if not domainPermitted(followDomain, federationList):
|
||||
|
@ -910,7 +901,7 @@ def sendFollowRequest(session, baseDir: str,
|
|||
}
|
||||
|
||||
if _followApprovalRequired(baseDir, nickname, domain, debug,
|
||||
followHandle, allowNewsFollowers):
|
||||
followHandle):
|
||||
# Remove any follow requests rejected for the account being followed.
|
||||
# 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
|
||||
|
|
2
inbox.py
2
inbox.py
|
@ -2449,7 +2449,6 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
|
|||
maxEmoji: int, translate: {}, unitTest: bool,
|
||||
YTReplacementDomain: str,
|
||||
showPublishedDateOnly: bool,
|
||||
allowNewsFollowers: bool,
|
||||
maxFollowers: int, allowLocalNetworkAccess: bool,
|
||||
peertubeInstances: []) -> None:
|
||||
"""Processes received items and moves them to the appropriate
|
||||
|
@ -2739,7 +2738,6 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
|
|||
queueJson['post'],
|
||||
federationList,
|
||||
debug, projectVersion,
|
||||
allowNewsFollowers,
|
||||
maxFollowers):
|
||||
if os.path.isfile(queueFilename):
|
||||
os.remove(queueFilename)
|
||||
|
|
11
tests.py
11
tests.py
|
@ -322,11 +322,12 @@ def createServerAlice(path: str, domain: str, port: int,
|
|||
maxNewswirePosts = 20
|
||||
dormantMonths = 3
|
||||
sendThreadsTimeoutMins = 30
|
||||
maxFollowers = 10
|
||||
print('Server running: Alice')
|
||||
runDaemon(sendThreadsTimeoutMins,
|
||||
dormantMonths, maxNewswirePosts,
|
||||
allowLocalNetworkAccess,
|
||||
2048, False, True, False, False, True, 10, False,
|
||||
2048, False, True, False, False, True, maxFollowers,
|
||||
0, 100, 1024, 5, False,
|
||||
0, False, 1, False, False, False,
|
||||
5, True, True, 'en', __version__,
|
||||
|
@ -418,11 +419,12 @@ def createServerBob(path: str, domain: str, port: int,
|
|||
maxNewswirePosts = 20
|
||||
dormantMonths = 3
|
||||
sendThreadsTimeoutMins = 30
|
||||
maxFollowers = 10
|
||||
print('Server running: Bob')
|
||||
runDaemon(sendThreadsTimeoutMins,
|
||||
dormantMonths, maxNewswirePosts,
|
||||
allowLocalNetworkAccess,
|
||||
2048, False, True, False, False, True, 10, False,
|
||||
2048, False, True, False, False, True, maxFollowers,
|
||||
0, 100, 1024, 5, False, 0,
|
||||
False, 1, False, False, False,
|
||||
5, True, True, 'en', __version__,
|
||||
|
@ -464,11 +466,12 @@ def createServerEve(path: str, domain: str, port: int, federationList: [],
|
|||
maxNewswirePosts = 20
|
||||
dormantMonths = 3
|
||||
sendThreadsTimeoutMins = 30
|
||||
maxFollowers = 10
|
||||
print('Server running: Eve')
|
||||
runDaemon(sendThreadsTimeoutMins,
|
||||
dormantMonths, maxNewswirePosts,
|
||||
allowLocalNetworkAccess,
|
||||
2048, False, True, False, False, True, 10, False,
|
||||
2048, False, True, False, False, True, maxFollowers,
|
||||
0, 100, 1024, 5, False, 0,
|
||||
False, 1, False, False, False,
|
||||
5, True, True, 'en', __version__,
|
||||
|
@ -851,7 +854,7 @@ def testFollowBetweenServers():
|
|||
clientToServer, federationList,
|
||||
aliceSendThreads, alicePostLog,
|
||||
aliceCachedWebfingers, alicePersonCache,
|
||||
True, __version__, False)
|
||||
True, __version__)
|
||||
print('sendResult: ' + str(sendResult))
|
||||
|
||||
for t in range(16):
|
||||
|
|
Loading…
Reference in New Issue