Merge branch 'tailwind'

pull/127/head
tycrek 2 years ago
commit 39a04f446f
No known key found for this signature in database
GPG Key ID: 25D74F3943625263

3025
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -40,13 +40,16 @@
"@skynetlabs/skynet-nodejs": "^2.3.0",
"@tsconfig/node16": "^1.0.1",
"@tycrek/express-nofavicon": "^1.0.3",
"@tycrek/express-postcss": "^0.1.0",
"@tycrek/isprod": "^2.0.2",
"@tycrek/log": "^0.5.9",
"@tycrek/papito": "^0.3.4",
"any-shell-escape": "^0.1.1",
"autoprefixer": "^10.3.7",
"aws-sdk": "^2.1008.0",
"check-node-version": "^4.1.0",
"crypto-random-string": "3.3.1",
"cssnano": "^5.0.8",
"discord-webhook-node": "^1.1.8",
"escape-html": "^1.0.3",
"express": "^4.17.1",
@ -60,11 +63,13 @@
"marked": "^3.0.7",
"node-fetch": "^2.6.7",
"node-vibrant": "^3.1.6",
"postcss-font-magician": "^3.0.0",
"prompt": "^1.2.0",
"pug": "^3.0.2",
"sanitize-filename": "^1.6.3",
"stream-to-array": "^2.3.0",
"submodule": "^1.2.1",
"tailwindcss": "^3.0.23",
"typescript": "^4.4.4",
"uuid": "^8.3.2"
},
@ -79,6 +84,7 @@
"@types/node": "^16.9.0",
"@types/node-fetch": "^2.5.12",
"@types/stream-to-array": "^2.3.0",
"@types/tailwindcss": "^3.0.9",
"@types/uuid": "^8.3.1",
"@types/ws": "^7.4.7"
}

@ -22,13 +22,15 @@ const { host, port, useSsl, isProxied, s3enabled, frontendName, indexFile, useSi
import fs from 'fs-extra';
import express from 'express';
const nofavicon = require('@tycrek/express-nofavicon');
const epcss = require('@tycrek/express-postcss');
import tailwindcss from 'tailwindcss';
import helmet from 'helmet';
import marked from 'marked';
import uploadRouter from './routers/upload';
import resourceRouter from './routers/resource';
import { path, log, getTrueHttp, getTrueDomain } from './utils';
const { CODE_INTERNAL_SERVER_ERROR } = require('../MagicNumbers.json');
const { name: ASS_NAME, version: ASS_VERSION } = require('../package.json');
const { name: ASS_NAME, version: ASS_VERSION, homepage } = require('../package.json');
//#endregion
// Welcome :D
@ -73,11 +75,7 @@ const ASS_INDEX = indexFile !== '' && fs.existsSync(path('share', indexFile)) &&
const ASS_INDEX_ENABLED = typeof ASS_INDEX === typeof Function;
app.get('/', (req, res, next) => ASS_INDEX_ENABLED // skipcq: JS-0229
? ASS_INDEX(req, res, next)
: fs.readFile(path('.github', 'README.md'))
.then((bytes) => bytes.toString())
.then((data) => marked(data))
.then((d) => res.render('index', { data: d }))
.catch(next));
: res.redirect(homepage));
// Set up custom frontend
const ASS_FRONTEND = fs.existsSync(path(`./${frontendName}/package.json`)) ? (require('submodule'), require(`../${frontendName}`)) : { enabled: false };
@ -86,6 +84,18 @@ ASS_FRONTEND.enabled && app.use(ASS_FRONTEND.endpoint, ASS_FRONTEND.router); //
// Upload router (has to come after custom frontends as express-busboy interferes with all POST calls)
app.use('/', ROUTERS.upload);
// CSS
app.use('/css', epcss({
cssPath: path('tailwind.css'),
plugins: [
tailwindcss,
require('autoprefixer')(),
require('cssnano')(),
require('postcss-font-magician')(),
],
warn: (warning: Error) => log.warn('PostCSS', warning.toString())
}));
// '/:resouceId' always needs to be LAST since it's a catch-all route
app.use('/:resourceId', (req: AssRequest, _res, next) => (req.resourceId = req.params.resourceId, next()), ROUTERS.resource); // skipcq: JS-0086, JS-0090

@ -0,0 +1,42 @@
const primary = '#FD842D';
const primaryDim = '#B64D02';
module.exports = {
separator: '_',
darkMode: 'class',
plugins: [
//require('tailwindcss-textshadow')
],
content: ['./views/**/*.pug'],
theme: {
extend: {
fontFamily: {
main: ['"Josefin Sans"', 'ui-sans-serif', 'system-ui', 'sans-serif']
},
backgroundColor: {
'primary': primary,
'body': '#212121',
},
colors: {
'content-bg': '#151515',
'primary': primary,
'primary-dim': primaryDim,
'primary-dark': '#793301',
'link-hover': '#FD710D',
'link-active': '#DE5E02',
'text-primary': '#BDBDBD',
},
borderColor: {
'primary-dim': primaryDim
},
maxHeight: {
'half-port': '50vh'
},
borderRadius: {
'24': '24px'
},
fontSize: {
'footer': '0.9rem'
}
}
}
};

@ -0,0 +1,27 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
.res-media {
@apply border-l-4 rounded max-h-half-port;
}
.link {
@apply no-underline hover_no-underline active_no-underline visited_no-underline
/* regular, visited */
text-primary visited_text-primary
border-b-2 visited_border-b-2
border-transparent visited_border-transparent
rounded-sm visited_rounded-sm
/* hover */
hover_text-link-hover
hover_border-primary-dim
/* active */
active_text-link-active
/* transitions */
ease-linear duration-150 transition-all;
}

@ -1,36 +0,0 @@
:root {
--color-primary: #fd842d;
--color-primary-dim: #B64D02;
--color-primary-dark: #793301;
--color-link-hover: #FD710D;
--color-link-active: #DE5E02;
}
/* Modest fixes */
pre, code { background-color: #1A1A1A !important; }
h1, h2, h3 { border-bottom: 2px solid #323232 !important; }
pre { overflow-x: hidden !important; }
/* Dark theme */
body {
background-color: #212121 !important;
color: #BDBDBD !important;
}
body, button { text-shadow: 1px 1px 1px black; }
code { color: #EEE !important; }
pre { border-radius: 16px; }
/* Remove styles and colors from links */
a, a:hover, a:active, a:visited { text-decoration: none; }
a, a:visited {
color: var(--color-primary) !important;
border-bottom: 2px solid;
border-bottom-color: transparent;
border-radius: 2px;
transition: color 150ms linear, border-bottom-color 150ms linear;
}
a:hover { color: var(--color-link-hover) !important; border-bottom-color: var(--color-primary-dim); }
a:active { color: var(--color-link-active) !important; }

@ -1,5 +0,0 @@
@import url('https://fonts.googleapis.com/css2?family=Josefin+Sans:wght@400;700&display=swap');
body, h1, h2, h3, h4, h5, h6, button {
font-family: 'Josefin Sans', sans-serif;
}

@ -1,5 +0,0 @@
img, video, audio {
border-left-width: 4px;
border-left-style: solid;
border-radius: 4px;
}

@ -1,221 +0,0 @@
/* 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;
}

@ -1,29 +0,0 @@
#container {
display: flex;
justify-content: center;
align-items: center;
text-align: center;
width: 100%;
height: 100%;
}
#content {
background-color: #151515;
border-radius: 24px;
}
#footer {
font-size-adjust: 0.3;
margin-left: 16px;
margin-right: 16px;
}
img, video, audio {
max-height: 50vh;
}
figcaption strong {
font-weight: bold;
}

@ -1,8 +1,7 @@
meta(name='viewport' content='width=device-width, initial-scale=1.0, viewport-fit=cover')
//- Markdown stylesheet & Highlight.js theme
style: include css/ass.css
style: include css/modest.css
link(rel='stylesheet', href='/css')
style: include css/dracula.highlight.js.css
//- jQuery; Highlight.js for codeblocks; Font Awesome

@ -1,7 +0,0 @@
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')
include head
include opengraph
body!=data

@ -2,14 +2,9 @@ html
head
title!=title
include head
style: include css/font.css
style.
body, h1, h2, h3, h4, h5, h6 { font-size: larger; }
style: include css/view.css
if color !== null
style: include css/img.css
style.
img, video, audio { border-color: #{color}; }
.res-media { border-color: #{color}; }
// Open Graph (https://ogp.me/)
meta(property='og:type' content=ogtype)
@ -26,24 +21,24 @@ html
* { display: none !important; }
meta(http-equiv='refresh' content=`0; url='${resourceAttr.src}'`)
body
#container
#content
h4!=title
figure
if fileIs.video
video#media(controls loop muted playsinline preload='metadata')&attributes(resourceAttr)
body.font-main.text-text-primary.bg-body
.w-full.h-full.flex.justify-center.items-center.text-center
.bg-content-bg.rounded-24
h4.mt-6.mb-4.text-3xl.font-main!=title
figure.block.mx-10.my-4.flex.flex-col.align-items-center
if fileIs.video
video.res-media(controls loop muted playsinline preload='metadata')&attributes(resourceAttr)
else if fileIs.image
img#media(decoding='async')&attributes(resourceAttr)
img.res-media(decoding='async')&attributes(resourceAttr)
else if fileIs.audio
audio#media(controls loop preload='metadata')&attributes(resourceAttr)
audio.res-media(controls loop preload='metadata')&attributes(resourceAttr)
else
code!=mimetype
figcaption
br
span Uploaded by #[strong!=uploader]
span.text-2xl Uploaded by #[strong!=uploader]
br
small #{timestamp} (#{size})
span #{timestamp} (#{size})
br
small: a(href='#' onclick=`window.location = '${resourceAttr.src}?download=yes'; return false;` download=title) Download
#footer: p Image hosted by #[a#footer-link(href='https://github.com/tycrek/ass' target='_blank'): strong ass], the superior self-hosted ShareX server
span: a.link(href='#' onclick=`window.location = '${resourceAttr.src}?download=yes'; return false;` download=title) Download
.mx-4.mb-8.text-footer: p Image hosted by #[a.link(href='https://github.com/tycrek/ass' target='_blank'): strong ass], the superior self-hosted ShareX server

Loading…
Cancel
Save