Fixes for new_async version of Jester.
This commit is contained in:
parent
42e74d230d
commit
fbd8f057bb
4 changed files with 172 additions and 156 deletions
|
|
@ -11,7 +11,7 @@ import cairo, os, strutils, jester
|
||||||
proc getCaptchaFilename*(i: int): string {.inline.} =
|
proc getCaptchaFilename*(i: int): string {.inline.} =
|
||||||
result = "public/captchas/capture_" & $i & ".png"
|
result = "public/captchas/capture_" & $i & ".png"
|
||||||
|
|
||||||
proc getCaptchaUrl*(req: var TRequest, i: int): string =
|
proc getCaptchaUrl*(req: PRequest, i: int): string =
|
||||||
result = req.makeUri("/captchas/capture_" & $i & ".png", absolute = false)
|
result = req.makeUri("/captchas/capture_" & $i & ".png", absolute = false)
|
||||||
|
|
||||||
proc createCaptcha*(file, text: string) =
|
proc createCaptcha*(file, text: string) =
|
||||||
|
|
|
||||||
12
forum.nim
12
forum.nim
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
import
|
import
|
||||||
os, strutils, times, md5, strtabs, cgi, math, db_sqlite, matchers,
|
os, strutils, times, md5, strtabs, cgi, math, db_sqlite, matchers,
|
||||||
rst, rstgen, captchas, sockets, scgi, jester
|
rst, rstgen, captchas, scgi, jester, asyncdispatch, asyncnet
|
||||||
|
|
||||||
from htmlgen import tr, th, td, span
|
from htmlgen import tr, th, td, span
|
||||||
|
|
||||||
|
|
@ -33,7 +33,7 @@ type
|
||||||
TPost = tuple[subject, content: string]
|
TPost = tuple[subject, content: string]
|
||||||
|
|
||||||
TForumData = object of TSession
|
TForumData = object of TSession
|
||||||
req: TRequest
|
req: PRequest
|
||||||
userid: string
|
userid: string
|
||||||
actionContent: string
|
actionContent: string
|
||||||
errorMsg, loginErrorMsg: string
|
errorMsg, loginErrorMsg: string
|
||||||
|
|
@ -651,6 +651,7 @@ template createTFD(): stmt =
|
||||||
if request.cookies.len > 0:
|
if request.cookies.len > 0:
|
||||||
checkLoggedIn(c)
|
checkLoggedIn(c)
|
||||||
|
|
||||||
|
routes:
|
||||||
get "/":
|
get "/":
|
||||||
createTFD()
|
createTFD()
|
||||||
c.isThreadsList = true
|
c.isThreadsList = true
|
||||||
|
|
@ -822,6 +823,11 @@ when isMainModule:
|
||||||
if paramCount() > 0:
|
if paramCount() > 0:
|
||||||
if paramStr(1) == "scgi":
|
if paramStr(1) == "scgi":
|
||||||
http = false
|
http = false
|
||||||
run("", port = TPort(9000), http = http)
|
|
||||||
|
#run("", port = TPort(9000), http = http)
|
||||||
|
var settings = newSettings()
|
||||||
|
settings.port = TPort(8080)
|
||||||
|
jester.serve(settings, match)
|
||||||
|
runForever()
|
||||||
db.close()
|
db.close()
|
||||||
|
|
||||||
|
|
|
||||||
11
nimforum.babel
Normal file
11
nimforum.babel
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
[Package]
|
||||||
|
name = "nimforum"
|
||||||
|
version = "0.1.0"
|
||||||
|
author = "Dominik Picheta"
|
||||||
|
description = "Nimrod forum"
|
||||||
|
license = "MIT"
|
||||||
|
|
||||||
|
bin = "forum"
|
||||||
|
|
||||||
|
[Deps]
|
||||||
|
Requires: "nimrod >= 0.9.2, cairo#head, jester#head"
|
||||||
|
|
@ -3,4 +3,3 @@
|
||||||
--path:"$nimrod/lib/packages/docutils"
|
--path:"$nimrod/lib/packages/docutils"
|
||||||
|
|
||||||
--path:"$nimrod"
|
--path:"$nimrod"
|
||||||
--path:"../jester"
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue