Commit 5d6d3f27 authored by Mickaël Desfrênes's avatar Mickaël Desfrênes
Browse files

fix circe run error, fix dependencies, bump version

parent 73c788b9
Loading
Loading
Loading
Loading
+16 −22
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ import re
import aiofiles
import argh

version = "0.0.44"
version = "0.0.45"

AUTH_DB_PATH = "{}/auth.db".format(CONFIG["CIRCE_WORKING_DIR"])

@@ -180,6 +180,7 @@ server = Sanic(name="circe", strict_slashes=True)
server.config.REQUEST_TIMEOUT = 60 * 30
server.config.RESPONSE_TIMEOUT = 60 * 30
server.config.KEEP_ALIVE = False
server.static("/static", os.path.dirname(os.path.abspath(__file__)) + "/static/")


@server.get("/")
@@ -288,9 +289,9 @@ if CONFIG["CIRCE_ENABLE_WEB_UI"]:
                delay=CONFIG["CIRCE_WEB_UI_REMOVE_USER_FILES_DELAY"],
            )
            signed = cookie_signer.sign(session_id)
            response.cookies["sess"] = signed.decode("UTF-8")
            response.cookies["sess"]["httponly"] = True
            response.cookies["sess"]["samesite"] = "Strict"
            response.add_cookie("sess", signed.decode("UTF-8"))
            response.cookies.get_cookie("sess").httponly = True
            response.cookies.get_cookie("sess").samesite = "Strict"
            return response

    @server.route("/upload/", methods=["POST", "GET"])
@@ -385,29 +386,24 @@ def serve(
    workers=CONFIG["CIRCE_WORKERS"],
    debug=CONFIG["CIRCE_DEBUG"],
    access_log=CONFIG["CIRCE_ACCESS_LOG"],
    static_dir=None,
):
    """
    Start Circe HTTP server
    """
    _check_port(host, port)
    if static_dir:
        server.static("/static", static_dir, name="static_files")
    else:
        server.static(
            "/static", os.path.dirname(os.path.abspath(__file__)) + "/static/"
        )
    working_directory = os.getcwd()
    app_args = ["sanic", "circe.server", "-w", str(workers)]
    if debug:
        app_args.append("--dev")
    if access_log:
        app_args.append("--access-logs")
    try:
        server.run(
            host=host,
            port=port,
            auto_reload=debug,
            debug=debug,
            workers=workers,
            access_log=access_log,
        call(
            app_args,
            cwd=working_directory,
        )
    except OSError:
        sys.exit("Could not start server. Please check your host/port configuration.")
    except KeyboardInterrupt:
        pass


def run(
@@ -421,7 +417,6 @@ def run(
    """
    try:
        _check_port(host, port)
        static_dir = os.path.dirname(os.path.abspath(__file__)) + "/static/"
        http_process = Process(
            target=serve,
            args=(
@@ -430,7 +425,6 @@ def run(
                int(workers),
                bool(debug),
                CONFIG["CIRCE_ACCESS_LOG"],
                static_dir,
            ),
        )
        http_process.start()
+593 −160

File changed.

Preview size limit exceeded, changes collapsed.

+11 −11
Original line number Diff line number Diff line
[tool.poetry]
name = "circe-CERTIC"
readme = "README.md"
version = "0.0.44"
version = "0.0.45"
description = "Circe Server"
authors = ["Mickaël Desfrênes <mickael.desfrenes@unicaen.fr>"]
license = "CeCILL-B"
@@ -11,16 +11,16 @@ packages = [

[tool.poetry.dependencies]
python = ">=3.9,<4"
requests = ">=2.28.0"
argh = ">=0.28.1"
sanic = ">=22.3.2"
huey = ">=2.4.3"
asyncio = ">=3.4.3"
itsdangerous = ">=2.1.2"
aiofiles = ">=23.1.0"
markdown2 = ">=2.4.3"
python-json-logger = ">=2.0.2"
python-dotenv = ">=1.0.0"
requests = "2.31.0"
argh = "0.29.4"
sanic = "23.6.0"
huey = "2.5.0"
asyncio = "3.4.3"
itsdangerous = "2.1.2"
aiofiles = "23.2.1"
markdown2 = "2.4.10"
python-json-logger = "2.0.7"
python-dotenv = "1.0.0"

[tool.poetry.dev-dependencies]
black = "*"