all repos — honk @ 69e032c42532ab3a63cd075a8c3628f806ca258f

my fork of honk

u
Anirudh Oppiliappan x@icyphox.sh
Sun, 11 Feb 2024 11:56:35 +0200
commit

69e032c42532ab3a63cd075a8c3628f806ca258f

parent

3db3571277cfaf7f3560d014ef476d9b4345081c

2 files changed, 25 insertions(+), 7 deletions(-)

jump to
M masto.gomasto.go

@@ -1,4 +1,4 @@

-package main +package mai import ( "database/sql"

@@ -246,11 +246,30 @@

return } -// https://docs.joinmastodon.org/methods/apps/#verify_credentials +// https://docs.joinmastodon.org/methods/accounts/#verify_credentials func verifycreds(rw http.ResponseWriter, r *http.Request) { - app := r.Context().Value("app").(*MastoApp) + var user *WhatAbout + ok := somenumberedusers.Get(1, &user) + if !ok { + elog.Fatalf("masto: no user number 1???") + } j := junk.New() - j["name"] = app.Name - j["vapid_key"] = app.VapidKey - goodjunk(rw, j) + j["id"] = user.ID + j["username"] = user.Name + j["acct"] = user.Name + j["display_name"] = user.Options.CustomDisplay + j["url"] = user.URL + j["note"] = user.HTAbout + j["avatar"] = user.Options.Avatar + j["header"] = user.Options.Banner + j["followers_count"] = 0 + j["following_count"] = 0 + j["statuses_count"] = getlocalhonkcount() + + s = junk.New() + s["note"] = user.About + s["privacy"] = "public" + j["source"] = s + + goodjunk(w, j) }
M web.goweb.go

@@ -2994,7 +2994,6 @@ mastopost.HandleFunc("/oauth/token", oauthtoken)

mastoget.HandleFunc("/api/v1/instance", instance) mastopost.HandleFunc("/api/v1/apps", apiapps) mastoget.HandleFunc("/api/v1/accounts/verify_credentials", checktoken(verifycreds)) - mastoget.HandleFunc("/api/v1/apps/verify_credentials", checktoken(verifycreds)) loggedmux := handlers.LoggingHandler(os.Stdout, mux) err = http.Serve(listener, loggedmux)