diff --git a/build.py b/build.py index 22eebbf8..c5fbe2dd 100755 --- a/build.py +++ b/build.py @@ -39,7 +39,7 @@ release_files = ( "README.md", ) -GOCHAN_VERSION = "4.0.1" +GOCHAN_VERSION = "4.0.2" DATABASE_VERSION = "4" # stored in DBNAME.DBPREFIXdatabase_version PATH_NOTHING = -1 diff --git a/frontend/package.json b/frontend/package.json index fff7198c..22fc29b8 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "gochan.js", - "version": "4.0.1", + "version": "4.0.2", "description": "", "main": "./ts/main.ts", "private": true, diff --git a/html/error/404.html b/html/error/404.html index 7299fdc1..602780fd 100755 --- a/html/error/404.html +++ b/html/error/404.html @@ -7,6 +7,6 @@

404: File not found

lol 404

The requested file could not be found on this server.

-
Site powered by Gochan v4.0.1 +
Site powered by Gochan v4.0.2 \ No newline at end of file diff --git a/html/error/500.html b/html/error/500.html index 6578dbd6..8fe12c28 100755 --- a/html/error/500.html +++ b/html/error/500.html @@ -7,6 +7,6 @@

Error 500: Internal Server error

server burning

The server encountered an error while trying to serve the page, and we apologize for the inconvenience. The system administrator will try to fix things as soon they get around to it, whenever that is. Hopefully soon.

-
Site powered by Gochan v4.0.1 +
Site powered by Gochan v4.0.2 \ No newline at end of file diff --git a/html/error/502.html b/html/error/502.html index 651b5634..e5644dd5 100644 --- a/html/error/502.html +++ b/html/error/502.html @@ -7,6 +7,6 @@

Error 502: Bad gateway

server burning

The server encountered an error while trying to serve the page, and we apologize for the inconvenience. The system administrator will try to fix things as soon they get around to it, whenever that is. Hopefully soon.

-
Site powered by Gochan v4.0.1 +
Site powered by Gochan v4.0.2 \ No newline at end of file diff --git a/pkg/gctemplates/templatetests/templatecases_test.go b/pkg/gctemplates/templatetests/templatecases_test.go index affaf46a..740ed489 100644 --- a/pkg/gctemplates/templatetests/templatecases_test.go +++ b/pkg/gctemplates/templatetests/templatecases_test.go @@ -70,6 +70,18 @@ var ( AnonymousName: "Anonymous Coward", } + simpleBoard2 = &gcsql.Board{ + ID: 2, + SectionID: 2, + URI: "sup", + Dir: "sup", + Title: "Gochan Support board", + Subtitle: "Board for helping out gochan users/admins", + Description: "Board for helping out gochan users/admins", + DefaultStyle: "yotsuba.css", + AnonymousName: "Anonymous Coward", + } + banPageCases = []templateTestCase{ { desc: "appealable permaban", @@ -251,6 +263,195 @@ var ( expectedOutput: `const styles=[];const defaultStyle="\"a\\a\"";const webroot="";const serverTZ=0;const fileTypes=[];`, }, } + + baseFooterCases = []templateTestCase{ + { + desc: "base footer test", + data: map[string]any{ + "boardConfig": simpleBoardConfig, + "board": simpleBoard1, + "numPages": 1, + "sections": []gcsql.Section{ + {ID: 1}, + }, + }, + expectedOutput: footer, + }, + { + desc: "base footer test", + data: map[string]any{ + "boardConfig": simpleBoardConfig, + "board": simpleBoard2, + "numPages": 3, + "sections": []gcsql.Section{ + {ID: 1}, + }, + }, + expectedOutput: footer, + }, + } + + baseHeaderCases = []templateTestCase{ + { + desc: "Header Test /test/", + data: map[string]any{ + "boardConfig": simpleBoardConfig, + "board": simpleBoard1, + "numPages": 1, + "sections": []gcsql.Section{ + {ID: 1}, + }, + }, + expectedOutput: headBeginning + + `/test/-Testing board` + + `` + + `` + + `` + + `` + + `` + + `
` + + `home
` + + `
/test/` + + `/test2/
` + + `
`, + }, + { + desc: "Header Test /sup/", + data: map[string]any{ + "boardConfig": simpleBoardConfig, + "board": simpleBoard2, + "numPages": 1, + "sections": []gcsql.Section{ + {ID: 1}, + }, + }, + expectedOutput: headBeginning + + `/sup/-Gochan Support board` + + `` + + `` + + `` + + `` + + `` + + `
` + + `home
` + + `
` + + `
`, + }, + { + desc: "Perma Ban Header Test", + data: map[string]any{ + "ban": &gcsql.IPBan{ + RangeStart: "192.168.56.0", + RangeEnd: "192.168.56.255", + IPBanBase: gcsql.IPBanBase{ + IsActive: true, + Permanent: true, + StaffID: 1, + Message: "ban message goes here", + }, + }, + "ip": "192.168.56.1", + "siteConfig": testingSiteConfig, + "systemCritical": config.SystemCriticalConfig{ + WebRoot: "/", + }, + "boardConfig": config.BoardConfig{ + DefaultStyle: "pipes.css", + }, + }, + expectedOutput: `` + + `` + + `YOU'RE PERMABANNED, IDIOT!` + + `` + + `` + + `
`, + }, + { + desc: "Appealable Perma Ban Header Test", + data: map[string]any{ + "ban": &gcsql.IPBan{ + RangeStart: "192.168.56.0", + RangeEnd: "192.168.56.255", + IPBanBase: gcsql.IPBanBase{ + Permanent: true, + CanAppeal: true, + StaffID: 1, + Message: "ban message goes here", + }, + }, + "ip": "192.168.56.1", + "siteConfig": testingSiteConfig, + "systemCritical": config.SystemCriticalConfig{ + WebRoot: "/", + }, + "boardConfig": config.BoardConfig{ + DefaultStyle: "pipes.css", + }, + }, + expectedOutput: `` + + `` + + `YOU ARE BANNED:(` + + `` + + `` + + `
`, + }, + { + desc: "Appealable Temp Ban Header Test", + data: map[string]any{ + "ban": &gcsql.IPBan{ + RangeStart: "192.168.56.0", + RangeEnd: "192.168.56.255", + IPBanBase: gcsql.IPBanBase{ + CanAppeal: true, + StaffID: 1, + Message: "ban message goes here", + }, + }, + "ip": "192.168.56.1", + "siteConfig": testingSiteConfig, + "systemCritical": config.SystemCriticalConfig{ + WebRoot: "/", + }, + "boardConfig": config.BoardConfig{ + DefaultStyle: "pipes.css", + }, + }, + expectedOutput: `` + + `` + + `YOU ARE BANNED:(` + + `` + + `` + + `
`, + }, + { + desc: "Unappealable Temp Ban Header Test", + data: map[string]any{ + "ban": &gcsql.IPBan{ + RangeStart: "192.168.56.0", + RangeEnd: "192.168.56.255", + IPBanBase: gcsql.IPBanBase{ + StaffID: 1, + Message: "ban message goes here", + }, + }, + "ip": "192.168.56.1", + "siteConfig": testingSiteConfig, + "systemCritical": config.SystemCriticalConfig{ + WebRoot: "/", + }, + "boardConfig": config.BoardConfig{ + DefaultStyle: "pipes.css", + }, + }, + expectedOutput: `` + + `` + + `YOU ARE BANNED:(` + + `` + + `` + + `
`, + }, + } ) const ( diff --git a/pkg/gctemplates/templatetests/templates_test.go b/pkg/gctemplates/templatetests/templates_test.go index d8ce11c7..8c088bba 100644 --- a/pkg/gctemplates/templatetests/templates_test.go +++ b/pkg/gctemplates/templatetests/templates_test.go @@ -108,3 +108,11 @@ func TestTemplateBase(t *testing.T) { initTemplatesMock(t, mock) } + +func TestBaseFooter(t *testing.T) { + runTemplateTestCases(t, gctemplates.PageFooter, baseFooterCases) +} + +func TestBaseHeader(t *testing.T) { + runTemplateTestCases(t, gctemplates.PageHeader, baseHeaderCases) +}