Finished comments (w/ "deletion")

Logging
most other "WIP" suff

also its 4:20AM!
Good night!
master
derzombiiie 2021-08-11 04:18:16 +02:00
parent 065fc93298
commit 117f85caec
16 changed files with 8644 additions and 17 deletions

1
config/admin.yaml Normal file
View File

@ -0,0 +1 @@
passhash: hvZeKKdU4acbLflANhWmxDbDLEKnWhDQKBOWG4bx5Cg=

View File

@ -1,5 +1,5 @@
debug: false # enable / disable debug mode
logging: 0 # WIP - adjust logging levels
logging: 1337 # WIP - adjust logging levels
# -1 - none
# 0 - basic (Logs new comments)
# 10 - datahorder (Logs everything (all requests with ip + timestamp))

421
editor.css Normal file
View File

@ -0,0 +1,421 @@
@font-face {
font-family: 'icomoon';
src:url('fonts/icomoon.eot');
src:url('fonts/icomoon.eot?#iefix') format('embedded-opentype'),
url('fonts/icomoon.woff') format('woff'),
url('fonts/icomoon.ttf') format('truetype'),
url('fonts/icomoon.svg#icomoon') format('svg');
font-weight: normal;
font-style: normal;
}
/* Use the following CSS code if you want to use data attributes for inserting your icons */
[data-icon]:before {
font-family: 'icomoon';
content: attr(data-icon);
speak: none;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
}
/* Use the following CSS code if you want to have a class per icon */
/*
Instead of a list of all class selectors,
you can use the generic selector below, but it's slower:
[class*="icon-"] {
*/
.icon-bold, .icon-italic, .icon-quote, .icon-unordered-list, .icon-ordered-list, .icon-link, .icon-image, .icon-play, .icon-music, .icon-contract, .icon-fullscreen, .icon-question, .icon-info, .icon-undo, .icon-redo, .icon-code, .icon-preview {
font-family: 'icomoon';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
}
.icon-bold:before {
content: "\e000";
}
.icon-italic:before {
content: "\e001";
}
.icon-quote:before {
content: "\e003";
}
.icon-unordered-list:before {
content: "\e004";
}
.icon-ordered-list:before {
content: "\e005";
}
.icon-link:before {
content: "\e006";
}
.icon-image:before {
content: "\e007";
}
.icon-play:before {
content: "\e008";
}
.icon-music:before {
content: "\e009";
}
.icon-contract:before {
content: "\e00a";
}
.icon-fullscreen:before {
content: "\e00b";
}
.icon-question:before {
content: "\e00c";
}
.icon-info:before {
content: "\e00d";
}
.icon-undo:before {
content: "\e00e";
}
.icon-redo:before {
content: "\e00f";
}
.icon-code:before {
content: "\e011";
}
.icon-preview:before {
content: "\e002";
}
/* BASICS */
.CodeMirror {
height: 300px;
}
.CodeMirror-scroll {
/* Set scrolling behaviour here */
overflow: auto;
}
/* PADDING */
.CodeMirror-lines {
padding: 4px 0; /* Vertical padding around content */
}
.CodeMirror pre {
padding: 0 4px; /* Horizontal padding of content */
}
.CodeMirror-scrollbar-filler {
background-color: white; /* The little square between H and V scrollbars */
}
/* CURSOR */
.CodeMirror div.CodeMirror-cursor {
border-left: 1px solid black;
z-index: 3;
}
/* Shown when moving in bi-directional text */
.CodeMirror div.CodeMirror-secondarycursor {
border-left: 1px solid silver;
}
.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor {
width: auto;
border: 0;
background: #7e7;
z-index: 1;
}
/* Can style cursor different in overwrite (non-insert) mode */
.CodeMirror div.CodeMirror-cursor.CodeMirror-overwrite {}
/* DEFAULT THEME */
.cm-s-paper .cm-keyword {color: #555;}
.cm-s-paper .cm-atom {color: #7f8c8d;}
.cm-s-paper .cm-number {color: #7f8c8d;}
.cm-s-paper .cm-def {color: #00f;}
.cm-s-paper .cm-variable {color: black;}
.cm-s-paper .cm-variable-2 {color: #555;}
.cm-s-paper .cm-variable-3 {color: #085;}
.cm-s-paper .cm-property {color: black;}
.cm-s-paper .cm-operator {color: black;}
.cm-s-paper .cm-comment {color: #959595;}
.cm-s-paper .cm-string {color: #7f8c8d;}
.cm-s-paper .cm-string-2 {color: #f50;}
.cm-s-paper .cm-meta {color: #555;}
.cm-s-paper .cm-error {color: #f00;}
.cm-s-paper .cm-qualifier {color: #555;}
.cm-s-paper .cm-builtin {color: #555;}
.cm-s-paper .cm-bracket {color: #997;}
.cm-s-paper .cm-tag {color: #7f8c8d;}
.cm-s-paper .cm-attribute {color: #7f8c8d;}
.cm-s-paper .cm-header {color: #000;}
.cm-s-paper .cm-quote {color: #888;}
.cm-s-paper .cm-hr {color: #999;}
.cm-s-paper .cm-link {color: #7f8c8d;}
.cm-negative {color: #d44;}
.cm-positive {color: #292;}
.cm-header, .cm-strong {font-weight: bold;}
.cm-em {font-style: italic;}
.cm-link {text-decoration: underline;}
.cm-invalidchar {color: #f00;}
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
/* STOP */
/* The rest of this file contains styles related to the mechanics of
the editor. You probably shouldn't touch them. */
.CodeMirror {
position: relative;
overflow: hidden;
}
.CodeMirror-scroll {
/* 30px is the magic margin used to hide the element's real scrollbars */
/* See overflow: hidden in .CodeMirror, and the paddings in .CodeMirror-sizer */
margin-bottom: -30px; margin-right: -30px;
padding-bottom: 30px; padding-right: 30px;
height: 100%;
outline: none; /* Prevent dragging from highlighting the element */
position: relative;
}
.CodeMirror-sizer {
position: relative;
}
/* The fake, visible scrollbars. Used to force redraw during scrolling
before actuall scrolling happens, thus preventing shaking and
flickering artifacts. */
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler {
position: absolute;
z-index: 6;
display: none;
}
.CodeMirror-vscrollbar {
right: 0; top: 0;
overflow-x: hidden;
overflow-y: scroll;
}
.CodeMirror-hscrollbar {
bottom: 0; left: 0;
overflow-y: hidden;
overflow-x: scroll;
}
.CodeMirror-scrollbar-filler {
right: 0; bottom: 0;
z-index: 6;
}
.CodeMirror-lines {
cursor: text;
}
.CodeMirror pre {
/* Reset some styles that the rest of the page might have set */
-moz-border-radius: 0; -webkit-border-radius: 0; -o-border-radius: 0; border-radius: 0;
border-width: 0;
background: transparent;
font-family: inherit;
font-size: inherit;
margin: 0;
white-space: pre-wrap;
word-wrap: normal;
line-height: inherit;
color: inherit;
z-index: 2;
position: relative;
overflow: visible;
}
.CodeMirror-wrap pre {
word-wrap: break-word;
white-space: pre-wrap;
word-break: normal;
}
.CodeMirror-linebackground {
position: absolute;
left: 0; right: 0; top: 0; bottom: 0;
z-index: 0;
}
.CodeMirror-linewidget {
position: relative;
z-index: 2;
overflow: auto;
}
.CodeMirror-widget {
display: inline-block;
}
.CodeMirror-wrap .CodeMirror-scroll {
overflow-x: hidden;
}
.CodeMirror-measure {
position: absolute;
width: 100%; height: 0px;
overflow: hidden;
visibility: hidden;
}
.CodeMirror-measure pre { position: static; }
.CodeMirror div.CodeMirror-cursor {
position: absolute;
visibility: hidden;
border-right: none;
width: 0;
}
.CodeMirror-focused div.CodeMirror-cursor {
visibility: visible;
}
.CodeMirror-selected { background: #d9d9d9; }
.CodeMirror-focused .CodeMirror-selected { background: #BDC3C7; }
.cm-searching {
background: #ffa;
background: rgba(255, 255, 0, .4);
}
/* IE7 hack to prevent it from returning funny offsetTops on the spans */
.CodeMirror span { *vertical-align: text-bottom; }
@media print {
/* Hide the cursor when printing */
.CodeMirror div.CodeMirror-cursor {
visibility: hidden;
}
}
.CodeMirror {
height: 450px;
}
:-webkit-full-screen {
background: #f9f9f5;
padding: 0.5em 1em;
width: 100%;
height: 100%;
}
:-moz-full-screen {
padding: 0.5em 1em;
background: #f9f9f5;
width: 100%;
height: 100%;
}
.editor-wrapper {
font: 16px/1.62 "Helvetica Neue", "Xin Gothic", "Hiragino Sans GB", "WenQuanYi Micro Hei", "Microsoft YaHei", sans-serif;
color: #2c3e50;
}
/* this is the title */
.editor-wrapper input.title {
font: 18px "Helvetica Neue", "Xin Gothic", "Hiragino Sans GB", "WenQuanYi Micro Hei", "Microsoft YaHei", sans-serif;
background: transparent;
padding: 4px;
width: 100%;
border: none;
outline: none;
opacity: 0.6;
}
.editor-toolbar {
position: relative;
opacity: 0.6;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
.editor-toolbar:before, .editor-toolbar:after {
display: block;
content: ' ';
height: 1px;
background-color: #bdc3c7;
background: -moz-linear-gradient(45deg, #f9f9f9, #bdc3c7, #f9f9f9);
background: -webkit-linear-gradient(45deg, #f9f9f9, #bdc3c7, #f9f9f9);
background: -ms-linear-gradient(45deg, #f9f9f9, #bdc3c7, #f9f9f9);
background: linear-gradient(45deg, #f9f9f9, #bdc3c7, #f9f9f9);
}
.editor-toolbar:before {
margin-bottom: 8px;
}
.editor-toolbar:after {
margin-top: 8px;
}
.editor-wrapper input.title:hover, .editor-wrapper input.title:focus, .editor-toolbar:hover {
opacity: 0.8;
}
.editor-toolbar a {
display: inline-block;
text-align: center;
text-decoration: none !important;
color: #2c3e50 !important;
width: 24px;
height: 24px;
margin: 2px;
border: 1px solid transparent;
border-radius: 3px;
cursor: pointer;
}
.editor-toolbar a:hover, .editor-toolbar a.active {
background: #fcfcfc;
border-color: #95a5a6;
}
.editor-toolbar a:before {
line-height: 24px;
}
.editor-toolbar i.separator {
display: inline-block;
width: 0;
border-left: 1px solid #d9d9d9;
border-right: 1px solid white;
color: transparent;
text-indent: -10px;
margin: 0 6px;
}
.editor-toolbar a.icon-fullscreen {
position: absolute;
right: 0;
}
.editor-statusbar {
border-top: 1px solid #ece9e9;
padding: 8px 10px;
font-size: 12px;
color: #959694;
text-align: right;
}
.editor-statusbar span {
display: inline-block;
min-width: 4em;
margin-left: 1em;
}
.editor-statusbar .lines:before {
content: 'lines: ';
}
.editor-statusbar .words:before {
content: 'words: ';
}
.editor-preview {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 100%;
background: #f9f9f5;
z-index: 9999;
overflow: auto;
-webkit-transition: left 0.2s ease;
-moz-transition: left 0.2s ease;
-ms-transition: left 0.2s ease;
transition: left 0.2s ease;
}
.editor-preview-active {
left: 0;
}
.editor-preview > p {
margin-top: 0;
}

421
editor.css.1 Normal file
View File

@ -0,0 +1,421 @@
@font-face {
font-family: 'icomoon';
src:url('fonts/icomoon.eot');
src:url('fonts/icomoon.eot?#iefix') format('embedded-opentype'),
url('fonts/icomoon.woff') format('woff'),
url('fonts/icomoon.ttf') format('truetype'),
url('fonts/icomoon.svg#icomoon') format('svg');
font-weight: normal;
font-style: normal;
}
/* Use the following CSS code if you want to use data attributes for inserting your icons */
[data-icon]:before {
font-family: 'icomoon';
content: attr(data-icon);
speak: none;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
}
/* Use the following CSS code if you want to have a class per icon */
/*
Instead of a list of all class selectors,
you can use the generic selector below, but it's slower:
[class*="icon-"] {
*/
.icon-bold, .icon-italic, .icon-quote, .icon-unordered-list, .icon-ordered-list, .icon-link, .icon-image, .icon-play, .icon-music, .icon-contract, .icon-fullscreen, .icon-question, .icon-info, .icon-undo, .icon-redo, .icon-code, .icon-preview {
font-family: 'icomoon';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
}
.icon-bold:before {
content: "\e000";
}
.icon-italic:before {
content: "\e001";
}
.icon-quote:before {
content: "\e003";
}
.icon-unordered-list:before {
content: "\e004";
}
.icon-ordered-list:before {
content: "\e005";
}
.icon-link:before {
content: "\e006";
}
.icon-image:before {
content: "\e007";
}
.icon-play:before {
content: "\e008";
}
.icon-music:before {
content: "\e009";
}
.icon-contract:before {
content: "\e00a";
}
.icon-fullscreen:before {
content: "\e00b";
}
.icon-question:before {
content: "\e00c";
}
.icon-info:before {
content: "\e00d";
}
.icon-undo:before {
content: "\e00e";
}
.icon-redo:before {
content: "\e00f";
}
.icon-code:before {
content: "\e011";
}
.icon-preview:before {
content: "\e002";
}
/* BASICS */
.CodeMirror {
height: 300px;
}
.CodeMirror-scroll {
/* Set scrolling behaviour here */
overflow: auto;
}
/* PADDING */
.CodeMirror-lines {
padding: 4px 0; /* Vertical padding around content */
}
.CodeMirror pre {
padding: 0 4px; /* Horizontal padding of content */
}
.CodeMirror-scrollbar-filler {
background-color: white; /* The little square between H and V scrollbars */
}
/* CURSOR */
.CodeMirror div.CodeMirror-cursor {
border-left: 1px solid black;
z-index: 3;
}
/* Shown when moving in bi-directional text */
.CodeMirror div.CodeMirror-secondarycursor {
border-left: 1px solid silver;
}
.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor {
width: auto;
border: 0;
background: #7e7;
z-index: 1;
}
/* Can style cursor different in overwrite (non-insert) mode */
.CodeMirror div.CodeMirror-cursor.CodeMirror-overwrite {}
/* DEFAULT THEME */
.cm-s-paper .cm-keyword {color: #555;}
.cm-s-paper .cm-atom {color: #7f8c8d;}
.cm-s-paper .cm-number {color: #7f8c8d;}
.cm-s-paper .cm-def {color: #00f;}
.cm-s-paper .cm-variable {color: black;}
.cm-s-paper .cm-variable-2 {color: #555;}
.cm-s-paper .cm-variable-3 {color: #085;}
.cm-s-paper .cm-property {color: black;}
.cm-s-paper .cm-operator {color: black;}
.cm-s-paper .cm-comment {color: #959595;}
.cm-s-paper .cm-string {color: #7f8c8d;}
.cm-s-paper .cm-string-2 {color: #f50;}
.cm-s-paper .cm-meta {color: #555;}
.cm-s-paper .cm-error {color: #f00;}
.cm-s-paper .cm-qualifier {color: #555;}
.cm-s-paper .cm-builtin {color: #555;}
.cm-s-paper .cm-bracket {color: #997;}
.cm-s-paper .cm-tag {color: #7f8c8d;}
.cm-s-paper .cm-attribute {color: #7f8c8d;}
.cm-s-paper .cm-header {color: #000;}
.cm-s-paper .cm-quote {color: #888;}
.cm-s-paper .cm-hr {color: #999;}
.cm-s-paper .cm-link {color: #7f8c8d;}
.cm-negative {color: #d44;}
.cm-positive {color: #292;}
.cm-header, .cm-strong {font-weight: bold;}
.cm-em {font-style: italic;}
.cm-link {text-decoration: underline;}
.cm-invalidchar {color: #f00;}
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
/* STOP */
/* The rest of this file contains styles related to the mechanics of
the editor. You probably shouldn't touch them. */
.CodeMirror {
position: relative;
overflow: hidden;
}
.CodeMirror-scroll {
/* 30px is the magic margin used to hide the element's real scrollbars */
/* See overflow: hidden in .CodeMirror, and the paddings in .CodeMirror-sizer */
margin-bottom: -30px; margin-right: -30px;
padding-bottom: 30px; padding-right: 30px;
height: 100%;
outline: none; /* Prevent dragging from highlighting the element */
position: relative;
}
.CodeMirror-sizer {
position: relative;
}
/* The fake, visible scrollbars. Used to force redraw during scrolling
before actuall scrolling happens, thus preventing shaking and
flickering artifacts. */
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler {
position: absolute;
z-index: 6;
display: none;
}
.CodeMirror-vscrollbar {
right: 0; top: 0;
overflow-x: hidden;
overflow-y: scroll;
}
.CodeMirror-hscrollbar {
bottom: 0; left: 0;
overflow-y: hidden;
overflow-x: scroll;
}
.CodeMirror-scrollbar-filler {
right: 0; bottom: 0;
z-index: 6;
}
.CodeMirror-lines {
cursor: text;
}
.CodeMirror pre {
/* Reset some styles that the rest of the page might have set */
-moz-border-radius: 0; -webkit-border-radius: 0; -o-border-radius: 0; border-radius: 0;
border-width: 0;
background: transparent;
font-family: inherit;
font-size: inherit;
margin: 0;
white-space: pre-wrap;
word-wrap: normal;
line-height: inherit;
color: inherit;
z-index: 2;
position: relative;
overflow: visible;
}
.CodeMirror-wrap pre {
word-wrap: break-word;
white-space: pre-wrap;
word-break: normal;
}
.CodeMirror-linebackground {
position: absolute;
left: 0; right: 0; top: 0; bottom: 0;
z-index: 0;
}
.CodeMirror-linewidget {
position: relative;
z-index: 2;
overflow: auto;
}
.CodeMirror-widget {
display: inline-block;
}
.CodeMirror-wrap .CodeMirror-scroll {
overflow-x: hidden;
}
.CodeMirror-measure {
position: absolute;
width: 100%; height: 0px;
overflow: hidden;
visibility: hidden;
}
.CodeMirror-measure pre { position: static; }
.CodeMirror div.CodeMirror-cursor {
position: absolute;
visibility: hidden;
border-right: none;
width: 0;
}
.CodeMirror-focused div.CodeMirror-cursor {
visibility: visible;
}
.CodeMirror-selected { background: #d9d9d9; }
.CodeMirror-focused .CodeMirror-selected { background: #BDC3C7; }
.cm-searching {
background: #ffa;
background: rgba(255, 255, 0, .4);
}
/* IE7 hack to prevent it from returning funny offsetTops on the spans */
.CodeMirror span { *vertical-align: text-bottom; }
@media print {
/* Hide the cursor when printing */
.CodeMirror div.CodeMirror-cursor {
visibility: hidden;
}
}
.CodeMirror {
height: 450px;
}
:-webkit-full-screen {
background: #f9f9f5;
padding: 0.5em 1em;
width: 100%;
height: 100%;
}
:-moz-full-screen {
padding: 0.5em 1em;
background: #f9f9f5;
width: 100%;
height: 100%;
}
.editor-wrapper {
font: 16px/1.62 "Helvetica Neue", "Xin Gothic", "Hiragino Sans GB", "WenQuanYi Micro Hei", "Microsoft YaHei", sans-serif;
color: #2c3e50;
}
/* this is the title */
.editor-wrapper input.title {
font: 18px "Helvetica Neue", "Xin Gothic", "Hiragino Sans GB", "WenQuanYi Micro Hei", "Microsoft YaHei", sans-serif;
background: transparent;
padding: 4px;
width: 100%;
border: none;
outline: none;
opacity: 0.6;
}
.editor-toolbar {
position: relative;
opacity: 0.6;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
.editor-toolbar:before, .editor-toolbar:after {
display: block;
content: ' ';
height: 1px;
background-color: #bdc3c7;
background: -moz-linear-gradient(45deg, #f9f9f9, #bdc3c7, #f9f9f9);
background: -webkit-linear-gradient(45deg, #f9f9f9, #bdc3c7, #f9f9f9);
background: -ms-linear-gradient(45deg, #f9f9f9, #bdc3c7, #f9f9f9);
background: linear-gradient(45deg, #f9f9f9, #bdc3c7, #f9f9f9);
}
.editor-toolbar:before {
margin-bottom: 8px;
}
.editor-toolbar:after {
margin-top: 8px;
}
.editor-wrapper input.title:hover, .editor-wrapper input.title:focus, .editor-toolbar:hover {
opacity: 0.8;
}
.editor-toolbar a {
display: inline-block;
text-align: center;
text-decoration: none !important;
color: #2c3e50 !important;
width: 24px;
height: 24px;
margin: 2px;
border: 1px solid transparent;
border-radius: 3px;
cursor: pointer;
}
.editor-toolbar a:hover, .editor-toolbar a.active {
background: #fcfcfc;
border-color: #95a5a6;
}
.editor-toolbar a:before {
line-height: 24px;
}
.editor-toolbar i.separator {
display: inline-block;
width: 0;
border-left: 1px solid #d9d9d9;
border-right: 1px solid white;
color: transparent;
text-indent: -10px;
margin: 0 6px;
}
.editor-toolbar a.icon-fullscreen {
position: absolute;
right: 0;
}
.editor-statusbar {
border-top: 1px solid #ece9e9;
padding: 8px 10px;
font-size: 12px;
color: #959694;
text-align: right;
}
.editor-statusbar span {
display: inline-block;
min-width: 4em;
margin-left: 1em;
}
.editor-statusbar .lines:before {
content: 'lines: ';
}
.editor-statusbar .words:before {
content: 'words: ';
}
.editor-preview {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 100%;
background: #f9f9f5;
z-index: 9999;
overflow: auto;
-webkit-transition: left 0.2s ease;
-moz-transition: left 0.2s ease;
-ms-transition: left 0.2s ease;
transition: left 0.2s ease;
}
.editor-preview-active {
left: 0;
}
.editor-preview > p {
margin-top: 0;
}

7408
editor.js Normal file

File diff suppressed because it is too large Load Diff

29
html/admin/index.html Normal file
View File

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>derzombiiie.com - home</title>
<link rel="stylesheet" href="/static/style/fonts.css">
<link rel="stylesheet" href="/static/style/main.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css">
<script src="/static/js/jq.js"></script>
<script src="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.js"></script>
<script src="/config.js"></script>
<script src="/static/js/themes.js"></script>
<script src="/static/js/menubar.js"></script>
<script src="/static/js/entry.js"></script>
<script src="/static/js/share.js"></script>
<script src="/static/js/admin.js"></script>
</head>
<body>
<div class="menubox"></div>
<div class="content">
</div>
</body>
</html>

6
html/js/admin.js Normal file
View File

@ -0,0 +1,6 @@
$(document).ready(()=>{
entrys = []
entrys.push( new metaentry(undefined, "create Post:", ".content", {"content":
`<div id="editor"></div>`
}) )
})

View File

@ -26,6 +26,9 @@ class comment {
// assemble element
let elem = document.createElement("DIV")
elem.classList = ["comment"]
elem.onclick = () => {
console.log(this.content.id)
}
elem.innerHTML = `
<div class="authorbox">
<span class="author">${this.content.author}${authorinfo}</span>

20
html/js/editor.js Normal file
View File

@ -0,0 +1,20 @@
--2021-08-11 04:05:44-- http://lab.lepture.com/editor/editor.js
Resolving lab.lepture.com (lab.lepture.com)... 172.67.133.196, 104.21.25.69, 2606:4700:3034::6815:1945, ...
Connecting to lab.lepture.com (lab.lepture.com)|172.67.133.196|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://lab.lepture.com/editor/editor.js [following]
--2021-08-11 04:05:44-- https://lab.lepture.com/editor/editor.js
Connecting to lab.lepture.com (lab.lepture.com)|172.67.133.196|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/javascript]
Saving to: editor.js
0K .......... .......... .......... .......... .......... 4.83M
50K .......... .......... .......... .......... .......... 5.49M
100K .......... .......... .......... .......... .......... 8.77M
150K .......... .......... .......... .......... .......... 12.3M
200K .......... .......... .......... .......... .......... 9.24M
250K .......... ... 28.2M=0.03s
2021-08-11 04:05:44 (7.50 MB/s) - editor.js saved [270070]

12
html/style/editor.css Normal file
View File

@ -0,0 +1,12 @@
URL transformed to HTTPS due to an HSTS policy
--2021-08-11 04:15:18-- https://lab.lepture.com/editor/editor.css
Resolving lab.lepture.com (lab.lepture.com)... 172.67.133.196, 104.21.25.69, 2606:4700:3034::6815:1945, ...
Connecting to lab.lepture.com (lab.lepture.com)|172.67.133.196|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/css]
Saving to: editor.css.1
0K ......... 10.7M=0.001s
2021-08-11 04:15:19 (10.7 MB/s) - editor.css.1 saved [9798]

191
logs/log.log Normal file
View File

@ -0,0 +1,191 @@
--- SEPERATOR ---
--- SEPERATOR ---
--- SEPERATOR ---
1628621212264 | test
--- SEPERATOR ---
1628621733444 | test
1628621745843 | te598st
1628621751779 | te598st
1628621751914 | te598st
1628621752050 | te598st
1628621752170 | te598st
1628621752314 | te598st
1628621752578 | test
1628621752706 | test
1628621752842 | test
1628621752970 | test
1628621753106 | test
1628621753258 | test
1628621753410 | test
1628621753578 | test
1628621754194 | test
1628621759779 | t134est
--- SEPERATOR ---
1628624763728 | Dumping config:
1628624763728 | {"debug":false,"logging":0,"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,"post_ranking_auto":43200,"index_post_sort":"new","comment_sync_on_write":false,"comment_auto_sync":360}
1628624766104 | Reading post 1
1628624766586 | Reading comments from post "1", with length: undefined
--- SEPERATOR ---
1628624791703 | Dumping config:
1628624791709 | {"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,"post_ranking_auto":43200,"index_post_sort":"new","comment_sync_on_write":false,"comment_auto_sync":360}
1628624861253 | Reading post 1
1628624861574 | Reading comments from post "1", with length: undefined
1628624866068 | Reading posts sorted by "new" with a length of 10
1628624877082 | Reading post 1
1628624877422 | Reading comments from post "1", with length: undefined
1628624886222 | Reading comments from post "1", with length: undefined
1628624901462 | Reading comments from post "1", with length: undefined
--- SEPERATOR ---
1628625022788 | Dumping config:
1628625022794 | {"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,"post_ranking_auto":43200,"index_post_sort":"new","comment_sync_on_write":false,"comment_auto_sync":360}
1628625024163 | Reading post 1
1628625024498 | Reading comments from post "1", with length: undefined
1628625028035 | Reading comments from post "1", with length: undefined
1628625028139 | Trying to comment to post "1", from ip "7900150988881157" (tkn: 7900150988881157) with content: "test"
--- SEPERATOR ---
--- SEPERATOR ---
1628629026095 | Dumping config:
1628629026102 | {"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,"post_ranking_auto":43200,"index_post_sort":"new","comment_sync_on_write":false,"comment_auto_sync":360}
1628629111558 | Reading post 1
1628629111960 | Reading comments from post "1", with length: undefined
--- SEPERATOR ---
--- SEPERATOR ---
--- SEPERATOR ---
--- SEPERATOR ---
--- SEPERATOR ---
1628629823565 | Dumping config:
1628629823570 | {"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,"post_ranking_auto":43200,"index_post_sort":"new","comment_sync_on_write":false,"comment_auto_sync":360}
1628629833628 | Reading post 1
1628629834159 | Reading comments from post "1", with length: undefined
--- SEPERATOR ---
--- SEPERATOR ---
1628629970756 | Dumping config:
1628629970763 | {"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,"post_ranking_auto":43200,"index_post_sort":"new","comment_sync_on_write":false,"comment_auto_sync":360}
1628629982262 | Reading post 1
1628629983038 | Reading comments from post "1", with length: undefined
--- SEPERATOR ---
1628630011585 | Dumping config:
1628630011591 | {"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,"post_ranking_auto":43200,"index_post_sort":"new","comment_sync_on_write":false,"comment_auto_sync":360}
1628630015970 | Reading post 1
1628630016356 | Reading comments from post "1", with length: undefined
--- SEPERATOR ---
1628632720771 | Dumping config:
1628632720777 | {"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,"post_ranking_auto":43200,"index_post_sort":"new","comment_sync_on_write":false,"comment_auto_sync":360}
1628632723752 | Reading post 1
1628632724130 | Reading comments from post "1", with length: undefined
1628632998497 | Reading post 1
1628632998909 | Reading comments from post "1", with length: undefined
--- SEPERATOR ---
1628633082188 | Dumping config:
1628633082194 | {"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,"post_ranking_auto":43200,"index_post_sort":"new","comment_sync_on_write":false,"comment_auto_sync":360}
1628633113710 | Reading post 1
1628633114087 | Reading comments from post "1", with length: undefined
--- SEPERATOR ---
1628633199160 | Dumping config:
1628633199166 | {"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,"post_ranking_auto":43200,"index_post_sort":"new","comment_sync_on_write":false,"comment_auto_sync":360}
1628633232313 | Reading post 1
1628633232671 | Reading comments from post "1", with length: undefined
--- SEPERATOR ---
1628633257596 | Dumping config:
1628633257602 | {"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,"post_ranking_auto":43200,"index_post_sort":"new","comment_sync_on_write":false,"comment_auto_sync":360}
1628633258723 | Reading post 1
1628633259065 | Reading comments from post "1", with length: undefined
1628633464042 | Reading post 1
1628633464404 | Reading comments from post "1", with length: undefined
--- SEPERATOR ---
1628636014054 | Dumping config:
1628636014059 | {"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,"post_ranking_auto":43200,"index_post_sort":"new","comment_sync_on_write":false,"comment_auto_sync":360}
1628636031591 | Reading post 1
1628636031977 | Reading comments from post "1", with length: undefined
1628636045906 | Reading post 1
1628636046243 | Reading comments from post "1", with length: undefined
--- SEPERATOR ---
1628636061003 | Dumping config:
1628636061010 | {"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,"post_ranking_auto":43200,"index_post_sort":"new","comment_sync_on_write":false,"comment_auto_sync":360}
1628636061097 | Reading post 1
1628636061455 | Reading comments from post "1", with length: undefined
1628636082206 | Reading post 1
1628636082615 | Reading comments from post "1", with length: undefined
1628636146596 | Reading post 1
1628636146946 | Reading comments from post "1", with length: undefined
--- SEPERATOR ---
1628636151374 | Dumping config:
1628636151379 | {"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,"post_ranking_auto":43200,"index_post_sort":"new","comment_sync_on_write":false,"comment_auto_sync":360}
1628636153396 | Reading post 1
1628636153739 | Reading comments from post "1", with length: undefined
--- SEPERATOR ---
1628636201386 | Dumping config:
1628636201391 | {"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,"post_ranking_auto":43200,"index_post_sort":"new","comment_sync_on_write":false,"comment_auto_sync":360}
1628636203626 | Reading post 1
1628636204029 | Reading comments from post "1", with length: undefined
1628636327381 | Reading post 1
1628636327727 | Reading comments from post "1", with length: undefined
1628636379909 | Reading post 1
1628636380277 | Reading comments from post "1", with length: undefined
1628636399705 | Reading post 1
1628636400039 | Reading comments from post "1", with length: undefined
--- SEPERATOR ---
1628636407969 | Dumping config:
1628636407975 | {"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,"post_ranking_auto":43200,"index_post_sort":"new","comment_sync_on_write":false,"comment_auto_sync":360}
1628636411207 | Reading post 1
1628636411596 | Reading comments from post "1", with length: undefined
1628636427108 | Reading post 1
1628636427441 | Reading comments from post "1", with length: undefined
1628636438310 | Reading post 1
1628636438666 | Reading comments from post "1", with length: undefined
--- SEPERATOR ---
1628636534917 | Dumping config:
1628636534923 | {"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,"post_ranking_auto":43200,"index_post_sort":"new","comment_sync_on_write":false,"comment_auto_sync":360}
1628636537582 | Reading post 1
1628636537986 | Reading comments from post "1", with length: undefined
1628636623858 | Reading post 1
1628636624196 | Reading comments from post "1", with length: undefined
1628636634733 | Reading post 1
1628636635073 | Reading comments from post "1", with length: undefined
1628636636272 | Reading post 1
1628636636579 | Reading comments from post "1", with length: undefined
1628636754757 | Reading post 1
1628636755108 | Reading comments from post "1", with length: undefined
1628636883824 | Reading post 1
1628636884150 | Reading comments from post "1", with length: undefined
1628636953698 | Reading post 1
1628636954051 | Reading comments from post "1", with length: undefined
1628639856992 | Reading post 1
1628639857411 | Reading comments from post "1", with length: undefined
1628641621511 | Reading posts sorted by "new" with a length of 10
1628641636021 | Reading post 0
1628641639236 | Reading posts sorted by "new" with a length of 10
--- SEPERATOR ---
--- SEPERATOR ---
--- SEPERATOR ---
--- SEPERATOR ---
--- SEPERATOR ---
--- SEPERATOR ---
--- SEPERATOR ---
--- SEPERATOR ---
--- SEPERATOR ---
--- SEPERATOR ---
--- SEPERATOR ---
--- SEPERATOR ---
--- SEPERATOR ---
--- SEPERATOR ---
--- SEPERATOR ---
--- SEPERATOR ---
--- SEPERATOR ---
1628643698392 | Dumping config:
1628643698398 | {"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,"post_ranking_auto":43200,"index_post_sort":"new","comment_sync_on_write":false,"comment_auto_sync":360}
1628643822222 | Reading posts sorted by "new" with a length of 10
--- SEPERATOR ---
--- SEPERATOR ---
--- SEPERATOR ---
--- SEPERATOR ---
--- SEPERATOR ---
--- SEPERATOR ---
--- SEPERATOR ---
--- SEPERATOR ---
--- SEPERATOR ---
1628645062957 | Dumping config:
1628645062963 | {"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,"post_ranking_auto":43200,"index_post_sort":"new","comment_sync_on_write":false,"comment_auto_sync":360}
1628645078201 | Reading posts sorted by "new" with a length of 10
1628645106038 | Reading posts sorted by "new" with a length of 10
1628645178501 | Reading posts sorted by "new" with a length of 10

53
node/admin.js Normal file
View File

@ -0,0 +1,53 @@
const fs = require("fs")
const crypto = require("crypto")
const yaml = require("js-yaml")
// init:
this.init = (comments, posts, log) => {
this.comments = comments
this.posts = posts
this.log = log
}
// readout stuff
this.config = yaml.load( fs.readFileSync("config/admin.yaml", "utf8") )
// crypto.createHash("sha256").update("base64")
this.setpass = ( p ) => {
this.config.passhash = crypto.createHash( "sha256" ).update( p ).digest( "base64" )
this.saveconf()
}
this.saveconf = () => {
fs.writeFile("config/admin.yaml", yaml.dump(this.config), "utf8", ()=>{})
}
this.pass = ( pass ) => {
if ( this.config.passhash == crypto.createHash( "sha256" ).update( pass ).digest( "base64" ) ) return true
return false
}
this.indexuse = (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 ) ) {
// not auth
res.set("WWW-Authenticate", "Basic realm=401")
res.status(401)
res.end("Not authenticated!")
return
}
next()
}
this.index = (req, res) => {
console.log("authenticated!")
fs.readFile("html/admin/index.html", (data) => {
res.type("text/html")
res.end(data)
})
return
}

View File

@ -10,6 +10,7 @@ var posts = require("./posts")
var comments = require("./comments")
const scheduler = require("./scheduler")
const log = require("./logging")
var admin = require("./admin")
// init logging
log.init( conf.logging, conf.logfile )
@ -31,7 +32,7 @@ const port = 5500
app.get("/", (req, res) => filestuff.readFS(req, res, "html/index.html", "text/html"))
app.use("/static", express.static("html"))
// config js file:
// config stuff:
app.get("/config.js", (req, res) => {
res.type("application/javascript")
res.end(`conf = {}
@ -41,6 +42,8 @@ conf.search_enable = ${conf.search_enable}
conf.index_post_sort = "${conf.index_post_sort}"
conf.comments_enabled = ${conf.comments_enabled}\n`)
})
log.log("Dumping config:", log.d.datahorder)
log.log(JSON.stringify(conf), log.d.datahorder)
// console commands:
con.registercmd( "stop", () => shutdown() )
@ -57,7 +60,7 @@ con.registercmd( "comment", (arg => {
if (!arg[2]) { console.log("No commentID, dumping all")
let len = commentDB.get( arg[1] + "-len" )
let ret = []
for (let i = 0 ; i > len ; i++ ) {
for (let i = 0 ; i < len ; i++ ) {
ret.push( commentDB.get( arg[1] + "-" + i ) )
}
return console.log(ret)
@ -82,27 +85,34 @@ con.registercmd( "comment", (arg => {
time = new Date().getTime()
console.log( "Auto-time: using time: " + time)
}
console.log( arg[3] )
console.log( comments.push(arg[1], {
"time": time,
"author":arg[3],
"body": body.join(" ")
"author":arg[3].replace(/%20/g, " "),
"authorinfo":{"origin":"console"},
"body": body.join(" ").replace(/\\n/g, "\n")
}) )
break
case "set":
case "delete":
if ( !arg[1] || !arg[2] ) return console.log("Usage \"post delete <postID> <commentID>\"")
console.log(comments.delete( arg[1], arg[2] ))
break
case "set": // DONT USE! its broken
if ( !arg[1] ) return console.log("No post ID specified!")
if ( !arg[2] ) return console.log("No content specified!")
if ( !arg[2] ) return console.log("No comment specified!")
body = Object.assign([], arg[3])
body.shift()
body.shift()
console.log( comments.set( arg[1], { "body":body.join(" ") } ) )
console.log( comments.set( arg[1], arg[2], { "body":body.join(" ") } ) )
break
case "sync":
console.log("syncing...")
t = commetsDB.sync()
t = commentDB.sync()
if (t) console.log(t)
console.log("DONE!")
break
@ -172,6 +182,8 @@ con.registercmd( "post", (arg => {
// shutdown:
function shutdown() {
log.log("Shutting down", log.d.basic)
log.clearBUFF()
process.exit(1)
}
@ -184,7 +196,10 @@ posts.rank()
// post auto rank
if ( conf.post_auto_rank > 0)
scheduler.schedule(posts.rank, conf.post_ranking_auto)
scheduler.schedule(() => {
posts.rank()
log.log("autolranking posts", log.d.basic)
}, conf.post_ranking_auto)
// readout comments:
const commentDB = new JSONdb("storage/comments.json", {
@ -202,6 +217,7 @@ app.get("/posts", (req, res) => {
res.end( JSON.stringify({"type":"err","text":"no len or to high specified"}) )
} else {
res.status( 200 )
log.log(`Reading posts sorted by "hot" with a length of ${req.query.len}`, log.d.datahorder)
res.end(`{"type":"s","content":${JSON.stringify(posts.read(req.query.len ? req.query.len : 10, "hot"))}}`)
}
} else if ( typeof(req.query.new) != "undefined") {
@ -210,11 +226,13 @@ app.get("/posts", (req, res) => {
res.end( JSON.stringify({"type":"err","text":"no len or to high specified"}) )
} else {
res.status( 200 )
log.log(`Reading posts sorted by "new" with a length of ${req.query.len}`, log.d.datahorder)
res.end(`{"type":"s","content":${JSON.stringify(posts.read(req.query.len ? req.query.len : 10, "new"))}}`)
}
}
} else {
res.status( 200 )
log.log(`Reading post ${req.query.post}`, log.d.datahorder)
filestuff.readFSr(req, res, "html/posts/index.html", "text/html", "\"a\"//<!--POST-DATA-INJECT-->//", JSON.stringify(postsDB.get(req.query.post)))
}
})
@ -230,8 +248,9 @@ app.all("/comments", (req, res) => {
console.log("commentetded!")
// get ip from tkn
waiting = true
fetch(conf.ipget_endpoint_set.replace("${TOKEN}", req.body.ip)).then(
fetch("https:" + conf.ipget_endpoint_set.replace("${TOKEN}", req.body.ip)).then(
d => d.text()).then(data=>{
log.log(`Trying to comment to post "${req.body.post}", from ip "${data}" (tkn: ${req.body.ip}) with content: "${req.body.body}"`, log.d.datahorder)
if (data == "") {
res.end(JSON.stringify({"type":"err","text":"ip-tkn"}))
return
@ -239,7 +258,9 @@ app.all("/comments", (req, res) => {
ret = comments.push(req.body.post, {
"time": new Date().getTime(),
"author":data,
"authorinfo":{"country":geoip.lookupCountry(data)},
"authorinfo":{
"country":geoip.lookupCountry(data),
"origin":"web"},
"body": req.body.body
})
if ( ret.type == "err" ) res.status( 400 )
@ -248,7 +269,8 @@ app.all("/comments", (req, res) => {
}
if ( req.query.post ) {
ret = comments.get(req.query.post, req.query.len ? req.query.len : undefined)
ret = comments.get(req.query.post, req.query.len ? req.query.len : undefined, undefined)
log.log(`Reading comments from post "${req.query.post}", with length: ${req.query.len}`)
if ( ret.type == "err" ) res.status( 400 )
res.end( JSON.stringify(ret) )
}
@ -272,6 +294,20 @@ app.get("/debug/:action", (req, res) => {
}
})
// admin stuff:
admin.init(comments, posts, log)
con.registercmd( "passwd", (arg) => {
if ( !arg[0] ) return console.log( "Usage: \"passwd <pass>\"" )
console.log( admin.setpass( arg[0] ) )
})
con.registercmd( "testpass", (arg) => {
if ( !arg[0] ) return console.log("Usage: \"testpass <pass>\"")
console.log( admin.pass( arg[0] ) )
})
app.use("/admin/", (req, res, next) => admin.indexuse(req, res, next))
app.get("/admin", (req, res) => filestuff.readFS(req, res, "html/admin/index.html", "text/html"))
app.listen(port, () => {
console.log(`Server listening on http://localhost:${port}`)
if(conf.cl) con.init()

View File

@ -30,7 +30,24 @@ this.get = (post, len) => {
let ret = []
for ( let i = length-1 ; i > -1 ; i-- ) {
ret.push( this.db.get(post + "-" + (i + offset) ) )
if ( !this.db.get(post + "-" + (i + offset) ).deleted ) {
let c = this.db.get(post + "-" + (i + offset) )
c.id = i
ret.push( c )
}
}
return {"type":"s","content":ret}
}
this.delete = (post, comment) => {
if ( !this.db.get(post + "-" + comment) ) return {"type":"err","text":"Comment dosn't exist"}
let commentBUFF = this.db.get(post + "-" + comment)
commentBUFF.deleted = true
this.db.set(post + "-" + comment, commentBUFF)
return {"type":"s","text":"Success!"}
}
this.set = (post, commentID, comment) => {
this.db.set(post + "-" + commentID, comment)
return {"type":"s"}
}

View File

@ -16,7 +16,7 @@ this.d = {
this.log = ( msg, ll ) => {
if(ll => this.ll) {
this.writelog( msg + "\n" )
this.writelog( new Date().getTime() + " | " + msg + "\n" )
}
if(this.ll == this.d.haxxer) {
console.log(msg)

View File

@ -4,7 +4,7 @@
"author": "87.123.198.124",
"body": "test"
},
"1-len": 12,
"1-len": 13,
"1-1": {
"time": 1628532147370,
"author": "87.123.198.124",
@ -61,6 +61,15 @@
"authorinfo": {
"country": "DE"
},
"body": "gaerhiölfhd"
"body": "gaerhiölfhd",
"deleted": true
},
"1-12": {
"time": 1628633229656,
"author": "DerZombiiie",
"authorinfo": {
"origin": "console"
},
"body": "this, as this is a testing blog post\nalso Newlines **no** markdown though :(\nmaybe later!"
}
}