⚙ : Reworked Config Gen

This commit is contained in:
Jyotirmoy Bandyopadhayaya 2023-06-24 23:22:22 +05:30
parent 1ffdf1f344
commit 407b34bcfa
Signed by: bravo68web
GPG Key ID: F5671FD7BCB9917A
6 changed files with 31 additions and 26 deletions

View File

@ -13,8 +13,11 @@ export default class SxcuController
next: NextFunction
): Promise<Response | void> => {
try {
const { apikey } = req.query as {
apikey: string;
};
const fileData = await this.createUploadImageSxcu(
req.user.apiKey,
apikey,
req.protocol + '://' + req.hostname
);
res.send(fileData);
@ -29,8 +32,11 @@ export default class SxcuController
next: NextFunction
): Promise<Response | void> => {
try {
const { apikey } = req.query as {
apikey: string;
};
const fileData = await this.createUploadFileSxcu(
req.user.apiKey,
apikey,
req.protocol + '://' + req.hostname
);
res.send(fileData);
@ -45,8 +51,11 @@ export default class SxcuController
next: NextFunction
): Promise<Response | void> => {
try {
const { apikey } = req.query as {
apikey: string;
};
const fileData = await this.createURLShrinkSxcu(
req.user.apiKey,
apikey,
req.protocol + '://' + req.hostname
);
res.send(fileData);
@ -61,8 +70,11 @@ export default class SxcuController
next: NextFunction
): Promise<Response | void> => {
try {
const { apikey } = req.query as {
apikey: string;
};
const fileData = await this.createPasteSxcu(
req.user.apiKey,
apikey,
req.protocol + '://' + req.hostname
);
res.send(fileData);

View File

@ -1,18 +1,16 @@
import { Router } from 'express';
import APIKeyAuth from '../middlewares/apikey_check';
import SXCUController from '../controllers/sxcu.controller';
const sxcuController = new SXCUController();
const apiKeyAuth = new APIKeyAuth();
const router = Router();
router.get('/file.sxcu', apiKeyAuth.check as any, sxcuController.file as any);
router.get('/file.sxcu', sxcuController.file as any);
router.get('/image.sxcu', apiKeyAuth.check as any, sxcuController.image as any);
router.get('/image.sxcu', sxcuController.image as any);
router.get('/url.sxcu', apiKeyAuth.check as any, sxcuController.url as any);
router.get('/url.sxcu', sxcuController.url as any);
router.get('/gist.sxcu', apiKeyAuth.check as any, sxcuController.text as any);
router.get('/gist.sxcu', sxcuController.text as any);
export default router;

View File

@ -23,6 +23,7 @@ export default class GistService implements IGistService {
isPrivate
isOneTimeOnly
views
passkey
}
}
`;
@ -64,8 +65,12 @@ export default class GistService implements IGistService {
};
await client.request(updtViewQuery, updtViewVariables);
}
if (gistData.passkey == passkey && gistData.isPrivate) {
return null;
if (gistData.isPrivate) {
if (gistData.passkey == passkey) {
return gistData;
} else {
return null;
}
} else {
return gistData;
}

View File

@ -16,7 +16,6 @@
"clipboardy": "2.3.0",
"commander": "^11.0.0",
"configstore": "5.0.1",
"copy-to-clipboard": "^3.3.3",
"inquirer": "^8.0.0"
},
"scripts": {

View File

@ -2,4 +2,7 @@ TOKEN=
CLIENT_ID=
DEV_GUILD_ID=
SHX_API_TOKEN=
SHX_API_URL=
SHX_API_URL=
PERMISSION_INTEGER=
SHX_DASH_URL=
DISCORD_OWNER_ID=

View File

@ -7097,13 +7097,6 @@ cookie@0.5.0, cookie@^0.5.0:
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.5.0.tgz#d1f5d71adec6558c58f389987c366aa47e994f8b"
integrity sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==
copy-to-clipboard@^3.3.3:
version "3.3.3"
resolved "https://registry.yarnpkg.com/copy-to-clipboard/-/copy-to-clipboard-3.3.3.tgz#55ac43a1db8ae639a4bd99511c148cdd1b83a1b0"
integrity sha512-2KV8NhB5JqC3ky0r9PMCAZKbUHSwtEo4CwCs0KXgruG43gX5PMqDEBbVU4OUzw2MuAWUfsuFmWvEKG5QRfSnJA==
dependencies:
toggle-selection "^1.0.6"
core-js-compat@^3.25.1, core-js-compat@^3.30.1, core-js-compat@^3.30.2:
version "3.31.0"
resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.31.0.tgz#4030847c0766cc0e803dcdfb30055d7ef2064bf1"
@ -13887,11 +13880,6 @@ to-regex-range@^5.0.1:
dependencies:
is-number "^7.0.0"
toggle-selection@^1.0.6:
version "1.0.6"
resolved "https://registry.yarnpkg.com/toggle-selection/-/toggle-selection-1.0.6.tgz#6e45b1263f2017fa0acc7d89d78b15b8bf77da32"
integrity sha512-BiZS+C1OS8g/q2RRbJmy59xpyghNBqrr6k5L/uKBGRsTfxmu3ffiRnd8mlGPUVayg8pvfi5urfnu8TU7DVOkLQ==
toidentifier@1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35"