Added setting to directly view resource in browser

pull/60/head
tycrek 3 years ago
parent 2ca3cd31df
commit d29f964c6b
No known key found for this signature in database
GPG Key ID: 25D74F3943625263

@ -107,7 +107,7 @@ ass was designed with developers in mind. If you are a developer & want somethin
[Docker](#docker) is the recommended way to install ass, but you can also install it locally.
1. You should have **Node.js 14 or later** & **npm 7 or later** installed.
1. You should have **Node.js 14** & **npm 7 or later** installed.
2. Clone this repo using `git clone https://github.com/tycrek/ass.git && cd ass/`
3. Run `npm i` to install the required dependencies
5. Run `npm start` to start ass.

@ -2,7 +2,7 @@ const fs = require('fs-extra');
const escape = require('escape-html');
const fetch = require('node-fetch');
const { deleteS3 } = require('../storage');
const { diskFilePath, s3enabled } = require('../config.json');
const { diskFilePath, s3enabled, viewDirect } = require('../config.json');
const { path, log, getTrueHttp, getTrueDomain, formatBytes, formatTimestamp, getS3url, getDirectUrl, getResourceColor, replaceholder } = require('../utils');
const { CODE_UNAUTHORIZED, CODE_NOT_FOUND, } = require('../MagicNumbers.json');
const data = require('../data');
@ -47,7 +47,8 @@ router.get('/', (req, res, next) => data.get(req.ass.resourceId).then((fileData)
oembedUrl: `${getTrueHttp()}${getTrueDomain()}/${resourceId}/oembed`,
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.originalname)
opengraph: replaceholder(ogs.join('\n'), fileData.size, fileData.timestamp, fileData.originalname),
viewDirect
});
}).catch(next));

@ -10,6 +10,7 @@ const config = {
gfyIdSize: 2,
resourceIdType: 'random',
mediaStrict: false,
viewDirect: false,
frontendName: 'ass-x',
indexFile: '',
s3enabled: false,
@ -143,6 +144,12 @@ function doSetup() {
default: config.mediaStrict,
required: false
},
viewDirect: {
description: 'View uploads in browser as direct resource, rather than a viewing page',
type: 'boolean',
default: config.viewDirect,
required: false
},
frontendName: {
description: 'Name of your frontend (leave blank if not using frontends)',
type: 'string',

@ -20,6 +20,12 @@ html
// oEmbed (https://oembed.com/)
link(href=oembedUrl title='oEmbed' rel='alternate' type='application/json+oembed')
// Direct resource redirect
if viewDirect
style.
* { display: none !important; }
meta(http-equiv='refresh' content=`0; url='${resourceAttr.src}'`)
body
#container
#content

Loading…
Cancel
Save