7 changed files with 77 additions and 50 deletions
@ -1,27 +0,0 @@ |
|||||||
{ |
|
||||||
"page-title": "Free Pastebin for One-Off Markdown Publishing", |
|
||||||
"title": "Free and Hassle-free Pastebin for Markdown Notes.", |
|
||||||
"name": "NoteHub", |
|
||||||
"new-page": "New Page", |
|
||||||
"status-404": "Not Found", |
|
||||||
"status-400": "Bad Request", |
|
||||||
"status-403": "Forbidden", |
|
||||||
"status-500": "Internal Server Error", |
|
||||||
"footer": "Source code on [GitHub](https://github.com/chmllr/NoteHub) · Hosted on [Heroku](http://heroku.com) · DB on [RedisLabs](http://redislabs.com) · SSL by [CloudFlare](http://cloudflare.com) <br/> Created by [@chmllr](https://github.com/chmllr)", |
|
||||||
"loading": "Loading...", |
|
||||||
"set-passwd": "Password for editing", |
|
||||||
"enter-passwd": "Password", |
|
||||||
"publish": "Publish", |
|
||||||
"update": "Save", |
|
||||||
"published": "Published", |
|
||||||
"publisher": "Publisher", |
|
||||||
"edited": "Edited", |
|
||||||
"views": "Article Views", |
|
||||||
"statistics": "Statistics", |
|
||||||
"stats": "statistics", |
|
||||||
"export": "export", |
|
||||||
"notehub": "⌂ notehub", |
|
||||||
"edit": "edit", |
|
||||||
"short-url": "short url", |
|
||||||
"api-title": "API" |
|
||||||
} |
|
||||||
@ -0,0 +1,33 @@ |
|||||||
|
<!DOCTYPE html> |
||||||
|
<html> |
||||||
|
|
||||||
|
<head> |
||||||
|
<title>NoteHub — New Page</title> |
||||||
|
<meta charset="UTF-8" /> |
||||||
|
<meta content="width=device-width, initial-scale=1.0" name="viewport" /> |
||||||
|
<link href="/style.css" rel="stylesheet" type="text/css" /> |
||||||
|
<script src="//cdnjs.cloudflare.com/ajax/libs/marked/0.3.5/marked.min.js" type="text/javascript"></script> |
||||||
|
<script src="//cdnjs.cloudflare.com/ajax/libs/blueimp-md5/1.0.1/js/md5.min.js" type="text/javascript"></script> |
||||||
|
<script src="/js/publishing.js" type="text/javascript"></script> |
||||||
|
</head> |
||||||
|
|
||||||
|
<body onload="onLoad()"> |
||||||
|
<article id="preview" style="flex: none; -webkit-flex: none"></article> |
||||||
|
<div class="hidden" id="dashed-line"></div> |
||||||
|
<div class="central-element helvetica" style="margin-bottom: 3em"> |
||||||
|
<form action="/note" autocomplete="off" method="%METHOD%"> |
||||||
|
<input id="password" name="password" type="hidden"> |
||||||
|
<input id="session" name="session" type="hidden" value="%SESSION%" /> |
||||||
|
<input id="signature" name="signature" type="hidden" /> |
||||||
|
<textarea id="note" name="note">Loading...</textarea> |
||||||
|
<fieldset class="hidden" id="input-elems"> |
||||||
|
<input class="ui-elem" id="plain-password" name="plain-password" placeholder="Password for editing" type="text"> |
||||||
|
<input class="button ui-elem" id="publish-button" type="submit" value="Publish"> |
||||||
|
<br> |
||||||
|
<br> |
||||||
|
</fieldset> |
||||||
|
</form> |
||||||
|
</div> |
||||||
|
</body> |
||||||
|
|
||||||
|
</html> |
||||||
@ -1,10 +1,15 @@ |
|||||||
var marked = require("marked"); |
var marked = require("marked"); |
||||||
var fs = require("fs"); |
var fs = require("fs"); |
||||||
|
|
||||||
var template = fs.readFileSync("resources/template.html", "utf-8"); |
var pageTemplate = fs.readFileSync("resources/template.html", "utf-8"); |
||||||
var buildHTML = (id, title, content) => template |
var newNoteTemplate = fs.readFileSync("resources/new.html", "utf-8"); |
||||||
|
var buildPage = (id, title, content) => pageTemplate |
||||||
.replace("%TITLE%", title) |
.replace("%TITLE%", title) |
||||||
.replace(/%LINK%/g, id) |
.replace(/%LINK%/g, id) |
||||||
.replace("%CONTENT%", content); |
.replace("%CONTENT%", content); |
||||||
|
|
||||||
module.exports.build = note => buildHTML(note.id, note.title, marked(note.text)); |
module.exports.buildNote = note => buildPage(note.id, note.title, marked(note.text)); |
||||||
|
|
||||||
|
module.exports.newNotePage = session => newNoteTemplate |
||||||
|
.replace("%METHOD%", "POST") |
||||||
|
.replace("%SESSION%", session); |
||||||
|
|||||||
Loading…
Reference in new issue