Compare commits

..

No commits in common. "277c713e7edbff36a002226d392d25bc2257c90a" and "6768713682ba1fd6c78258f50643386080495e04" have entirely different histories.

3 changed files with 7 additions and 12 deletions

View file

@ -32,12 +32,8 @@ func main() {
// nostr endpoints
l.Debug().Msg("enabling nostr user endpoint")
http.HandleFunc("/.well-known/nostr.json", nostr.GetNostrAddr)
addr := config.GetConfig().LndAddr
if addr != "" {
l.Debug().Msg("enabling nostr request endpoint")
http.HandleFunc("/request/nostr", nostr.RequestNostrAddr)
}
l.Debug().Msg("enabling nostr request endpoint")
http.HandleFunc("/request/nostr", nostr.RequestNostrAddr)
// start server
port := config.GetConfig().ListenAddr

View file

@ -29,7 +29,7 @@ type matrixClientWellKnown struct {
func MatrixServer(w http.ResponseWriter, req *http.Request) {
l := logger.Get()
// uses an environment variable for now
wellKnownAddr := fmt.Sprintf("%s:8448", config.GetConfig().MatrixWellKnownAddress)
wellKnownAddr := config.GetConfig().MatrixWellKnownAddress
if wellKnownAddr == "" {
w.WriteHeader(http.StatusNotFound)
l.Debug().Str("path", "matrix/server").Msg("matrix well known address unset")

View file

@ -46,10 +46,9 @@ func RequestNostrAddr(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "html/nostr_form.html")
case "POST":
r.ParseForm()
name := strings.ToLower(r.FormValue("Name"))
redisCli := redis.NostrRedisConn.Client
// check if the user already exists
rKey := getRkey("verified", name, getHostname(r.Host))
rKey := getRkey("verified", r.FormValue("Name"), getHostname(r.Host))
exists := redisCli.Exists(ctx, rKey)
if exists.Val() == 1 {
w.WriteHeader(http.StatusConflict)
@ -58,7 +57,7 @@ func RequestNostrAddr(w http.ResponseWriter, r *http.Request) {
})
return
}
rKey = getRkey("requested", name, getHostname(r.Host))
rKey = getRkey("requested", r.FormValue("Name"), getHostname(r.Host))
exists = redisCli.Exists(ctx, rKey)
if exists.Val() == 1 {
w.WriteHeader(http.StatusConflict)
@ -80,7 +79,7 @@ func RequestNostrAddr(w http.ResponseWriter, r *http.Request) {
// create the struct
relays := make(map[string][]string)
names := map[string]string{name: hexKey}
names := map[string]string{r.FormValue("Name"): hexKey}
user := nostrWellKnown{}
if r.FormValue("Relays") != "" {
relays = map[string][]string{
@ -151,7 +150,7 @@ func GetNostrAddr(w http.ResponseWriter, r *http.Request) {
l := logger.Get()
// get query string for username
r.ParseForm()
requestedName := strings.ToLower(r.FormValue("name"))
requestedName := r.FormValue("name")
// connect to redis
redisCli := redis.NostrRedisConn.Client