1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2025-07-27 11:09:48 +02:00

WIP: make code compatible with new SILK API
All checks were successful
gitea-sync/antd-web-apps/pipeline/head This commit looks good

This commit is contained in:
DanyLE
2023-04-26 18:51:03 +02:00
parent 93b6ca18ad
commit a76942f2f3
60 changed files with 1527 additions and 2845 deletions

View File

@ -1,6 +1,7 @@
<?lua
local chat_uri="https://chat.iohub.dev/comment"
local title = __main__:get("title")
local render = __main__:get("render")
local url = __main__:get("url")
@ -18,17 +19,20 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="<?=HTTP_ROOT?>/rst/ubuntu-regular.css" />
<link rel="stylesheet" type="text/css" href="<?=HTTP_ROOT?>/rst/font-awesome.css" />
<link rel="stylesheet" type="text/css" href="<?=HTTP_ROOT?>/rst/afx.css" />
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Ubuntu:regular,bold&subset=Latin" />
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" />
<link rel="stylesheet" type="text/css" href="<?=HTTP_ROOT?>/assets/afx.css" />
<link rel="stylesheet" type="text/css" href="<?=HTTP_ROOT?>/assets/style.css" />
<link rel="stylesheet" type="text/css" href="<?=HTTP_ROOT?>/assets/github-markdown.css" />
<link rel="stylesheet" type="text/css" href="https://chat.iohub.dev/assets/quicktalk.css" />
<script src="https://chat.iohub.dev/assets/quicktalk.js"> </script>
<!--link rel="stylesheet" type="text/css" href="https://app.iohub.dev/next/talk/assets/quicktalk.css" />
<script src="https://app.iohub.dev/next/talk/assets/quicktalk.js"> </script-->
<script src="<?=HTTP_ROOT?>/rst/afx.js"> </script>
<script src="<?=HTTP_ROOT?>/rst/gscripts/jquery-3.4.1.min.js"> </script>
<script src="<?=HTTP_ROOT?>/assets/afx.js"> </script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"> </script>
<script src="<?=HTTP_ROOT?>/assets/main.js"></script>
<?lua if d3 then ?>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/6.5.0/d3.min.js" ></script>
@ -41,8 +45,8 @@
<meta property="og:image" content="" />
<?lua if render then ?>
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@blog.lxsang.me" />
<meta name="twitter:creator" content="@lexsang" />
<meta name="twitter:site" content="@blog.iohub.dev" />
<meta name="twitter:creator" content="@DanyLE" />
<meta property="og:url" content="<?=url?>" />
<meta property="og:type" content="article" />
<meta property="og:title" content="<?=title?>" />
@ -54,9 +58,9 @@
<script src="<?=HTTP_ROOT?>/rst/katex/katex.min.js"> </script>
<script src="<?=HTTP_ROOT?>/rst/katex/auto-render.min.js"> </script>
<?lua else ?>
<meta property="og:url" content="https://blog.lxsang.me" />
<meta property="og:url" content="https://blog.iohub.dev" />
<meta property="og:type" content="article" />
<meta property="og:title" content="Xuan Sang LE's blog" />
<meta property="og:title" content="Dany LE's blog" />
<meta property="og:description" content="Blog Home" />
<?lua end ?>
<script>
@ -66,7 +70,7 @@
var options = {
target: "quick_talk_comment_thread",
page: "desktop",
api_uri: "https://chat.iohub.dev/comment",
api_uri: "<?=chat_uri?>",
uri: "<?=url?>",
author: {
first: "mrsang",
@ -122,22 +126,25 @@
<div id = "top">
<div id = "navbar" class = "<?=cls?>">
<div class = "logo"><a href = "https://lxsang.me"></a></div>
<div class = "logo"><a href = "https://iohub.dev"></a></div>
<ul>
<li><i class = "fa fa-home"></i><a href="<?=HTTP_ROOT?>">Home</a></li>
<?lua
if not HEADER.mobile then
?>
<li > <i class = "fa fa-globe"></i><a href = "/post/graph">Explore</a></li>
<li > <i class = "fa fa-globe"></i><a href = "<?=HTTP_ROOT?>/post/graph">Explore</a></li>
<li> <i class = "fa fa-paper-plane"></i><a href="#" onclick="subscribe('<?=HTTP_ROOT?>')">Subscribe</a></li>
<?lua end ?>
<li ><i class = "fa fa-address-card"></i><a href="https://info.lxsang.me" >Portfolio</a></li>
<li ><i class = "fa fa-address-card"></i><a href="https://info.iohub.dev" >Portfolio</a></li>
<li><i class = "fa fa-envelope"></i><a href="#" onclick="mailtoMe('<?=HTTP_ROOT?>')" >Contact</a></li>
</ul>
<?lua
if not HEADER.mobile then
?>
<input type = "text" class = "search-box"></input>
<form class="search-form" method="get" action="<?=HTTP_ROOT?>/post/search">
<input type = "text" class = "search-box" name="q"></input>
<input type="submit" hidden ></input>
</form>
<div class= "search-icon"></div>
<?lua
end

View File

@ -14,9 +14,9 @@
local atags = {}
local i = 1
for tag in data.tags:gmatch(",*([^,]+)") do
tag = std.trim(tag, " ")
tag = ulib.trim(tag, " ")
if tag ~= "" then
local b64tag = std.b64encode(tag)
local b64tag = enc.b64encode(tag)
atags[i] = '<a href = "'..HTTP_ROOT..'/post/bytag/'..b64tag:gsub("=","")..'/'..POST_LIMIT..'">'..tag.."</a>"
i = i+ 1
end

View File

@ -23,16 +23,16 @@
local atags = {}
local i = 1
for tag in data.tags:gmatch(",*([^,]+)") do
tag = std.trim(tag, " ")
tag = ulib.trim(tag, " ")
if tag ~= "" then
local b64tag = std.b64encode(tag)
local b64tag = enc.b64encode(tag)
atags[i] = '<a href = "'..HTTP_ROOT..'/post/bytag/'..b64tag:gsub("=","")..'/'..POST_LIMIT..'">'..tag.."</a>"
i = i+ 1
end
end
echo(table.concat(atags, ", "))
local url = HTTP_ROOT.."/post/id/"..data.id
local old_url = HTTP_ROOT.."/r:id:"..data.id
local url = HTTP_ROOT.."/post/id/"..string.format("%d",data.id)
local old_url = HTTP_ROOT.."/r:id:"..string.format("%d",data.id)
?>
</span>
<!--div class="fb-like" data-href="<?=old_url?>" data-layout="button_count" data-action="like" data-size="small" data-show-faces="true" data-share="true"></div-->
@ -58,7 +58,7 @@
end
if title then
echo(content:sub(0, b))
echo("<a class = 'title_link' href='"..HTTP_ROOT.."/post/id/"..data.id.."'>"..title.."</a>")
echo("<a class = 'title_link' href='"..url.."'>"..title.."</a>")
echo(content:sub(c))
else
echo(content)
@ -67,18 +67,18 @@
</div>
<div class = "detail">
<span></span>
<?='<a href="'..HTTP_ROOT..'/post/id/'..data.id..'" ></a>'?>
<?='<a href="'..url..'" ></a>'?>
<span></span>
</div>
</div>
</div>
<?lua
end
local beforelk = HTTP_ROOT.."/post/beforeof/"..first_id.."/"..POST_LIMIT
local afterlk = HTTP_ROOT.."/post/afterof/"..last_id.."/"..POST_LIMIT
local beforelk = HTTP_ROOT.."/post/beforeof/"..string.format("%d",first_id).."/"..POST_LIMIT
local afterlk = HTTP_ROOT.."/post/afterof/"..string.format("%d",last_id).."/"..POST_LIMIT
if action == "bytag" or action == "search" then
beforelk = HTTP_ROOT.."/post/"..action.."/"..query.."/"..POST_LIMIT.."/before/"..first_id
afterlk = HTTP_ROOT.."/post/"..action.."/"..query.."/"..POST_LIMIT.."/after/"..last_id
beforelk = HTTP_ROOT.."/post/"..action.."/"..query.."/"..POST_LIMIT.."/before/"..string.format("%d",first_id)
afterlk = HTTP_ROOT.."/post/"..action.."/"..query.."/"..POST_LIMIT.."/after/"..string.format("%d",last_id)
end
?>
<div class = "time-travel">

View File

@ -0,0 +1,17 @@
<div class="search-result">
<h2>Posts matched for query: <?=REQUEST.q?></h2>
<ul>
<?lua
for i,v in ipairs(result) do
?>
<li>
<p class="title">
<b>Score <?=string.format("%.3f",v[2])?></b> <a href="<?=HTTP_ROOT?>/post/id/<?=v[3].id?>"><?=v[3].title?></a>
</p>
<p class="preview">
<?=v[3].content?>...
</p>
</li>
<?lua end ?>
</ul>
</div>