KindTextFileとKindReplaceableTextFileを追加

This commit is contained in:
studiokaiji
2023-11-10 08:44:08 +09:00
parent c608573ed5
commit 9e795da738
2 changed files with 10 additions and 1 deletions

View File

@@ -5,7 +5,9 @@ const (
KindWebhostHTML = 5392
KindWebhostCSS = 5393
KindWebhostJS = 5394
KindTextFile = 1064
KindWebhostReplaceableHTML = 35392
KindWebhostReplaceableCSS = 35393
KindWebhostReplaceableJS = 35394
KindReplaceableTextFile = 30064
)

View File

@@ -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 {