Update libraries and depdendies

pull/15/head 1.3.1
Joe Biellik 6 years ago
parent c3e8534157
commit 3d5b2f17a1

@ -1,6 +1,6 @@
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2015-2017 Joe Biellik Copyright (c) 2015-2018 Joe Biellik
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

@ -3,20 +3,20 @@
[![Release Version](https://img.shields.io/github/release/JoeBiellik/paste.svg)](https://github.com/JoeBiellik/paste/releases) [![Release Version](https://img.shields.io/github/release/JoeBiellik/paste.svg)](https://github.com/JoeBiellik/paste/releases)
[![Dependencies](https://img.shields.io/david/JoeBiellik/paste.svg)](https://david-dm.org/JoeBiellik/paste) [![Dependencies](https://img.shields.io/david/JoeBiellik/paste.svg)](https://david-dm.org/JoeBiellik/paste)
> Simple [Node.js](https://nodejs.org/) pastebin built with [Koa](http://koajs.com/), [MongoDB](https://www.mongodb.org/), [Jade](http://jade-lang.com/), [Bootstrap 4](http://v4-alpha.getbootstrap.com/) and [Prism.js](http://prismjs.com/). > Simple [Node.js](https://nodejs.org/) pastebin built with [Koa](https://koajs.com/), [MongoDB](https://www.mongodb.com/), [Jade](http://jade-lang.com/), [Bootstrap](https://getbootstrap.com/) and [Prism.js](https://prismjs.com/).
Try it out at [paste.fyi](http://paste.fyi/) Try it out at [paste.fyi](http://paste.fyi/)
## Features ## Features
* Clean code thanks to ES7 async/await and [Koa v2](http://koajs.com/) * Clean code thanks to ES7 async/await and [Koa](https://koajs.com/)
* Full syntax highlighting via [Prism.js](http://prismjs.com/) * Full syntax highlighting via [Prism.js](https://prismjs.com/)
* <kbd>CTRL</kbd>+<kbd>Enter</kbd> hotkey for quick paste submission * <kbd>CTRL</kbd>+<kbd>Enter</kbd> hotkey for quick paste submission
* Short URLs via [shortid](https://github.com/dylang/shortid), e.g. `NyQO9puMe` * Short URLs via [shortid](https://github.com/dylang/shortid), e.g. `NyQO9puMe`
* Full support for CLI requests with [curl](http://curl.haxx.se/) etc * Full support for CLI requests with [curl](https://curl.haxx.se/) etc
* Textarea grows to fit content via [autosize.js](https://github.com/jackmoore/autosize) * Textarea grows to fit content via [autosize.js](https://github.com/jackmoore/autosize)
* Automatic and configurable paste expiry * Automatic and configurable paste expiry
* Runs fully containerized with [Docker](https://www.docker.com/) and [Vagrant](https://www.vagrantup.com/) * Runs fully containerized with [Docker](https://www.docker.com/) and [Vagrant](https://www.vagrantup.com/)
* Simple and responsive UI built with [Bootstrap 4](http://v4-alpha.getbootstrap.com/) * Simple and responsive UI built with [Bootstrap](https://getbootstrap.com/)
## Usage ## Usage
```sh ```sh

@ -19,7 +19,7 @@ module.exports = {
ctx.body = paste.paste; ctx.body = paste.paste;
} }
} catch (ex) { } catch (ex) {
ctx.throw('Paste Not Found', 404); ctx.throw(404, 'Paste Not Found');
} }
}, },

@ -8,8 +8,10 @@ module.exports = () => {
mongoose.connection.once('open', util.log.bind(util, 'MongoDB connection open')); mongoose.connection.once('open', util.log.bind(util, 'MongoDB connection open'));
mongoose.connection.on('error', console.error.bind(console, 'MongoDB connection error:')); mongoose.connection.on('error', console.error.bind(console, 'MongoDB connection error:'));
mongoose.set('useCreateIndex', true);
mongoose.connect(config.db, { mongoose.connect(config.db, {
useMongoClient: true useNewUrlParser: true
}); });
return mongoose.connection; return mongoose.connection;

@ -2,7 +2,7 @@ const mongoose = require('mongoose');
const shortid = require('shortid'); const shortid = require('shortid');
const paste = new mongoose.Schema({ const paste = new mongoose.Schema({
_id: { type: String, unique: true, default: shortid.generate }, _id: { type: String, default: shortid.generate },
paste: { type: String }, paste: { type: String },
expiresAt: { type: Date, expires: 0, default: new Date(Date.now() + 1000 * 60 * 60 * 24 * 7) } expiresAt: { type: Date, expires: 0, default: new Date(Date.now() + 1000 * 60 * 60 * 24 * 7) }
}, { }, {

4910
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -1,11 +1,11 @@
{ {
"name": "paste", "name": "paste",
"version": "1.3.0", "version": "1.3.1",
"description": "Simple Node.js pastebin", "description": "Simple Node.js pastebin",
"license": "MIT", "license": "MIT",
"repository": "JoeBiellik/paste", "repository": "JoeBiellik/paste",
"homepage": "https://github.com/JoeBiellik/paste", "homepage": "https://github.com/JoeBiellik/paste",
"author": "Joe Biellik <contact@joebiellik.com> (http://joebiellik.com/)", "author": "Joe Biellik <contact@joebiellik.com> (https://joebiellik.com/)",
"bugs": { "bugs": {
"email": "contact@joebiellik.com", "email": "contact@joebiellik.com",
"url": "https://github.com/JoeBiellik/paste/issues" "url": "https://github.com/JoeBiellik/paste/issues"
@ -23,21 +23,21 @@
"lint": "eslint . && pug-lint ./views" "lint": "eslint . && pug-lint ./views"
}, },
"dependencies": { "dependencies": {
"config": "^1.16.0", "config": "^3.0.0",
"koa": "^2.3.0", "koa": "^2.3.0",
"koa-body": "^2.3.0", "koa-body": "^4.0.4",
"koa-compress": "^2.0.0", "koa-compress": "^3.0.0",
"koa-logger": "^3.0.1", "koa-logger": "^3.0.1",
"koa-router": "^7.2.1", "koa-router": "^7.2.1",
"koa-static-cache": "^5.1.1", "koa-static-cache": "^5.1.1",
"koa-views": "^6.0.2", "koa-views": "^6.0.2",
"mongoose": "^4.11.4", "mongoose": "^5.3.13",
"pug": "^2.0.0-rc.2", "pug": "^2.0.0-rc.2",
"shortid": "^2.2.4" "shortid": "^2.2.4"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^4.3.0", "eslint": "^5.9.0",
"nodemon": "^1.7.2", "nodemon": "^1.18.6",
"pug-lint": "^2.3.0" "pug-lint": "^2.5.0"
} }
} }

@ -1,58 +1,50 @@
extends layout extends layout
block head block head
link(rel='stylesheet', href='https://cdn.jsdelivr.net/prism/1.5.1/themes/prism-coy.css') link(rel='stylesheet', href='https://cdn.jsdelivr.net/npm/prismjs@1.15.0/themes/prism-coy.css')
link(rel='stylesheet', href='https://cdn.jsdelivr.net/prism/1.6.0/plugins/toolbar/prism-toolbar.css') link(rel='stylesheet', href='https://cdn.jsdelivr.net/npm/prismjs@1.15.0/plugins/toolbar/prism-toolbar.css')
link(rel='stylesheet', href='https://cdn.jsdelivr.net/prism/1.5.1/plugins/line-numbers/prism-line-numbers.css') link(rel='stylesheet', href='https://cdn.jsdelivr.net/npm/prismjs@1.15.0/plugins/line-numbers/prism-line-numbers.css')
style. style.
html, body { html, body, .code-toolbar, pre, code {
height: 100%; height: 100%;
} }
html, body, code, pre {
min-height: 100%;
}
pre[class*="language-"] { pre[class*="language-"] {
margin: 0; margin: 0;
box-shadow: none;
max-height: none;
border-left: none;
} }
pre[class*="language-"]::before, pre[class*="language-"]::after { pre[class*="language-"]::before, pre[class*="language-"]::after {
box-shadow: none;
display: none; display: none;
} }
pre.code-toolbar > .toolbar { .code-toolbar > .toolbar {
top: 20px; top: 1rem;
right: 20px; right: 1rem;
opacity: .5; opacity: 1;
}
pre[class*="language-"] > code {
border-left: none;
} }
pre.code-toolbar > .toolbar a, .code-toolbar > .toolbar a, .code-toolbar > .toolbar button, .code-toolbar > .toolbar span {
pre.code-toolbar > .toolbar button, padding: 0.25rem 1rem 0.5rem;
pre.code-toolbar > .toolbar span { font-size: 1.2rem;
padding: .5rem 1rem;
font-size: 1.25rem;
color: #fff; color: #fff;
background-color: #0275d8; background-color: #0275d8;
border-color: #0275d8; border-color: #0275d8;
border-radius: .3rem; border-radius: .3rem;
opacity: 0.5;
transition: opacity 0.3s ease-in-out;
} }
pre.code-toolbar > .toolbar a:hover, .code-toolbar > .toolbar a:hover, .code-toolbar > .toolbar a:focus, .code-toolbar > .toolbar button:hover, .code-toolbar > .toolbar button:focus, .code-toolbar > .toolbar span:hover, .code-toolbar > .toolbar span:focus {
pre.code-toolbar > .toolbar a:focus,
pre.code-toolbar > .toolbar button:hover,
pre.code-toolbar > .toolbar button:focus,
pre.code-toolbar > .toolbar span:hover,
pre.code-toolbar > .toolbar span:focus {
color: #fff; color: #fff;
background-color: #025aa5; background-color: #025aa5;
opacity: 1;
} }
block content block content
pre.line-numbers pre.line-numbers
code(class='language-' + lang) code(class='language-' + lang)
| #{paste} | #{paste}
script(src='https://cdn.jsdelivr.net/prism/1.6.0/prism.js') script(src='https://cdn.jsdelivr.net/npm/prismjs@1.15.0/prism.js')
script(src='https://cdn.jsdelivr.net/prism/1.6.0/components/prism-' + lang + '.min.js') script(src='https://cdn.jsdelivr.net/npm/prismjs@1.15.0/components/prism-' + lang + '.min.js')
script(src='https://cdn.jsdelivr.net/prism/1.6.0/plugins/toolbar/prism-toolbar.min.js') script(src='https://cdn.jsdelivr.net/npm/prismjs@1.15.0/plugins/toolbar/prism-toolbar.min.js')
script(src='https://cdn.jsdelivr.net/prism/1.6.0/plugins/line-numbers/prism-line-numbers.min.js') script(src='https://cdn.jsdelivr.net/npm/prismjs@1.15.0/plugins/line-numbers/prism-line-numbers.min.js')
script(src='https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.7.1/clipboard.min.js') script(src='https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js')
script(src='https://cdn.jsdelivr.net/prism/1.6.0/plugins/copy-to-clipboard/prism-copy-to-clipboard.min.js') script(src='https://cdn.jsdelivr.net/npm/prismjs@1.15.0/plugins/copy-to-clipboard/prism-copy-to-clipboard.min.js')

@ -70,6 +70,6 @@ block content
pre.text-center.text-muted.mb-0. pre.text-center.text-muted.mb-0.
echo 'Hello World' | curl -F 'paste=&lt;-' #{url} echo 'Hello World' | curl -F 'paste=&lt;-' #{url}
script(src='https://cdnjs.cloudflare.com/ajax/libs/autosize.js/4.0.0/autosize.min.js' integrity='sha256-F7Bbc+3hGv34D+obsHHsSm3ZKRBudWR7e2H0fS0beok=', crossorigin='anonymous') script(src='https://cdnjs.cloudflare.com/ajax/libs/autosize.js/4.0.2/autosize.min.js' integrity='sha256-dW8u4dvEKDThJpWRwLgGugbARnA3O2wqBcVerlg9LMc=', crossorigin='anonymous')
script(src='https://code.jquery.com/jquery-3.2.1.min.js', integrity='sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=', crossorigin='anonymous') script(src='https://code.jquery.com/jquery-3.3.1.min.js', integrity='sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=', crossorigin='anonymous')
script(src='/main.js') script(src='/main.js')

@ -4,7 +4,7 @@ html(lang='en')
meta(charset='utf-8') meta(charset='utf-8')
meta(name='viewport', content='width=device-width, initial-scale=1, shrink-to-fit=no') meta(name='viewport', content='width=device-width, initial-scale=1, shrink-to-fit=no')
title #{title} title #{title}
link(rel='stylesheet', href='https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css', integrity='sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ', crossorigin='anonymous') link(rel='stylesheet', href='https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css', integrity='sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO', crossorigin='anonymous')
block head block head

Loading…
Cancel
Save