Commit 8be154d9 authored by owlo's avatar owlo

starting godcommands

parent 560e9b35
No preview for this file type
......@@ -13,8 +13,8 @@ type MobileS struct {
Wis int
Con int
Tec int
Inventory map[string]interface{}
Equipment map[string]interface{}
Inventory map[int]string
Equipment map[string]string
Summary string
LastBork string
Source map[string]interface{}
......
......@@ -71,7 +71,41 @@ func validateLogin(signature string, file []byte, actors []libs.ActorS) bool {
return false
}
func createMobile(username string) bool {
hostname = "http://snowcrash.network"
UID := UIDMaker("user")
userFile, err := os.Create("tests/mobiles/" + UID)
if err != nil {
fmt.Println("Error creating userfile")
}
var userActor libs.MobileS
userActor.PreferredUsername = username
userActor.Str = 15
userActor.Dex = 15
userActor.Int = 15
userActor.Wis = 15
userActor.Con = 15
userActor.Tec = 1
userActor.Inventory = map[int]string{
0: "A mobile sticker",
}
userActor.Equipment = map[string]string{
"body": "Fur",
}
userActor.Inbox = hostname + "#inbox/" + username
userActor.Outbox = hostname + "#outbox/" + username
userActor.Following = hostname + "#following/" + username
userActor.Followers = hostname + "#followers/" + username
userData, err := json.Marshal(&userActor)
if err != nil {
fmt.Println("Error marshalling json.")
return false
}
userFile.Write(userData)
userFile.Sync()
return true
}
func createUser(username string, password string) bool {
hostname = "http://snowcrash.network"
UID := UIDMaker("user")
......@@ -498,6 +532,29 @@ func main() {
}
})
mux.HandleFunc("/exampleMobile", func(w http.ResponseWriter, req *http.Request) {
// Before any call to WriteHeader or Write, declare
// the trailers you will set during the HTTP
// response. These three headers are actually sent in
// the trailer.
if req.Header.Get("Accept") == "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"" {
fmt.Println("Accept header is correct.")
w.Header().Set("Content-Type", "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"")
//w.Header().Set("Authentication", signature)
mobile := req.Header.Get("Mobile-Name")
w.WriteHeader(http.StatusOK)
fmt.Println("Signing test json.")
if err != nil {
fmt.Println("Error, user directory empty!")
}
createMobile(mobile)
if err != nil {
fmt.Println("Error reading file")
}
w.Write([]byte("bep"))
}
})
mux.HandleFunc("/examplePC", func(w http.ResponseWriter, req *http.Request) {
// Before any call to WriteHeader or Write, declare
// the trailers you will set during the HTTP
......
{"Str":15,"Dex":15,"Int":15,"Wis":15,"Con":15,"Tec":1,"Inventory":{"0":"A mobile sticker"},"Equipment":{"body":"Fur"},"Summary":"","LastBork":"","Source":null,"Type":"","Following":"http://snowcrash.network#following/assholebuck","Followers":"http://snowcrash.network#followers/assholebuck","Liked":"","Inbox":"http://snowcrash.network#inbox/assholebuck","Outbox":"http://snowcrash.network#outbox/assholebuck","Url":"","Attachment":{"TypeS":"","Content":"","Url":""},"AttributedTo":{"TypeS":"","Name":""},"Audience":{"TypeS":"","Name":""},"Content":"","Id":"","Context":null,"Name":{"Context":"","TypeS":"","Name":""},"EndTime":{"Context":"","TypeS":"","Name":"","StartTime":"","EndTime":""},"Generator":{"TypeS":"","Name":""},"Icon":null,"InReplyTo":{"Summary":"","TypeS":"","Content":""},"Location":{"Name":"","TypeS":"","Place":""},"Preview":"","Published":"","Replies":{"TypeS":"","TotalItems":0,"Items":null},"StartTime":"","Tag":{"TypeS":"","Id":"","Name":""},"Updated":"","To":"","Bto":"","Cc":"","Bcc":"","MediaType":"","Duration":"","Position":{"Y":null,"X":null},"Streams":{"Location":"","Obj":{"Attachment":{"TypeS":"","Content":"","Url":""},"AttributedTo":{"TypeS":"","Name":""},"Audience":{"TypeS":"","Name":""},"Content":{"Content":"","Summary":"","TypeS":"","MediaType":""},"Context":{"Context":"","Summary":"","TypeS":"","Items":null},"Name":{"Context":"","TypeS":"","Name":""},"EndTime":{"Context":"","TypeS":"","Name":"","StartTime":"","EndTime":""},"Generator":{"TypeS":"","Name":""},"Icon":{"TypeS":"","Name":"","Url":"","Width":0,"Height":0},"InReplyTo":{"Summary":"","TypeS":"","Content":""},"Location":{"Name":"","TypeS":"","Place":""},"Preview":"","Published":"","Replies":{"TypeS":"","TotalItems":0,"Items":null},"StartTime":"","Summary":"","Tag":{"TypeS":"","Id":"","Name":""},"Updated":"","Url":"","To":"","Bto":"","Cc":"","Bcc":"","MediaType":"","Duration":"","Position":{"Y":null,"X":null}},"TotalItems":0,"Current":null,"First":"","Last":"","Items":null},"PreferredUsername":"assholebuck","Endpoints":{}}
\ No newline at end of file
{"Str":15,"Dex":15,"Int":15,"Wis":15,"Con":15,"Tec":1,"Inventory":{"0":"A mobile sticker"},"Equipment":{"body":"Fur"},"Summary":"","LastBork":"","Source":null,"Type":"","Following":"http://snowcrash.network#following/sholedeer","Followers":"http://snowcrash.network#followers/sholedeer","Liked":"","Inbox":"http://snowcrash.network#inbox/sholedeer","Outbox":"http://snowcrash.network#outbox/sholedeer","Url":"","Attachment":{"TypeS":"","Content":"","Url":""},"AttributedTo":{"TypeS":"","Name":""},"Audience":{"TypeS":"","Name":""},"Content":"","Id":"","Context":null,"Name":{"Context":"","TypeS":"","Name":""},"EndTime":{"Context":"","TypeS":"","Name":"","StartTime":"","EndTime":""},"Generator":{"TypeS":"","Name":""},"Icon":null,"InReplyTo":{"Summary":"","TypeS":"","Content":""},"Location":{"Name":"","TypeS":"","Place":""},"Preview":"","Published":"","Replies":{"TypeS":"","TotalItems":0,"Items":null},"StartTime":"","Tag":{"TypeS":"","Id":"","Name":""},"Updated":"","To":"","Bto":"","Cc":"","Bcc":"","MediaType":"","Duration":"","Position":{"Y":null,"X":null},"Streams":{"Location":"","Obj":{"Attachment":{"TypeS":"","Content":"","Url":""},"AttributedTo":{"TypeS":"","Name":""},"Audience":{"TypeS":"","Name":""},"Content":{"Content":"","Summary":"","TypeS":"","MediaType":""},"Context":{"Context":"","Summary":"","TypeS":"","Items":null},"Name":{"Context":"","TypeS":"","Name":""},"EndTime":{"Context":"","TypeS":"","Name":"","StartTime":"","EndTime":""},"Generator":{"TypeS":"","Name":""},"Icon":{"TypeS":"","Name":"","Url":"","Width":0,"Height":0},"InReplyTo":{"Summary":"","TypeS":"","Content":""},"Location":{"Name":"","TypeS":"","Place":""},"Preview":"","Published":"","Replies":{"TypeS":"","TotalItems":0,"Items":null},"StartTime":"","Summary":"","Tag":{"TypeS":"","Id":"","Name":""},"Updated":"","Url":"","To":"","Bto":"","Cc":"","Bcc":"","MediaType":"","Duration":"","Position":{"Y":null,"X":null}},"TotalItems":0,"Current":null,"First":"","Last":"","Items":null},"PreferredUsername":"assholedeer","Endpoints":{}}
\ No newline at end of file
{"Str":15,"Dex":15,"Int":15,"Wis":15,"Con":15,"Tec":1,"Inventory":{"0":"A mobile sticker"},"Equipment":{"body":"Fur"},"Summary":"","LastBork":"","Source":null,"Type":"","Following":"http://snowcrash.network#following/assholefawn","Followers":"http://snowcrash.network#followers/assholefawn","Liked":"","Inbox":"http://snowcrash.network#inbox/assholefawn","Outbox":"http://snowcrash.network#outbox/assholefawn","Url":"","Attachment":{"TypeS":"","Content":"","Url":""},"AttributedTo":{"TypeS":"","Name":""},"Audience":{"TypeS":"","Name":""},"Content":"","Id":"","Context":null,"Name":{"Context":"","TypeS":"","Name":""},"EndTime":{"Context":"","TypeS":"","Name":"","StartTime":"","EndTime":""},"Generator":{"TypeS":"","Name":""},"Icon":null,"InReplyTo":{"Summary":"","TypeS":"","Content":""},"Location":{"Name":"","TypeS":"","Place":""},"Preview":"","Published":"","Replies":{"TypeS":"","TotalItems":0,"Items":null},"StartTime":"","Tag":{"TypeS":"","Id":"","Name":""},"Updated":"","To":"","Bto":"","Cc":"","Bcc":"","MediaType":"","Duration":"","Position":{"Y":null,"X":null},"Streams":{"Location":"","Obj":{"Attachment":{"TypeS":"","Content":"","Url":""},"AttributedTo":{"TypeS":"","Name":""},"Audience":{"TypeS":"","Name":""},"Content":{"Content":"","Summary":"","TypeS":"","MediaType":""},"Context":{"Context":"","Summary":"","TypeS":"","Items":null},"Name":{"Context":"","TypeS":"","Name":""},"EndTime":{"Context":"","TypeS":"","Name":"","StartTime":"","EndTime":""},"Generator":{"TypeS":"","Name":""},"Icon":{"TypeS":"","Name":"","Url":"","Width":0,"Height":0},"InReplyTo":{"Summary":"","TypeS":"","Content":""},"Location":{"Name":"","TypeS":"","Place":""},"Preview":"","Published":"","Replies":{"TypeS":"","TotalItems":0,"Items":null},"StartTime":"","Summary":"","Tag":{"TypeS":"","Id":"","Name":""},"Updated":"","Url":"","To":"","Bto":"","Cc":"","Bcc":"","MediaType":"","Duration":"","Position":{"Y":null,"X":null}},"TotalItems":0,"Current":null,"First":"","Last":"","Items":null},"PreferredUsername":"assholefawn","Endpoints":{}}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment