Basic browser extension support

This commit is contained in:
2017-06-24 21:07:45 +02:00
parent 932ed7c165
commit 7e92409758
10 changed files with 75 additions and 6 deletions

10
utils/allowembed.go Normal file
View File

@ -0,0 +1,10 @@
package utils
import "github.com/aerogo/aero"
// AllowEmbed allows the page to be called by the browser extension.
func AllowEmbed(ctx *aero.Context, response string) string {
// This is a bit of a hack.
ctx.SetResponseHeader("X-Frame-Options", "ALLOW-FROM chrome-extension://hjfcooigdelogjmniiahfiilcefdlpha/options.html")
return response
}

15
utils/container.go Normal file
View File

@ -0,0 +1,15 @@
package utils
import (
"github.com/aerogo/aero"
)
// GetContainerClass returns the class for the "container" element.
// In the browser extension it will get the "embedded" class.
func GetContainerClass(ctx *aero.Context) string {
if ctx.URI() == "/extension/embed" {
return "embedded"
}
return ""
}