ajout de commentaires au code.

This commit is contained in:
2022-08-10 01:59:10 -04:00
parent eca736bba6
commit 67f571860e
14 changed files with 306 additions and 30 deletions
+10 -1
View File
@@ -1,4 +1,13 @@
# Copyright 2019 - Thomas T. Jarløv
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
# Bruno Charest
# 2022-08-09
#
# __ DESCRIPTIONS __
# database_utils : procedure related to database
#
# Inspiration of : https://ttj.dk/blog/2019/01/20/setup-a-website-with-nim
# Copyright 2019 - Thomas T. Jarløv
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
# import db_sqlite, os, parsecfg, strutils, logging
import db_sqlite, os, parsecfg, logging
+9
View File
@@ -1,3 +1,12 @@
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
# Bruno Charest
# 2022-08-09
#
# __ DESCRIPTIONS __
# joplin_json_utils : Types and procedure related to json request
#
# [TODO] joplin_json_utils : need to create many procedures
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
# Data structure for TAGS
type Tag = object
+71 -5
View File
@@ -1,10 +1,24 @@
import std/[asyncdispatch, httpclient]
import std/json
import std/options
import strformat
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
# Bruno Charest
# 2022-08-09
#
# __ DESCRIPTIONS __
# joplin_utils : procedure related joplin application
#
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
import net
import times
import osproc
import jester
import std/json
import httpcore
import strutils
import strformat
import std/options
from os import sleep
import httpcore, net, times, strutils
import std/[asyncdispatch, httpclient]
# Setup joplin_ping data
type
@@ -224,6 +238,58 @@ proc get_joplin_tags*(token:string): Future[joplin_tags] {.async.} =
return j_tags
# get the token from Joplin Terminal
proc get_joplin_cli_token*(): string =
var flagName: string = ""
var flagValue: string = ""
var result = execCmdEx("joplin config api.token")
if result.exitCode == 0:
let param1 = result.output
let flagSplit = param1.split(" = ")
flagName = flagSplit[0]
flagValue = flagSplit[1]
return flagValue
# start Joplin Terminal
proc joplin_cli_start*(): bool =
var rc = false
var result = execCmdEx("joplin server start &")
if result.exitCode == 0:
echo result.output
rc = true
else:
rc = false
return rc
# check Joplin Terminal staus
proc joplin_cli_status*(): bool =
var rc = false
var result = execCmdEx("joplin server status")
if result.exitCode == 0:
echo result.output
rc = true
else:
rc = false
return rc
# stop Joplin Terminal
proc joplin_cli_stop*(): bool =
var rc = false
var result = execCmdEx("joplin server stop")
if result.exitCode == 0:
echo result.output
rc = true
else:
rc = false
return rc
# proc get_joplin_tags_json*(token:string): Future[] {.async.} =
+13 -3
View File
@@ -1,8 +1,18 @@
# Copyright 2019 - Thomas T. Jarløv
# Credit Nimforum - https://github.com/nim-lang/nimforum
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
# Bruno Charest
# 2022-08-09
#
# __ DESCRIPTIONS __
# password_utils : procedure related password
#
# Inspiration of : https://ttj.dk/blog/2019/01/20/setup-a-website-with-nim
# Copyright 2019 - Thomas T. Jarløv
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
# import md5, bcrypt, math, random, os
import md5, bcrypt, random
import md5
import bcrypt
import random
randomize()
var urandom: File
+17 -1
View File
@@ -1,10 +1,26 @@
import joplin_utils
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
# Bruno Charest
# 2022-08-09
#
# __ DESCRIPTIONS __
# web_utils : procedure related web interface
#
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
import jester
import joplin_utils
# --==--==--==--==--==--==--==--==--==--==-- #
# TYPE : Selected Option for master web page
# --==--==--==--==--==--==--==--==--==--==-- #
type
selectedOption* = enum
newNote="New Note", search="Search", shortcuts="Shortcuts", notes="Notes", notebooks="Notesbooks", tags="Tags"
# --==--==--==--==--==--==--==--==--==--==-- #
# TYPE : Data Informations for Left Colomn
# --==--==--==--==--==--==--==--==--==--==-- #
type ColomnLeftData* = ref object of RootObj
j_status*: bool
option*: selectedOption