don't compute the url, it doesn't seem to be necessary

This commit is contained in:
Jean-Paul Calderone 2019-03-21 13:58:46 -04:00
parent 9c7e93e924
commit edf01d7817
2 changed files with 3 additions and 12 deletions

View File

@ -70,14 +70,14 @@ class TokenAuthenticatedWebSocketServerProtocol(WebSocketServerProtocol):
pass
def create_log_streaming_resource(client, websocket_url):
def create_log_streaming_resource(client):
"""
Create a new resource that accepts WebSocket connections if they
include a correct `Authorization: tahoe-lafs <api_auth_token>`
header (where `api_auth_token` matches the private configuration
value).
"""
factory = WebSocketServerFactory(websocket_url)
factory = WebSocketServerFactory()
factory.tahoe_client = client
factory.protocol = TokenAuthenticatedWebSocketServerProtocol
return WebSocketResource(factory)

View File

@ -171,16 +171,7 @@ class Root(MultiFormatPage):
self.child_magic_folder = magic_folder.MagicFolderWebApi(client)
# handler for "/logs_v1" URIs
# note, webport can be a bare port or a Twisted
# endpoint-string but running it through serverFromString
# requires the reactor and still doesn't gain us anything
# (there's still no public API for "what is the port")
if webport.startswith("tcp:"):
port = webport.split(':')[1]
else:
port = webport
websocket_url = u"ws://127.0.0.1:{}/logs_v1".format(port)
self.child_logs_v1 = create_log_streaming_resource(client, websocket_url)
self.child_logs_v1 = create_log_streaming_resource(client)
self.child_file = FileHandler(client)
self.child_named = FileHandler(client)