added fix profile listing user profile information

This commit is contained in:
2023-06-04 11:26:51 +01:00
parent 8b0d468455
commit a6f2282d70
2 changed files with 8 additions and 8 deletions

View File

@@ -31,12 +31,12 @@ type apiBlockRecordProfile struct {
/*
apiProfileList lists all users profile fields.
Request: GET /profile/list?node[nodeid]
Request: GET /profile/list?node=[nodeid]
Response: 200 with JSON structure apiProfileData
*/
func (api *WebapiInstance) apiProfileList(w http.ResponseWriter, r *http.Request) {
NodeID, valid := DecodeBlake3Hash(r.Form.Get("node"))
NodeID, valid := DecodeBlake3Hash(r.URL.Query().Get("node"))
var fields []blockchain.BlockRecordProfile
var status int
@@ -63,8 +63,8 @@ Response: 200 with JSON structure apiProfileData
*/
func (api *WebapiInstance) apiProfileRead(w http.ResponseWriter, r *http.Request) {
r.ParseForm()
fieldN, err1 := strconv.Atoi(r.Form.Get("field"))
NodeID, valid := DecodeBlake3Hash(r.Form.Get("node"))
fieldN, err1 := strconv.Atoi(r.URL.Query().Get("field"))
NodeID, valid := DecodeBlake3Hash(r.URL.Query().Get("node"))
if err1 != nil || fieldN < 0 {
http.Error(w, "", http.StatusBadRequest)

View File

@@ -358,20 +358,20 @@ Result: 200 with JSON structure SearchResult. Check the field status.
*/
func (api *WebapiInstance) apiExplore(w http.ResponseWriter, r *http.Request) {
r.ParseForm()
offset, _ := strconv.Atoi(r.Form.Get("offset"))
limit, err := strconv.Atoi(r.Form.Get("limit"))
offset, _ := strconv.Atoi(r.URL.Query().Get("offset"))
limit, err := strconv.Atoi(r.URL.Query().Get("limit"))
if err != nil {
limit = 100
}
fileType, err := strconv.Atoi(r.Form.Get("type"))
fileType, err := strconv.Atoi(r.URL.Query().Get("type"))
if err != nil {
fileType = -1
}
var result *SearchResult
NodeId, valid := DecodeBlake3Hash(r.Form.Get("node"))
NodeId, valid := DecodeBlake3Hash(r.URL.Query().Get("node"))
if valid {
result = api.ExploreHelper(fileType, limit, offset, NodeId, true)
} else {