mirror of
https://github.com/Eggbertx/gochan.git
synced 2025-08-02 10:56:25 -07:00
Merge branch 'master' into pre2021-migration-update
This commit is contained in:
commit
2e91aeb0a4
7 changed files with 214 additions and 5 deletions
2
build.py
2
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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "gochan.js",
|
||||
"version": "4.0.1",
|
||||
"version": "4.0.2",
|
||||
"description": "",
|
||||
"main": "./ts/main.ts",
|
||||
"private": true,
|
||||
|
|
|
@ -7,6 +7,6 @@
|
|||
<h1>404: File not found</h1>
|
||||
<img src="/error/lol 404.gif" alt="lol 404">
|
||||
<p>The requested file could not be found on this server.</p>
|
||||
<hr/>Site powered by <a href="https://github.com/gochan-org/gochan" target="_blank">Gochan</a> v4.0.1
|
||||
<hr/>Site powered by <a href="https://github.com/gochan-org/gochan" target="_blank">Gochan</a> v4.0.2
|
||||
</body>
|
||||
</html>
|
|
@ -7,6 +7,6 @@
|
|||
<h1>Error 500: Internal Server error</h1>
|
||||
<img src="/error/server500.gif" alt="server burning">
|
||||
<p>The server encountered an error while trying to serve the page, and we apologize for the inconvenience. The <a href="https://en.wikipedia.org/wiki/Idiot">system administrator</a> will try to fix things as soon they get around to it, whenever that is. Hopefully soon.</p>
|
||||
<hr/>Site powered by <a href="https://github.com/gochan-org/gochan" target="_blank">Gochan</a> v4.0.1
|
||||
<hr/>Site powered by <a href="https://github.com/gochan-org/gochan" target="_blank">Gochan</a> v4.0.2
|
||||
</body>
|
||||
</html>
|
|
@ -7,6 +7,6 @@
|
|||
<h1>Error 502: Bad gateway</h1>
|
||||
<img src="/error/server500.gif" alt="server burning">
|
||||
<p>The server encountered an error while trying to serve the page, and we apologize for the inconvenience. The <a href="https://en.wikipedia.org/wiki/Idiot">system administrator</a> will try to fix things as soon they get around to it, whenever that is. Hopefully soon.</p>
|
||||
<hr/>Site powered by <a href="https://github.com/gochan-org/gochan" target="_blank">Gochan</a> v4.0.1
|
||||
<hr/>Site powered by <a href="https://github.com/gochan-org/gochan" target="_blank">Gochan</a> v4.0.2
|
||||
</body>
|
||||
</html>
|
|
@ -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 +
|
||||
`<title>/test/-Testing board</title>` +
|
||||
`<link rel="stylesheet"href="/css/global.css"/>` +
|
||||
`<link id="theme"rel="stylesheet"href="/css/pipes.css"/>` +
|
||||
`<link rel="shortcut icon"href="/favicon.png">` +
|
||||
`<script type="text/javascript"src="/js/consts.js"></script>` +
|
||||
`<script type="text/javascript"src="/js/gochan.js"></script>` +
|
||||
`</head><body><div id="topbar"><div class="topbar-section">` +
|
||||
`<a href="/"class="topbar-item">home</a></div>` +
|
||||
`<div class="topbar-section"><a href="/test/"class="topbar-item"title="Testing board">/test/</a>` +
|
||||
`<a href="/test2/" class="topbar-item" title="Testing board#2">/test2/</a></div></div>` +
|
||||
`<div id="content">`,
|
||||
},
|
||||
{
|
||||
desc: "Header Test /sup/",
|
||||
data: map[string]any{
|
||||
"boardConfig": simpleBoardConfig,
|
||||
"board": simpleBoard2,
|
||||
"numPages": 1,
|
||||
"sections": []gcsql.Section{
|
||||
{ID: 1},
|
||||
},
|
||||
},
|
||||
expectedOutput: headBeginning +
|
||||
`<title>/sup/-Gochan Support board</title>` +
|
||||
`<link rel="stylesheet"href="/css/global.css"/>` +
|
||||
`<link id="theme"rel="stylesheet"href="/css/pipes.css"/>` +
|
||||
`<link rel="shortcut icon"href="/favicon.png">` +
|
||||
`<script type="text/javascript"src="/js/consts.js"></script>` +
|
||||
`<script type="text/javascript"src="/js/gochan.js"></script>` +
|
||||
`</head><body><div id="topbar"><div class="topbar-section">` +
|
||||
`<a href="/"class="topbar-item">home</a></div>` +
|
||||
`<div class="topbar-section"><a href="/test/"class="topbar-item"title="Testing board">/test/</a>` +
|
||||
`<a href="/test2/" class="topbar-item" title="Testing board#2">/test2/</a></div></div>` +
|
||||
`<div id="content">`,
|
||||
},
|
||||
{
|
||||
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: `<!DOCTYPE html><html lang="en"><head>` +
|
||||
`<meta charset="UTF-8"><meta name="viewport"content="width=device-width, initial-scale=1.0">` +
|
||||
`<title>YOU'RE PERMABANNED, IDIOT!</title><link rel="stylesheet"href="/css/global.css"/>` +
|
||||
`<link id="theme"rel="stylesheet"href="/css/pipes.css"/><link rel="shortcut icon"href="/favicon.png">` +
|
||||
`<script type="text/javascript"src="/js/consts.js"></script><script type="text/javascript"src="/js/gochan.js"></script>` +
|
||||
`</head><body><div id="topbar"><div class="topbar-section"><a href="/"class="topbar-item">home</a></div></div><div id="content">`,
|
||||
},
|
||||
{
|
||||
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: `<!DOCTYPE html><html lang="en"><head>` +
|
||||
`<meta charset="UTF-8"><meta name="viewport"content="width=device-width, initial-scale=1.0">` +
|
||||
`<title>YOU ARE BANNED:(</title><link rel="stylesheet"href="/css/global.css"/>` +
|
||||
`<link id="theme"rel="stylesheet"href="/css/pipes.css"/><link rel="shortcut icon"href="/favicon.png">` +
|
||||
`<script type="text/javascript"src="/js/consts.js"></script><script type="text/javascript"src="/js/gochan.js"></script>` +
|
||||
`</head><body><div id="topbar"><div class="topbar-section"><a href="/"class="topbar-item">home</a></div></div><div id="content">`,
|
||||
},
|
||||
{
|
||||
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: `<!DOCTYPE html><html lang="en">` +
|
||||
`<head><meta charset="UTF-8"><meta name="viewport"content="width=device-width, initial-scale=1.0">` +
|
||||
`<title>YOU ARE BANNED:(</title><link rel="stylesheet"href="/css/global.css"/>` +
|
||||
`<link id="theme"rel="stylesheet"href="/css/pipes.css"/><link rel="shortcut icon"href="/favicon.png">` +
|
||||
`<script type="text/javascript"src="/js/consts.js"></script><script type="text/javascript"src="/js/gochan.js"></script>` +
|
||||
`</head><body><div id="topbar"><div class="topbar-section"><a href="/"class="topbar-item">home</a></div></div><div id="content">`,
|
||||
},
|
||||
{
|
||||
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: `<!DOCTYPE html><html lang="en"><head>` +
|
||||
`<meta charset="UTF-8"><meta name="viewport"content="width=device-width, initial-scale=1.0">` +
|
||||
`<title>YOU ARE BANNED:(</title><link rel="stylesheet"href="/css/global.css"/>` +
|
||||
`<link id="theme"rel="stylesheet"href="/css/pipes.css"/><link rel="shortcut icon"href="/favicon.png">` +
|
||||
`<script type="text/javascript"src="/js/consts.js"></script><script type="text/javascript"src="/js/gochan.js"></script>` +
|
||||
`</head><body><div id="topbar"><div class="topbar-section"><a href="/"class="topbar-item">home</a></div></div><div id="content">`,
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue