mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Now expects the Google Calendar client_secret.yml to be in ~/.wtf/gcal/client_secret.yml
This commit is contained in:
parent
d41f5f5f99
commit
dd51994d8d
@ -4,7 +4,9 @@ wtf:
|
|||||||
refreshInterval: 900
|
refreshInterval: 900
|
||||||
url: "https://api.bamboohr.com/api/gateway.php"
|
url: "https://api.bamboohr.com/api/gateway.php"
|
||||||
gcal:
|
gcal:
|
||||||
|
eventCount: 10
|
||||||
refreshInterval: 300
|
refreshInterval: 300
|
||||||
|
secretFile: "~/.wtf/gcal/client_secret.json"
|
||||||
git:
|
git:
|
||||||
refreshInterval: 8
|
refreshInterval: 8
|
||||||
jira:
|
jira:
|
||||||
|
@ -17,6 +17,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/senorprogrammer/wtf/homedir"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
"golang.org/x/oauth2"
|
"golang.org/x/oauth2"
|
||||||
"golang.org/x/oauth2/google"
|
"golang.org/x/oauth2/google"
|
||||||
@ -28,7 +29,9 @@ import (
|
|||||||
func Fetch() (*calendar.Events, error) {
|
func Fetch() (*calendar.Events, error) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
b, err := ioutil.ReadFile("./gcal/client_secret.json")
|
secretPath, _ := homedir.Expand(Config.UString("wtf.gcal.secretFile"))
|
||||||
|
|
||||||
|
b, err := ioutil.ReadFile(secretPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -45,7 +48,7 @@ func Fetch() (*calendar.Events, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
t := today().Format(time.RFC3339)
|
t := today().Format(time.RFC3339)
|
||||||
events, err := srv.Events.List("primary").ShowDeleted(false).SingleEvents(true).TimeMin(t).MaxResults(10).OrderBy("startTime").Do()
|
events, err := srv.Events.List("primary").ShowDeleted(false).SingleEvents(true).TimeMin(t).MaxResults(int64(Config.UInt("wtf.gcal.eventCount", 10))).OrderBy("startTime").Do()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user