예제 #1
0
	def __init__(self, auth, port=8080, **options):
		http.HTTPServer.__init__(self, port=port, **options)

		jsclient = ConcurrenTree.file("orchard/jsclient/")
		js = ConcurrenTree.file("orchard/jsclient/js")
		css = ConcurrenTree.file("orchard/jsclient/css")
		img = ConcurrenTree.file("img/logos")

		http.Alias(self, "/favicon.ico", "Orchard32.ico", img)
		http.Alias(self, "/", "index.html", jsclient)
		http.Alias(self, "/index", "index.html", jsclient)

		http.FileServer(self, "tab", jsclient+"tab/")
		http.FileServer(self, "js", js)
		http.FileServer(self, "css", css)
		http.FileServer(self, "bootstrap", jsclient+"bootstrap/", False)
		http.FileServer(self, "img", img)

		http.Alias(self, "/js/head.js", "head.min.js", js)
		http.Alias(self, "/js/jquery.js", "jquery-1.4.2.min.js", js)
		http.Alias(self, "/js/textile.js", "textile-editor.min.js", js)
		http.Alias(self, "/js/stream/ws.js", "ws.js", js)

		http.Callback(self, "/account/new", self.newAccount, method="POST")

		self.rootpath = jsclient
		self.port = port
		self.auth = auth
예제 #2
0
파일: http.py 프로젝트: adajw/ConcurrenTree
    def __init__(self, port=8080):
        self.closed = False
        self.port = port
        self.rootpath = ConcurrenTree.file()
        print "HTTP server root path:", self.rootpath

        jsclient = ConcurrenTree.file("orchard/jsclient/")
        img = ConcurrenTree.file("img/")

        self.server = hfs.Server(
            ("", port),
            [
                hfs.File(jsclient, "client.html", ["/", "/index.htm", "/index.html"], "text/html"),
                hfs.File(jsclient, "newclient.html", "/newclient", "text/html"),
                hfs.File(jsclient, "js/util.js", ["/util.js", "/js/util.js"], mimetype="text/javascript"),
                hfs.File(jsclient, "js/buffer.js", ["/buffer.js", "/js/buffer.js"], mimetype="text/javascript"),
                hfs.File(
                    jsclient, "js/ctree.js", ["/ctree.js", "/js/ctree.js"], mimetype="text/javascript", preload=True
                ),
                hfs.File(
                    jsclient, "js/operation.js", ["/operation.js", "/js/operation.js"], mimetype="text/javascript"
                ),
                hfs.File(jsclient, "js/bcp.js", ["/bcp.js", "/js/bcp.js"], mimetype="text/javascript", preload=True),
                hfs.File(jsclient, "js/view.js", ["/view.js", "/js/view.js"], mimetype="text/javascript", preload=True),
                hfs.File(jsclient, "js/worker.js", mimetype="text/javascript"),
                hfs.File(jsclient, "js/display.js", mimetype="text/javascript"),
                hfs.File(jsclient, "js/displayworker.js", mimetype="text/javascript"),
                hfs.File(jsclient, "js/stream.js", ["/stream.js", "/js/stream.js"], mimetype="text/javascript"),
                hfs.File(jsclient, "js/ws.js", "/js/stream/ws.js", mimetype="text/javascript"),
                hfs.File(
                    jsclient,
                    "js/jquery-1.4.2.min.js",
                    ["/jquery.js", "/jquery-1.4.2.min.js"],
                    "text/javascript",
                    browsercache=True,
                    cache=True,
                    preload=True,
                ),
                hfs.File(
                    jsclient, "js/textile-editor.min.js", ["/textile.js", "/textile-editor.min.js"], "text/javascript"
                ),
                hfs.File(
                    jsclient,
                    "js/head.min.js",
                    "/head.js",
                    mimetype="text/javascript",
                    browsercache=True,
                    cache=True,
                    preload=True,
                ),
                hfs.File(
                    img,
                    "logos/OrchardLogo.svg",
                    ["/img/logo.svg", "/OrchardLogo.svg"],
                    "image/svg+xml",
                    browsercache=True,
                ),
                hfs.File(
                    img,
                    "logos/OrchardBigLogo.svg",
                    ["/img/biglogo.svg", "/OrchardBigLogo.svg"],
                    "image/svg+xml",
                    browsercache=True,
                ),
                hfs.File(img, "logos/Orchard32.ico", "/favicon.ico", "image", browsercache=True),
            ],
            supercache=False,
        )
        self._policy = Policy()