mirror of
https://github.com/studiokaiji/nostr-webhost.git
synced 2025-12-17 14:54:31 +01:00
@@ -52,8 +52,7 @@ func pathToKind(path string, replaceable bool) (int, error) {
|
|||||||
|
|
||||||
// Replaceableにする場合のidentifier(dタグ)を取得
|
// Replaceableにする場合のidentifier(dタグ)を取得
|
||||||
func getReplaceableIdentifier(indexHtmlIdentifier, filePath string) string {
|
func getReplaceableIdentifier(indexHtmlIdentifier, filePath string) string {
|
||||||
encodedFilePath := strings.ReplaceAll(filePath, "/", "_")
|
return indexHtmlIdentifier + "/" + filePath[1:]
|
||||||
return indexHtmlIdentifier + "-" + encodedFilePath
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var nostrEventsQueue []*nostr.Event
|
var nostrEventsQueue []*nostr.Event
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ func Start(port string) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Replaceable Event (NIP-33)
|
// 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を取得しFilterに追加
|
||||||
pubKey := ctx.Param("pubKey")
|
pubKey := ctx.Param("pubKey")
|
||||||
// npubから始まる場合はデコードする
|
// npubから始まる場合はデコードする
|
||||||
@@ -113,7 +113,9 @@ func Start(port string) {
|
|||||||
authors := []string{pubKey}
|
authors := []string{pubKey}
|
||||||
|
|
||||||
// dTagを取得しFilterに追加
|
// dTagを取得しFilterに追加
|
||||||
dTag := ctx.Param("dTag")
|
// dTagの最初は`/`ではじまるのでそれをslice
|
||||||
|
dTag := ctx.Param("dTag")[1:]
|
||||||
|
|
||||||
tags := nostr.TagMap{}
|
tags := nostr.TagMap{}
|
||||||
tags["d"] = []string{dTag}
|
tags["d"] = []string{dTag}
|
||||||
|
|
||||||
|
|||||||
@@ -58,14 +58,11 @@ func main() {
|
|||||||
fmt.Println("index.html:")
|
fmt.Println("index.html:")
|
||||||
fmt.Println(" - event.id:", id)
|
fmt.Println(" - event.id:", id)
|
||||||
|
|
||||||
label := " - "
|
if !replaceable {
|
||||||
if replaceable {
|
label := " - nevent"
|
||||||
label += "naddr"
|
|
||||||
} else {
|
|
||||||
label += "nevent"
|
|
||||||
}
|
|
||||||
fmt.Printf("%s: %s\n", label, encoded)
|
fmt.Printf("%s: %s\n", label, encoded)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return err
|
return err
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user