This commit is contained in:
sample-text-here 2022-01-07 19:44:00 -08:00
parent 1102571cb9
commit ae8d08537e
8 changed files with 59 additions and 63 deletions

View file

@ -1,6 +1,6 @@
{
"name": "bantiose",
"version": "0.2.0",
"version": "0.2.1",
"description": "a general purpose content hole",
"main": "index.js",
"scripts": {
@ -17,12 +17,10 @@
"cookie-parser": "^1.4.6",
"express": "^4.17.2",
"express-handlebars": "^6.0.2",
"highlight.js": "^11.4.0",
"knex": "^0.95.15",
"markdown-it": "^12.3.0",
"sharp": "^0.29.3",
"sqlite3": "^5.0.2"
},
"devDependencies": {
"@types/express": "^4.17.13"
}
}

View file

@ -1,11 +1,11 @@
lockfileVersion: 5.3
specifiers:
'@types/express': ^4.17.13
busboy: ^1.3.0
cookie-parser: ^1.4.6
express: ^4.17.2
express-handlebars: ^6.0.2
highlight.js: ^11.4.0
knex: ^0.95.15
markdown-it: ^12.3.0
sharp: ^0.29.3
@ -16,69 +16,14 @@ dependencies:
cookie-parser: 1.4.6
express: 4.17.2
express-handlebars: 6.0.2
highlight.js: 11.4.0
knex: 0.95.15_sqlite3@5.0.2
markdown-it: 12.3.0
sharp: 0.29.3
sqlite3: 5.0.2
devDependencies:
'@types/express': 4.17.13
packages:
/@types/body-parser/1.19.2:
resolution: {integrity: sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==}
dependencies:
'@types/connect': 3.4.35
'@types/node': 17.0.6
dev: true
/@types/connect/3.4.35:
resolution: {integrity: sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==}
dependencies:
'@types/node': 17.0.6
dev: true
/@types/express-serve-static-core/4.17.27:
resolution: {integrity: sha512-e/sVallzUTPdyOTiqi8O8pMdBBphscvI6E4JYaKlja4Lm+zh7UFSSdW5VMkRbhDtmrONqOUHOXRguPsDckzxNA==}
dependencies:
'@types/node': 17.0.6
'@types/qs': 6.9.7
'@types/range-parser': 1.2.4
dev: true
/@types/express/4.17.13:
resolution: {integrity: sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA==}
dependencies:
'@types/body-parser': 1.19.2
'@types/express-serve-static-core': 4.17.27
'@types/qs': 6.9.7
'@types/serve-static': 1.13.10
dev: true
/@types/mime/1.3.2:
resolution: {integrity: sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==}
dev: true
/@types/node/17.0.6:
resolution: {integrity: sha512-+XBAjfZmmivILUzO0HwBJoYkAyyySSLg5KCGBDFLomJo0sV6szvVLAf4ANZZ0pfWzgEds5KmGLG9D5hfEqOhaA==}
dev: true
/@types/qs/6.9.7:
resolution: {integrity: sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==}
dev: true
/@types/range-parser/1.2.4:
resolution: {integrity: sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==}
dev: true
/@types/serve-static/1.13.10:
resolution: {integrity: sha512-nCkHGI4w7ZgAdNkrEu0bv+4xNV/XDqW+DydknebMOQwkpDGx8G+HTlj7R7ABI8i8nKxVw0wtKPi1D+lPOkh4YQ==}
dependencies:
'@types/mime': 1.3.2
'@types/node': 17.0.6
dev: true
/abbrev/1.1.1:
resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==}
dev: false
@ -664,6 +609,11 @@ packages:
function-bind: 1.1.1
dev: false
/highlight.js/11.4.0:
resolution: {integrity: sha512-nawlpCBCSASs7EdvZOYOYVkJpGmAOKMYZgZtUqSRqodZE0GRVcFKwo1RcpeOemqh9hyttTdd5wDBwHkuSyUfnA==}
engines: {node: '>=12.0.0'}
dev: false
/http-errors/1.8.1:
resolution: {integrity: sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==}
engines: {node: '>= 0.6'}

View file

@ -11,13 +11,19 @@ a:hover, a:focus {
text-decoration: underline;
}
code {
code, pre {
font-family: monospace;
overflow-x: auto;
padding: 1px 2px;
border-radius: 2px;
background-color: var(--background2);
}
pre {
padding: 1em 1em;
border-radius: 4px;
}
blockquote {
border-left: solid var(--color2) 4px;
padding: 0 1em;

22
public/highlight.css Normal file
View file

@ -0,0 +1,22 @@
.hljs-comment { color: var(--color2) }
.hljs-meta { color: var(--color2) }
.hljs-string { color: var(--accent3) }
.hljs-literal { color: var(--accent3) }
.hljs-variable { color: var(--accent3) }
.hljs-keyword { color: var(--accent1) }
.hljs-selector-tag { color: var(--accent1) }
.hljs-type { color: var(--accent1) }
.hljs-symbol { color: var(--accent2) }
.hljs-bullet { color: var(--accent2) }
.hljs-attribute { color: var(--accent2) }
.hljs-section { color: var(--accent2) }
.hljs-name { color: var(--accent2) }
.hljs-title { color: var(--accent2) }
.hljs-attr { color: var(--accent3) }
.hljs-template-variable { color: var(--accent3) }
.hljs-selector-id { color: var(--accent1) }
.hljs-selector-class { color: var(--accent1) }
.hljs-selector-attr { color: var(--accent1) }
.hljs-selector-pseudo { color: var(--accent1) }
.hljs-addition { color: #55a532 }
.hljs-deletion { color: #bd2c00 }

View file

@ -1,6 +1,7 @@
/* the main css stylesheet for everything */
@import "/static/form.css";
@import "/static/content.css";
@import "/static/highlight.css";
@import "/static/misc.css";
:root {
@ -22,7 +23,7 @@
body {
background: var(--background);
color: var(--color);
font: 16px/1.4 sysem-ui;
font: 16px/1.4 system-ui;
margin: 2em auto;
max-width: 900px;
overflow-y: overlay;

View file

@ -6,8 +6,10 @@
.post {
margin: 1em;
min-height: 240px;
border: solid var(--accent1) 2px;
overflow-wrap: break-word;
overflow: hidden;
background-size: cover;
}
@ -15,6 +17,10 @@
color: inherit;
}
.post pre {
overflow: hidden;
}
.fineprint {
color: var(--color2);
margin-bottom: 1em;

View file

@ -18,6 +18,9 @@ export default (app, { log, db, sessions }) => {
async function signup(req, res) {
const { username, password } = req.body;
// h usernames
if(/^[a-z0-9_-]{4,64}$/i.test(username)) return render(res, "signup", "passwords dont match");
// make sure the passwords match!
if(password !== req.body.firmpass) return render(res, "signup", "passwords dont match");

View file

@ -1,9 +1,19 @@
import markdown from "markdown-it";
import hljs from "highlight.js";
const md = markdown({
xHtmlOut: true,
langPrefix: "lang-",
typographer: true,
linkify: true,
highlight(str, lang) {
if (lang && hljs.getLanguage(lang)) {
try {
return hljs.highlight(str, { language: lang }).value;
} catch {}
}
return "";
},
});
// get a post by id