mirror of https://gitlab.com/bashrc2/epicyon
Default geolocation
parent
05f1ada1c1
commit
67ab24db90
|
|
@ -458,7 +458,7 @@ def _desktopReplyToPost(session, postId: str,
|
||||||
isArticle = False
|
isArticle = False
|
||||||
subject = None
|
subject = None
|
||||||
commentsEnabled = True
|
commentsEnabled = True
|
||||||
city = 'London'
|
city = 'London, England'
|
||||||
sayStr = 'Sending reply'
|
sayStr = 'Sending reply'
|
||||||
_sayCommand(sayStr, sayStr, screenreader, systemLanguage, espeak)
|
_sayCommand(sayStr, sayStr, screenreader, systemLanguage, espeak)
|
||||||
if sendPostViaServer(__version__,
|
if sendPostViaServer(__version__,
|
||||||
|
|
@ -515,7 +515,7 @@ def _desktopNewPost(session,
|
||||||
attach = None
|
attach = None
|
||||||
mediaType = None
|
mediaType = None
|
||||||
attachedImageDescription = None
|
attachedImageDescription = None
|
||||||
city = 'London'
|
city = 'London, England'
|
||||||
isArticle = False
|
isArticle = False
|
||||||
subject = None
|
subject = None
|
||||||
commentsEnabled = True
|
commentsEnabled = True
|
||||||
|
|
@ -1160,7 +1160,7 @@ def _desktopNewDMbase(session, toHandle: str,
|
||||||
attach = None
|
attach = None
|
||||||
mediaType = None
|
mediaType = None
|
||||||
attachedImageDescription = None
|
attachedImageDescription = None
|
||||||
city = 'London'
|
city = 'London, England'
|
||||||
isArticle = False
|
isArticle = False
|
||||||
subject = None
|
subject = None
|
||||||
commentsEnabled = True
|
commentsEnabled = True
|
||||||
|
|
|
||||||
12
epicyon.py
12
epicyon.py
|
|
@ -465,7 +465,7 @@ parser.add_argument('--attach', dest='attach', type=str,
|
||||||
parser.add_argument('--imagedescription', dest='imageDescription', type=str,
|
parser.add_argument('--imagedescription', dest='imageDescription', type=str,
|
||||||
default=None, help='Description of an attached image')
|
default=None, help='Description of an attached image')
|
||||||
parser.add_argument('--city', dest='city', type=str,
|
parser.add_argument('--city', dest='city', type=str,
|
||||||
default='London',
|
default='London, England',
|
||||||
help='Spoofed city for image metadata misdirection')
|
help='Spoofed city for image metadata misdirection')
|
||||||
parser.add_argument('--warning', '--warn', '--cwsubject', '--subject',
|
parser.add_argument('--warning', '--warn', '--cwsubject', '--subject',
|
||||||
dest='subject', type=str, default=None,
|
dest='subject', type=str, default=None,
|
||||||
|
|
@ -1113,7 +1113,7 @@ if args.message:
|
||||||
followersOnly = args.followersonly
|
followersOnly = args.followersonly
|
||||||
clientToServer = args.client
|
clientToServer = args.client
|
||||||
attachedImageDescription = args.imageDescription
|
attachedImageDescription = args.imageDescription
|
||||||
city = 'London'
|
city = 'London, England'
|
||||||
sendThreads = []
|
sendThreads = []
|
||||||
postLog = []
|
postLog = []
|
||||||
personCache = {}
|
personCache = {}
|
||||||
|
|
@ -1963,7 +1963,7 @@ if args.avatar:
|
||||||
if not args.nickname:
|
if not args.nickname:
|
||||||
print('Specify a nickname with --nickname [name]')
|
print('Specify a nickname with --nickname [name]')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
city = 'London'
|
city = 'London, England'
|
||||||
if setProfileImage(baseDir, httpPrefix, args.nickname, domain,
|
if setProfileImage(baseDir, httpPrefix, args.nickname, domain,
|
||||||
port, args.avatar, 'avatar', '128x128', city):
|
port, args.avatar, 'avatar', '128x128', city):
|
||||||
print('Avatar added for ' + args.nickname)
|
print('Avatar added for ' + args.nickname)
|
||||||
|
|
@ -1978,7 +1978,7 @@ if args.backgroundImage:
|
||||||
if not args.nickname:
|
if not args.nickname:
|
||||||
print('Specify a nickname with --nickname [name]')
|
print('Specify a nickname with --nickname [name]')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
city = 'London'
|
city = 'London, England'
|
||||||
if setProfileImage(baseDir, httpPrefix, args.nickname, domain,
|
if setProfileImage(baseDir, httpPrefix, args.nickname, domain,
|
||||||
port, args.backgroundImage, 'background',
|
port, args.backgroundImage, 'background',
|
||||||
'256x256', city):
|
'256x256', city):
|
||||||
|
|
@ -2354,7 +2354,7 @@ if args.unfilterStr:
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
if args.testdata:
|
if args.testdata:
|
||||||
city = 'London'
|
city = 'London, England'
|
||||||
nickname = 'testuser567'
|
nickname = 'testuser567'
|
||||||
password = 'boringpassword'
|
password = 'boringpassword'
|
||||||
print('Generating some test data for user: ' + nickname)
|
print('Generating some test data for user: ' + nickname)
|
||||||
|
|
@ -2424,7 +2424,7 @@ if args.testdata:
|
||||||
testAttachImageFilename = None
|
testAttachImageFilename = None
|
||||||
testMediaType = None
|
testMediaType = None
|
||||||
testImageDescription = None
|
testImageDescription = None
|
||||||
testCity = 'London'
|
testCity = 'London, England'
|
||||||
|
|
||||||
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
||||||
"like this is totally just a #test man",
|
"like this is totally just a #test man",
|
||||||
|
|
|
||||||
2
inbox.py
2
inbox.py
|
|
@ -2183,7 +2183,7 @@ def _bounceDM(senderPostId: str, session, httpPrefix: str,
|
||||||
attachImageFilename = None
|
attachImageFilename = None
|
||||||
mediaType = None
|
mediaType = None
|
||||||
imageDescription = ''
|
imageDescription = ''
|
||||||
city = 'London'
|
city = 'London, England'
|
||||||
inReplyTo = removeIdEnding(senderPostId)
|
inReplyTo = removeIdEnding(senderPostId)
|
||||||
inReplyToAtomUri = None
|
inReplyToAtomUri = None
|
||||||
schedulePost = False
|
schedulePost = False
|
||||||
|
|
|
||||||
6
media.py
6
media.py
|
|
@ -65,10 +65,10 @@ def spoofGeolocation(baseDir: str,
|
||||||
if not os.path.isfile(locationsFilename):
|
if not os.path.isfile(locationsFilename):
|
||||||
locationsFilename = baseDir + '/locations.txt'
|
locationsFilename = baseDir + '/locations.txt'
|
||||||
variance = 0.2
|
variance = 0.2
|
||||||
default_latitude = 51.5069
|
default_latitude = 51.8744
|
||||||
default_longitude = -0.1114
|
default_longitude = 0.368333
|
||||||
default_latdirection = 'N'
|
default_latdirection = 'N'
|
||||||
default_longdirection = 'E'
|
default_longdirection = 'W'
|
||||||
|
|
||||||
if citiesList:
|
if citiesList:
|
||||||
cities = citiesList
|
cities = citiesList
|
||||||
|
|
|
||||||
|
|
@ -531,7 +531,7 @@ def _convertRSStoActivityPub(baseDir: str, httpPrefix: str,
|
||||||
attachImageFilename = None
|
attachImageFilename = None
|
||||||
mediaType = None
|
mediaType = None
|
||||||
imageDescription = None
|
imageDescription = None
|
||||||
city = 'London'
|
city = 'London, England'
|
||||||
blog = createNewsPost(baseDir,
|
blog = createNewsPost(baseDir,
|
||||||
domain, port, httpPrefix,
|
domain, port, httpPrefix,
|
||||||
rssDescription,
|
rssDescription,
|
||||||
|
|
|
||||||
29
tests.py
29
tests.py
|
|
@ -465,7 +465,7 @@ def createServerAlice(path: str, domain: str, port: int,
|
||||||
testAttachImageFilename = None
|
testAttachImageFilename = None
|
||||||
testMediaType = None
|
testMediaType = None
|
||||||
testImageDescription = None
|
testImageDescription = None
|
||||||
testCity = 'London'
|
testCity = 'London, England'
|
||||||
createPublicPost(path, nickname, domain, port, httpPrefix,
|
createPublicPost(path, nickname, domain, port, httpPrefix,
|
||||||
"No wise fish would go anywhere without a porpoise",
|
"No wise fish would go anywhere without a porpoise",
|
||||||
testFollowersOnly,
|
testFollowersOnly,
|
||||||
|
|
@ -509,7 +509,7 @@ def createServerAlice(path: str, domain: str, port: int,
|
||||||
brochMode = False
|
brochMode = False
|
||||||
showNodeInfoAccounts = True
|
showNodeInfoAccounts = True
|
||||||
showNodeInfoVersion = True
|
showNodeInfoVersion = True
|
||||||
city = 'London'
|
city = 'London, England'
|
||||||
print('Server running: Alice')
|
print('Server running: Alice')
|
||||||
runDaemon(city,
|
runDaemon(city,
|
||||||
showNodeInfoAccounts,
|
showNodeInfoAccounts,
|
||||||
|
|
@ -569,7 +569,7 @@ def createServerBob(path: str, domain: str, port: int,
|
||||||
testAttachImageFilename = None
|
testAttachImageFilename = None
|
||||||
testImageDescription = None
|
testImageDescription = None
|
||||||
testMediaType = None
|
testMediaType = None
|
||||||
testCity = 'London'
|
testCity = 'London, England'
|
||||||
createPublicPost(path, nickname, domain, port, httpPrefix,
|
createPublicPost(path, nickname, domain, port, httpPrefix,
|
||||||
"It's your life, live it your way.",
|
"It's your life, live it your way.",
|
||||||
testFollowersOnly,
|
testFollowersOnly,
|
||||||
|
|
@ -613,7 +613,7 @@ def createServerBob(path: str, domain: str, port: int,
|
||||||
brochMode = False
|
brochMode = False
|
||||||
showNodeInfoAccounts = True
|
showNodeInfoAccounts = True
|
||||||
showNodeInfoVersion = True
|
showNodeInfoVersion = True
|
||||||
city = 'London'
|
city = 'London, England'
|
||||||
print('Server running: Bob')
|
print('Server running: Bob')
|
||||||
runDaemon(city,
|
runDaemon(city,
|
||||||
showNodeInfoAccounts,
|
showNodeInfoAccounts,
|
||||||
|
|
@ -670,7 +670,7 @@ def createServerEve(path: str, domain: str, port: int, federationList: [],
|
||||||
brochMode = False
|
brochMode = False
|
||||||
showNodeInfoAccounts = True
|
showNodeInfoAccounts = True
|
||||||
showNodeInfoVersion = True
|
showNodeInfoVersion = True
|
||||||
city = 'London'
|
city = 'London, England'
|
||||||
print('Server running: Eve')
|
print('Server running: Eve')
|
||||||
runDaemon(city,
|
runDaemon(city,
|
||||||
showNodeInfoAccounts,
|
showNodeInfoAccounts,
|
||||||
|
|
@ -778,7 +778,7 @@ def testPostMessageBetweenServers():
|
||||||
mediaType = getAttachmentMediaType(attachedImageFilename)
|
mediaType = getAttachmentMediaType(attachedImageFilename)
|
||||||
attachedImageDescription = 'Logo'
|
attachedImageDescription = 'Logo'
|
||||||
isArticle = False
|
isArticle = False
|
||||||
city = 'London'
|
city = 'London, England'
|
||||||
# nothing in Alice's outbox
|
# nothing in Alice's outbox
|
||||||
outboxPath = aliceDir + '/accounts/alice@' + aliceDomain + '/outbox'
|
outboxPath = aliceDir + '/accounts/alice@' + aliceDomain + '/outbox'
|
||||||
assert len([name for name in os.listdir(outboxPath)
|
assert len([name for name in os.listdir(outboxPath)
|
||||||
|
|
@ -1096,7 +1096,7 @@ def testFollowBetweenServers():
|
||||||
aliceCachedWebfingers = {}
|
aliceCachedWebfingers = {}
|
||||||
alicePostLog = []
|
alicePostLog = []
|
||||||
isArticle = False
|
isArticle = False
|
||||||
city = 'London'
|
city = 'London, England'
|
||||||
sendResult = \
|
sendResult = \
|
||||||
sendPost(__version__,
|
sendPost(__version__,
|
||||||
sessionAlice, aliceDir, 'alice', aliceDomain, alicePort,
|
sessionAlice, aliceDir, 'alice', aliceDomain, alicePort,
|
||||||
|
|
@ -1402,7 +1402,7 @@ def testCreatePerson():
|
||||||
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
||||||
"G'day world!", False, True, clientToServer,
|
"G'day world!", False, True, clientToServer,
|
||||||
True, None, None, None, None,
|
True, None, None, None, None,
|
||||||
'Not suitable for Vogons', 'London')
|
'Not suitable for Vogons', 'London, England')
|
||||||
|
|
||||||
os.chdir(currDir)
|
os.chdir(currDir)
|
||||||
shutil.rmtree(baseDir)
|
shutil.rmtree(baseDir)
|
||||||
|
|
@ -1605,7 +1605,7 @@ def testClientToServer():
|
||||||
attachedImageFilename = baseDir + '/img/logo.png'
|
attachedImageFilename = baseDir + '/img/logo.png'
|
||||||
mediaType = getAttachmentMediaType(attachedImageFilename)
|
mediaType = getAttachmentMediaType(attachedImageFilename)
|
||||||
attachedImageDescription = 'Logo'
|
attachedImageDescription = 'Logo'
|
||||||
city = 'London'
|
city = 'London, England'
|
||||||
isArticle = False
|
isArticle = False
|
||||||
cachedWebfingers = {}
|
cachedWebfingers = {}
|
||||||
personCache = {}
|
personCache = {}
|
||||||
|
|
@ -2843,7 +2843,7 @@ def testReplyToPublicPost() -> None:
|
||||||
attachImageFilename = None
|
attachImageFilename = None
|
||||||
mediaType = None
|
mediaType = None
|
||||||
imageDescription = 'Some description'
|
imageDescription = 'Some description'
|
||||||
city = 'London'
|
city = 'London, England'
|
||||||
reply = \
|
reply = \
|
||||||
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
||||||
content, followersOnly, saveToFile,
|
content, followersOnly, saveToFile,
|
||||||
|
|
@ -3273,7 +3273,7 @@ def testLinksWithinPost() -> None:
|
||||||
commentsEnabled = True
|
commentsEnabled = True
|
||||||
mediaType = None
|
mediaType = None
|
||||||
imageDescription = None
|
imageDescription = None
|
||||||
city = 'London'
|
city = 'London, England'
|
||||||
|
|
||||||
postJsonObject = \
|
postJsonObject = \
|
||||||
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
||||||
|
|
@ -3683,6 +3683,13 @@ def testSpoofGeolocation() -> None:
|
||||||
assert coords[1] <= 118.408 + 0.1
|
assert coords[1] <= 118.408 + 0.1
|
||||||
assert coords[2] == 'N'
|
assert coords[2] == 'N'
|
||||||
assert coords[3] == 'W'
|
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():
|
def runAllTests():
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue