"use strict"; (() => { var exports = {}; exports.id = 9976; exports.ids = [9976]; exports.modules = { /***/ 2261: /***/ ((module) => { module.exports = require("serverless-mysql"); /***/ }), /***/ 4300: /***/ ((module) => { module.exports = require("buffer"); /***/ }), /***/ 6113: /***/ ((module) => { module.exports = require("crypto"); /***/ }), /***/ 7147: /***/ ((module) => { module.exports = require("fs"); /***/ }), /***/ 1017: /***/ ((module) => { module.exports = require("path"); /***/ }), /***/ 5425: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { // @ts-check const { scryptSync , createDecipheriv } = __webpack_require__(6113); const { Buffer } = __webpack_require__(4300); /** * @param {string} encryptedString * @returns {string | null} */ const decrypt = (encryptedString)=>{ const algorithm = "aes-192-cbc"; const password = process.env.DSQL_ENCRYPTION_PASSWORD || ""; const salt = process.env.DSQL_ENCRYPTION_SALT || ""; let key = scryptSync(password, salt, 24); let iv = Buffer.alloc(16, 0); // @ts-ignore const decipher = createDecipheriv(algorithm, key, iv); try { let decrypted = decipher.update(encryptedString, "hex", "utf8"); decrypted += decipher.final("utf8"); return decrypted; } catch (error) { return null; } }; module.exports = decrypt; /***/ }), /***/ 2472: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ handler) /* harmony export */ }); /* harmony import */ var _package_shared_functions_backend_varDatabaseDbHandler__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1311); /* harmony import */ var _package_shared_functions_backend_varDatabaseDbHandler__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_package_shared_functions_backend_varDatabaseDbHandler__WEBPACK_IMPORTED_MODULE_0__); // @ts-check /** * ============================================================================== * Imports * ============================================================================== */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** * API handler * ============================================================================== * @type {import("next").NextApiHandler} */ async function handler(req, res) { /** * Check method * * @description Check request method and return if invalid */ if (req.method !== "GET") return res.json({ success: false, msg: "Failed!" }); /** * Validate Form * * @description Check if request body is valid */ const sanitizedReqBody = req.query; const { type , value , tableName , dbFullName , userId , dbId , userType , database , } = sanitizedReqBody; // if (!email.match(/.*@.*\..*/)) return res.json({ success: false, msg: "Invalid Email" }); /** * Add New Rating * * @description Check user verification status */ let queryStr = `SELECT \`${type}\` FROM \`${tableName}\` WHERE \`${type}\`=?`; let queryArray = [ value ]; if (userId) { queryStr += " AND user_id=?"; queryArray.push(userId); } if (dbId) { queryStr += " AND db_id=?"; queryArray.push(dbId); } if (userType) { queryStr += " AND user_type=?"; queryArray.push(userType); } if (database) { queryStr += " AND `database`=?"; queryArray.push(database); } const duplicate = await _package_shared_functions_backend_varDatabaseDbHandler__WEBPACK_IMPORTED_MODULE_0___default()({ queryString: queryStr, queryValuesArray: queryArray, database: dbFullName && typeof dbFullName == "string" ? dbFullName.replace(/[^a-z0-9_]/g, "") : "datasquirel" }); /** * Add New Rating * * @description Check user verification status */ res.json({ result: duplicate && duplicate[0] ? true : false }); } /***/ }) }; ; // load runtime var __webpack_require__ = require("../../webpack-api-runtime.js"); __webpack_require__.C(exports); var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId)) var __webpack_exports__ = __webpack_require__.X(0, [2224,3017,3403,8326,1311], () => (__webpack_exec__(2472))); module.exports = __webpack_exports__; })();