mirror of
https://github.com/studiokaiji/nostr-webhost.git
synced 2025-12-18 15:24:19 +01:00
dタグをパス形式にした
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package server
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
@@ -98,7 +99,9 @@ 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) {
|
||||||
|
fmt.Println("hi")
|
||||||
|
|
||||||
// pubKeyを取得しFilterに追加
|
// pubKeyを取得しFilterに追加
|
||||||
pubKey := ctx.Param("pubKey")
|
pubKey := ctx.Param("pubKey")
|
||||||
// npubから始まる場合はデコードする
|
// npubから始まる場合はデコードする
|
||||||
@@ -113,10 +116,14 @@ 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}
|
||||||
|
|
||||||
|
fmt.Println(dTag)
|
||||||
|
|
||||||
// Poolからデータを取得する
|
// Poolからデータを取得する
|
||||||
ev := pool.QuerySingle(ctx, allRelays, nostr.Filter{
|
ev := pool.QuerySingle(ctx, allRelays, nostr.Filter{
|
||||||
Kinds: []int{
|
Kinds: []int{
|
||||||
|
|||||||
Reference in New Issue
Block a user