Skip to content

Commit

Permalink
Merge pull request #40 from studiokaiji/feature-#39
Browse files Browse the repository at this point in the history
Feature #39
  • Loading branch information
studiokaiji authored Oct 10, 2023
2 parents b289eb0 + d22fc16 commit 634fb78
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
3 changes: 1 addition & 2 deletions hostr/cmd/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions hostr/cmd/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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から始まる場合はデコードする
Expand All @@ -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}

Expand Down
9 changes: 3 additions & 6 deletions hostr/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down

0 comments on commit 634fb78

Please sign in to comment.