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 {