Compare commits
No commits in common. "8965c64a83e06d748a4e472f706820f725014c8a" and "83e72e7ed683b7b681412462567075c5e2793090" have entirely different histories.
8965c64a83
...
83e72e7ed6
|
@ -1,4 +0,0 @@
|
||||||
APP_PORT=8080
|
|
||||||
APP_DEBUG=true
|
|
||||||
|
|
||||||
MAXLEN=5120
|
|
|
@ -1,9 +0,0 @@
|
||||||
# blek! Bin
|
|
||||||
blek! Bin is a minimalist, privacy-respecting alternative to pastebin.
|
|
||||||
|
|
||||||
# Running an instance
|
|
||||||
```bash
|
|
||||||
cp .env.example .env
|
|
||||||
# edit your .env
|
|
||||||
npm run dev/prod
|
|
||||||
```
|
|
|
@ -1,26 +0,0 @@
|
||||||
const fs = require('fs');
|
|
||||||
const path = require('path');
|
|
||||||
const crypto = require('crypto');
|
|
||||||
|
|
||||||
const root = path.join(process.cwd(), '/usercontent');
|
|
||||||
console.log(root);
|
|
||||||
|
|
||||||
const make_id = () => {
|
|
||||||
return crypto.randomBytes(8).toString('hex');
|
|
||||||
};
|
|
||||||
|
|
||||||
async function get(id) {
|
|
||||||
return fs.readFile(path.join(root, id));
|
|
||||||
}
|
|
||||||
|
|
||||||
async function write(fname, data) {
|
|
||||||
return fs.writeFile(path.join(root, fname), data);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function create(data) {
|
|
||||||
const id = make_id();
|
|
||||||
await fs.writeFile(path.join(root, id), data);
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = { get, write, create, make_id };
|
|
|
@ -1,8 +1,4 @@
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
const bodyparse = require('body-parser');
|
|
||||||
|
|
||||||
router.use(bodyparse.json());
|
|
||||||
router.use(bodyparse.urlencoded({extended: true}));
|
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
|
@ -10,7 +10,6 @@
|
||||||
"author": "b1ek",
|
"author": "b1ek",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"body-parser": "^1.20.2",
|
|
||||||
"dotenv": "^16.0.3",
|
"dotenv": "^16.0.3",
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
"express-async-handler": "^1.2.0",
|
"express-async-handler": "^1.2.0",
|
||||||
|
|
|
@ -7,7 +7,6 @@ textarea {
|
||||||
border: 1px solid #6c6f6c;
|
border: 1px solid #6c6f6c;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
box-shadow: 0 2px 2px #20402030;
|
box-shadow: 0 2px 2px #20402030;
|
||||||
transition: 150ms ease;
|
|
||||||
padding: 4px 8px
|
padding: 4px 8px
|
||||||
}
|
}
|
||||||
textarea:hover {
|
textarea:hover {
|
||||||
|
@ -18,18 +17,3 @@ textarea:hover {
|
||||||
width: 400px;
|
width: 400px;
|
||||||
height: 240px
|
height: 240px
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
input[type=submit] {
|
|
||||||
background-color: rgb(236, 221, 200);
|
|
||||||
border: 1px solid #9c9f9c;
|
|
||||||
border-radius: 4px;
|
|
||||||
margin-top: 8px;
|
|
||||||
padding: 4px 8px;
|
|
||||||
font-family: monospace;
|
|
||||||
box-shadow: 0 2px 2px #60806020;
|
|
||||||
transition: 150ms ease;
|
|
||||||
}
|
|
||||||
input[type=submit]:hover {
|
|
||||||
box-shadow: 0 2px 4px #60806040;
|
|
||||||
}
|
|
|
@ -2,6 +2,5 @@ const express = require('express');
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
|
|
||||||
router.use(require('./main'));
|
router.use(require('./main'));
|
||||||
router.use(require('./upload'));
|
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
|
@ -1,16 +0,0 @@
|
||||||
const express = require('express');
|
|
||||||
const router = express.Router();
|
|
||||||
const handler = require('express-async-handler');
|
|
||||||
const content = require('../helpers/content');
|
|
||||||
|
|
||||||
async function upload(req, res) {
|
|
||||||
const data = req.body.text;
|
|
||||||
const id = await content.create(data);
|
|
||||||
res.redirect(
|
|
||||||
'/view?id=' + encodeURIComponent(id)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
router.post('/upload', handler(upload));
|
|
||||||
|
|
||||||
module.exports = router;
|
|
|
@ -1,2 +0,0 @@
|
||||||
./*
|
|
||||||
!./.gitignore
|
|
Loading…
Reference in New Issue