diff --git a/assets.go b/assets.go index cf462350..e5ee4417 100644 --- a/assets.go +++ b/assets.go @@ -4,6 +4,7 @@ import ( "io/ioutil" "github.com/aerogo/aero" + "github.com/aerogo/manifest" "github.com/aerogo/sitemap" "github.com/animenotifier/arn" "github.com/animenotifier/notify.moe/components/css" @@ -17,13 +18,21 @@ func configureAssets(app *aero.Application) { // Service worker serviceWorkerBytes, err := ioutil.ReadFile("scripts/ServiceWorker/ServiceWorker.js") + + if err != nil { + panic("Couldn't load service worker") + } + serviceWorker := string(serviceWorkerBytes) // CSS bundle cssBundle := css.Bundle() + // Manifest + webManifest, err := manifest.FromFile("manifest.json") + if err != nil { - panic("Couldn't load service worker") + panic("Couldn't load web manifest") } app.Get("/scripts", func(ctx *aero.Context) string { @@ -40,7 +49,7 @@ func configureAssets(app *aero.Application) { // Web manifest app.Get("/manifest.json", func(ctx *aero.Context) string { - return ctx.JSON(app.Config.Manifest) + return ctx.JSON(webManifest) }) // Favicon diff --git a/config.json b/config.json index 38b6d225..18095d8c 100644 --- a/config.json +++ b/config.json @@ -39,64 +39,6 @@ "/scripts", "/styles" ], - "manifest": { - "short_name": "Anime", - "gcm_sender_id": "941298467524", - "theme_color": "#ef371f", - "background_color": "#f6f6f6", - "icons": [ - { - "src": "images/brand/1024.png", - "sizes": "1024x1024", - "type": "image/png" - }, - { - "src": "images/brand/512.png", - "sizes": "512x512", - "type": "image/png" - }, - { - "src": "images/brand/384.png", - "sizes": "384x384", - "type": "image/png" - }, - { - "src": "images/brand/256.png", - "sizes": "256x256", - "type": "image/png" - }, - { - "src": "images/brand/220.png", - "sizes": "220x220", - "type": "image/png" - }, - { - "src": "images/brand/192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "images/brand/180.png", - "sizes": "180x180", - "type": "image/png" - }, - { - "src": "images/brand/144.png", - "sizes": "144x144", - "type": "image/png" - }, - { - "src": "images/brand/128.png", - "sizes": "128x128", - "type": "image/png" - }, - { - "src": "images/brand/64.png", - "sizes": "64x64", - "type": "image/png" - } - ] - }, "ports": { "http": 4000, "https": 4001 diff --git a/go.mod b/go.mod index 8af7c776..a88dd07e 100644 --- a/go.mod +++ b/go.mod @@ -6,13 +6,14 @@ require ( cloud.google.com/go v0.39.0 // indirect github.com/OneOfOne/xxhash v1.2.5 github.com/StackExchange/wmi v0.0.0-20181212234831-e0a55b97c705 // indirect - github.com/aerogo/aero v1.1.15 + github.com/aerogo/aero v1.1.17 github.com/aerogo/api v0.1.7 github.com/aerogo/crawler v0.2.5 github.com/aerogo/graphql v0.3.6 github.com/aerogo/http v1.0.6 github.com/aerogo/layout v0.1.9 github.com/aerogo/log v0.2.5 + github.com/aerogo/manifest v0.1.4 github.com/aerogo/markdown v0.1.8 github.com/aerogo/nano v0.2.1 github.com/aerogo/pack v0.5.0 @@ -36,6 +37,7 @@ require ( github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c // indirect github.com/json-iterator/go v1.1.6 github.com/logpacker/PayPal-Go-SDK v1.1.4 + github.com/mattn/go-isatty v0.0.8 // indirect github.com/minio/minio-go v6.0.14+incompatible github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mssola/user_agent v0.5.0 @@ -45,8 +47,10 @@ require ( github.com/smartystreets/assertions v0.0.0-20190401211740-f487f9de1cd3 // indirect github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a // indirect github.com/stretchr/testify v1.3.0 + golang.org/x/net v0.0.0-20190520210107-018c4d40a106 // indirect golang.org/x/oauth2 v0.0.0-20190517181255-950ef44c6e07 golang.org/x/sync v0.0.0-20190423024810-112230192c58 // indirect + golang.org/x/sys v0.0.0-20190522044717-8097e1b27ff5 // indirect golang.org/x/text v0.3.2 // indirect google.golang.org/appengine v1.6.0 // indirect gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect diff --git a/go.sum b/go.sum index dd3120f7..59c135a8 100644 --- a/go.sum +++ b/go.sum @@ -21,6 +21,8 @@ github.com/aerogo/aero v1.1.13 h1:e+FXHaSRZ2a/xrLwF1Yeujh5yHBovdLfHxJYtZvPpWw= github.com/aerogo/aero v1.1.13/go.mod h1:jcHCf+a3vExpo1SKRPrmkspO9VWiDZHC5/ITss/Sz6Y= github.com/aerogo/aero v1.1.15 h1:T+CYwhGi1OpFc2xZzCn8I/NKOcqvBtXVU+/+l1xEgfA= github.com/aerogo/aero v1.1.15/go.mod h1:AqpqKoaoM/WuCmzbQl0Cl5IFkyRv7xPCfAc+oP10ur0= +github.com/aerogo/aero v1.1.17 h1:OgpdDSgY7FQ4iCZwzVRMsW3On0f7hSoyjV1yj5esoEQ= +github.com/aerogo/aero v1.1.17/go.mod h1:tXqLwzzZEsSJgKe7RgfvonPQ9CnYThLRLri2paUjSdE= github.com/aerogo/api v0.1.7 h1:2cEOUlPvlRnLo6A0xn8+UpmluWqRoYEGn0Ik4kxmUEI= github.com/aerogo/api v0.1.7/go.mod h1:6uPqLd2/VzFiuC7L7hPMtUNjfRjczJQUP6Uks7EiXpw= github.com/aerogo/cluster v0.1.5 h1:mOYQmaYRsvIi1inaGLICmeJgCYycBxiHnjcTFLtC6kc= @@ -57,6 +59,14 @@ github.com/aerogo/linter-performance v1.0.3 h1:pYsmUd8jp6CVrFx+YNo9Gfdf222CKG2gC github.com/aerogo/linter-performance v1.0.3/go.mod h1:po6XSSbSgR30lazzqSRGV++a2omxYr2qjqFvcvUCH40= github.com/aerogo/log v0.2.5 h1:LGeElbLqyaD8r8Ls9HuG7tYF6YV4kP56IxJWl/b4cZQ= github.com/aerogo/log v0.2.5/go.mod h1:8+dc8oT2gd4ftwf+u6WMKcjOfR6yzkcN+q3N6xg7VhI= +github.com/aerogo/manifest v0.1.1 h1:QhFKIvKTrZsqf1OnzQa1q5s0PDxWwevyG/35NQ82Nhc= +github.com/aerogo/manifest v0.1.1/go.mod h1:J8Dali+Ky2sktH1mG176b2picI3saJ3ZAmOWnz2+l8k= +github.com/aerogo/manifest v0.1.2 h1:LGTe7W3VHeyZaw18or/3JMnjvnGmnEmJdWpHRDzoCro= +github.com/aerogo/manifest v0.1.2/go.mod h1:3SvBzx0rCDNQ+C779aEj5ZyP0YWwdGPeEzsPM3VIOzg= +github.com/aerogo/manifest v0.1.3 h1:7SDWy/CNNnY7koppa2ZXkRe4vaUM6y4tEMxlxs8ghHw= +github.com/aerogo/manifest v0.1.3/go.mod h1:3SvBzx0rCDNQ+C779aEj5ZyP0YWwdGPeEzsPM3VIOzg= +github.com/aerogo/manifest v0.1.4 h1:JGRMJAANtgzhygMCMov6WgIRkiVuMgP3a+ossf//TJU= +github.com/aerogo/manifest v0.1.4/go.mod h1:3SvBzx0rCDNQ+C779aEj5ZyP0YWwdGPeEzsPM3VIOzg= github.com/aerogo/markdown v0.1.8 h1:X/FlyuBqdVaFflggxDbXcqGCQNInLKwU/tvyNhg+mQw= github.com/aerogo/markdown v0.1.8/go.mod h1:8+ZWJnLT2rxY75TEd/Y5+rV89Sw9NOh5WiGSjptGNYk= github.com/aerogo/mirror v0.2.2 h1:kASC9ZsTDBPwzZehb2o5qLbNv+bj8t9V167ExjEMRS0= @@ -205,6 +215,8 @@ github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcncea github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.7 h1:UvyT9uN+3r7yLEYSlJsbQGdsaB/a0DlgWP3pql6iwOc= github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/microcosm-cc/bluemonday v1.0.2 h1:5lPfLTTAvAbtS0VqT+94yOtFnGfUWYyx0+iToC3Os3s= github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc= github.com/minio/minio-go v6.0.14+incompatible h1:fnV+GD28LeqdN6vT2XdGKW8Qe/IfjJDswNVuni6km9o= @@ -285,6 +297,8 @@ golang.org/x/net v0.0.0-20190509222800-a4d6f7feada5 h1:6M3SDHlHHDCx2PcQw3S4KsR17 golang.org/x/net v0.0.0-20190509222800-a4d6f7feada5/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190514140710-3ec191127204 h1:4yG6GqBtw9C+UrLp6s2wtSniayy/Vd/3F7ffLE427XI= golang.org/x/net v0.0.0-20190514140710-3ec191127204/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190520210107-018c4d40a106 h1:EZofHp/BzEf3j39/+7CX1JvH0WaPG+ikBrqAdAPf+GM= +golang.org/x/net v0.0.0-20190520210107-018c4d40a106/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190517181255-950ef44c6e07 h1:XC1K3wNjuz44KaI+cj85C9TW85w/46RH7J+DTXNH5Wk= @@ -315,6 +329,9 @@ golang.org/x/sys v0.0.0-20190516014833-cab07311ab81/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190516102723-cedb8e16d18a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190516110030-61b9204099cb h1:k07iPOt0d6nEnwXF+kHB+iEg+WSuKe/SOQuFM2QoD+E= golang.org/x/sys v0.0.0-20190516110030-61b9204099cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190520201301-c432e742b0af/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190522044717-8097e1b27ff5 h1:f005F/Jl5JLP036x7QIvUVhNTqxvSYwFIiyOh2q12iU= +golang.org/x/sys v0.0.0-20190522044717-8097e1b27ff5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2 h1:z99zHgr7hKfrUcX/KsoJk5FJfjTceCKIp96+biqP4To= diff --git a/manifest.json b/manifest.json new file mode 100644 index 00000000..fe121aba --- /dev/null +++ b/manifest.json @@ -0,0 +1,58 @@ +{ + "name": "Anime Notifier", + "short_name": "Anime", + "theme_color": "#ef371f", + "background_color": "#f6f6f6", + "icons": [ + { + "src": "images/brand/1024.png", + "sizes": "1024x1024", + "type": "image/png" + }, + { + "src": "images/brand/512.png", + "sizes": "512x512", + "type": "image/png" + }, + { + "src": "images/brand/384.png", + "sizes": "384x384", + "type": "image/png" + }, + { + "src": "images/brand/256.png", + "sizes": "256x256", + "type": "image/png" + }, + { + "src": "images/brand/220.png", + "sizes": "220x220", + "type": "image/png" + }, + { + "src": "images/brand/192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "images/brand/180.png", + "sizes": "180x180", + "type": "image/png" + }, + { + "src": "images/brand/144.png", + "sizes": "144x144", + "type": "image/png" + }, + { + "src": "images/brand/128.png", + "sizes": "128x128", + "type": "image/png" + }, + { + "src": "images/brand/64.png", + "sizes": "64x64", + "type": "image/png" + } + ] +} \ No newline at end of file