mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2024-12-22 19:42:20 +00:00
Add ?nowidget GET parameter
This commit is contained in:
parent
0f98f6f62c
commit
dc01eca73c
@ -85,6 +85,7 @@ func viewerGetHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
host = strings.Replace(host, ".", "-", -1)
|
host = strings.Replace(host, ".", "-", -1)
|
||||||
if streamID, ok := cfg.MapDomainToStream[host]; ok {
|
if streamID, ok := cfg.MapDomainToStream[host]; ok {
|
||||||
|
// Move home page to /about
|
||||||
if path == "about" {
|
if path == "about" {
|
||||||
path = ""
|
path = ""
|
||||||
} else {
|
} else {
|
||||||
@ -97,12 +98,15 @@ func viewerGetHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
Cfg *Options
|
Cfg *Options
|
||||||
Path string
|
Path string
|
||||||
WidgetURL string
|
WidgetURL string
|
||||||
}{Path: path, Cfg: cfg}
|
}{Path: path, Cfg: cfg, WidgetURL: ""}
|
||||||
|
|
||||||
// Compute the WidgetURL with the stream path
|
// Load widget is user does not disable it with ?nowidget
|
||||||
b := &bytes.Buffer{}
|
if _, ok := r.URL.Query()["nowidget"]; !ok {
|
||||||
_ = template.Must(template.New("").Parse(cfg.WidgetURL)).Execute(b, data)
|
// Compute the WidgetURL with the stream path
|
||||||
data.WidgetURL = b.String()
|
b := &bytes.Buffer{}
|
||||||
|
_ = template.Must(template.New("").Parse(cfg.WidgetURL)).Execute(b, data)
|
||||||
|
data.WidgetURL = b.String()
|
||||||
|
}
|
||||||
|
|
||||||
if err := templates.ExecuteTemplate(w, "base", data); err != nil {
|
if err := templates.ExecuteTemplate(w, "base", data); err != nil {
|
||||||
log.Println(err.Error())
|
log.Println(err.Error())
|
||||||
|
Loading…
Reference in New Issue
Block a user