mirror of
https://github.com/PretendoNetwork/juxtaposition-ui.git
synced 2026-03-21 17:34:24 -05:00
feat: update config to add bucket
Some checks are pending
Build and Publish Docker Image / build-publish (push) Waiting to run
Some checks are pending
Build and Publish Docker Image / build-publish (push) Waiting to run
This commit is contained in:
parent
e2c4a39b2e
commit
a3aa394b37
|
|
@ -23,7 +23,8 @@
|
|||
"secret": ""
|
||||
},
|
||||
"endpoint": "https://nyc3.digitaloceanspaces.com",
|
||||
"region": "us-east-1"
|
||||
"region": "us-east-1",
|
||||
"bucket": "bucket"
|
||||
},
|
||||
"grpc": {
|
||||
"friends": {
|
||||
|
|
|
|||
|
|
@ -217,9 +217,9 @@ router.post('/communities/new', upload.fields([{ name: 'browserIcon', maxCount:
|
|||
const icon64 = await util.resizeImage(req.files.browserIcon[0].buffer.toString('base64'), 64, 64);
|
||||
const icon32 = await util.resizeImage(req.files.browserIcon[0].buffer.toString('base64'), 32, 32);
|
||||
|
||||
if (!await util.uploadCDNAsset('pn-cdn', `icons/${communityID}/128.png`, icon128, 'public-read') ||
|
||||
!await util.uploadCDNAsset('pn-cdn', `icons/${communityID}/64.png`, icon64, 'public-read') ||
|
||||
!await util.uploadCDNAsset('pn-cdn', `icons/${communityID}/32.png`, icon32, 'public-read')) {
|
||||
if (!await util.uploadCDNAsset(`icons/${communityID}/128.png`, icon128, 'public-read') ||
|
||||
!await util.uploadCDNAsset(`icons/${communityID}/64.png`, icon64, 'public-read') ||
|
||||
!await util.uploadCDNAsset(`icons/${communityID}/32.png`, icon32, 'public-read')) {
|
||||
return res.sendStatus(422);
|
||||
}
|
||||
|
||||
|
|
@ -230,8 +230,8 @@ router.post('/communities/new', upload.fields([{ name: 'browserIcon', maxCount:
|
|||
// Wii U Header
|
||||
const WiiUHeader = await util.resizeImage(req.files.WiiUbrowserHeader[0].buffer.toString('base64'), 1280, 180);
|
||||
|
||||
if (!await util.uploadCDNAsset('pn-cdn', `headers/${communityID}/3DS.png`, CTRHeader, 'public-read') ||
|
||||
!await util.uploadCDNAsset('pn-cdn', `headers/${communityID}/WiiU.png`, WiiUHeader, 'public-read')) {
|
||||
if (!await util.uploadCDNAsset(`headers/${communityID}/3DS.png`, CTRHeader, 'public-read') ||
|
||||
!await util.uploadCDNAsset(`headers/${communityID}/WiiU.png`, WiiUHeader, 'public-read')) {
|
||||
return res.sendStatus(422);
|
||||
}
|
||||
|
||||
|
|
@ -302,9 +302,9 @@ router.post('/communities/:id', upload.fields([{ name: 'browserIcon', maxCount:
|
|||
const icon64 = await util.resizeImage(req.files.browserIcon[0].buffer.toString('base64'), 64, 64);
|
||||
const icon32 = await util.resizeImage(req.files.browserIcon[0].buffer.toString('base64'), 32, 32);
|
||||
|
||||
if (!await util.uploadCDNAsset('pn-cdn', `icons/${communityID}/128.png`, icon128, 'public-read') ||
|
||||
!await util.uploadCDNAsset('pn-cdn', `icons/${communityID}/64.png`, icon64, 'public-read') ||
|
||||
!await util.uploadCDNAsset('pn-cdn', `icons/${communityID}/32.png`, icon32, 'public-read')) {
|
||||
if (!await util.uploadCDNAsset(`icons/${communityID}/128.png`, icon128, 'public-read') ||
|
||||
!await util.uploadCDNAsset(`icons/${communityID}/64.png`, icon64, 'public-read') ||
|
||||
!await util.uploadCDNAsset(`icons/${communityID}/32.png`, icon32, 'public-read')) {
|
||||
return res.sendStatus(422);
|
||||
}
|
||||
|
||||
|
|
@ -314,7 +314,7 @@ router.post('/communities/:id', upload.fields([{ name: 'browserIcon', maxCount:
|
|||
// 3DS Header
|
||||
if (req.files.CTRbrowserHeader) {
|
||||
const CTRHeader = await util.resizeImage(req.files.CTRbrowserHeader[0].buffer.toString('base64'), 400, 220);
|
||||
if (!await util.uploadCDNAsset('pn-cdn', `headers/${communityID}/3DS.png`, CTRHeader, 'public-read')) {
|
||||
if (!await util.uploadCDNAsset(`headers/${communityID}/3DS.png`, CTRHeader, 'public-read')) {
|
||||
return res.sendStatus(422);
|
||||
}
|
||||
}
|
||||
|
|
@ -322,7 +322,7 @@ router.post('/communities/:id', upload.fields([{ name: 'browserIcon', maxCount:
|
|||
// Wii U Header
|
||||
if (req.files.WiiUbrowserHeader) {
|
||||
const WiiUHeader = await util.resizeImage(req.files.WiiUbrowserHeader[0].buffer.toString('base64'), 1280, 180);
|
||||
if (!await util.uploadCDNAsset('pn-cdn', `headers/${communityID}/WiiU.png`, WiiUHeader, 'public-read')) {
|
||||
if (!await util.uploadCDNAsset(`headers/${communityID}/WiiU.png`, WiiUHeader, 'public-read')) {
|
||||
return res.sendStatus(422);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ router.post('/new', async function (req, res) {
|
|||
if (req.body._post_type === 'painting' && req.body.painting) {
|
||||
painting = req.body.painting.replace(/\0/g, '').trim();
|
||||
paintingURI = await util.processPainting(painting, true);
|
||||
if (!await util.uploadCDNAsset('pn-cdn', `paintings/${req.pid}/${postID}.png`, paintingURI, 'public-read')) {
|
||||
if (!await util.uploadCDNAsset(`paintings/${req.pid}/${postID}.png`, paintingURI, 'public-read')) {
|
||||
res.status(422);
|
||||
return res.render(req.directory + '/error.ejs', {
|
||||
code: 422,
|
||||
|
|
@ -82,7 +82,7 @@ router.post('/new', async function (req, res) {
|
|||
}
|
||||
if (req.body.screenshot) {
|
||||
screenshot = req.body.screenshot.replace(/\0/g, '').trim();
|
||||
if (await util.uploadCDNAsset('pn-cdn', `screenshots/${req.pid}/${postID}.jpg`, Buffer.from(screenshot, 'base64'), 'public-read')) {
|
||||
if (await util.uploadCDNAsset(`screenshots/${req.pid}/${postID}.jpg`, Buffer.from(screenshot, 'base64'), 'public-read')) {
|
||||
res.status(422);
|
||||
return res.render(req.directory + '/error.ejs', {
|
||||
code: 422,
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ async function newPost(req, res) {
|
|||
painting = req.body.painting;
|
||||
}
|
||||
paintingURI = await util.processPainting(painting, true);
|
||||
if (!await util.uploadCDNAsset('pn-cdn', `paintings/${req.pid}/${postID}.png`, paintingURI, 'public-read')) {
|
||||
if (!await util.uploadCDNAsset(`paintings/${req.pid}/${postID}.png`, paintingURI, 'public-read')) {
|
||||
res.status(422);
|
||||
return res.render(req.directory + '/error.ejs', {
|
||||
code: 422,
|
||||
|
|
@ -242,7 +242,7 @@ async function newPost(req, res) {
|
|||
}
|
||||
if (req.body.screenshot) {
|
||||
screenshot = req.body.screenshot.replace(/\0/g, '').trim();
|
||||
if (!await util.uploadCDNAsset('pn-cdn', `screenshots/${req.pid}/${postID}.jpg`, Buffer.from(screenshot, 'base64'), 'public-read')) {
|
||||
if (!await util.uploadCDNAsset(`screenshots/${req.pid}/${postID}.jpg`, Buffer.from(screenshot, 'base64'), 'public-read')) {
|
||||
res.status(422);
|
||||
return res.render(req.directory + '/error.ejs', {
|
||||
code: 422,
|
||||
|
|
|
|||
|
|
@ -316,11 +316,11 @@ function processLanguage(paramPackData) {
|
|||
return translations.EN;
|
||||
}
|
||||
}
|
||||
async function uploadCDNAsset(bucket, key, data, acl) {
|
||||
async function uploadCDNAsset(key, data, acl) {
|
||||
const awsPutParams = new PutObjectCommand({
|
||||
Body: data,
|
||||
Key: key,
|
||||
Bucket: bucket,
|
||||
Bucket: config.aws.bucket,
|
||||
ACL: acl
|
||||
});
|
||||
try {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user