Fix issues compiling and testing
This commit is contained in:
parent
4e1b906b49
commit
41a1a36dbf
6 changed files with 37 additions and 15 deletions
20
README.md
20
README.md
|
|
@ -63,6 +63,26 @@ test Runs tester
|
||||||
fasttest Runs tester without recompiling backend
|
fasttest Runs tester without recompiling backend
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To get up and running:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/nim-lang/nimforum
|
||||||
|
cd nimforum
|
||||||
|
git submodule update --init --recursive
|
||||||
|
|
||||||
|
nimble install
|
||||||
|
|
||||||
|
# Setup the db with user: admin, pass: admin and some other users
|
||||||
|
nimble devdb
|
||||||
|
|
||||||
|
# Run this again if frontend code changes
|
||||||
|
nimble frontend
|
||||||
|
|
||||||
|
# Will start a server at localhost:5000
|
||||||
|
nimble backend
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
Development typically involves running `nimble devdb` which sets up the
|
Development typically involves running `nimble devdb` which sets up the
|
||||||
database for development and testing, then `nimble backend`
|
database for development and testing, then `nimble backend`
|
||||||
which compiles and runs the forum's backend, and `nimble frontend`
|
which compiles and runs the forum's backend, and `nimble frontend`
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# Package
|
# Package
|
||||||
version = "2.0.1"
|
version = "2.1.0"
|
||||||
author = "Dominik Picheta"
|
author = "Dominik Picheta"
|
||||||
description = "The Nim forum"
|
description = "The Nim forum"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
@ -13,13 +13,13 @@ skipExt = @["nim"]
|
||||||
# Dependencies
|
# Dependencies
|
||||||
|
|
||||||
requires "nim >= 0.18.1"
|
requires "nim >= 0.18.1"
|
||||||
requires "jester 0.4.0"
|
requires "jester#22f8240"
|
||||||
requires "bcrypt#head"
|
requires "bcrypt#head"
|
||||||
requires "hmac#9c61ebe2fd134cf97"
|
requires "hmac#9c61ebe2fd134cf97"
|
||||||
requires "recaptcha 1.0.2"
|
requires "recaptcha 1.0.2"
|
||||||
requires "sass#649e0701fa5c"
|
requires "sass#649e0701fa5c"
|
||||||
|
|
||||||
requires "karax#d8df257dd"
|
requires "karax#c8c7b13"
|
||||||
|
|
||||||
requires "webdriver#20f3c1b"
|
requires "webdriver#20f3c1b"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,13 +71,13 @@ when isMainModule:
|
||||||
"test",
|
"test",
|
||||||
"$2a$08$bY85AhoD1e9u0IsD9sM7Ee6kFSLeXRLxJ6rMgfb1wDnU9liaymoTG",
|
"$2a$08$bY85AhoD1e9u0IsD9sM7Ee6kFSLeXRLxJ6rMgfb1wDnU9liaymoTG",
|
||||||
1526908753,
|
1526908753,
|
||||||
"*B2a] IL\"~sh)q-GBd/i$^>.TL]PR~>1IX>Fp-:M3pCm^cFD\um"
|
"*B2a] IL\"~sh)q-GBd/i$^>.TL]PR~>1IX>Fp-:M3pCm^cFD\\um"
|
||||||
)
|
)
|
||||||
let ident2 = makeIdentHash(
|
let ident2 = makeIdentHash(
|
||||||
"test",
|
"test",
|
||||||
"$2a$08$bY85AhoD1e9u0IsD9sM7Ee6kFSLeXRLxJ6rMgfb1wDnU9liaymoTG",
|
"$2a$08$bY85AhoD1e9u0IsD9sM7Ee6kFSLeXRLxJ6rMgfb1wDnU9liaymoTG",
|
||||||
1526908753,
|
1526908753,
|
||||||
"*B2a] IL\"~sh)q-GBd/i$^>.TL]PR~>1IX>Fp-:M3pCm^cFD\um"
|
"*B2a] IL\"~sh)q-GBd/i$^>.TL]PR~>1IX>Fp-:M3pCm^cFD\\um"
|
||||||
)
|
)
|
||||||
doAssert ident == ident2
|
doAssert ident == ident2
|
||||||
|
|
||||||
|
|
@ -85,6 +85,6 @@ when isMainModule:
|
||||||
"test",
|
"test",
|
||||||
"$2a$08$bY85AhoD1e9u0IsD9sM7Ee6kFSLeXRLxJ6rMgfb1wDnU9liaymoTG",
|
"$2a$08$bY85AhoD1e9u0IsD9sM7Ee6kFSLeXRLxJ6rMgfb1wDnU9liaymoTG",
|
||||||
1526908754,
|
1526908754,
|
||||||
"*B2a] IL\"~sh)q-GBd/i$^>.TL]PR~>1IX>Fp-:M3pCm^cFD\um"
|
"*B2a] IL\"~sh)q-GBd/i$^>.TL]PR~>1IX>Fp-:M3pCm^cFD\\um"
|
||||||
)
|
)
|
||||||
doAssert ident != invalid
|
doAssert ident != invalid
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
import system except Thread
|
import system except Thread
|
||||||
import
|
import
|
||||||
os, strutils, times, md5, strtabs, math, db_sqlite,
|
os, strutils, times, md5, strtabs, math, db_sqlite,
|
||||||
scgi, jester, asyncdispatch, asyncnet, sequtils,
|
jester, asyncdispatch, asyncnet, sequtils,
|
||||||
parseutils, random, rst, recaptcha, json, re, sugar,
|
parseutils, random, rst, recaptcha, json, re, sugar,
|
||||||
strformat, logging
|
strformat, logging
|
||||||
import cgi except setCookie
|
import cgi except setCookie
|
||||||
|
|
@ -76,7 +76,6 @@ proc getGravatarUrl(email: string, size = 80): string =
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
template `||`(x: untyped): untyped = (if not isNil(x): x else: "")
|
|
||||||
|
|
||||||
proc validateCaptcha(recaptchaResp, ip: string) {.async.} =
|
proc validateCaptcha(recaptchaResp, ip: string) {.async.} =
|
||||||
# captcha validation:
|
# captcha validation:
|
||||||
|
|
@ -133,9 +132,9 @@ proc checkLoggedIn(c: TForumData) =
|
||||||
|
|
||||||
let row = getRow(db,
|
let row = getRow(db,
|
||||||
sql"select name, email, status from person where id = ?", c.userid)
|
sql"select name, email, status from person where id = ?", c.userid)
|
||||||
c.username = ||row[0]
|
c.username = row[0]
|
||||||
c.email = ||row[1]
|
c.email = row[1]
|
||||||
c.rank = parseEnum[Rank](||row[2])
|
c.rank = parseEnum[Rank](row[2])
|
||||||
|
|
||||||
# In order to handle the "last visit" line appropriately, i.e.
|
# In order to handle the "last visit" line appropriately, i.e.
|
||||||
# it shouldn't disappear after a refresh, we need to manage a
|
# it shouldn't disappear after a refresh, we need to manage a
|
||||||
|
|
@ -463,7 +462,7 @@ proc executeReply(c: TForumData, threadId: int, content: string,
|
||||||
crud(crCreate, "post", "author", "ip", "content", "thread", "replyingTo"),
|
crud(crCreate, "post", "author", "ip", "content", "thread", "replyingTo"),
|
||||||
c.userId, c.req.ip, content, $threadId,
|
c.userId, c.req.ip, content, $threadId,
|
||||||
if replyingTo.isSome(): $replyingTo.get()
|
if replyingTo.isSome(): $replyingTo.get()
|
||||||
else: nil
|
else: ""
|
||||||
)
|
)
|
||||||
discard tryExec(
|
discard tryExec(
|
||||||
db,
|
db,
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ when defined(js):
|
||||||
if user.isNone(): return not thread.isModerated
|
if user.isNone(): return not thread.isModerated
|
||||||
|
|
||||||
let rank = user.get().rank
|
let rank = user.get().rank
|
||||||
if rank < Moderator and thread.isModerated:
|
if rank < Rank.Moderator and thread.isModerated:
|
||||||
return thread.author == user.get()
|
return thread.author == user.get()
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ template withBackend(body: untyped): untyped =
|
||||||
|
|
||||||
import browsertests/[scenario1, threads, issue181, categories]
|
import browsertests/[scenario1, threads, issue181, categories]
|
||||||
|
|
||||||
when isMainModule:
|
proc main() =
|
||||||
spawn runProcess("geckodriver -p 4444 --log config")
|
spawn runProcess("geckodriver -p 4444 --log config")
|
||||||
defer:
|
defer:
|
||||||
discard execCmd("killall geckodriver")
|
discard execCmd("killall geckodriver")
|
||||||
|
|
@ -71,3 +71,6 @@ when isMainModule:
|
||||||
except:
|
except:
|
||||||
sleep(10000) # See if we can grab any more output.
|
sleep(10000) # See if we can grab any more output.
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
when isMainModule:
|
||||||
|
main()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue