diff --git a/hostr/cmd/deploy/deploy.go b/hostr/cmd/deploy/deploy.go index 5576bd1..ff19deb 100644 --- a/hostr/cmd/deploy/deploy.go +++ b/hostr/cmd/deploy/deploy.go @@ -52,8 +52,7 @@ func pathToKind(path string, replaceable bool) (int, error) { // Replaceableにする場合のidentifier(dタグ)を取得 func getReplaceableIdentifier(indexHtmlIdentifier, filePath string) string { - encodedFilePath := strings.ReplaceAll(filePath, "/", "_") - return indexHtmlIdentifier + "-" + encodedFilePath + return indexHtmlIdentifier + "/" + filePath[1:] } var nostrEventsQueue []*nostr.Event diff --git a/hostr/cmd/server/server.go b/hostr/cmd/server/server.go index ace2625..8ede8f5 100644 --- a/hostr/cmd/server/server.go +++ b/hostr/cmd/server/server.go @@ -98,7 +98,7 @@ func Start(port string) { }) // Replaceable Event (NIP-33) - r.GET("/p/:pubKey/d/:dTag", func(ctx *gin.Context) { + r.GET("/p/:pubKey/d/*dTag", func(ctx *gin.Context) { // pubKeyを取得しFilterに追加 pubKey := ctx.Param("pubKey") // npubから始まる場合はデコードする @@ -113,7 +113,9 @@ func Start(port string) { authors := []string{pubKey} // dTagを取得しFilterに追加 - dTag := ctx.Param("dTag") + // dTagの最初は`/`ではじまるのでそれをslice + dTag := ctx.Param("dTag")[1:] + tags := nostr.TagMap{} tags["d"] = []string{dTag} diff --git a/hostr/main.go b/hostr/main.go index 8eaa10f..55691d6 100644 --- a/hostr/main.go +++ b/hostr/main.go @@ -58,13 +58,10 @@ func main() { fmt.Println("index.html:") fmt.Println(" - event.id:", id) - label := " - " - if replaceable { - label += "naddr" - } else { - label += "nevent" + if !replaceable { + label := " - nevent" + fmt.Printf("%s: %s\n", label, encoded) } - fmt.Printf("%s: %s\n", label, encoded) } return err },