This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const router = async (req, res) => { | |
if (req.method === 'POST') { | |
return postS3(req, res) | |
} else if (req.method === 'GET') { | |
return getS3(req, res) | |
} else { | |
throw createError(405, 'Invalid method') | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const generateUUID = (size = 10) => { | |
return randomBytes(Math.ceil(size * 3 / 4)) | |
.toString('base64') | |
.slice(0, size) | |
.replace(/\+/g, 'a') | |
.replace(/\//g, 'b') | |
} | |
const postS3 = async (req, res) => { | |
const {contentType} = await json(req) // we are requiring the ContenType from the request |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getS3 = async (req, res) => { | |
const s3key = `${req.url.substr(1)}` // we need to remove the first backslash from the url | |
const params = { | |
Bucket: config.bucket_name, | |
Key: s3key, | |
Expires: 60 * 60 * 24 // 1 day | |
} | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
04d5e324d86e49a5d055f7e9e0b89378688fb4851ec52853b9c1d1c6b763b55515feeb09f1efd11c58c97fc3483207a591a0dc5d9e31e5866c929425a7cbbfe16e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Author: Nilo Dantas - n1lo | |
Based on: https://bugs.launchpad.net/ubuntu/+source/ibus/+bug/518056 - helio-valente post | |
How to use Cedilha on US Keyboard on ArchLinux | |
1) Put: English(US, internacional with dead Keys) on your system keyboard layout. | |
2) Editing the files: | |
sudo vim /usr/lib/gtk-3.0/3.0.0/immodules.cache |
NewerOlder