Compare commits
No commits in common. "b3fe5c17ed6db5aba74b37eed29b1789ede7c265" and "8a69473bafff97f9ea6e06a50b178a605ca86b6d" have entirely different histories.
b3fe5c17ed
...
8a69473baf
13
README.md
13
README.md
|
|
@ -1,6 +1,11 @@
|
||||||
# ekster
|
# ekster
|
||||||
|
|
||||||
a [Microsub](https://indieweb.org/Microsub) server
|
a microsub server
|
||||||
|
|
||||||
|
|
||||||
|
## Warning!
|
||||||
|
|
||||||
|
Very alpha: no warranty.
|
||||||
|
|
||||||
## Installing and running ekster
|
## Installing and running ekster
|
||||||
|
|
||||||
|
|
@ -14,7 +19,7 @@ you need a Go environment. Use these commands to install the programs.
|
||||||
go get -u p83.nl/go/ekster/cmd/eksterd
|
go get -u p83.nl/go/ekster/cmd/eksterd
|
||||||
go get -u p83.nl/go/ekster/cmd/ek
|
go get -u p83.nl/go/ekster/cmd/ek
|
||||||
|
|
||||||
`eksterd` uses [Redis](https://redis.io/) as the database to temporarily save
|
`eksterd` uses [Redis](https://redis.io/) as the database, to temporarily save
|
||||||
the items and feeds. The more permanent information is saved in `backend.json`.
|
the items and feeds. The more permanent information is saved in `backend.json`.
|
||||||
|
|
||||||
#### Running eksterd
|
#### Running eksterd
|
||||||
|
|
@ -157,7 +162,3 @@ Micropub client.
|
||||||
`ekster` will check every 10 minutes, if the token is still valid. This could
|
`ekster` will check every 10 minutes, if the token is still valid. This could
|
||||||
be retrieved automatically, but this doesn't happen at the moment.
|
be retrieved automatically, but this doesn't happen at the moment.
|
||||||
|
|
||||||
## Other Microsub projects
|
|
||||||
|
|
||||||
* <https://indieweb.org/Microsub>
|
|
||||||
* Aperture: [code](https://github.com/aaronparecki/Aperture), [hosted](https://aperture.p3k.io)
|
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,6 @@ var (
|
||||||
entryRegex = regexp.MustCompile("^entry\\[\\d+\\]$")
|
entryRegex = regexp.MustCompile("^entry\\[\\d+\\]$")
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
OutputContentType = "application/json; charset=utf-8"
|
|
||||||
)
|
|
||||||
|
|
||||||
type microsubHandler struct {
|
type microsubHandler struct {
|
||||||
backend microsub.Microsub
|
backend microsub.Microsub
|
||||||
}
|
}
|
||||||
|
|
@ -67,7 +63,7 @@ func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
jw := json.NewEncoder(w)
|
jw := json.NewEncoder(w)
|
||||||
w.Header().Add("Content-Type", OutputContentType)
|
w.Header().Add("Content-Type", "application/json")
|
||||||
err = jw.Encode(map[string][]microsub.Channel{
|
err = jw.Encode(map[string][]microsub.Channel{
|
||||||
"channels": channels,
|
"channels": channels,
|
||||||
})
|
})
|
||||||
|
|
@ -82,7 +78,7 @@ func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
jw := json.NewEncoder(w)
|
jw := json.NewEncoder(w)
|
||||||
w.Header().Add("Content-Type", OutputContentType)
|
w.Header().Add("Content-Type", "application/json")
|
||||||
jw.SetIndent("", " ")
|
jw.SetIndent("", " ")
|
||||||
jw.SetEscapeHTML(false)
|
jw.SetEscapeHTML(false)
|
||||||
err = jw.Encode(timeline)
|
err = jw.Encode(timeline)
|
||||||
|
|
@ -98,7 +94,7 @@ func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
jw := json.NewEncoder(w)
|
jw := json.NewEncoder(w)
|
||||||
jw.SetIndent("", " ")
|
jw.SetIndent("", " ")
|
||||||
w.Header().Add("Content-Type", OutputContentType)
|
w.Header().Add("Content-Type", "application/json")
|
||||||
err = jw.Encode(timeline)
|
err = jw.Encode(timeline)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), 500)
|
http.Error(w, err.Error(), 500)
|
||||||
|
|
@ -112,7 +108,7 @@ func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
jw := json.NewEncoder(w)
|
jw := json.NewEncoder(w)
|
||||||
w.Header().Add("Content-Type", OutputContentType)
|
w.Header().Add("Content-Type", "application/json")
|
||||||
err = jw.Encode(map[string][]microsub.Feed{
|
err = jw.Encode(map[string][]microsub.Feed{
|
||||||
"items": following,
|
"items": following,
|
||||||
})
|
})
|
||||||
|
|
@ -144,7 +140,7 @@ func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Error(w, err.Error(), 500)
|
http.Error(w, err.Error(), 500)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
w.Header().Add("Content-Type", OutputContentType)
|
w.Header().Add("Content-Type", "application/json")
|
||||||
fmt.Fprintln(w, "[]")
|
fmt.Fprintln(w, "[]")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -156,7 +152,7 @@ func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Error(w, err.Error(), 500)
|
http.Error(w, err.Error(), 500)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
w.Header().Add("Content-Type", OutputContentType)
|
w.Header().Add("Content-Type", "application/json")
|
||||||
err = jw.Encode(channel)
|
err = jw.Encode(channel)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), 500)
|
http.Error(w, err.Error(), 500)
|
||||||
|
|
@ -168,7 +164,7 @@ func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Error(w, err.Error(), 500)
|
http.Error(w, err.Error(), 500)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
w.Header().Add("Content-Type", OutputContentType)
|
w.Header().Add("Content-Type", "application/json")
|
||||||
err = jw.Encode(channel)
|
err = jw.Encode(channel)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), 500)
|
http.Error(w, err.Error(), 500)
|
||||||
|
|
@ -184,7 +180,7 @@ func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Error(w, err.Error(), 500)
|
http.Error(w, err.Error(), 500)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
w.Header().Add("Content-Type", OutputContentType)
|
w.Header().Add("Content-Type", "application/json")
|
||||||
jw := json.NewEncoder(w)
|
jw := json.NewEncoder(w)
|
||||||
err = jw.Encode(feed)
|
err = jw.Encode(feed)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -199,7 +195,7 @@ func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Error(w, err.Error(), 500)
|
http.Error(w, err.Error(), 500)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
w.Header().Add("Content-Type", OutputContentType)
|
w.Header().Add("Content-Type", "application/json")
|
||||||
fmt.Fprintln(w, "[]")
|
fmt.Fprintln(w, "[]")
|
||||||
} else if action == "search" {
|
} else if action == "search" {
|
||||||
query := values.Get("query")
|
query := values.Get("query")
|
||||||
|
|
@ -209,7 +205,7 @@ func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
jw := json.NewEncoder(w)
|
jw := json.NewEncoder(w)
|
||||||
w.Header().Add("Content-Type", OutputContentType)
|
w.Header().Add("Content-Type", "application/json")
|
||||||
err = jw.Encode(map[string][]microsub.Feed{
|
err = jw.Encode(map[string][]microsub.Feed{
|
||||||
"results": feeds,
|
"results": feeds,
|
||||||
})
|
})
|
||||||
|
|
@ -249,7 +245,7 @@ func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Error(w, fmt.Sprintf("unknown method in timeline %s\n", method), 500)
|
http.Error(w, fmt.Sprintf("unknown method in timeline %s\n", method), 500)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
w.Header().Add("Content-Type", OutputContentType)
|
w.Header().Add("Content-Type", "application/json")
|
||||||
fmt.Fprintln(w, "[]")
|
fmt.Fprintln(w, "[]")
|
||||||
} else {
|
} else {
|
||||||
http.Error(w, fmt.Sprintf("unknown action %s\n", action), 500)
|
http.Error(w, fmt.Sprintf("unknown action %s\n", action), 500)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user