summary refs log tree commit diff
path: root/synapse/http
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2014-08-18 15:01:08 +0100
committerKegan Dougal <kegan@matrix.org>2014-08-18 17:18:54 +0100
commita18b1a649c5dd7fbb42fa2b1af0530542b8c3873 (patch)
tree1dcce57de58d3510dd5e34edc8117424906268db /synapse/http
parentIn members list, on avatar mouseover, show a tooltip with the user matrix id (diff)
downloadsynapse-a18b1a649c5dd7fbb42fa2b1af0530542b8c3873.tar.xz
Added /matrix/content path, HS resource_for_content_repo attribute and FileUploadResource. Added stub methods.
Diffstat (limited to 'synapse/http')
-rw-r--r--synapse/http/server.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/synapse/http/server.py b/synapse/http/server.py
index bad2738bde..f86151e51c 100644
--- a/synapse/http/server.py
+++ b/synapse/http/server.py
@@ -25,6 +25,7 @@ from twisted.web.server import NOT_DONE_YET
 from twisted.web.util import redirectTo
 
 import collections
+import json
 import logging
 
 
@@ -176,6 +177,33 @@ class RootRedirect(resource.Resource):
         return resource.Resource.getChild(self, name, request)
 
 
+class FileUploadResource(resource.Resource):
+    isLeaf = True
+
+    def __init__(self, directory):
+        resource.Resource.__init__(self)
+        self.directory = directory
+
+    def render(self, request):
+        self._async_render(request)
+        return server.NOT_DONE_YET
+
+    # @defer.inlineCallbacks
+    def _async_render(self, request):
+        request.setResponseCode(200)
+        request.setHeader(b"Content-Type", b"application/json")
+
+        request.setHeader("Access-Control-Allow-Origin", "*")
+        request.setHeader("Access-Control-Allow-Methods",
+                          "GET, POST, PUT, DELETE, OPTIONS")
+        request.setHeader("Access-Control-Allow-Headers",
+                          "Origin, X-Requested-With, Content-Type, Accept")
+
+        request.write(json.dumps({"url": "not_implemented"}))
+        request.finish()
+        defer.succeed("not implemented")
+
+
 def respond_with_json_bytes(request, code, json_bytes, send_cors=False):
     """Sends encoded JSON in response to the given request.