Add Jsonpub hook
parent
af67b7ebbb
commit
0ee80b3798
|
@ -43,6 +43,7 @@ type config struct {
|
||||||
SyndicationTargets []string `env:"SYNDICATION" envSeparator:","`
|
SyndicationTargets []string `env:"SYNDICATION" envSeparator:","`
|
||||||
TinifyKey string `env:"TINIFY_KEY"`
|
TinifyKey string `env:"TINIFY_KEY"`
|
||||||
ActivityStreams bool `env:"ACTIVITY_STREAMS" envDefault:"false"`
|
ActivityStreams bool `env:"ACTIVITY_STREAMS" envDefault:"false"`
|
||||||
|
JsonpubUrl string `env:"JSONPUB_URL"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func initConfig() (err error) {
|
func initConfig() (err error) {
|
||||||
|
@ -124,6 +125,10 @@ func initConfig() (err error) {
|
||||||
token: cfg.MicroblogToken,
|
token: cfg.MicroblogToken,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// Jsonpub
|
||||||
|
if len(cfg.JsonpubUrl) > 0 {
|
||||||
|
socials = append(socials, &Jsonpub{url: cfg.JsonpubUrl})
|
||||||
|
}
|
||||||
return socials
|
return socials
|
||||||
}()
|
}()
|
||||||
if SelectedSocials == nil {
|
if SelectedSocials == nil {
|
||||||
|
|
|
@ -67,3 +67,12 @@ func (social *MicroblogPub) Post(location string, text string) {
|
||||||
req.Header.Add("Authorization", "Bearer "+social.token)
|
req.Header.Add("Authorization", "Bearer "+social.token)
|
||||||
_, _ = client.Do(req)
|
_, _ = client.Do(req)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Jsonpub
|
||||||
|
type Jsonpub struct {
|
||||||
|
url string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (social *Jsonpub) Post(_ string, _ string) {
|
||||||
|
_, _ = http.Post(social.url, "", nil)
|
||||||
|
}
|
Loading…
Reference in New Issue