From 9e795da738c4f35ad29b165ce1ef3e3cdf5864db Mon Sep 17 00:00:00 2001 From: studiokaiji Date: Fri, 10 Nov 2023 08:44:08 +0900 Subject: [PATCH] =?UTF-8?q?KindTextFile=E3=81=A8KindReplaceableTextFile?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hostr/cmd/consts/consts.go | 2 ++ hostr/cmd/tools/getContentType.go | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/hostr/cmd/consts/consts.go b/hostr/cmd/consts/consts.go index da69610..31e757a 100644 --- a/hostr/cmd/consts/consts.go +++ b/hostr/cmd/consts/consts.go @@ -5,7 +5,9 @@ const ( KindWebhostHTML = 5392 KindWebhostCSS = 5393 KindWebhostJS = 5394 + KindTextFile = 1064 KindWebhostReplaceableHTML = 35392 KindWebhostReplaceableCSS = 35393 KindWebhostReplaceableJS = 35394 + KindReplaceableTextFile = 30064 ) diff --git a/hostr/cmd/tools/getContentType.go b/hostr/cmd/tools/getContentType.go index 4d25943..4ed7157 100644 --- a/hostr/cmd/tools/getContentType.go +++ b/hostr/cmd/tools/getContentType.go @@ -3,10 +3,17 @@ package tools import ( "fmt" + "github.com/nbd-wtf/go-nostr" "github.com/studiokaiji/nostr-webhost/hostr/cmd/consts" ) -func GetContentType(kind int) (string, error) { +func GetContentType(event nostr.Event) (string, error) { + kind := event.Kind + + if kind == "" { + + } + if kind == consts.KindWebhostHTML || kind == consts.KindWebhostReplaceableHTML { return "text/html; charset=utf-8", nil } else if kind == consts.KindWebhostCSS || kind == consts.KindWebhostReplaceableCSS {