Rearranges directories and files.
This commit is contained in:
parent
41a6790fe8
commit
8518c70a66
40 changed files with 43 additions and 32 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
|
@ -1,3 +1,6 @@
|
|||
[submodule "frontend/spectre"]
|
||||
path = frontend/spectre
|
||||
url = https://github.com/picturepan2/spectre
|
||||
[submodule "public/css/spectre"]
|
||||
path = public/css/spectre
|
||||
url = https://github.com/picturepan2/spectre
|
||||
|
|
|
|||
19
editdb.nim
19
editdb.nim
|
|
@ -1,19 +0,0 @@
|
|||
|
||||
import strutils, db_sqlite, ranks
|
||||
|
||||
var db = open(connection="nimforum.db", user="postgres", password="",
|
||||
database="nimforum")
|
||||
|
||||
when false:
|
||||
db.exec(sql("update person set status = ?"), $User)
|
||||
db.exec(sql("update person set status = ? where ban <> ''"), $Troll)
|
||||
db.exec(sql("update person set status = ? where ban like '%spam%'"), $Spammer)
|
||||
db.exec(sql("update person set status = ? where ban = 'DEACTIVATED' or ban = 'EMAILCONFIRMATION'"), $EmailUnconfirmed)
|
||||
db.exec(sql("update person set status = ? where admin = 'true'"), $Admin)
|
||||
else:
|
||||
db.exec sql"create index PersonStatusIdx on person(status);"
|
||||
db.exec sql"create index PostByAuthorIdx on post(thread, author);"
|
||||
db.exec sql"update person set name = 'cheatfate' where name = 'ka';"
|
||||
|
||||
|
||||
close(db)
|
||||
|
|
@ -1,11 +1,32 @@
|
|||
[Package]
|
||||
name = "nimforum"
|
||||
# Package
|
||||
version = "0.1.0"
|
||||
author = "Dominik Picheta"
|
||||
description = "Nim forum"
|
||||
description = "The Nim forum"
|
||||
license = "MIT"
|
||||
|
||||
bin = "forum"
|
||||
srcDir = "src"
|
||||
|
||||
[Deps]
|
||||
Requires: "nim >= 0.14.0, jester#head, bcrypt#head, recaptcha >= 1.0.0"
|
||||
bin = @["forum"]
|
||||
|
||||
skipExt = @["nim"]
|
||||
|
||||
# Dependencies
|
||||
|
||||
requires "nim >= 0.14.0"
|
||||
requires "jester#head"
|
||||
requires "bcrypt#head"
|
||||
requires "recaptcha >= 1.0.0"
|
||||
requires "sass"
|
||||
|
||||
requires "karax"
|
||||
|
||||
# Tasks
|
||||
|
||||
task backend, "Runs the forum backend":
|
||||
exec "nimble c src/forum.nim"
|
||||
exec "./src/forum"
|
||||
|
||||
task frontend, "Builds the necessary JS frontend":
|
||||
exec "nimble js src/frontend/forum.nim"
|
||||
mkDir "public/js"
|
||||
cpFile "src/frontend/nimcache/forum.js", "public/js/forum.js"
|
||||
|
|
@ -13,6 +13,8 @@ import
|
|||
import cgi except setCookie
|
||||
import options
|
||||
|
||||
import sass
|
||||
|
||||
import auth
|
||||
|
||||
import frontend/threadlist except User
|
||||
|
|
@ -866,6 +868,10 @@ proc initialise() =
|
|||
doAssert config.isDev, "Recaptcha required for production!"
|
||||
echo("[WARNING] No recaptcha secret key specified.")
|
||||
|
||||
let cssLoc = "public" / "css"
|
||||
if not existsFile(cssLoc / "nimforum.css"):
|
||||
sass.compileFile(cssLoc / "nimforum.scss", cssLoc / "nimforum.css")
|
||||
|
||||
template createTFD() =
|
||||
var c {.inject.}: TForumData
|
||||
new(c)
|
||||
|
|
@ -1252,11 +1258,11 @@ initialise()
|
|||
routes:
|
||||
|
||||
get "/nimforum.css":
|
||||
resp readFile("frontend/nimforum.css"), "text/css"
|
||||
resp readFile("public/css/nimforum.css"), "text/css"
|
||||
get "/nimcache/forum.js":
|
||||
resp readFile("frontend/nimcache/forum.js"), "application/javascript"
|
||||
resp readFile("public/js/forum.js"), "application/javascript"
|
||||
get re"/images/(.+?\.png)/?":
|
||||
let path = "frontend/images/" & request.matches[0]
|
||||
let path = "public/images/" & request.matches[0]
|
||||
if fileExists(path):
|
||||
resp readFile(path), "image/png"
|
||||
else:
|
||||
|
|
@ -1724,10 +1730,10 @@ routes:
|
|||
redirect uri("/404")
|
||||
|
||||
get "/404":
|
||||
resp Http404, readFile("frontend/karax.html")
|
||||
resp Http404, readFile("public/karax.html")
|
||||
|
||||
get re"/(.+)?":
|
||||
resp readFile("frontend/karax.html")
|
||||
resp readFile("public/karax.html")
|
||||
|
||||
get "/threadActivity.xml":
|
||||
createTFD()
|
||||
|
|
@ -1870,10 +1876,10 @@ routes:
|
|||
else:
|
||||
resp genMain(c, genFormResetPassword(c), "Reset Password - Nim Forum")
|
||||
|
||||
const licenseRst = slurp("static/license.rst")
|
||||
get "/license":
|
||||
createTFD()
|
||||
resp genMain(c, rstToHtml(licenseRst), "Content license - Nim Forum")
|
||||
resp genMain(c, rstToHtml(readFile("static/license.rst")),
|
||||
"Content license - Nim Forum")
|
||||
|
||||
post "/search/?@page?":
|
||||
cond isFTSAvailable
|
||||
Loading…
Add table
Add a link
Reference in a new issue