From 5488804ea8dacd3b1ffcb5a67b0fca840f95c026 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Tue, 12 Dec 2023 11:25:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=90=8E=E7=AB=AF=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=B5=8C=E5=85=A5=E7=AC=AC=E4=B8=89=E6=96=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/smartdoc/settings/base.py | 2 +- apps/smartdoc/urls.py | 4 +++- ui/src/api/application.ts | 2 +- ui/src/views/applicaiton-overview/component/EmbedDialog.vue | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/smartdoc/settings/base.py b/apps/smartdoc/settings/base.py index 8b4c06802..33bd31ad0 100644 --- a/apps/smartdoc/settings/base.py +++ b/apps/smartdoc/settings/base.py @@ -47,7 +47,7 @@ MIDDLEWARE = [ 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', - 'django.middleware.clickjacking.XFrameOptionsMiddleware', + ] JWT_AUTH = { diff --git a/apps/smartdoc/urls.py b/apps/smartdoc/urls.py index 6246f8919..a7f99c1ee 100644 --- a/apps/smartdoc/urls.py +++ b/apps/smartdoc/urls.py @@ -77,7 +77,9 @@ def page_not_found(request, exception): file = open(index_path, "r", encoding='utf-8') content = file.read() file.close() - return HttpResponse(content, status=200) + if request.path.startswith('/ui/chat/'): + return HttpResponse(content, status=200) + return HttpResponse(content, status=200, headers={'X-Frame-Options': 'DENY'}) handler404 = page_not_found diff --git a/ui/src/api/application.ts b/ui/src/api/application.ts index 0b1b60c5a..cce0add96 100644 --- a/ui/src/api/application.ts +++ b/ui/src/api/application.ts @@ -200,7 +200,7 @@ const getChatOpen: (applicaiton_id: String) => Promise> = (applicait } */ const postChatMessage: (chat_id: string, message: string) => Promise = (chat_id, message) => { - return postStream(`/api/${prefix}/chat_message/${chat_id}`, { message }) + return postStream(`/api${prefix}/chat_message/${chat_id}`, { message }) } /** diff --git a/ui/src/views/applicaiton-overview/component/EmbedDialog.vue b/ui/src/views/applicaiton-overview/component/EmbedDialog.vue index 83319cc95..db1264ca5 100644 --- a/ui/src/views/applicaiton-overview/component/EmbedDialog.vue +++ b/ui/src/views/applicaiton-overview/component/EmbedDialog.vue @@ -71,7 +71,7 @@ allow="microphone"> host: "${window.location.host}" } <\/script> -