1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2024-11-20 02:18:20 +01:00

update: working version compatible with the latest version of silk and antd
All checks were successful
gitea-sync/antd-web-apps/pipeline/head This commit looks good

This commit is contained in:
DanyLE 2023-05-22 13:53:41 +02:00
parent a05507123c
commit b65bee0323
8 changed files with 23 additions and 30 deletions

View File

@ -7,8 +7,8 @@ require("silk.api")
-- crypto lib
enc = require("enc")
WWW_ROOT = __ROOT__.."/blog"
-- TODO: change me
DB_FILE = "/home/dany/databases/mrsang.db"
DB_LOC="/opt/www/databases"
DB_FILE = DB_LOC.."/mrsang.db"
-- add aditional paths
package.path = package.path..";"..WWW_ROOT .. '/?.lua'
@ -18,8 +18,7 @@ if HEADER.Host then
else
HTTP_ROOT = "https://blog.iohub.dev"
end
-- TODO remove me
HTTP_ROOT = HTTP_ROOT.."/next/blog"
CONTROLLER_ROOT = "blog.controllers"
MODEL_ROOT = "blog.models"
-- file path: path/to/file

View File

@ -1,7 +1,6 @@
BaseController:subclass("IndexController")
function IndexController:index(...)
-- TODO: add description to router
local file = io.open(DOC_COVER, "r")
if file then
local content = ""

View File

@ -14,8 +14,7 @@ if HEADER.Host then
else
HTTP_ROOT = "https://doc.iohub.dev"
end
-- TODO remove me
HTTP_ROOT = HTTP_ROOT.."/next/doc"
-- class path: path.to.class
CONTROLLER_ROOT = "doc.controllers"
@ -23,8 +22,7 @@ MODEL_ROOT = "doc.models"
-- file path: path/to/file
VIEW_ROOT = WWW_ROOT..DIR_SEP.."views"
-- TODO change me
DOC_DIR = "/home/dany/doc"
DOC_DIR = "/opt/www/doc"
DOC_COVER = DOC_DIR.."/library.md"
package.path = package.path..";"..__ROOT__.."/os/libs/?.lua"

View File

@ -154,7 +154,7 @@ end
</div>
<div id = "bottom">
Powered by antd server, (c) 2019 - <?=os.date("*t").year?> Xuan Sang LE
Powered by antd server, (c) 2019 - <?=os.date("*t").year?> Dany LE
</div>
<script>
const toc_class_toggle = () => {

View File

@ -11,8 +11,8 @@ if HEADER.Host then
else
HTTP_ROOT = "https://info.iohub.dev"
end
-- TODO remove me
HTTP_ROOT = HTTP_ROOT.."/next/info"
DB_LOC="/opt/www/databases"
CONTROLLER_ROOT = "info.controllers"
MODEL_ROOT = "info.models"
@ -25,9 +25,10 @@ local REGISTRY = {}
-- set logging level
REGISTRY.logger = Logger:new{ level = Logger.INFO}
REGISTRY.users_allowed = { phuong = true, mrsang = true, dany = true }
-- TODO change me
REGISTRY.user = "dany"
REGISTRY.dbfile = "/home/"..REGISTRY.user.."/databases/"..REGISTRY.user..".db"
REGISTRY.user = "mrsang"
REGISTRY.dbfile = DB_LOC.."/"..REGISTRY.user..".db"
REGISTRY.db = DBModel:new{db=REGISTRY.dbfile}
REGISTRY.layout = 'default'
@ -72,7 +73,7 @@ function NotfoundController:index(...)
REQUEST.r = ulib.trim(REQUEST.r:gsub(user, ""), "/")
if REGISTRY.db then REGISTRY.db:close() end
REGISTRY.user = user
REGISTRY.dbfile = "/home/"..REGISTRY.user.."/databases/"..REGISTRY.user..".db"
REGISTRY.dbfile = DB_LOC.."/"..REGISTRY.user..".db"
REGISTRY.db = DBModel:new{db=REGISTRY.dbfile}
REGISTRY.db:open()
router:delegate()

View File

@ -1,7 +1,7 @@
<html>
<head>
<script type="text/javascript" src="<?=HTTP_ROOT?>/rst/gscripts/showdown.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/showdown/2.1.0/showdown.min.js"></script>
<link rel="stylesheet" type="text/css" href="<?=HTTP_ROOT?>/style.css" />
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" />

View File

@ -54,8 +54,7 @@ function CommentController:index(...)
data.children = {}
-- find all the replies to this thread
local sub_comments, suborder =
self.comment:find(
{
self.comment:find({
where = {
pid = pid,
rid = data.id

View File

@ -7,8 +7,8 @@ require("silk.api")
-- crypto lib
enc = require("enc")
WWW_ROOT = __ROOT__.."/talk"
-- TODO change me
DB_FILE = "/home/dany/databases/quicktalk.db"
DB_LOC="/opt/www/databases"
DB_FILE = DB_LOC.."/quicktalk.db"
function fail(msg)
std.json()
std.t(JSON.encode({error = msg}))
@ -25,9 +25,6 @@ else
HTTP_ROOT = "https://talk.iohub.dev"
end
-- TODO remove me
HTTP_ROOT = HTTP_ROOT.."/next/talk"
-- class path: path.to.class
CONTROLLER_ROOT = "talk.controllers"
MODEL_ROOT = "talk.models"