Add Jsonpub hook

master
Jan-Lukas Else 2020-03-04 17:41:44 +01:00
parent af67b7ebbb
commit 0ee80b3798
2 changed files with 14 additions and 0 deletions

View File

@ -43,6 +43,7 @@ type config struct {
SyndicationTargets []string `env:"SYNDICATION" envSeparator:","`
TinifyKey string `env:"TINIFY_KEY"`
ActivityStreams bool `env:"ACTIVITY_STREAMS" envDefault:"false"`
JsonpubUrl string `env:"JSONPUB_URL"`
}
func initConfig() (err error) {
@ -124,6 +125,10 @@ func initConfig() (err error) {
token: cfg.MicroblogToken,
})
}
// Jsonpub
if len(cfg.JsonpubUrl) > 0 {
socials = append(socials, &Jsonpub{url: cfg.JsonpubUrl})
}
return socials
}()
if SelectedSocials == nil {

View File

@ -67,3 +67,12 @@ func (social *MicroblogPub) Post(location string, text string) {
req.Header.Add("Authorization", "Bearer "+social.token)
_, _ = client.Do(req)
}
// Jsonpub
type Jsonpub struct {
url string
}
func (social *Jsonpub) Post(_ string, _ string) {
_, _ = http.Post(social.url, "", nil)
}