u
Anirudh Oppiliappan x@icyphox.sh
Tue, 26 Sep 2023 20:21:27 +0300
2 files changed,
9 insertions(+),
7 deletions(-)
M
masto.go
→
masto.go
@@ -55,7 +55,7 @@ // https://docs.joinmastodon.org/methods/oauth/#authorize
func oauthorize(rw http.ResponseWriter, r *http.Request) { nrw := NotResponseWriter{} login.LoginFunc(nrw, r) - dlog.Println("got code!", nrw.body.String()) + dlog.Println("got code!", nrw.auth) rw.WriteHeader(http.StatusOK) return }
M
masto_util.go
→
masto_util.go
@@ -1,10 +1,8 @@
package main import ( - "bytes" "crypto/rand" "fmt" - "log" "net/http" "time"@@ -12,8 +10,9 @@ "humungus.tedunangst.com/r/webs/junk"
) type NotResponseWriter struct { - body bytes.Buffer + auth string header http.Header + status int } func (w NotResponseWriter) Header() http.Header {@@ -21,11 +20,14 @@ return w.header
} func (w NotResponseWriter) Write(b []byte) (int, error) { - log.Println("actual code", string(b)) - return w.body.Write(b) + dlog.Println("notresponsewriter: oauth code:", string(b)) + w.auth = string(b) + return 0, nil } -func (w NotResponseWriter) WriteHeader(statusCode int) {} +func (w NotResponseWriter) WriteHeader(statusCode int) { + w.status = statusCode +} func snowflake() uint64 { ts := time.Now()