Default geolocation

merge-requests/30/head
Bob Mottram 2021-05-09 20:29:53 +01:00
parent 05f1ada1c1
commit 67ab24db90
6 changed files with 32 additions and 25 deletions

View File

@ -458,7 +458,7 @@ def _desktopReplyToPost(session, postId: str,
isArticle = False
subject = None
commentsEnabled = True
city = 'London'
city = 'London, England'
sayStr = 'Sending reply'
_sayCommand(sayStr, sayStr, screenreader, systemLanguage, espeak)
if sendPostViaServer(__version__,
@ -515,7 +515,7 @@ def _desktopNewPost(session,
attach = None
mediaType = None
attachedImageDescription = None
city = 'London'
city = 'London, England'
isArticle = False
subject = None
commentsEnabled = True
@ -1160,7 +1160,7 @@ def _desktopNewDMbase(session, toHandle: str,
attach = None
mediaType = None
attachedImageDescription = None
city = 'London'
city = 'London, England'
isArticle = False
subject = None
commentsEnabled = True

View File

@ -465,7 +465,7 @@ parser.add_argument('--attach', dest='attach', type=str,
parser.add_argument('--imagedescription', dest='imageDescription', type=str,
default=None, help='Description of an attached image')
parser.add_argument('--city', dest='city', type=str,
default='London',
default='London, England',
help='Spoofed city for image metadata misdirection')
parser.add_argument('--warning', '--warn', '--cwsubject', '--subject',
dest='subject', type=str, default=None,
@ -1113,7 +1113,7 @@ if args.message:
followersOnly = args.followersonly
clientToServer = args.client
attachedImageDescription = args.imageDescription
city = 'London'
city = 'London, England'
sendThreads = []
postLog = []
personCache = {}
@ -1963,7 +1963,7 @@ if args.avatar:
if not args.nickname:
print('Specify a nickname with --nickname [name]')
sys.exit()
city = 'London'
city = 'London, England'
if setProfileImage(baseDir, httpPrefix, args.nickname, domain,
port, args.avatar, 'avatar', '128x128', city):
print('Avatar added for ' + args.nickname)
@ -1978,7 +1978,7 @@ if args.backgroundImage:
if not args.nickname:
print('Specify a nickname with --nickname [name]')
sys.exit()
city = 'London'
city = 'London, England'
if setProfileImage(baseDir, httpPrefix, args.nickname, domain,
port, args.backgroundImage, 'background',
'256x256', city):
@ -2354,7 +2354,7 @@ if args.unfilterStr:
sys.exit()
if args.testdata:
city = 'London'
city = 'London, England'
nickname = 'testuser567'
password = 'boringpassword'
print('Generating some test data for user: ' + nickname)
@ -2424,7 +2424,7 @@ if args.testdata:
testAttachImageFilename = None
testMediaType = None
testImageDescription = None
testCity = 'London'
testCity = 'London, England'
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
"like this is totally just a #test man",

View File

@ -2183,7 +2183,7 @@ def _bounceDM(senderPostId: str, session, httpPrefix: str,
attachImageFilename = None
mediaType = None
imageDescription = ''
city = 'London'
city = 'London, England'
inReplyTo = removeIdEnding(senderPostId)
inReplyToAtomUri = None
schedulePost = False

View File

@ -65,10 +65,10 @@ def spoofGeolocation(baseDir: str,
if not os.path.isfile(locationsFilename):
locationsFilename = baseDir + '/locations.txt'
variance = 0.2
default_latitude = 51.5069
default_longitude = -0.1114
default_latitude = 51.8744
default_longitude = 0.368333
default_latdirection = 'N'
default_longdirection = 'E'
default_longdirection = 'W'
if citiesList:
cities = citiesList

View File

@ -531,7 +531,7 @@ def _convertRSStoActivityPub(baseDir: str, httpPrefix: str,
attachImageFilename = None
mediaType = None
imageDescription = None
city = 'London'
city = 'London, England'
blog = createNewsPost(baseDir,
domain, port, httpPrefix,
rssDescription,

View File

@ -465,7 +465,7 @@ def createServerAlice(path: str, domain: str, port: int,
testAttachImageFilename = None
testMediaType = None
testImageDescription = None
testCity = 'London'
testCity = 'London, England'
createPublicPost(path, nickname, domain, port, httpPrefix,
"No wise fish would go anywhere without a porpoise",
testFollowersOnly,
@ -509,7 +509,7 @@ def createServerAlice(path: str, domain: str, port: int,
brochMode = False
showNodeInfoAccounts = True
showNodeInfoVersion = True
city = 'London'
city = 'London, England'
print('Server running: Alice')
runDaemon(city,
showNodeInfoAccounts,
@ -569,7 +569,7 @@ def createServerBob(path: str, domain: str, port: int,
testAttachImageFilename = None
testImageDescription = None
testMediaType = None
testCity = 'London'
testCity = 'London, England'
createPublicPost(path, nickname, domain, port, httpPrefix,
"It's your life, live it your way.",
testFollowersOnly,
@ -613,7 +613,7 @@ def createServerBob(path: str, domain: str, port: int,
brochMode = False
showNodeInfoAccounts = True
showNodeInfoVersion = True
city = 'London'
city = 'London, England'
print('Server running: Bob')
runDaemon(city,
showNodeInfoAccounts,
@ -670,7 +670,7 @@ def createServerEve(path: str, domain: str, port: int, federationList: [],
brochMode = False
showNodeInfoAccounts = True
showNodeInfoVersion = True
city = 'London'
city = 'London, England'
print('Server running: Eve')
runDaemon(city,
showNodeInfoAccounts,
@ -778,7 +778,7 @@ def testPostMessageBetweenServers():
mediaType = getAttachmentMediaType(attachedImageFilename)
attachedImageDescription = 'Logo'
isArticle = False
city = 'London'
city = 'London, England'
# nothing in Alice's outbox
outboxPath = aliceDir + '/accounts/alice@' + aliceDomain + '/outbox'
assert len([name for name in os.listdir(outboxPath)
@ -1096,7 +1096,7 @@ def testFollowBetweenServers():
aliceCachedWebfingers = {}
alicePostLog = []
isArticle = False
city = 'London'
city = 'London, England'
sendResult = \
sendPost(__version__,
sessionAlice, aliceDir, 'alice', aliceDomain, alicePort,
@ -1402,7 +1402,7 @@ def testCreatePerson():
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
"G'day world!", False, True, clientToServer,
True, None, None, None, None,
'Not suitable for Vogons', 'London')
'Not suitable for Vogons', 'London, England')
os.chdir(currDir)
shutil.rmtree(baseDir)
@ -1605,7 +1605,7 @@ def testClientToServer():
attachedImageFilename = baseDir + '/img/logo.png'
mediaType = getAttachmentMediaType(attachedImageFilename)
attachedImageDescription = 'Logo'
city = 'London'
city = 'London, England'
isArticle = False
cachedWebfingers = {}
personCache = {}
@ -2843,7 +2843,7 @@ def testReplyToPublicPost() -> None:
attachImageFilename = None
mediaType = None
imageDescription = 'Some description'
city = 'London'
city = 'London, England'
reply = \
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
content, followersOnly, saveToFile,
@ -3273,7 +3273,7 @@ def testLinksWithinPost() -> None:
commentsEnabled = True
mediaType = None
imageDescription = None
city = 'London'
city = 'London, England'
postJsonObject = \
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
@ -3683,6 +3683,13 @@ def testSpoofGeolocation() -> None:
assert coords[1] <= 118.408 + 0.1
assert coords[2] == 'N'
assert coords[3] == 'W'
coords = spoofGeolocation('', 'unknown', currTime, citiesList)
assert coords[0] >= 51.8744 - 0.1
assert coords[0] <= 51.8744 + 0.1
assert coords[1] >= 0.368333 - 0.1
assert coords[1] <= 0.368333 + 0.1
assert coords[2] == 'N'
assert coords[3] == 'W'
def runAllTests():