mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-19 11:16:24 +00:00
Create the /private hierarchy
This commit is contained in:
parent
2877c9b3c1
commit
5f4f8d9dbb
@ -12,6 +12,9 @@ import eliot
|
|||||||
|
|
||||||
from allmydata.util.hashutil import timing_safe_compare
|
from allmydata.util.hashutil import timing_safe_compare
|
||||||
from .common import humanize_failure
|
from .common import humanize_failure
|
||||||
|
from twisted.web.resource import (
|
||||||
|
Resource,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class TokenAuthenticatedWebSocketServerProtocol(WebSocketServerProtocol):
|
class TokenAuthenticatedWebSocketServerProtocol(WebSocketServerProtocol):
|
||||||
@ -81,3 +84,9 @@ def create_log_streaming_resource(client):
|
|||||||
factory.tahoe_client = client
|
factory.tahoe_client = client
|
||||||
factory.protocol = TokenAuthenticatedWebSocketServerProtocol
|
factory.protocol = TokenAuthenticatedWebSocketServerProtocol
|
||||||
return WebSocketResource(factory)
|
return WebSocketResource(factory)
|
||||||
|
|
||||||
|
|
||||||
|
def create_log_resources(client):
|
||||||
|
logs = Resource()
|
||||||
|
logs.putChild(b"v1", create_log_streaming_resource(client))
|
||||||
|
return logs
|
||||||
|
20
src/allmydata/web/private.py
Normal file
20
src/allmydata/web/private.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
from __future__ import (
|
||||||
|
print_function,
|
||||||
|
unicode_literals,
|
||||||
|
absolute_import,
|
||||||
|
division,
|
||||||
|
)
|
||||||
|
|
||||||
|
from twisted.web.resource import (
|
||||||
|
Resource,
|
||||||
|
)
|
||||||
|
|
||||||
|
from .logs import (
|
||||||
|
create_log_resources,
|
||||||
|
)
|
||||||
|
|
||||||
|
def create_private_tree(client):
|
||||||
|
private = Resource()
|
||||||
|
private.putChild(b"logs", create_log_resources(client))
|
||||||
|
return private
|
@ -25,8 +25,9 @@ from allmydata.web.common import (
|
|||||||
render_time,
|
render_time,
|
||||||
render_time_attr,
|
render_time_attr,
|
||||||
)
|
)
|
||||||
from allmydata.web.logs import create_log_streaming_resource
|
from allmydata.web.private import (
|
||||||
|
create_private_tree,
|
||||||
|
)
|
||||||
|
|
||||||
class URIHandler(RenderMixin, rend.Page):
|
class URIHandler(RenderMixin, rend.Page):
|
||||||
# I live at /uri . There are several operations defined on /uri itself,
|
# I live at /uri . There are several operations defined on /uri itself,
|
||||||
@ -169,8 +170,10 @@ class Root(MultiFormatPage):
|
|||||||
# handler for "/magic_folder" URIs
|
# handler for "/magic_folder" URIs
|
||||||
self.child_magic_folder = magic_folder.MagicFolderWebApi(client)
|
self.child_magic_folder = magic_folder.MagicFolderWebApi(client)
|
||||||
|
|
||||||
# handler for "/logs_v1" URIs
|
# Handler for everything beneath "/private", an area of the resource
|
||||||
self.child_logs_v1 = create_log_streaming_resource(client)
|
# hierarchy which is only accessible with the private per-node API
|
||||||
|
# auth token.
|
||||||
|
self.child_private = create_private_tree(client)
|
||||||
|
|
||||||
self.child_file = FileHandler(client)
|
self.child_file = FileHandler(client)
|
||||||
self.child_named = FileHandler(client)
|
self.child_named = FileHandler(client)
|
||||||
|
Loading…
Reference in New Issue
Block a user