Your ROOT_URL in app.ini is https://git.cloudchain.link/ but you are visiting https://dash.bss.nz/open-source-mirrors/ass/commit/f525cc2f133d72f6b4b44eff8ffc7db0f322a5ff
You should set ROOT_URL correctly, otherwise the web may not work correctly.
5 changed files with
7 additions and
7 deletions
@ -225,7 +225,7 @@ function startup() {
// Return the file differently depending on what storage option was used
let uploaders = {
s3 : ( ) => fetch ( getS3url ( fileData . randomId )) . then ( ( file ) => {
s3 : ( ) => fetch ( getS3url ( fileData . randomId , fileData . mimetype )) . then ( ( file ) => {
file . headers . forEach ( ( value , header ) => res . setHeader ( header , value ) ) ;
file . body . pipe ( res ) ;
} ) ,
@ -41,7 +41,7 @@ class OpenGraph {
}
build ( ) {
let resourceUrl = ! s3enabled ? ( this . http + this . domain + "/" + this . resourceId + ( this . type . includes ( 'video' ) ? '.mp4' : this . type . includes ( 'gif' ) ? '.gif' : '' ) ) : getS3url ( this . randomId );
let resourceUrl = ! s3enabled ? ( this . http + this . domain + "/" + this . resourceId + ( this . type . includes ( 'video' ) ? '.mp4' : this . type . includes ( 'gif' ) ? '.gif' : '' ) ) : getS3url ( this . randomId , this . type );
return Mustache . render ( html , {
homepage ,
version ,
@ -17,7 +17,7 @@ const uploadS3 = multer({
s3 : s3 ,
bucket : s3bucket ,
acl : 'public-read' ,
key : ( req , _ file, cb ) => cb ( null , req . randomId ) ,
key : ( req , file, cb ) => cb ( null , req . randomId . concat ( file . mimetype . includes ( 'video' ) ? '.mp4' : file . mimetype . includes ( 'gif' ) ? '.gif' : '' ) ) ,
contentType : ( _req , file , cb ) => cb ( null , file . mimetype )
} )
} ) . single ( 'file' ) ;
@ -25,7 +25,7 @@ function getVideoThumbnail(file) {
function getResizedThumbnail ( file ) {
return new Promise ( ( resolve , reject ) =>
Jimp . read ( s3enabled ? getS3url ( file . randomId ) : path ( file . path ) )
Jimp . read ( s3enabled ? getS3url ( file . randomId , file . mimetype ) : path ( file . path ) )
. then ( ( image ) => image
. quality ( THUMBNAIL _QUALITY )
. resize ( THUMBNAIL _SIZE , THUMBNAIL _SIZE , Jimp . RESIZE _BICUBIC )
@ -41,12 +41,12 @@ module.exports = {
} ,
arrayEquals : ( arr1 , arr2 ) => arr1 . length === arr2 . length && arr1 . slice ( ) . sort ( ) . every ( ( value , index ) => value === arr2 . slice ( ) . sort ( ) [ index ] ) ,
downloadTempS3 : ( file ) => new Promise ( ( resolve , reject ) =>
fetch ( getS3url ( file . randomId ))
fetch ( getS3url ( file . randomId , file . mimetype ))
. then ( ( f2 ) => f2 . body . pipe ( fs . createWriteStream ( Path . join ( _ _dirname , 'uploads/' , file . originalname ) ) . on ( 'close' , ( ) => resolve ( ) ) ) )
. catch ( reject ) ) ,
getS3url ,
}
function getS3url ( s3key ) {
return ` https:// ${ s3bucket } . ${ s3endpoint } / ${ s3key } ` ;
function getS3url ( s3key , type ) {
return ` https:// ${ s3bucket } . ${ s3endpoint } / ${ s3key } ${ type . includes ( 'video' ) ? '.mp4' : type . includes ( 'gif' ) ? '.gif' : '' } ` ;
}