Basics of Google login are implemented

This commit is contained in:
2017-06-07 18:06:57 +02:00
parent 2f0d8c9636
commit 3cc9ba54c6
5 changed files with 79 additions and 7 deletions

15
main.go
View File

@ -1,8 +1,6 @@
package main
import (
"strings"
"github.com/aerogo/aero"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/pages/airing"
@ -21,6 +19,14 @@ import (
var app = aero.New()
// APIKeys ...
type APIKeys struct {
Google struct {
ID string `json:"id"`
Secret string `json:"secret"`
} `json:"google"`
}
func main() {
// CSS
app.SetStyle(components.CSS())
@ -47,11 +53,12 @@ func main() {
app.Ajax("/airing", airing.Get)
app.Ajax("/users", users.Get)
EnableGoogleLogin(app)
app.Get("/images/cover/:file", func(ctx *aero.Context) string {
format := ".jpg"
accept := ctx.GetRequestHeader("Accept")
if strings.Index(accept, "image/webp") != -1 {
if ctx.CanUseWebP() {
format = ".webp"
}