|
|
|
@ -48,7 +48,7 @@ router.use('/', (err: ErrWrap, _req: Request, res: Response, next: Function) =>
|
|
|
|
|
router.post('/', (req: Request, res: Response, next: Function) => {
|
|
|
|
|
// Load overrides
|
|
|
|
|
const trueDomain = getTrueDomain(req.headers['x-ass-domain']);
|
|
|
|
|
const generator = req.headers['x-ass-access'] || resourceIdType;
|
|
|
|
|
const generator = req.headers['x-ass-access']?.toString() || resourceIdType;
|
|
|
|
|
|
|
|
|
|
// Save domain with file
|
|
|
|
|
req.file!.domain = `${getTrueHttp()}${trueDomain}`;
|
|
|
|
@ -80,7 +80,7 @@ router.post('/', (req: Request, res: Response, next: Function) => {
|
|
|
|
|
let resourceId = '';
|
|
|
|
|
|
|
|
|
|
// Function to call to generate a fresh ID. Used for multiple attempts in case an ID is already taken
|
|
|
|
|
const gen = () => generateId(generator, resourceIdSize, req.headers['x-ass-gfycat'] || gfyIdSize, req.file!.originalname);
|
|
|
|
|
const gen = () => generateId(generator, resourceIdSize, parseInt(req.headers['x-ass-gfycat']?.toString() || gfyIdSize.toString()), req.file!.originalname);
|
|
|
|
|
|
|
|
|
|
// Keeps track of the number of attempts in case all ID's are taken
|
|
|
|
|
const attempts = {
|
|
|
|
|