Compare commits

..

No commits in common. "c10bf83c419eb5d85aa3170a7155cdc1a2152031" and "03c73750645222c25ae2f7d47a4e4b75719f7b0e" have entirely different histories.

2 changed files with 7 additions and 41 deletions

View File

@ -19,7 +19,6 @@ package main
import (
"encoding/json"
"flag"
"fmt"
"log"
"net/url"
@ -30,10 +29,6 @@ import (
"p83.nl/go/ekster/pkg/microsub"
)
var (
verbose = flag.Bool("verbose", false, "show verbose logging")
)
func init() {
log.SetFlags(log.Lshortfile | log.Ldate | log.Ltime)
}
@ -107,8 +102,6 @@ func loadEndpoints(c *client.Client, me *url.URL, filename string) error {
}
func main() {
flag.Parse()
configDir := fmt.Sprintf("%s/.config/microsub", os.Getenv("HOME"))
if len(os.Args) == 3 && os.Args[1] == "connect" {
@ -163,9 +156,7 @@ func main() {
log.Fatal(err)
}
c.Logging = *verbose
performCommands(&c, flag.Args())
performCommands(&c, os.Args[1:])
}
func performCommands(sub microsub.Microsub, commands []string) {

View File

@ -3,9 +3,7 @@ package client
import (
"encoding/json"
"fmt"
"log"
"net/http"
"net/http/httputil"
"net/url"
"strings"
@ -16,8 +14,6 @@ type Client struct {
Me *url.URL
MicrosubEndpoint *url.URL
Token string
Logging bool
}
func (c *Client) microsubGetRequest(action string, args map[string]string) (*http.Response, error) {
@ -38,19 +34,7 @@ func (c *Client) microsubGetRequest(action string, args map[string]string) (*htt
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", c.Token))
if c.Logging {
x, _ := httputil.DumpRequestOut(req, true)
log.Printf("REQUEST:\n\n%s\n\n", x)
}
res, err := client.Do(req)
if c.Logging {
x, _ := httputil.DumpResponse(res, true)
log.Printf("RESPONSE:\n\n%s\n\n", x)
}
return res, err
return client.Do(req)
}
func (c *Client) microsubPostRequest(action string, args map[string]string) (*http.Response, error) {
@ -71,19 +55,7 @@ func (c *Client) microsubPostRequest(action string, args map[string]string) (*ht
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", c.Token))
if c.Logging {
x, _ := httputil.DumpRequestOut(req, true)
log.Printf("REQUEST:\n\n%s\n\n", x)
}
res, err := client.Do(req)
if c.Logging {
x, _ := httputil.DumpResponse(res, true)
log.Printf("RESPONSE:\n\n%s\n\n", x)
}
return res, err
return client.Do(req)
}
func (c *Client) microsubPostFormRequest(action string, args map[string]string, data url.Values) (*http.Response, error) {
@ -122,8 +94,11 @@ func (c *Client) ChannelsGetList() ([]microsub.Channel, error) {
dec := json.NewDecoder(res.Body)
var channels channelsResponse
err = dec.Decode(&channels)
if err != nil {
return channels.Channels, err
}
return channels.Channels, nil
}
func (c *Client) TimelineGet(before, after, channel string) (microsub.Timeline, error) {