fixed some stuff with special chars in admin.js

master
root 2021-09-06 01:04:30 +02:00
parent f3ea39af16
commit 54d846c0f8
11 changed files with 102 additions and 24 deletions

7
.gitignore vendored
View File

@ -1,5 +1,8 @@
# Mico logs: # Mico logs:
log.txt log.txt
# Mby someday the WS-access logs node_modules/
# Mby storage config/*
!config/config.example.yaml
storage/*
html/data/*

View File

@ -1 +1 @@
passhash: zbTuKuppzGqDMxu+ltwsqpopnSEynvsDNvwCqC4YOag= passhash: MFPgsnQ5GlRQI2Nr6h2uZDVsrLnpjrVQN8x1X1tW9dk=

View File

@ -8,27 +8,30 @@
# especially not non strings into boolean entrys # especially not non strings into boolean entrys
# (strings are the things with "quotes" and booleans are true / false) # (strings are the things with "quotes" and booleans are true / false)
logging: 1337 # adjust logging levels logging: 0 # adjust logging levels
# -1 - none # -1 - none
# 0 - basic (Logs new comments) # 0 - basic (Logs new comments)
# 10 - datahorder (Logs everything (all requests with ip + timestamp)) # 10 - datahorder (Logs everything (all requests with ip + timestamp))
# 1337 - haxxer (JUST FOR DEBUGGING (and cool looks)) (takes everything from datahorder and just prints it out) # 1337 - haxxer (JUST FOR DEBUGGING (and cool looks)) (takes everything from datahorder and just prints it out)
logfile: "logs/log.log" # logfile logfile: "log.txt" # logfile
ipget_endpoint_set: "//ipget.com?setto=${TOKEN}" # endpoint for setting token to ip ${TOKEN} beeing replaced with random char string which is send to server as "ip" listening_port: 5501
ipget_endpoint_get: "//ipget.com?get=${TOKEN}" # ${TOKEN} beeing replaced with token from client listening_addr: "127.0.0.1"
ipget_endpoint_set: "//derzombiiie.com/getip.php?settoken=${TOKEN}" # endpoint for setting token to ip ${TOKEN} beeing replaced with random char string which is send to server as "ip"
ipget_endpoint_get: "//derzombiiie.com/getip.php?token=${TOKEN}" # ${TOKEN} beeing replaced with token from client
cl: true # enable / disable interactive-ish shell cl: true # enable / disable interactive-ish shell
# GET with "settoken" // (random by client) saves ip with that token # GET with "settoken" // (random by client) saves ip with that token
# content config: # content config:
site_name: "a-blog" site_name: "derzombiiie.com"
search_enable: true # enable / disable search search_enable: true # enable / disable search
commenting_enabled: true # enable / disable ability to comment bellow articles commenting_enabled: true # enable / disable ability to comment bellow articles
# post ranking config: # post ranking config:
post_ranking_auto: 43200 # time in seconds, posts are autoranked | -1 for not at all (default is 12h aka. 43200) post_ranking_auto: 215100 # time in seconds, posts are autoranked | -1 for not at all (default is 12h aka. 43200)
index_post_sort: "new" # sorting used for index page index_post_sort: "new" # sorting used for index page
# new | hot (planned are: manual, rit (like reddits "hot")) # new | hot (planned are: manual, rit (like reddits "hot"))

View File

@ -0,0 +1,41 @@
# GENERAL ABOUT THIS CONFIG FILE:
# there are no "fallback" values,
# anything in here is required to be set to something
# a backup copy of the default file is recommended
# the way some values in this file are treeted may be unsafe
# DONT copy suspicious looking config entrys from the interwebz
# especially not non strings into boolean entrys
# (strings are the things with "quotes" and booleans are true / false)
# listening
listening_port: 5501 # port server listening on
listening_addr: 127.0.0.1 # ip server is listening on
logging: 0 # adjust logging levels
# -1 - none
# 0 - basic (Logs new comments)
# 10 - datahorder (Logs everything (all requests with ip + timestamp))
# 1337 - haxxer (JUST FOR DEBUGGING (and cool looks)) (takes everything from datahorder and just prints it out)
logfile: "log.txt" # logfile
ipget_endpoint_set: "//example.com/set/${TOKEN}" # endpoint for setting token to ip ${TOKEN} beeing replaced with random char string which is send to server as "ip"
ipget_endpoint_get: "//example.com/get/${TOKEN}" # ${TOKEN} beeing replaced with token from client
cl: true # enable / disable interactive-ish shell
# GET with "settoken" // (random by client) saves ip with that token
# content config:
site_name: "a-blog"
search_enable: true # enable / disable search
commenting_enabled: true # enable / disable ability to comment bellow articles
# post ranking config:
post_ranking_auto: 43200 # time in seconds, posts are autoranked | -1 for not at all (default is 12h aka. 43200)
index_post_sort: "new" # sorting used for index page
# new | hot (planned are: manual, rit (like reddits "hot"))
# file access config:
comment_sync_on_write: false # sync comments everytime a comment gets edited / created / deleted
comment_auto_sync: 360 # interval in seconds, comments are synced to disk | -1 for not at all

View File

@ -5,7 +5,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>derzombiiie.com - home</title> <title>impressum</title>
<link rel="stylesheet" href="/static/style/fonts.css"> <link rel="stylesheet" href="/static/style/fonts.css">
<link rel="stylesheet" href="/static/style/main.css"> <link rel="stylesheet" href="/static/style/main.css">
<script src="/static/js/jq.js"></script> <script src="/static/js/jq.js"></script>
@ -27,12 +27,9 @@
<div class="title">Impressum</div> <div class="title">Impressum</div>
<hr class="sperator"> <hr class="sperator">
<div class="preview"> <div class="preview">
No address here<br>
But im from germany im gonna tell you that much<br>
This is a PRIVATE website (atm)<br>
<br>
contact:<br> contact:<br>
Edzel at <ahqtrg>de</ahqtrg>rz<span>(<w>a</w>t)</span>e<a>lidra<span>go<span></a><a>n</a>(full-stop)c<aerghe>o</aerghe>m</span></span> Edzel at <ahqtrg>de</ahqtrg>rz<span>(<w>a</w>t)</span>e<a>lidra<span>go<span></a><a>n</a>(full-stop)c<aerghe>o</aerghe>m</span></span>
<!-- no scraping here xD -->
</div> </div>
</div> </div>
</div> </div>

View File

@ -69,7 +69,7 @@ function save() {
} }
// dl it locally ( as .json ) // dl it locally ( as .json )
$(".dl").attr("href", "data:application/json;base64," + btoa( JSON.stringify(postjson) )) $(".dl").attr("href", "data:text/plain;charset=utf-8," + encodeURIComponent( JSON.stringify(postjson) ))
document.getElementsByClassName("dl")[0].click() document.getElementsByClassName("dl")[0].click()
} }

View File

@ -29,22 +29,23 @@
<div class="preview"> <div class="preview">
Here is a privacy policy placeholder<br> Here is a privacy policy placeholder<br>
Basically:<br> Basically:<br>
This site is not using any cookies by default possible cookies get added when<br> This site is not using <strong>any</strong> cookies by default, cookies get added when<br>
<ul> <ul>
<li>You change theme</li> <li>you change theme</li>
<li>You login</li> <li>you login</li>
</ul> </ul>
<br> <br>
Im NOT tracking your IP address outside the commenting field and voting<br> Im NOT tracking your IP address outside the commenting field and voting<br>
In commeting its used to get you county and ip as "author"<br> In commeting its used to get you county and ip as "author"<br>
For voting its used to not make you able to vote multible times with the same ip<br> For voting its used to not make you able to vote multible times with the same ip<br>
its only transmitted/saved when commenting / voting not before<br> its only transmitted/processed when commenting / voting not before<br>
<br> only in commenting its persistent in voting its not saved to disk
<!-- <br>
<h1>WIP:</h1> <h1>WIP:</h1>
For AD-tracking:<br> For AD-tracking:<br>
This site (will) use googles ADsense<br> This site (will) use googles ADsense<br>
<a style="color:blue" href="//policies.google.com/technologies/ads">Here</a> you can get an overview of the googles privacy policy. <a style="color:blue" href="//policies.google.com/technologies/ads">Here</a> you can get an overview of the googles privacy policy.
</div> --> </div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -348,8 +348,10 @@ app.get("/search", (req, res) => {
if ( req.query.api != undefined ) { if ( req.query.api != undefined ) {
res.type("application/json") res.type("application/json")
res.end( JSON.stringify( {"type":"err","text":"NO SEARCH PARAMS"} ) ) res.end( JSON.stringify( {"type":"err","text":"NO SEARCH PARAMS"} ) )
return
} else { } else {
res.end("No search params") res.end("No search params")
return
} }
} }
@ -393,7 +395,7 @@ app.use("/admin/", (req, res, next) => admin.pre(req, res, next))
app.get("/admin", (req, res) => filestuff.readFS(req, res, "html/admin/index.html", "text/html")) app.get("/admin", (req, res) => filestuff.readFS(req, res, "html/admin/index.html", "text/html"))
app.post("/admin/post", (req, res) => admin.post(req, res)) app.post("/admin/post", (req, res) => admin.post(req, res))
app.listen(port, () => { app.listen(conf.listening_port, conf.listening_addr, () => {
console.log(`Server listening on http://0.0.0.0:${port}`) console.log(`Server listening on http://${conf.listening_addr}:${conf.listening_port}`)
if(conf.cl) con.init() if(conf.cl) con.init()
}) })

View File

@ -119,7 +119,10 @@ this.push = (post) => {
"tags": post.tags, "tags": post.tags,
"title":post.title "title":post.title
}) })
// update len
this.db.set("len", len+1) this.db.set("len", len+1)
this.len++
this.index() this.index()
return {"type":"s","text":"Success! postid: " + len,"content":len} return {"type":"s","text":"Success! postid: " + len,"content":len}
} }

View File

@ -1,2 +1,12 @@
{ {
} "0-len": 1,
"0-0": {
"time": 1629909525274,
"author": "derz",
"authorinfo": {
"origin": "console"
},
"body": "This is a testing comment just to show how this would look, if youl'd comment. The \"author\" / headline field would be your ip + corosponding location.",
"id": 0
}
}

View File

@ -1,2 +1,20 @@
{ {
"0": {
"author": "derz-ed",
"content": "This site is a blog, it's probably gonna be about some coding / data-mining or other random stuff I'm interested in.\nIf you really like the style of this blog, you can get it on [github](//github.com/Eds-trash-can/a-blog).\nMost stuff is directly inspired by [unknown6656](//unknown6656.com) blog.\n\n### Some general information on how to use this site:\n* you can comment bellow posts in the \"your comment\" textarea\n* you can rate an article by clicking either the green/red on an /posts site not on / or /search\n* you can adjust the theme in the [cookie settings](//blog.derzombiiie.com/static/keks.html) also available the footer\n\nAlso please excuse any bad English as I'm not a native speaker.\n\nThis post was first posted: 18:20 - 25.08.2021",
"create": 1629909096761,
"desc": "very small description of what i think this blog is about.",
"id": 0,
"rating": {
"+": 0,
"-": 0
},
"tags": [
"first-post",
".info",
"meta"
],
"title": "what this is about"
},
"len": 1
} }