databag/net/server/internal/api_getProfile.go
2022-01-20 15:19:26 -08:00

31 lines
631 B
Go

package databag
import (
"net/http"
)
func GetProfile(w http.ResponseWriter, r *http.Request) {
account, code, err := BearerAppToken(r, true);
if err != nil {
ErrResponse(w, code, err)
return
}
detail := account.AccountDetail
// send profile data
profile := Profile {
Guid: account.Guid,
Handle: account.Username,
Name: detail.Name,
Description: detail.Description,
Location: detail.Location,
Image: detail.Image,
Revision: account.ProfileRevision,
Version: APP_VERSION,
Node: "https://" + getStrConfigValue(CONFIG_DOMAIN, "") + "/",
}
WriteResponse(w, profile)
}