2020-11-10 21:53:46 -05:00
|
|
|
package main
|
|
|
|
|
2020-12-16 02:41:45 +00:00
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
2020-11-10 21:53:46 -05:00
|
|
|
const (
|
2020-12-17 04:23:25 +00:00
|
|
|
NEW_INSTANCE = 0
|
|
|
|
RUNNING = 200
|
|
|
|
UNAUTHORIZED = 401
|
|
|
|
FORBIDDEN = 403
|
|
|
|
NOT_FOUND = 404
|
|
|
|
UNPROCESSABLE_ENTITY = 422
|
|
|
|
TOOMANYREQUESTS = 429
|
|
|
|
INTERNAL_ERROR = 500
|
|
|
|
CLIENT_ISSUE = 600
|
|
|
|
ONION_PROTOCOL = 601
|
|
|
|
BAD_RESPONSE = 602
|
|
|
|
BAD_NODEINFO = 604
|
|
|
|
UNSUPPORTED_INSTANCE = 605
|
|
|
|
STREAM_ENDED = 606
|
|
|
|
KEEPALIVE = 607
|
2020-11-10 21:53:46 -05:00
|
|
|
)
|
|
|
|
|
2020-12-29 17:30:26 +00:00
|
|
|
type ObjectType struct {
|
2020-12-29 20:20:02 +00:00
|
|
|
Id string `json:"id"`
|
2020-12-29 17:30:26 +00:00
|
|
|
}
|
|
|
|
|
2020-11-10 21:53:46 -05:00
|
|
|
// Parsing Unmarshal JSON type
|
2021-02-01 12:52:42 +00:00
|
|
|
type ReportActivity struct {
|
2020-11-10 21:53:46 -05:00
|
|
|
|
|
|
|
// Retrieved values
|
2020-12-17 04:23:25 +00:00
|
|
|
Id string `json:"id"`
|
|
|
|
Uri string `json:"uri"`
|
|
|
|
Account AccountType
|
|
|
|
Content string `json:"content"`
|
|
|
|
Created_at string `json:"created_at"`
|
2020-11-10 21:53:46 -05:00
|
|
|
|
|
|
|
// Derived values
|
2020-12-17 04:23:25 +00:00
|
|
|
normalized string
|
2020-11-10 21:53:46 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
type AccountType struct {
|
2020-12-17 04:23:25 +00:00
|
|
|
Acct string `json:"acct"`
|
|
|
|
Avatar string `json:"avatar"`
|
|
|
|
Bot bool `json:"bot"`
|
|
|
|
Created_at string `json:"created_at"`
|
|
|
|
Display_name string `json:"display_name"`
|
|
|
|
Url string `json:"url"`
|
2020-11-10 21:53:46 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// Instance's new min_id value
|
|
|
|
type RunningInstance struct {
|
2020-12-29 20:20:02 +00:00
|
|
|
Software string `json:"software"`
|
|
|
|
Version string `json:"version"`
|
|
|
|
Status int `json:"status"`
|
|
|
|
LastRun string `json:"lastrun"`
|
|
|
|
CaptureType string `json:"capturetype"`
|
|
|
|
client http.Client
|
|
|
|
client_id string
|
|
|
|
client_secret string
|
2021-02-02 23:34:43 +00:00
|
|
|
recentactivities *UniqueFifo
|
|
|
|
recentactors *UniqueFifo
|
2020-11-10 21:53:46 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
type NodeInfoSoftware struct {
|
2020-12-17 04:23:25 +00:00
|
|
|
Name string `json:"name"`
|
|
|
|
Version string `json:"version"`
|
2020-11-10 21:53:46 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
type NodeInfo struct {
|
2020-12-17 04:23:25 +00:00
|
|
|
Software NodeInfoSoftware `json:"software"`
|
2020-11-10 21:53:46 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
type CommandMap struct {
|
2020-12-17 04:23:25 +00:00
|
|
|
Type string `json:"Type"`
|
|
|
|
Endpoint string `json:"Endpoint"`
|
2020-11-10 21:53:46 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
type ResponseBack struct {
|
2020-12-17 04:23:25 +00:00
|
|
|
Type string `json:"Type"`
|
|
|
|
Message string `json:"Message"`
|
|
|
|
RunningInstances map[string]RunningInstance `json:"RunningInstances"`
|
2020-11-10 21:53:46 -05:00
|
|
|
}
|
2020-12-16 02:41:45 +00:00
|
|
|
|
|
|
|
type Userinfo struct {
|
2020-12-17 04:23:25 +00:00
|
|
|
Id string `"json:id"`
|
|
|
|
Type string `"json:type"`
|
|
|
|
Following string `"json:following"`
|
|
|
|
Followers string `"json:followers"`
|
|
|
|
Inbox string `"json:inbox"`
|
|
|
|
Outbox string `"json:outbox"`
|
|
|
|
Featured string `"json:featured"`
|
|
|
|
PreferredUsername string `"json:preferredUsername"`
|
|
|
|
Name string `"json:name"`
|
|
|
|
Summary string `"json:summary"`
|
|
|
|
Url string `"json:Url"`
|
|
|
|
ManuallyApprovesFollowers string `"json:manuallyApprovesFollowers"`
|
|
|
|
Discoverable string `"json:discoverable"`
|
2020-12-16 02:41:45 +00:00
|
|
|
}
|