From 74678904f2856ce96e1303a5187e37d0986356e3 Mon Sep 17 00:00:00 2001 From: tycrek Date: Sat, 16 Oct 2021 22:33:36 -0600 Subject: [PATCH] Print "on Sia blockchain" in logs --- src/ass.ts | 4 ++-- src/storage.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ass.ts b/src/ass.ts index 5ec86c3..6fec4b2 100644 --- a/src/ass.ts +++ b/src/ass.ts @@ -16,7 +16,7 @@ if (doSetup) { } // Load the config -const { host, port, useSsl, isProxied, s3enabled, frontendName, indexFile } = require('../config.json'); +const { host, port, useSsl, isProxied, s3enabled, frontendName, indexFile, useSia } = require('../config.json'); //#region Imports import fs from 'fs-extra'; @@ -100,4 +100,4 @@ log .info('Frontend', ASS_FRONTEND.enabled ? ASS_FRONTEND.brand : 'disabled', `${ASS_FRONTEND.enabled ? `${getTrueHttp()}${getTrueDomain()}${ASS_FRONTEND.endpoint}` : ''}`) .info('Custom index', ASS_INDEX_ENABLED ? `enabled` : 'disabled') .blank() - .express().Host(app, port, host, () => log.success('Ready for uploads', `Storing resources ${s3enabled ? 'in S3' : 'on disk'}`)); + .express().Host(app, port, host, () => log.success('Ready for uploads', `Storing resources ${s3enabled ? 'in S3' : useSia ? 'on Sia blockchain' : 'on disk'}`)); diff --git a/src/storage.ts b/src/storage.ts index 52387be..30de980 100644 --- a/src/storage.ts +++ b/src/storage.ts @@ -9,6 +9,7 @@ import Vibrant from './vibrant'; import Hash from './hash'; import { generateId, log } from './utils'; const { s3enabled, s3endpoint, s3bucket, s3usePathStyle, s3accessKey, s3secretKey, diskFilePath, saveAsOriginal, saveWithDate, mediaStrict, maxUploadSize } = require('../config.json'); +const { s3enabled, s3endpoint, s3bucket, s3usePathStyle, s3accessKey, s3secretKey, diskFilePath, saveAsOriginal, saveWithDate, mediaStrict, maxUploadSize, useSia } = require('../config.json'); const { CODE_UNSUPPORTED_MEDIA_TYPE } = require('../MagicNumbers.json'); const ID_GEN_LENGTH = 32; @@ -94,7 +95,7 @@ export function processUploaded(req: AssRequest, res: AssResponse, next: Functio .then(() => { if (req.file!.size / Math.pow(1024, 2) > maxUploadSize) throw new Error('LIMIT_FILE_SIZE'); }) // Save file - .then(() => log.debug('Saving file', req.file!.originalname, s3enabled ? 'in S3' : 'on disk')) + .then(() => log.debug('Saving file', req.file!.originalname, s3enabled ? 'in S3' : useSia ? 'on Sia blockchain' : 'on disk')) .then(() => // skipcq: JS-0229 new Promise((resolve, reject) => s3enabled @@ -113,8 +114,7 @@ export function processUploaded(req: AssRequest, res: AssResponse, next: Functio .then(() => fs.copy(req.file!.path, getLocalFilename(req), { preserveTimestamps: true })) .then(resolve) .catch(reject) - )) - .then(() => log.debug('File saved', req.file!.originalname, s3enabled ? 'in S3' : 'on disk')) + .then(() => log.debug('File saved', req.file!.originalname, s3enabled ? 'in S3' : useSia ? 'on Sia blockchain' : 'on disk')) .catch((err) => next(err)) // Delete the file