added index page

pull/19/head
tycrek 3 years ago
parent c396710bc6
commit 19a54b5af4
No known key found for this signature in database
GPG Key ID: 25D74F3943625263

@ -14,6 +14,7 @@ const fs = require('fs-extra');
const express = require('express');
const useragent = require('express-useragent');
const rateLimit = require("express-rate-limit");
const marked = require('marked');
const multer = require('multer');
const DateTime = require('luxon').DateTime;
const { WebhookClient, MessageEmbed } = require('discord.js');
@ -80,6 +81,7 @@ function preStartup() {
function startup() {
app.enable('case sensitive routing');
app.set('trust proxy', isProxied);
app.set('view engine', 'pug');
app.use(useragent.express());
// Don't process favicon requests
@ -94,6 +96,9 @@ function startup() {
(!req.ass.resourceId || !data[req.ass.resourceId]) ? res.sendStatus(404) : next();
});
// Index
app.get('/', (_req, res) => fs.readFile(path('README.md')).then((bytes) => bytes.toString()).then(marked).then((data) => res.render('index', { data })));
// Rate limit
app.post('/', rateLimit({
windowMs: 1000 * 60, // 60 seconds

@ -0,0 +1,80 @@
/* Dracula Theme v1.2.5
*
* https://github.com/dracula/highlightjs
*
* Copyright 2016-present, All rights reserved
*
* Code licensed under the MIT license
*
* @author Denis Ciccale <dciccale@gmail.com>
* @author Zeno Rocha <hi@zenorocha.com>
*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
background: #282a36;
}
.hljs-built_in,
.hljs-selector-tag,
.hljs-section,
.hljs-link {
color: #8be9fd;
}
.hljs-keyword {
color: #ff79c6;
}
.hljs,
.hljs-subst {
color: #f8f8f2;
}
.hljs-title {
color: #50fa7b;
}
.hljs-string,
.hljs-meta,
.hljs-name,
.hljs-type,
.hljs-attr,
.hljs-symbol,
.hljs-bullet,
.hljs-addition,
.hljs-variable,
.hljs-template-tag,
.hljs-template-variable {
color: #f1fa8c;
}
.hljs-comment,
.hljs-quote,
.hljs-deletion {
color: #6272a4;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-title,
.hljs-section,
.hljs-doctag,
.hljs-type,
.hljs-name,
.hljs-strong {
font-weight: bold;
}
.hljs-literal,
.hljs-number {
color: #bd93f9;
}
.hljs-emphasis {
font-style: italic;
}

@ -0,0 +1,20 @@
html
head
title ass - The superior self-hosted ShareX server
meta(name='description' content='ass is a self-hosted ShareX upload server written in Node.js')
style: include modest.css
style: include dracula.highlight.js.css
script(src='https://cdn.jsdelivr.net/npm/darkreader@4/darkreader.min.js')
script(src='https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.7.1/build/highlight.min.js')
script.
// Dark mode with Dark Reader
DarkReader.enable({
brightness: 100,
contrast: 100,
sepia: 5
});
// Highlight code blocks
hljs.highlightAll();
include opengraph
body!=data

@ -0,0 +1,221 @@
/* https://markdowncss.github.io/modest/ */
@media print {
*,
*:before,
*:after {
background: transparent !important;
color: #000 !important;
box-shadow: none !important;
text-shadow: none !important;
}
a,
a:visited {
text-decoration: underline;
}
a[href]:after {
content: " (" attr(href) ")";
}
abbr[title]:after {
content: " (" attr(title) ")";
}
a[href^="#"]:after,
a[href^="javascript:"]:after {
content: "";
}
pre,
blockquote {
border: 1px solid #999;
page-break-inside: avoid;
}
thead {
display: table-header-group;
}
tr,
img {
page-break-inside: avoid;
}
img {
max-width: 100% !important;
}
p,
h2,
h3 {
orphans: 3;
widows: 3;
}
h2,
h3 {
page-break-after: avoid;
}
}
pre,
code {
font-family: Menlo, Monaco, "Courier New", monospace;
}
pre {
padding: .5rem;
line-height: 1.25;
overflow-x: scroll;
}
a,
a:visited {
color: #3498db;
}
a:hover,
a:focus,
a:active {
color: #2980b9;
}
.modest-no-decoration {
text-decoration: none;
}
html {
font-size: 12px;
}
@media screen and (min-width: 32rem) and (max-width: 48rem) {
html {
font-size: 15px;
}
}
@media screen and (min-width: 48rem) {
html {
font-size: 16px;
}
}
body {
line-height: 1.85;
}
p,
.modest-p {
font-size: 1rem;
margin-bottom: 1.3rem;
}
h1,
.modest-h1,
h2,
.modest-h2,
h3,
.modest-h3,
h4,
.modest-h4 {
margin: 1.414rem 0 .5rem;
font-weight: inherit;
line-height: 1.42;
}
h1,
.modest-h1 {
margin-top: 0;
font-size: 3.998rem;
}
h2,
.modest-h2 {
font-size: 2.827rem;
}
h3,
.modest-h3 {
font-size: 1.999rem;
}
h4,
.modest-h4 {
font-size: 1.414rem;
}
h5,
.modest-h5 {
font-size: 1.121rem;
}
h6,
.modest-h6 {
font-size: .88rem;
}
small,
.modest-small {
font-size: .707em;
}
/* https://github.com/mrmrs/fluidity */
img,
canvas,
iframe,
video,
svg,
select,
textarea {
max-width: 100%;
}
@import url(http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,300italic,700);
@import url(http://fonts.googleapis.com/css?family=Arimo:700,700italic);
html {
font-size: 18px;
max-width: 100%;
}
body {
color: #444;
font-family: 'Open Sans Condensed', sans-serif;
font-weight: 300;
margin: 0 auto;
max-width: 48rem;
line-height: 1.45;
padding: .25rem;
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-family: Arimo, Helvetica, sans-serif;
}
h1,
h2,
h3 {
border-bottom: 2px solid #fafafa;
margin-bottom: 1.15rem;
padding-bottom: .5rem;
text-align: center;
}
blockquote {
border-left: 8px solid #fafafa;
padding: 1rem;
}
pre,
code {
background-color: #fafafa;
}

@ -0,0 +1,5 @@
meta(property='og:title' content='ass - The superior self-hosted ShareX server')
meta(property='og:type' content='website')
meta(property='og:url' content='https://github.com/tycrek/ass')
meta(property='og:description' content='ass is a self-hosted ShareX upload server written in Node.js')
meta(property='og:image' content='https://jmoore.dev/files/ass-round-square-logo-white-with-text.png')
Loading…
Cancel
Save