almost done with /search
+ search by tags + fixed "$$" beeing replaced with "$" in filestuff.js - added some testing posts admin.js + added "." password as "nologin" ( if password is "." you cant login ( its going to be replaced with actual setting in config/config.yaml ) ) TODO: - search bar in menubar - make "search_enable" setting affect /search & tag links - remove "search_only_tags" as im not implementing full body search anytime soonmaster
parent
601a161099
commit
dd473f495a
|
@ -1 +1 @@
|
|||
passhash: jGl25bVBBBW96Qi9Te4V37Fnqchz/Eu4qB9vKrRIqRg=
|
||||
passhash: zbTuKuppzGqDMxu+ltwsqpopnSEynvsDNvwCqC4YOag=
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
$(document).ready(() => {
|
||||
results = []
|
||||
for ( let i = 0 ; i < searchDATA.length ; i++ ) {
|
||||
for ( let i = 0 ; i < searchDATA.sd.length ; i++ ) {
|
||||
// generate shorted description:
|
||||
let desc = ""
|
||||
let d = searchDATA[i].desc.split(" ")
|
||||
let d = searchDATA.sd[i].desc.split(" ")
|
||||
for( let i = 0 ; i < 10 ; i ++ ) {
|
||||
desc += d[i] + " "
|
||||
}
|
||||
desc += "..."
|
||||
|
||||
results.push( new entry( searchDATA[i].title, searchDATA[i].author, desc, "", searchDATA[i].tags, searchDATA[i].id, searchDATA[i].rating ) )
|
||||
results.push( new entry( searchDATA.sd[i].title, searchDATA.sd[i].author, desc, "", searchDATA.sd[i].tags, searchDATA.sd[i].id, searchDATA.sd[i].rating ) )
|
||||
results[results.length-1].appendto(".content")
|
||||
console.log("loop")
|
||||
}
|
||||
|
||||
$(".subtitle.search").html(searchDATA.arg.join(", "))
|
||||
})
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
<div class="entrybox">
|
||||
<div class="entry metaentry">
|
||||
<div class="title">search</div>
|
||||
<div class="subtitle search">placeholder for search params</div>
|
||||
<div class="subtitle search"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
25
logs/log.log
25
logs/log.log
|
@ -1600,3 +1600,28 @@ err, crashed!"
|
|||
1629587475660 | Reading post 2
|
||||
1629587476646 | Reading comments from post "2", with length: undefined
|
||||
1629587478649 | Trying to vote on post: 2; and vote: -; iptkn: 4752029791258578; ip: 82.207.236.116;
|
||||
--- SEPERATOR ---
|
||||
--- SEPERATOR ---
|
||||
--- SEPERATOR ---
|
||||
--- SEPERATOR ---
|
||||
1629669522494 | Dumping config:
|
||||
1629669522500 | {"debug":false,"logging":1337,"logfile":"logs/log.log","ipget_endpoint_set":"//derzombiiie.com/getip.php?settoken=${TOKEN}","ipget_endpoint_get":"//derzombiiie.com/getip.php?token=${TOKEN}","cl":true,"site_name":"blog.derzombiiie.com","search_enable":false,"search_only_tags":true,"commenting_enabled":true,"post_ranking_auto":43200,"index_post_sort":"new","comment_sync_on_write":false,"comment_auto_sync":360}
|
||||
1629669553756 | Reading posts sorted by "new" with a length of 10
|
||||
1629669590850 | Reading post 0
|
||||
1629669591245 | Reading comments from post "0", with length: undefined
|
||||
1629669592410 | Trying to vote on post: 0; and vote: +; iptkn: 6332908487673150; ip: 87.123.198.233;
|
||||
1629669600218 | searching stuff by tags "$$$" and sorting "undefined"
|
||||
--- SEPERATOR ---
|
||||
1629670234769 | Dumping config:
|
||||
1629670234776 | {"debug":false,"logging":1337,"logfile":"logs/log.log","ipget_endpoint_set":"//derzombiiie.com/getip.php?settoken=${TOKEN}","ipget_endpoint_get":"//derzombiiie.com/getip.php?token=${TOKEN}","cl":true,"site_name":"blog.derzombiiie.com","search_enable":false,"search_only_tags":true,"commenting_enabled":true,"post_ranking_auto":43200,"index_post_sort":"new","comment_sync_on_write":false,"comment_auto_sync":360}
|
||||
1629670293840 | Reading posts sorted by "new" with a length of 10
|
||||
--- SEPERATOR ---
|
||||
--- SEPERATOR ---
|
||||
--- SEPERATOR ---
|
||||
--- SEPERATOR ---
|
||||
--- SEPERATOR ---
|
||||
--- SEPERATOR ---
|
||||
--- SEPERATOR ---
|
||||
--- SEPERATOR ---
|
||||
--- SEPERATOR ---
|
||||
--- SEPERATOR ---
|
||||
|
|
|
@ -34,7 +34,7 @@ this.pre = (req, res, next) => {
|
|||
const auth = ( req.headers.authorization || "" ).split(" ")[1] || ""
|
||||
const [user, pass] = Buffer.from(auth, "base64").toString().split(":")
|
||||
|
||||
if( user != "admin" || !this.pass( pass ) ) {
|
||||
if( user != "admin" || !this.pass( pass ) || pass == "." ) {
|
||||
// not auth
|
||||
res.set("WWW-Authenticate", "Basic realm=401")
|
||||
res.status(401)
|
||||
|
|
|
@ -196,6 +196,7 @@ posts.index() // for search
|
|||
if ( conf.post_auto_rank > 0)
|
||||
scheduler.schedule(() => {
|
||||
posts.rank()
|
||||
posts.index()
|
||||
log.log("autolranking posts", log.d.basic)
|
||||
}, conf.post_ranking_auto)
|
||||
|
||||
|
@ -331,7 +332,11 @@ app.get("/search", (req, res) => {
|
|||
let sort = req.query.sort ? req.query.sort : undefined
|
||||
|
||||
if ( req.query.api == undefined ) {
|
||||
filestuff.readFSr(req, res, "html/search/index.html", "text/html", `""//<!--SEARCH-DATA-INJECT-->//`, JSON.stringify( posts.search( tags, sort, true ) ) )
|
||||
let r = {}
|
||||
r.sd = posts.search( tags, sort, true )
|
||||
r.arg = tags
|
||||
|
||||
filestuff.readFSr(req, res, "html/search/index.html", "text/html", `""//<!--SEARCH-DATA-INJECT-->//`, JSON.stringify( r ) )
|
||||
return
|
||||
}
|
||||
log.log( `searching stuff by tags "${req.query.tag}" and sorting "${req.query.sort}"` )
|
||||
|
|
|
@ -29,7 +29,7 @@ module.exports.readFSr = (req, res, file, type, search, replace) => {
|
|||
res.end("not found!")
|
||||
} else {
|
||||
res.type(type ? type : file)
|
||||
res.end(data.replace(search, replace))
|
||||
res.end( data.split(search).join(replace) )
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
"desc": "hier nicht",
|
||||
"id": 1,
|
||||
"rating": {
|
||||
"+": 0,
|
||||
"+": 1,
|
||||
"-": 0
|
||||
},
|
||||
"tags": [
|
||||
|
@ -43,7 +43,7 @@
|
|||
"id": 2,
|
||||
"rating": {
|
||||
"+": 0,
|
||||
"-": 0
|
||||
"-": 1
|
||||
},
|
||||
"tags": [
|
||||
"$$$",
|
||||
|
|
Loading…
Reference in New Issue