diff options
Diffstat (limited to 'internal/templates')
| -rw-r--r-- | internal/templates/templates.go | 91 |
1 files changed, 90 insertions, 1 deletions
diff --git a/internal/templates/templates.go b/internal/templates/templates.go index 8f25f8f..b68a504 100644 --- a/internal/templates/templates.go +++ b/internal/templates/templates.go | |||
| @@ -185,8 +185,24 @@ var codeCaddyTemplate = `{{.BaseDomain}} { | |||
| 185 | } | 185 | } |
| 186 | } | 186 | } |
| 187 | 187 | ||
| 188 | @cgitassets path /cgit/* | ||
| 189 | handle @cgitassets { | ||
| 190 | root * /usr/share/cgit | ||
| 191 | uri strip_prefix /cgit | ||
| 192 | file_server | ||
| 193 | } | ||
| 194 | |||
| 188 | handle { | 195 | handle { |
| 189 | respond "not found" 404 | 196 | reverse_proxy unix//run/fcgiwrap.socket { |
| 197 | transport fastcgi { | ||
| 198 | env SCRIPT_FILENAME /usr/lib/cgit/cgit.cgi | ||
| 199 | env QUERY_STRING {query} | ||
| 200 | env REQUEST_METHOD {method} | ||
| 201 | env PATH_INFO {path} | ||
| 202 | env HTTP_HOST {host} | ||
| 203 | env SERVER_NAME {host} | ||
| 204 | } | ||
| 205 | } | ||
| 190 | } | 206 | } |
| 191 | } | 207 | } |
| 192 | ` | 208 | ` |
| @@ -239,6 +255,79 @@ func CodeCaddy(data map[string]string) (string, error) { | |||
| 239 | return renderTemplate("code-caddy", codeCaddyTemplate, data) | 255 | return renderTemplate("code-caddy", codeCaddyTemplate, data) |
| 240 | } | 256 | } |
| 241 | 257 | ||
| 258 | var cgitrcTemplate = `virtual-root=/ | ||
| 259 | css=/cgit/cgit.css | ||
| 260 | logo=/cgit/cgit.png | ||
| 261 | header=/opt/ship/cgit-header.html | ||
| 262 | scan-path=/srv/git/ | ||
| 263 | export-ok=git-daemon-export-ok | ||
| 264 | enable-http-clone=0 | ||
| 265 | clone-url=https://{{.BaseDomain}}/$CGIT_REPO_URL | ||
| 266 | root-title={{.BaseDomain}} | ||
| 267 | root-desc= | ||
| 268 | remove-suffix=.git | ||
| 269 | ` | ||
| 270 | |||
| 271 | var cgitHeaderTemplate = `<style> | ||
| 272 | body, table, td, th, div#cgit { background: #1a1a2e; color: #ccc; } | ||
| 273 | a { color: #7aa2f7; } | ||
| 274 | a:hover { color: #9ecbff; } | ||
| 275 | table.list tr:hover td { background: #222244; } | ||
| 276 | table.list td, table.list th { border-bottom: 1px solid #333; } | ||
| 277 | th { background: #16213e; } | ||
| 278 | td.commitgraph .column1 { color: #7aa2f7; } | ||
| 279 | td.commitgraph .column2 { color: #9ece6a; } | ||
| 280 | td.logheader { background: #16213e; } | ||
| 281 | div#header { background: #16213e; border-bottom: 1px solid #333; } | ||
| 282 | div#header .sub { color: #888; } | ||
| 283 | table.tabs { border-bottom: 1px solid #333; } | ||
| 284 | table.tabs td a { color: #ccc; } | ||
| 285 | table.tabs td a.active { color: #fff; background: #1a1a2e; border: 1px solid #333; border-bottom: 1px solid #1a1a2e; } | ||
| 286 | div.footer { color: #555; } | ||
| 287 | div.footer a { color: #555; } | ||
| 288 | div.diffstat-header { background: #16213e; } | ||
| 289 | table.diffstat { border-bottom: 1px solid #333; } | ||
| 290 | table.diffstat td.graph span.graph-moreremoved { background: #f7768e; } | ||
| 291 | table.diffstat td.graph span.graph-moreadded { background: #9ece6a; } | ||
| 292 | table.diffstat td.graph span.graph-removed { background: #f7768e; } | ||
| 293 | table.diffstat td.graph span.graph-added { background: #9ece6a; } | ||
| 294 | table.diff { background: #131320; border: 1px solid #333; } | ||
| 295 | div.diff td { font-family: monospace; } | ||
| 296 | div.head { color: #ccc; background: #16213e; padding: 2px 4px; } | ||
| 297 | div.hunk { color: #7aa2f7; background: #1a1a3e; padding: 2px 4px; } | ||
| 298 | div.add { color: #9ece6a; background: #1a2e1a; padding: 2px 4px; } | ||
| 299 | div.del { color: #f7768e; background: #2e1a1a; padding: 2px 4px; } | ||
| 300 | table.diff td.add { color: #9ece6a; background: #1a2e1a; } | ||
| 301 | table.diff td.del { color: #f7768e; background: #2e1a1a; } | ||
| 302 | table.diff td.hunk { color: #7aa2f7; background: #1a1a3e; } | ||
| 303 | table.diff td { border: none; background: #1a1a2e; } | ||
| 304 | table.blob td.lines { color: #ccc; } | ||
| 305 | table.blob td.linenumbers { background: #16213e; } | ||
| 306 | table.blob td.linenumbers a { color: #555; } | ||
| 307 | table.blob td.linenumbers a:hover { color: #7aa2f7; } | ||
| 308 | table.ssdiff td.add { color: #9ece6a; background: #1a2e1a; } | ||
| 309 | table.ssdiff td.del { color: #f7768e; background: #2e1a1a; } | ||
| 310 | table.ssdiff td { border-right: 1px solid #333; } | ||
| 311 | table.ssdiff td.hunk { color: #7aa2f7; background: #1a1a3e; } | ||
| 312 | table.ssdiff td.head { background: #16213e; border-bottom: 1px solid #333; } | ||
| 313 | table.ssdiff td.foot { background: #16213e; border-top: 1px solid #333; } | ||
| 314 | table.ssdiff td.lineno { background: #16213e; color: #555; } | ||
| 315 | pre { color: #ccc; } | ||
| 316 | input, textarea, select { background: #222; color: #ccc; border: 1px solid #444; } | ||
| 317 | img#logo { display: none; } | ||
| 318 | </style> | ||
| 319 | ` | ||
| 320 | |||
| 321 | // CgitRC generates the /etc/cgitrc config file | ||
| 322 | func CgitRC(data map[string]string) (string, error) { | ||
| 323 | return renderTemplate("cgitrc", cgitrcTemplate, data) | ||
| 324 | } | ||
| 325 | |||
| 326 | // CgitHeader generates the cgit header HTML file (dark theme) | ||
| 327 | func CgitHeader() string { | ||
| 328 | return cgitHeaderTemplate | ||
| 329 | } | ||
| 330 | |||
| 242 | // DockerService generates a systemd unit for a Docker-based app | 331 | // DockerService generates a systemd unit for a Docker-based app |
| 243 | func DockerService(data map[string]string) (string, error) { | 332 | func DockerService(data map[string]string) (string, error) { |
| 244 | return renderTemplate("docker-service", dockerServiceTemplate, data) | 333 | return renderTemplate("docker-service", dockerServiceTemplate, data) |
