-
Notifications
You must be signed in to change notification settings - Fork 2
/
server.go
39 lines (28 loc) · 1.34 KB
/
server.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package google
import (
"net/http"
"strings"
"go.uber.org/zap"
"go.autokitteh.dev/autokitteh/sdk/sdkservices"
"go.autokitteh.dev/autokitteh/web/static"
)
func Start(l *zap.Logger, mux *http.ServeMux, vars sdkservices.Vars, o sdkservices.OAuth, d sdkservices.Dispatcher) {
// New connection UIs + handlers.
h := NewHTTPHandler(l, vars, o)
mux.Handle(uiPath, http.FileServer(http.FS(static.GoogleWebContent)))
mux.HandleFunc(oauthPath, h.HandleOAuth)
mux.HandleFunc(credsPath, h.HandleCreds)
urlPath := strings.ReplaceAll(uiPath, "google", "gmail")
mux.Handle(urlPath, http.FileServer(http.FS(static.GmailWebContent)))
urlPath = strings.ReplaceAll(uiPath, "google", "googlecalendar")
mux.Handle(urlPath, http.FileServer(http.FS(static.GoogleCalendarWebContent)))
urlPath = strings.ReplaceAll(uiPath, "google", "googlechat")
mux.Handle(urlPath, http.FileServer(http.FS(static.GoogleChatWebContent)))
urlPath = strings.ReplaceAll(uiPath, "google", "googledrive")
mux.Handle(urlPath, http.FileServer(http.FS(static.GoogleDriveWebContent)))
urlPath = strings.ReplaceAll(uiPath, "google", "googleforms")
mux.Handle(urlPath, http.FileServer(http.FS(static.GoogleFormsWebContent)))
urlPath = strings.ReplaceAll(uiPath, "google", "googlesheets")
mux.Handle(urlPath, http.FileServer(http.FS(static.GoogleSheetsWebContent)))
// TODO: Event webhooks.
}