intermediate parsing web received
This commit is contained in:
parent
4d5d3a8a2b
commit
8aff111336
@ -9,13 +9,20 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
type InboxContent struct {
|
type CreateObject struct {
|
||||||
// AtContext string `json:"@context"`
|
|
||||||
Actor string `json:"actor"`
|
Actor string `json:"actor"`
|
||||||
Cc []string `json:"cc"`
|
Cc []string `json:"cc"`
|
||||||
Context string `json:"content"`
|
Content string `json:"content"`
|
||||||
|
To []string `json:"to"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type FindType struct {
|
||||||
|
Actor string `json:"actor"`
|
||||||
|
Cc []string `json:"cc"`
|
||||||
|
//Object interface{} `json:"Object"`
|
||||||
|
Object json.RawMessage `json:"Object"`
|
||||||
Id string `json:"id"`
|
Id string `json:"id"`
|
||||||
//Object string `json:"object"`
|
|
||||||
Published string `json:"published"`
|
Published string `json:"published"`
|
||||||
To []string `json:"to"`
|
To []string `json:"to"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
@ -93,11 +100,36 @@ func inbox(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var q InboxContent
|
var findtype FindType
|
||||||
err = json.Unmarshal(body, &q)
|
err = json.Unmarshal(body, &findtype)
|
||||||
fmt.Println(err)
|
|
||||||
fmt.Println(q.Cc)
|
fmt.Println(findtype.Type)
|
||||||
fmt.Println(q)
|
|
||||||
|
switch findtype.Type {
|
||||||
|
case "Create":
|
||||||
|
var createobject CreateObject
|
||||||
|
|
||||||
|
err = json.Unmarshal(findtype.Object, &createobject)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("Ignore the post here")
|
||||||
|
}
|
||||||
|
fmt.Println("Content: ", createobject.Content)
|
||||||
|
case "Like":
|
||||||
|
case "Announcement":
|
||||||
|
case "Delete":
|
||||||
|
case "Undo":
|
||||||
|
default:
|
||||||
|
fmt.Println("Others --> " + findtype.Type)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println("Actor: ", findtype.Actor)
|
||||||
|
fmt.Println("Cc: ", findtype.Cc)
|
||||||
|
fmt.Println("Id: ", findtype.Id)
|
||||||
|
fmt.Println("Published: ", findtype.Published)
|
||||||
|
fmt.Println("To: ", findtype.To)
|
||||||
|
fmt.Println("Type: ", findtype.Type)
|
||||||
|
|
||||||
|
fmt.Println("Object: ", string(findtype.Object))
|
||||||
}
|
}
|
||||||
|
|
||||||
func users_fedilogue_followers(w http.ResponseWriter, r *http.Request) {
|
func users_fedilogue_followers(w http.ResponseWriter, r *http.Request) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user