fix: nostr casing, matrix server addr
This commit is contained in:
parent
6768713682
commit
6460002bb0
2 changed files with 6 additions and 5 deletions
|
@ -29,7 +29,7 @@ type matrixClientWellKnown struct {
|
||||||
func MatrixServer(w http.ResponseWriter, req *http.Request) {
|
func MatrixServer(w http.ResponseWriter, req *http.Request) {
|
||||||
l := logger.Get()
|
l := logger.Get()
|
||||||
// uses an environment variable for now
|
// uses an environment variable for now
|
||||||
wellKnownAddr := config.GetConfig().MatrixWellKnownAddress
|
wellKnownAddr := fmt.Sprintf("%s:8448", config.GetConfig().MatrixWellKnownAddress)
|
||||||
if wellKnownAddr == "" {
|
if wellKnownAddr == "" {
|
||||||
w.WriteHeader(http.StatusNotFound)
|
w.WriteHeader(http.StatusNotFound)
|
||||||
l.Debug().Str("path", "matrix/server").Msg("matrix well known address unset")
|
l.Debug().Str("path", "matrix/server").Msg("matrix well known address unset")
|
||||||
|
|
|
@ -46,9 +46,10 @@ func RequestNostrAddr(w http.ResponseWriter, r *http.Request) {
|
||||||
http.ServeFile(w, r, "html/nostr_form.html")
|
http.ServeFile(w, r, "html/nostr_form.html")
|
||||||
case "POST":
|
case "POST":
|
||||||
r.ParseForm()
|
r.ParseForm()
|
||||||
|
name := strings.ToLower(r.FormValue("Name"))
|
||||||
redisCli := redis.NostrRedisConn.Client
|
redisCli := redis.NostrRedisConn.Client
|
||||||
// check if the user already exists
|
// check if the user already exists
|
||||||
rKey := getRkey("verified", r.FormValue("Name"), getHostname(r.Host))
|
rKey := getRkey("verified", name, getHostname(r.Host))
|
||||||
exists := redisCli.Exists(ctx, rKey)
|
exists := redisCli.Exists(ctx, rKey)
|
||||||
if exists.Val() == 1 {
|
if exists.Val() == 1 {
|
||||||
w.WriteHeader(http.StatusConflict)
|
w.WriteHeader(http.StatusConflict)
|
||||||
|
@ -57,7 +58,7 @@ func RequestNostrAddr(w http.ResponseWriter, r *http.Request) {
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
rKey = getRkey("requested", r.FormValue("Name"), getHostname(r.Host))
|
rKey = getRkey("requested", name, getHostname(r.Host))
|
||||||
exists = redisCli.Exists(ctx, rKey)
|
exists = redisCli.Exists(ctx, rKey)
|
||||||
if exists.Val() == 1 {
|
if exists.Val() == 1 {
|
||||||
w.WriteHeader(http.StatusConflict)
|
w.WriteHeader(http.StatusConflict)
|
||||||
|
@ -79,7 +80,7 @@ func RequestNostrAddr(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
// create the struct
|
// create the struct
|
||||||
relays := make(map[string][]string)
|
relays := make(map[string][]string)
|
||||||
names := map[string]string{r.FormValue("Name"): hexKey}
|
names := map[string]string{name: hexKey}
|
||||||
user := nostrWellKnown{}
|
user := nostrWellKnown{}
|
||||||
if r.FormValue("Relays") != "" {
|
if r.FormValue("Relays") != "" {
|
||||||
relays = map[string][]string{
|
relays = map[string][]string{
|
||||||
|
@ -150,7 +151,7 @@ func GetNostrAddr(w http.ResponseWriter, r *http.Request) {
|
||||||
l := logger.Get()
|
l := logger.Get()
|
||||||
// get query string for username
|
// get query string for username
|
||||||
r.ParseForm()
|
r.ParseForm()
|
||||||
requestedName := r.FormValue("name")
|
requestedName := strings.ToLower(r.FormValue("name"))
|
||||||
|
|
||||||
// connect to redis
|
// connect to redis
|
||||||
redisCli := redis.NostrRedisConn.Client
|
redisCli := redis.NostrRedisConn.Client
|
||||||
|
|
Loading…
Reference in a new issue