2023-09-28 10:13:41 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2023-10-06 22:02:18 +02:00
|
|
|
"git.okoyono.de/oko-intern/okospaceapi/pkg/spaceapi"
|
2023-09-28 10:13:41 +02:00
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
|
|
|
//go:generate ../generate-spaceapi-types.sh
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
definition := spaceapi.Root{
|
|
|
|
// TODO: Fill up with stuff
|
|
|
|
ApiCompatibility: []string{"14"},
|
2023-09-28 22:40:00 +02:00
|
|
|
Space: "økoyono",
|
|
|
|
Url: "https://okoyono.de/",
|
|
|
|
Contact: &spaceapi.Contact{
|
|
|
|
Email: "oko@datenhalter.de", // TODO: Better email
|
|
|
|
Mastodon: "@f@social.okoyono.de", // TODO: Replace with real handle
|
|
|
|
Matrix: "#public:matrix.okoyono.de",
|
|
|
|
},
|
|
|
|
Location: &spaceapi.Location{
|
2024-01-10 00:09:24 +01:00
|
|
|
Lat: 0.0, // TODO: Fill with cool coordinates
|
|
|
|
Lon: 0.0, // TODO: Fill with cool coordinates
|
|
|
|
Timezone: "Europe/Berlin",
|
2023-09-28 22:40:00 +02:00
|
|
|
},
|
|
|
|
Logo: "https://okoyono.de/images/ant.svg",
|
2023-09-28 10:13:41 +02:00
|
|
|
Links: []*spaceapi.LinksItems{
|
|
|
|
{
|
2024-01-10 00:09:24 +01:00
|
|
|
Description: "Website",
|
2023-09-28 10:13:41 +02:00
|
|
|
Name: "website",
|
|
|
|
Url: "https://okoyono.de",
|
|
|
|
},
|
2023-09-28 22:40:00 +02:00
|
|
|
{
|
2024-01-10 00:09:24 +01:00
|
|
|
Description: "Forgejo (Sourcecode)",
|
2023-09-28 22:40:00 +02:00
|
|
|
Name: "forgejo",
|
|
|
|
Url: "https://git.okoyono.de",
|
|
|
|
},
|
|
|
|
{
|
2024-01-10 00:09:24 +01:00
|
|
|
Description: "Mastodon (Social Media)",
|
2023-09-28 22:40:00 +02:00
|
|
|
Name: "mastodon",
|
|
|
|
Url: "https://social.okoyono.de",
|
|
|
|
},
|
2024-01-10 00:09:24 +01:00
|
|
|
{
|
|
|
|
Description: "OwnCast (Tube)",
|
|
|
|
Name: "owncast",
|
|
|
|
Url: "https://tube.okoyono.de",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Description: "SearXNG (Search)",
|
|
|
|
Name: "searxng",
|
|
|
|
Url: "https://search.okoyono.de",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Description: "Etherpad (pad)",
|
|
|
|
Name: "etherpad",
|
|
|
|
Url: "https://pad.okoyono.de",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Description: "Jitsi (Videochat)",
|
|
|
|
Name: "jitsi",
|
|
|
|
Url: "https://meet.okoyono.de",
|
|
|
|
},
|
2023-09-28 10:13:41 +02:00
|
|
|
},
|
2023-09-28 22:40:00 +02:00
|
|
|
Projects: []string{
|
|
|
|
"https://buchdesmonats.okoyono.de/",
|
|
|
|
"https://comicdesmonats.okoyono.de/",
|
|
|
|
"https://git.okoyono.de/okoyono/weatherstation",
|
2023-09-28 10:13:41 +02:00
|
|
|
},
|
2023-09-28 22:40:00 +02:00
|
|
|
Sensors: &spaceapi.Sensors{
|
|
|
|
TotalMemberCount: []*spaceapi.TotalMemberCountItems{
|
|
|
|
{
|
|
|
|
Description: "We are a small group of people from south Germany, meeting remote on a regular basis.",
|
|
|
|
Location: "Remote",
|
2024-01-09 23:23:23 +01:00
|
|
|
Value: 6,
|
2023-09-28 22:40:00 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
//Temperature: []*spaceapi.TemperatureItems{
|
|
|
|
// {
|
|
|
|
// Location: "@f",
|
|
|
|
// Name: "weatherstatiøn",
|
|
|
|
// Description: "Weatherstatiøn located at @f.",
|
|
|
|
// Value: sensors.TemperatureF(),
|
|
|
|
// },
|
|
|
|
//},
|
2023-09-28 10:13:41 +02:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
json, err := definition.MarshalJSON()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
err = http.ListenAndServe(":8080", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
|
|
w.Header().Set("Content-Type", "application/json")
|
|
|
|
_, err := w.Write(json)
|
|
|
|
if err != nil {
|
|
|
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
|
|
}
|
|
|
|
}))
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|