1
0
Fork 0
mirror of https://github.com/Eggbertx/gochan.git synced 2025-08-03 11:46:22 -07:00

Instead of failing if config.SiteWebfolder isn't set, use default "/"

Also append and/or prepend "/" as necessary to prevent possible issues
Also also fixed issues with broken links caused by the previous commit
This commit is contained in:
Joshua Merrell 2018-09-27 13:44:30 -07:00
parent e1de5162ac
commit 01877937eb
3 changed files with 9 additions and 5 deletions

View file

@ -531,8 +531,12 @@ func initConfig() {
}
if config.SiteWebfolder == "" {
println(0, "SiteWebfolder not set in gochan.json, halting.")
os.Exit(2)
println(0, "SiteWebFolder not set in gochan.json, using / as default.")
} else if string(config.SiteWebfolder[0]) != "/" {
config.SiteWebfolder = "/" + config.SiteWebfolder
}
if config.SiteWebfolder[len(config.SiteWebfolder)-1:] != "/" {
config.SiteWebfolder += "/"
}
if config.DomainRegex == "" {

View file

@ -70,7 +70,7 @@
{{else}}Next{{end}}</td></tr>
</table>
<span id="boardmenu-bottom">
[{{range $i, $boardlink := $.boards}}{{if gt $i 0}}/{{end}} <a href="{{$.config.SiteWebfolder}}/{{$boardlink.Dir}}/">{{$boardlink.Dir}}</a> {{end}}]
[{{range $i, $boardlink := $.boards}}{{if gt $i 0}}/{{end}} <a href="{{$.config.SiteWebfolder}}{{$boardlink.Dir}}/">{{$boardlink.Dir}}</a> {{end}}]
</span>
</div>
</div>

View file

@ -10,7 +10,7 @@
<title>/{{$.board.Dir}}/ - {{truncateString $.op.MessageText 20 true}}</title>
{{end}}
{{else}}<title>/{{.board.Dir}}/ - {{.board.Title}}</title>{{end}}
<script type="text/javascript" src="{{$.config.SiteWebfolder}}/javascript/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="{{$.config.SiteWebfolder}}javascript/jquery-3.3.1.min.js"></script>
<script type="text/javascript">
var styles = [{{range $ii, $style := $.config.Styles}}{{if gt $ii 0}}, {{end}}"{{$style}}"{{end}}];
var webroot = "{{$.config.SiteWebfolder}}";
@ -25,7 +25,7 @@
<link rel="stylesheet" href="{{$.config.SiteWebfolder}}css/global/img.css" />
{{range $_, $style := .config.Styles}}
<link rel="{{if not (isStyleDefault $style)}}alternate {{end}}stylesheet" href="{{$.config.SiteWebfolder}}css/{{$style}}/img.css" />{{end}}
<link rel="shortcut icon" href="{{$.config.SiteWebfolder}}/favicon.png" />
<link rel="shortcut icon" href="{{$.config.SiteWebfolder}}favicon.png" />
</head>
<body>
<div id="topbar">