mirror of
https://github.com/Eggbertx/gochan.git
synced 2025-08-20 09:26:23 -07:00
remove Version field from config struct to avoid JSON parsing issues
This commit is contained in:
parent
a6d7e9f188
commit
bf383a1b20
9 changed files with 18 additions and 17 deletions
2
Makefile
2
Makefile
|
@ -18,5 +18,5 @@ build:
|
|||
ifndef GOPATH
|
||||
@echo "$ GOPATH not set. Please run 'export GOPATH=\$$PWD/lib' (or wherever you prefer) and run this again."
|
||||
endif
|
||||
go build -v -ldflags "${LDFLAGS} -X main.version=${GOCHAN_VERSION} -X main.buildtimeString=${GOCHAN_BUILDTIME}" -o ${DIRNAME}${GOCHAN_BIN} ./src
|
||||
go build -v -ldflags "${LDFLAGS} -X main.versionStr=${GOCHAN_VERSION} -X main.buildtimeString=${GOCHAN_BUILDTIME}" -o ${DIRNAME}${GOCHAN_BIN} ./src
|
||||
|
||||
|
|
1
dist.sh
1
dist.sh
|
@ -7,6 +7,7 @@ function copyStuff {
|
|||
mkdir $DIRNAME
|
||||
make release
|
||||
mkdir $DIRNAME/html
|
||||
cp -r sass $DIRNAME
|
||||
cp -r html/css $DIRNAME/html/css
|
||||
cp -r html/error $DIRNAME/html/error
|
||||
cp -r html/javascript $DIRNAME/html/javascript
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
var version string
|
||||
var versionStr string
|
||||
var buildtimeString string // set in Makefile, format: YRMMDD.HHMM
|
||||
|
||||
func main() {
|
||||
|
@ -20,7 +20,7 @@ func main() {
|
|||
connectToSQLServer()
|
||||
parseCommandLine()
|
||||
|
||||
printf(0, "Starting gochan v%s.%s, using verbosity level %d\n", config.Version.String(), buildtimeString, config.Verbosity)
|
||||
printf(0, "Starting gochan v%s.%s, using verbosity level %d\n", versionStr, buildtimeString, config.Verbosity)
|
||||
println(0, "Loading and parsing templates...")
|
||||
if err := initTemplates(); err != nil {
|
||||
handleError(0, customError(err))
|
||||
|
|
|
@ -77,7 +77,7 @@ func connectToSQLServer() {
|
|||
}
|
||||
}
|
||||
|
||||
if sqlVersion != version {
|
||||
if sqlVersion != versionStr {
|
||||
_, err = execSQL("INSERT INTO `"+config.DBprefix+"info` (`name`,`value`) VALUES('version',?)", version)
|
||||
if err != nil && !strings.Contains(err.Error(), "Duplicate entry") {
|
||||
handleError(0, "failed with error: %s\n", customError(err))
|
||||
|
|
|
@ -239,8 +239,8 @@ var funcMap = template.FuncMap{
|
|||
},
|
||||
|
||||
// Version functions
|
||||
"formatVersion": func(v GochanVersion) string {
|
||||
return v.String()
|
||||
"version": func() string {
|
||||
return version.String()
|
||||
},
|
||||
}
|
||||
|
||||
|
|
13
src/types.go
13
src/types.go
|
@ -19,6 +19,7 @@ var (
|
|||
modLog *log.Logger
|
||||
readBannedIPs []string
|
||||
bbcompiler bbcode.Compiler
|
||||
version GochanVersion
|
||||
)
|
||||
|
||||
type RecentPost struct {
|
||||
|
@ -423,11 +424,10 @@ type GochanConfig struct {
|
|||
// Verbosity = 0 for no debugging info. Critical errors and general output only
|
||||
// Verbosity = 1 for non-critical warnings and important info
|
||||
// Verbosity = 2 for all debugging/benchmarks/warnings
|
||||
Verbosity int `description:"The level of verbosity to use in error/warning messages. 0 = critical errors/startup messages, 1 = warnings, 2 = benchmarks/notices." default:"0"`
|
||||
EnableAppeals bool `description:"If checked, allow banned users to appeal their bans.<br />This will likely be removed (permanently allowing appeals) or made board-specific in the future." default:"checked"`
|
||||
MaxLogDays int `description:"The maximum number of days to keep messages in the moderation/staff log file."`
|
||||
RandomSeed string `critical:"true"`
|
||||
Version GochanVersion `critical:"true"`
|
||||
Verbosity int `description:"The level of verbosity to use in error/warning messages. 0 = critical errors/startup messages, 1 = warnings, 2 = benchmarks/notices." default:"0"`
|
||||
EnableAppeals bool `description:"If checked, allow banned users to appeal their bans.<br />This will likely be removed (permanently allowing appeals) or made board-specific in the future." default:"checked"`
|
||||
MaxLogDays int `description:"The maximum number of days to keep messages in the moderation/staff log file."`
|
||||
RandomSeed string `critical:"true"`
|
||||
}
|
||||
|
||||
func initConfig() {
|
||||
|
@ -675,5 +675,6 @@ func initConfig() {
|
|||
bbcompiler.SetTag("quote", nil)
|
||||
bbcompiler.SetTag("size", nil)
|
||||
|
||||
config.Version = ParseVersion(version)
|
||||
version = ParseVersion(versionStr)
|
||||
version.Normalize()
|
||||
}
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
<head>
|
||||
<title>Banned</title>
|
||||
<link rel="shortcut icon" href="/favicon.png">
|
||||
<link rel="stylesheet" href="/css/global/front.css" />
|
||||
{{range $i, $style := .config.Styles}}
|
||||
<link rel="{{if not (isStyleDefault $style)}}alternate {{end}}stylesheet" href="/css/{{$style}}/front.css" />{{end}}
|
||||
<link rel="stylesheet" href="{{$.config.SiteWebfolder}}css/global.css" />
|
||||
<link rel="stylesheet" href="{{$.config.SiteWebfolder}}css/{{$.config.DefaultStyle}}.css" />
|
||||
<script type="text/javascript">
|
||||
var styles = [{{range $i, $style := .config.Styles}}{{if gt $i 0}}, {{end}}"{{$style}}"{{end}}];
|
||||
var webroot = "{{.config.SiteWebfolder}}"
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
<h1>{{.ErrorHeader}}</h1>
|
||||
{{/*<img src="{{.ErrorImage}}" border="0" alt="">*/}}
|
||||
<p>{{.ErrorText}}</p>
|
||||
<hr><address>http://gochan.org powered by Gochan {{.config.Version}}</address>
|
||||
<hr><address>http://gochan.org powered by Gochan {{version}}</address>
|
||||
</body>
|
||||
</html>
|
|
@ -1,6 +1,6 @@
|
|||
<div id="footer">
|
||||
<a href="{{$.config.SiteWebfolder}}">Home</a> | <a href="{{$.config.SiteWebfolder}}#boards">Boards</a> | <a href="{{$.config.SiteWebfolder}}#rules">Rules</a> | <a href="{{$.config.SiteWebfolder}}#faq">FAQ</a><br />
|
||||
Powered by <a href="http://github.com/eggbertx/gochan/">Gochan {{formatVersion .config.Version}}</a><br />
|
||||
Powered by <a href="http://github.com/eggbertx/gochan/">Gochan {{version}}</a><br />
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue