-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Opensea viewer #43
base: main
Are you sure you want to change the base?
Opensea viewer #43
Changes from all commits
973c478
291613c
abe76fb
5468f6e
68b12d2
141a713
92b2fa8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,6 +80,8 @@ router.get('/:url', async (req, res) => { | |
date: response[0]?.upload_date, | ||
fileId: uniqueId, | ||
isUploaded: response[0]?.is_uploaded, | ||
width: response[0]?.width, | ||
height: response[0]?.height, | ||
}); | ||
} | ||
}, | ||
|
@@ -228,8 +230,8 @@ router.post('/:url', async function (req, res) { | |
// count = 0; | ||
const form = formidable({ | ||
multiples: false, | ||
maxTotalFileSize: 2000 * 1024 * 1024, | ||
maxFileSize: 2000 * 1024 * 1024, | ||
maxTotalFileSize: 10000 * 1024 * 1024, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move to config |
||
maxFileSize: 10000 * 1024 * 1024, | ||
}); | ||
form.parse(req, async (err, fields, files) => { | ||
if (err) { | ||
|
@@ -249,14 +251,22 @@ router.post('/:url', async function (req, res) { | |
let fileId = uuidv4(); | ||
let pngFileName = tempName + '.png'; | ||
let tempDirPath = path.resolve(__dirname, '../temp'); | ||
let height = 0, | ||
width = 0; | ||
|
||
await map_file_type(user, fileId, bucketName, tempName, parts[1]); | ||
// let fileInfo = await file_stats(bucketName, tempName); | ||
// let fileId = fileInfo[0].file_unique_id; | ||
if ( | ||
files.file[0].mimetype === 'image/jpeg' || | ||
files.file[0].mimetype === 'image/png' | ||
) { | ||
await map_file_type( | ||
user, | ||
fileId, | ||
bucketName, | ||
tempName, | ||
parts[1], | ||
width, | ||
height, | ||
); | ||
minioClient.fPutObject( | ||
bucketName, | ||
'hv/' + user + '/thumbnail/' + fileName + fileId, | ||
|
@@ -265,7 +275,6 @@ router.post('/:url', async function (req, res) { | |
if (err) { | ||
return res.status(400).json({ error: 'Failed to upload' }); | ||
} | ||
// await file_uploaded(user, bucketName, tempName, parts[1]); | ||
res | ||
.status(200) | ||
.json({ data: objInfo, filename: tempName, format: parts[1] }); | ||
|
@@ -284,6 +293,37 @@ router.post('/:url', async function (req, res) { | |
sockets[socket_id].disconnect(); | ||
removeSocket(socket_id); | ||
} else { | ||
const command1 = `vipsheader`; | ||
const args1 = [`${filePath}`]; | ||
|
||
const childProcess1 = spawn(command1, args1); | ||
|
||
childProcess1.stdout.on('data', data => { | ||
const output = data.toString(); | ||
const dimensions = output.match(/(\d+)x(\d+)/); | ||
if (dimensions) { | ||
width = parseInt(dimensions[1]); | ||
height = parseInt(dimensions[2]); | ||
} | ||
console.warn(width, height); | ||
}); | ||
|
||
childProcess1.stderr.on('data', err => { | ||
console.error('Error:', err.toString()); | ||
}); | ||
Comment on lines
+311
to
+313
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. throw new Error(`Vips header : ${err.message}`} |
||
|
||
childProcess1.on('close', async () => { | ||
await map_file_type( | ||
user, | ||
fileId, | ||
bucketName, | ||
tempName, | ||
parts[1], | ||
width, | ||
height, | ||
); | ||
}); | ||
|
||
Comment on lines
+296
to
+326
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add comment to explain the usage |
||
const command = `vips`; | ||
const args = [ | ||
'dzsave', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ app.use('/hv/link', require_auth_proxylinks, proxyLinks); | |
// app.use('/hv/getURL',getURL); | ||
// app.use('/hv/deleteBucket',deleteBucket); | ||
// app.use('/hv/deleteObject',deleteObject); | ||
// app.use('/hv/link', proxyLinks); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. uncomment this |
||
|
||
app.get('/*', function (req, res) { | ||
res.sendFile(path.join(__dirname, 'build', 'index.html')); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove