Skip to content

Commit

Permalink
Fake url in xpd when using local server #33
Browse files Browse the repository at this point in the history
  • Loading branch information
ma1co committed Jun 8, 2017
1 parent f800132 commit f0ceb82
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions config.py
Expand Up @@ -5,3 +5,4 @@
githubAppListRepo = 'OpenMemories-AppList'

appengineServer = 'sony-pmca.appspot.com'
officialServer = 'www.playmemoriescameraapps.com'
2 changes: 1 addition & 1 deletion pmca/commands/usb.py
Expand Up @@ -39,7 +39,7 @@ def createMarketServer(host=None, repo=defaultAppStoreRepo, certFile=defaultCert
return RemoteMarketServer(host)
else:
print('Using local server')
return LocalMarketServer(repo, certFile)
return LocalMarketServer(repo, certFile, config.officialServer)


def listApps(host=None):
Expand Down
3 changes: 1 addition & 2 deletions pmca/installer/__init__.py
Expand Up @@ -80,8 +80,7 @@ def install(dev, host, port, xpdData, statusFunc=None):
# The camera wants us to open an SSL socket
connectionId = message.connectionId
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if message.host != host:
raise Exception('Connecting to wrong host: %s' % message.host)
# Ignoring message.host
sock.connect((host, port))
elif isinstance(message, SslSendDataMessage) and sock and message.connectionId == connectionId:
# The camera wants to send data over the socket
Expand Down
5 changes: 3 additions & 2 deletions pmca/marketserver/server.py
Expand Up @@ -57,11 +57,12 @@ def do_GET(self):
class LocalMarketServer(HTTPServer):
"""A local https server to communicate with the camera"""

def __init__(self, repo, certFile, host='127.0.0.1', port=4443):
def __init__(self, repo, certFile, fakeHost, host='127.0.0.1', port=4443):
HTTPServer.__init__(self, (host, port), HttpHandler)
self.host = host
self.port = port
self.url = 'https://' + host + '/'
self.fakeUrl = 'https://' + fakeHost + '/'
self.appstore = appstore.AppStore(repo)
self.apk = None
self.result = None
Expand All @@ -84,7 +85,7 @@ def setApp(self, package):

def getXpd(self):
"""Return the xpd contents"""
return getXpdResponse('0', self.url)
return getXpdResponse('0', self.fakeUrl)

def getResult(self):
"""Return the result sent from the camera"""
Expand Down

0 comments on commit f0ceb82

Please sign in to comment.