databag/net/server/internal/api_getProfile.go

31 lines
631 B
Go
Raw Normal View History

2022-01-19 08:03:46 +00:00
package databag
import (
"net/http"
)
func GetProfile(w http.ResponseWriter, r *http.Request) {
2022-01-22 19:40:20 +00:00
account, code, err := BearerAppToken(r, true);
2022-01-19 20:07:57 +00:00
if err != nil {
2022-01-20 23:19:26 +00:00
ErrResponse(w, code, err)
2022-01-19 08:03:46 +00:00
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)
}