Skip to content

Commit 1537b98

Browse files
committed
Add top_html config option
1 parent d9b3e24 commit 1537b98

File tree

5 files changed

+15
-0
lines changed

5 files changed

+15
-0
lines changed

cmds/houndd/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
"encoding/json"
55
"flag"
6+
"html/template"
67
"log"
78
"net/http"
89
"os"
@@ -81,8 +82,10 @@ func makeTemplateData(cfg *config.Config) (interface{}, error) {
8182
var data struct {
8283
ReposAsJson string
8384
FaviconURL string
85+
TopHTML template.HTML
8486
}
8587
data.FaviconURL = cfg.FaviconURL
88+
data.TopHTML = template.HTML(cfg.TopHTML)
8689

8790
res := map[string]*config.Repo{}
8891
for name, repo := range cfg.Repos {

config/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ type Config struct {
6464
JwtCookieName string `json:"jwt_cookie_name"`
6565
JwtSecretKey string `json:"jwt_secret_key"`
6666
FaviconURL string `json:"favicon_url"`
67+
TopHTML string `json:"top_html"`
6768
}
6869

6970
// SecretMessage is just like json.RawMessage but it will not

ui/assets/excluded_files.tpl.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@
33
<head>
44
<meta charset="utf-8">
55
<title>Gitgrep - Excluded Files</title>
6+
{{ if not (eq .FaviconURL "") }}
7+
<link rel="icon" type="image/x-icon" href="{{ .FaviconURL }}"/>
8+
{{ end }}
69
<link rel="stylesheet" href="css/octicons/octicons.css">
710
<link rel="stylesheet" href="css/hound.css">
811
</head>
912
<body>
13+
{{ if not (eq .TopHTML "") }}
14+
{{ .TopHTML }}
15+
{{ end }}
1016
<div id="root"></div>
1117

1218
<script src="js/react-{{.ReactVersion}}.min.js"></script>

ui/assets/index.tpl.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
title="Gitgrep" />
1515
</head>
1616
<body>
17+
{{ if not (eq .TopHTML "") }}
18+
{{ .TopHTML }}
19+
{{ end }}
1720
<div id="root">
1821
<div id="result">
1922
</div>

ui/ui.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ func renderForDev(w io.Writer, root string, c *content, cfg *config.Config, r *h
101101
"Source": html_template.HTML(buf.String()),
102102
"Host": r.Host,
103103
"FaviconURL": cfg.FaviconURL,
104+
"TopHTML": html_template.HTML(cfg.TopHTML),
104105
})
105106
}
106107

@@ -162,6 +163,7 @@ func renderForPrd(w io.Writer, c *content, cfg *config.Config, cfgJson string, r
162163
"Source": html_template.HTML(buf.String()),
163164
"Host": r.Host,
164165
"FaviconURL": cfg.FaviconURL,
166+
"TopHTML": html_template.HTML(cfg.TopHTML),
165167
})
166168
}
167169

0 commit comments

Comments
 (0)