From 651f213351e549725c8d1b2e6b37838a565a3fdf Mon Sep 17 00:00:00 2001 From: tycrek Date: Mon, 18 Apr 2022 11:25:21 -0600 Subject: [PATCH] Added toggle for brand line --- src/routers/resource.ts | 8 +++++++- views/view.pug | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/routers/resource.ts b/src/routers/resource.ts index 398fbd1..f0acc4d 100644 --- a/src/routers/resource.ts +++ b/src/routers/resource.ts @@ -16,6 +16,10 @@ import { users } from '../auth'; import express from 'express'; const router = express.Router(); +let theme = {}; +if (path('share/', 'theme.json')) + theme = fs.readJsonSync(path('share/', 'theme.json')); + // Middleware for parsing the resource ID and handling 404 router.use((req: Request, res: Response, next) => { // Parse the resource ID @@ -57,7 +61,9 @@ router.get('/', (req: Request, res: Response, next) => data().get(req.ass.resour ogtype: fileData.is.video ? 'video.other' : fileData.is.image ? 'image' : 'website', urlType: `og:${fileData.is.video ? 'video' : fileData.is.audio ? 'audio' : 'image'}`, opengraph: replaceholder(ogs.join('\n'), fileData.size, fileData.timestamp, fileData.timeoffset, fileData.originalname), - viewDirect + viewDirect, + //@ts-ignore + showAd: theme.showAd ?? true, }); }).catch(next)); diff --git a/views/view.pug b/views/view.pug index 2ef16ed..c6aefa5 100644 --- a/views/view.pug +++ b/views/view.pug @@ -41,4 +41,5 @@ html span #{timestamp} (#{size}) br 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 + if showAd + .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