Add reader command
This commit is contained in:
parent
412debc637
commit
816e9087ca
|
|
@ -22,6 +22,7 @@ import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
@ -30,6 +31,7 @@ import (
|
||||||
"p83.nl/go/ekster/pkg/client"
|
"p83.nl/go/ekster/pkg/client"
|
||||||
"p83.nl/go/ekster/pkg/indieauth"
|
"p83.nl/go/ekster/pkg/indieauth"
|
||||||
"p83.nl/go/ekster/pkg/microsub"
|
"p83.nl/go/ekster/pkg/microsub"
|
||||||
|
"p83.nl/go/ekster/pkg/server"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
@ -380,6 +382,15 @@ func performCommands(sub microsub.Microsub, commands []string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(commands) == 1 && commands[0] == "reader" {
|
||||||
|
handler := server.NewMicrosubHandler(sub)
|
||||||
|
port := 8092
|
||||||
|
log.Printf("Listening on port %d\n", port)
|
||||||
|
http.Handle("/microsub", http.StripPrefix("/microsub", handler))
|
||||||
|
http.Handle("/", http.FileServer(http.Dir("http-files")))
|
||||||
|
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", port), nil))
|
||||||
|
}
|
||||||
|
|
||||||
if len(commands) == 1 && commands[0] == "version" {
|
if len(commands) == 1 && commands[0] == "version" {
|
||||||
fmt.Printf("ek %s\n", Version)
|
fmt.Printf("ek %s\n", Version)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user