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