From 6564d5245a4e833dcd5f8aabcbe684fecbb3c12d Mon Sep 17 00:00:00 2001 From: boke0 Date: Sun, 14 Mar 2021 14:44:33 +0900 Subject: [PATCH] [fix] --- kyokusui/controller.py | 3 ++- kyokusui/templates/thread.html | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/kyokusui/controller.py b/kyokusui/controller.py index 178d25e..56aee65 100644 --- a/kyokusui/controller.py +++ b/kyokusui/controller.py @@ -139,7 +139,8 @@ def retrieve(self, request): return Response.render(template, { "board": board, "thread": thread, - "boards": Board.list_subscribed(request.user) + "boards": Board.list_subscribed(request.user), + "ws_scheme": "ws" if request.scheme == "http" else "wss" }) def log(self, request): diff --git a/kyokusui/templates/thread.html b/kyokusui/templates/thread.html index 2fd7906..f424fc0 100644 --- a/kyokusui/templates/thread.html +++ b/kyokusui/templates/thread.html @@ -89,7 +89,7 @@ const textarea = document.querySelector("#message") const image_form = document.querySelector("#image") const image2send = document.querySelector("#image2send") -const ws = new WebSocket("{{ fullurl(request, "/api/v0/board/" + board._id + "/" + thread._id + "/socket", scheme="ws" if request.scheme == "http" else "wss") }}") +const ws = new WebSocket("{{ fullurl(request, "/api/v0/board/" + board._id + "/" + thread._id + "/socket", scheme=ws_scheme) }}") image_form.onchange = async e => { const files = await Promise.all(Array.from(e.target.files).map(f => { return new Promise((resolve, reject) => {