complété test de requête joplin notebooks
This commit is contained in:
parent
382b315e96
commit
c3f97dc832
7
code/joplin_utils.nim
Normal file
7
code/joplin_utils.nim
Normal file
@ -0,0 +1,7 @@
|
||||
import std/[asyncdispatch, httpclient]
|
||||
|
||||
proc get_joplin_notebooks*(): Future[string] {.async.} =
|
||||
var client = newAsyncHttpClient()
|
||||
return await client.getContent("http://localhost:41184/folders?token=e5f6644fbf6a97ddc55648dae72b11caecda6c6642d8ce0d3b20129b89b196385737eb908923542c3343649ebbf865b55bda031ab4c3a16edc7723ef2ad77d8f")
|
||||
|
||||
# echo waitFor get_joplin_notebooks()
|
16
main.nim
16
main.nim
@ -11,7 +11,7 @@ import uri # We need to encode urls: encodeUrl()
|
||||
|
||||
import code/database_utils # Utils used in the database
|
||||
import code/password_utils # Our file with password utils
|
||||
|
||||
import code/joplin_utils
|
||||
|
||||
# First we'll load config files
|
||||
let dict = loadConfig("config/config.cfg")
|
||||
@ -139,6 +139,10 @@ proc logout(c: var TData) =
|
||||
const query = sql"DELETE FROM session WHERE ip = ? AND key = ?"
|
||||
exec(db, query, c.req.ip, c.req.cookies["sid"])
|
||||
|
||||
proc testproc(): string =
|
||||
result = ""
|
||||
result = "voici des infos de la proc testproc !"
|
||||
|
||||
|
||||
# Do the check inside our routes
|
||||
template createTFD() =
|
||||
@ -190,7 +194,7 @@ when isMainModule:
|
||||
#include "tmpl/main.tmpl"
|
||||
include "tmpl/user.tmpl"
|
||||
include "tmpl/website.tmpl"
|
||||
|
||||
include "tmpl/test.tmpl"
|
||||
|
||||
# Setup routes (URL's)
|
||||
routes:
|
||||
@ -225,3 +229,11 @@ routes:
|
||||
createTFD()
|
||||
logout(c)
|
||||
redirect("/")
|
||||
|
||||
get "/test_notebooks":
|
||||
createTFD()
|
||||
var all_notebooks = ""
|
||||
all_notebooks = waitFor get_joplin_notebooks()
|
||||
# info("route de test :")
|
||||
|
||||
resp test_notebooks(c, all_notebooks)
|
||||
|
@ -1,72 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<svg class="svg-icon" viewBox="0 0 20 20">
|
||||
<path
|
||||
d="M17.237,3.056H2.93c-0.694,0-1.263,0.568-1.263,1.263v8.837c0,0.694,0.568,1.263,1.263,1.263h4.629v0.879c-0.015,0.086-0.183,0.306-0.273,0.423c-0.223,0.293-0.455,0.592-0.293,0.92c0.07,0.139,0.226,0.303,0.577,0.303h4.819c0.208,0,0.696,0,0.862-0.379c0.162-0.37-0.124-0.682-0.374-0.955c-0.089-0.097-0.231-0.252-0.268-0.328v-0.862h4.629c0.694,0,1.263-0.568,1.263-1.263V4.319C18.5,3.625,17.932,3.056,17.237,3.056 M8.053,16.102C8.232,15.862,8.4,15.597,8.4,15.309v-0.89h3.366v0.89c0,0.303,0.211,0.562,0.419,0.793H8.053z M17.658,13.156c0,0.228-0.193,0.421-0.421,0.421H2.93c-0.228,0-0.421-0.193-0.421-0.421v-1.263h15.149V13.156z M17.658,11.052H2.509V4.319c0-0.228,0.193-0.421,0.421-0.421h14.308c0.228,0,0.421,0.193,0.421,0.421V11.052z">
|
||||
</path>
|
||||
</svg>
|
||||
|
||||
|
||||
<svg viewBox="0 0 24 24" preserveAspectRatio="xMidYMid meet" focusable="false" class="menu-icon">
|
||||
<g>
|
||||
<path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"></path>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
<svg class="sidebar-icon" viewBox="0 0 24 24" preserveAspectRatio="xMidYMid meet" focusable="false">
|
||||
<g>
|
||||
<path d="M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z"></path>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
|
||||
y="0px" width="489px" height="489.001px" viewBox="0 0 489 489.001" style="enable-background:new 0 0 489 489.001;"
|
||||
xml:space="preserve">
|
||||
<g>
|
||||
<path d="M355.768,0H86.218C53.33,0,26.577,26.753,26.577,59.636v369.729c0,32.883,26.752,59.636,59.641,59.636h316.566
|
||||
c32.889-0.001,59.641-26.754,59.641-59.637V109.16L355.768,0z M402.784,446.479H86.218c-9.437,0-17.119-7.678-17.119-17.113V59.636
|
||||
c0-9.437,7.683-17.114,17.119-17.114H334.86v47.604c0,21.043,17.109,38.162,38.152,38.375l46.891,0.477v300.388
|
||||
C419.903,438.801,412.219,446.479,402.784,446.479z" />
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -35,11 +35,11 @@ body {
|
||||
.login {
|
||||
font-size: large;
|
||||
fill: var(--blue-joplin-color);
|
||||
max-width: fit-content;
|
||||
/* max-width: fit-content; */
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
top: 30%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
transform: translate(-52%, -50%);
|
||||
|
||||
}
|
||||
|
||||
|
15
tmpl/test.tmpl
Normal file
15
tmpl/test.tmpl
Normal file
@ -0,0 +1,15 @@
|
||||
#? stdtmpl | standard
|
||||
#
|
||||
#proc test_notebooks(c: var TData, all_notebooks: var string): string =
|
||||
# result = ""
|
||||
|
||||
<html>
|
||||
<body>
|
||||
<!--<main class="content">Windows Info !! ${c.username} ${c.email}</main>-->
|
||||
<h3>
|
||||
${all_notebooks}
|
||||
</h3>
|
||||
</html>
|
||||
</body>
|
||||
|
||||
#end proc
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user