Updates
This commit is contained in:
@@ -58,9 +58,6 @@ const fs = __webpack_require__(7147);
|
||||
*/ module.exports = function grabDbSSL() {
|
||||
const SSL_DIR = process.env.DSQL_SSL_DIR;
|
||||
if (!SSL_DIR?.match(/./)) {
|
||||
// console.log(
|
||||
// "No SSL certificate provided. Query will run in normal mode. To add SSL add an env path dir `DSQL_SSL_DIR` with a file named `ca-cert.pem`"
|
||||
// );
|
||||
return undefined;
|
||||
}
|
||||
const caFilePath = `${SSL_DIR}/ca-cert.pem`;
|
||||
|
||||
@@ -177,9 +177,6 @@ const fs = __webpack_require__(7147);
|
||||
*/ module.exports = function grabDbSSL() {
|
||||
const SSL_DIR = process.env.DSQL_SSL_DIR;
|
||||
if (!SSL_DIR?.match(/./)) {
|
||||
// console.log(
|
||||
// "No SSL certificate provided. Query will run in normal mode. To add SSL add an env path dir `DSQL_SSL_DIR` with a file named `ca-cert.pem`"
|
||||
// );
|
||||
return undefined;
|
||||
}
|
||||
const caFilePath = `${SSL_DIR}/ca-cert.pem`;
|
||||
|
||||
@@ -89,9 +89,6 @@ const fs = __webpack_require__(7147);
|
||||
*/ module.exports = function grabDbSSL() {
|
||||
const SSL_DIR = process.env.DSQL_SSL_DIR;
|
||||
if (!SSL_DIR?.match(/./)) {
|
||||
// console.log(
|
||||
// "No SSL certificate provided. Query will run in normal mode. To add SSL add an env path dir `DSQL_SSL_DIR` with a file named `ca-cert.pem`"
|
||||
// );
|
||||
return undefined;
|
||||
}
|
||||
const caFilePath = `${SSL_DIR}/ca-cert.pem`;
|
||||
|
||||
@@ -16,14 +16,15 @@ exports.modules = {
|
||||
==== MODULE TRACE END ==== */ // @ts-check
|
||||
|
||||
const fs = __webpack_require__(7147);
|
||||
const LOCAL_DB_HANDLER = __webpack_require__(3062);
|
||||
const fullAccessDbHandler = __webpack_require__(8539);
|
||||
const varReadOnlyDatabaseDbHandler = __webpack_require__(3118);
|
||||
const serverError = __webpack_require__(3017);
|
||||
const addDbEntry = __webpack_require__(5338);
|
||||
const updateDbEntry = __webpack_require__(5886);
|
||||
const deleteDbEntry = __webpack_require__(6147);
|
||||
const DB_HANDLER = __webpack_require__(2224);
|
||||
const parseDbResults = __webpack_require__(8326);
|
||||
const trimSql = __webpack_require__(6888);
|
||||
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
||||
* Run DSQL users queries
|
||||
* ==============================================================================
|
||||
@@ -60,22 +61,30 @@ const parseDbResults = __webpack_require__(8326);
|
||||
* @description Declare "results" variable
|
||||
*/ try {
|
||||
if (typeof query === "string") {
|
||||
const formattedQuery = trimSql(query);
|
||||
/**
|
||||
* Input Validation
|
||||
*
|
||||
* @description Input Validation
|
||||
*/ if (readOnly && formattedQuery.match(/^alter|^delete|information_schema|databases|^create/i)) {
|
||||
throw new Error("Wrong Input!");
|
||||
}
|
||||
if (local) {
|
||||
const rawResults = await DB_HANDLER(query, queryValuesArray);
|
||||
const rawResults = await LOCAL_DB_HANDLER(formattedQuery, queryValuesArray);
|
||||
result = tableSchema ? parseDbResults({
|
||||
unparsedResults: rawResults,
|
||||
tableSchema
|
||||
}) : rawResults;
|
||||
} else if (readOnly) {
|
||||
result = await varReadOnlyDatabaseDbHandler({
|
||||
queryString: query,
|
||||
queryString: formattedQuery,
|
||||
queryValuesArray,
|
||||
database: dbFullName,
|
||||
tableSchema
|
||||
});
|
||||
} else {
|
||||
result = await fullAccessDbHandler({
|
||||
queryString: query,
|
||||
queryString: formattedQuery,
|
||||
queryValuesArray,
|
||||
database: dbFullName,
|
||||
tableSchema
|
||||
@@ -319,6 +328,84 @@ const DSQL_USER_DB_HANDLER = __webpack_require__(3403);
|
||||
};
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3062:
|
||||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||||
|
||||
// @ts-check
|
||||
|
||||
const mysql = __webpack_require__(2261);
|
||||
const grabDbSSL = __webpack_require__(4824);
|
||||
/**
|
||||
* DSQL user read-only DB handler
|
||||
* @param {object} params
|
||||
* @param {string} params.paradigm
|
||||
* @param {string} params.database
|
||||
* @param {string} params.queryString
|
||||
* @param {string[]} [params.queryValues]
|
||||
*/ async function LOCAL_DB_HANDLER(/** @type {any[]} */ ...args) {
|
||||
const MASTER = mysql({
|
||||
config: {
|
||||
host: process.env.DSQL_DB_HOST,
|
||||
user: process.env.DSQL_DB_USERNAME,
|
||||
password: process.env.DSQL_DB_PASSWORD,
|
||||
database: process.env.DSQL_DB_NAME,
|
||||
port: process.env.DSQL_DB_PORT ? Number(process.env.DSQL_DB_PORT) : undefined,
|
||||
charset: "utf8mb4",
|
||||
ssl: grabDbSSL()
|
||||
},
|
||||
onConnect: ()=>{
|
||||
console.log("Connection Successful!");
|
||||
},
|
||||
onConnectError: (/** @type {any} */ err)=>{
|
||||
console.log("Connection Error", err.message);
|
||||
},
|
||||
onError: (/** @type {any} */ err)=>{
|
||||
console.log("Client Error", err.message);
|
||||
}
|
||||
});
|
||||
console.log("Querying ...");
|
||||
try {
|
||||
const results = await MASTER.query(...args);
|
||||
await MASTER.end();
|
||||
return JSON.parse(JSON.stringify(results));
|
||||
} catch (/** @type {any} */ error) {
|
||||
console.log("DB Error =>", error.message);
|
||||
return {
|
||||
success: false,
|
||||
error: error.message
|
||||
};
|
||||
}
|
||||
}
|
||||
module.exports = LOCAL_DB_HANDLER;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6888:
|
||||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||||
|
||||
// @ts-check
|
||||
|
||||
const https = __webpack_require__(5687);
|
||||
const http = __webpack_require__(3685);
|
||||
/**
|
||||
* @typedef {object} GrabHostNamesReturn
|
||||
* @property {string} host
|
||||
* @property {number | string} port
|
||||
* @property {typeof http | typeof https} scheme
|
||||
*/ /**
|
||||
* # Trim SQL
|
||||
* @description Remove Returns and miltiple spaces from SQL Query
|
||||
* @param {string} sql
|
||||
* @returns {string}
|
||||
*/ function trimSql(sql) {
|
||||
return sql.replace(/\n|\r|\n\r|\r\n/gm, " ").replace(/ {2,}/g, " ").trim();
|
||||
}
|
||||
module.exports = trimSql;
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
|
||||
@@ -64,7 +64,7 @@ var frontend_fetchApi = __webpack_require__(6729);
|
||||
}
|
||||
////////////////////////////////////////
|
||||
google.accounts.id.initialize({
|
||||
client_id: "392696781563-imb0ddojfn6m4bdokjk5v80jn546t9tq.apps.googleusercontent.com",
|
||||
client_id: "",
|
||||
callback: handleCredentialResponse
|
||||
});
|
||||
////////////////////////////////////////
|
||||
@@ -229,7 +229,7 @@ var clearCaches = __webpack_require__(9137);
|
||||
if (res.msg?.match(/Github User Email not present/i)) {
|
||||
const enterEmail = window.prompt(`Cannot access the email address of this github account. Please enter an email address to continue.`);
|
||||
if (enterEmail && enterEmail?.match(/.*@.*\..*/) && !enterEmail?.match(/ /)) {
|
||||
const newFetchUrl = `https://github.com/login/oauth/authorize?client_id=${"0729d312ff3108b79188"}&scope=user&redirect_uri=${"http://localhost:7070"}${window.location.pathname}?email=${enterEmail}`;
|
||||
const newFetchUrl = `https://github.com/login/oauth/authorize?client_id=${""}&scope=user&redirect_uri=${"http://localhost:7070"}${window.location.pathname}?email=${enterEmail}`;
|
||||
window.location.assign(newFetchUrl);
|
||||
}
|
||||
}
|
||||
@@ -268,7 +268,7 @@ var clearCaches = __webpack_require__(9137);
|
||||
className: "button outlined gray w-full more-padding small-text normal-weight gap-6",
|
||||
onClick: (e)=>{
|
||||
setLoading(true);
|
||||
const fetchUrl = `https://github.com/login/oauth/authorize?client_id=${"0729d312ff3108b79188"}&scope=user&redirect_uri=${"http://localhost:7070"}${window.location.pathname}`;
|
||||
const fetchUrl = `https://github.com/login/oauth/authorize?client_id=${""}&scope=user&redirect_uri=${"http://localhost:7070"}${window.location.pathname}`;
|
||||
console.log(fetchUrl);
|
||||
window.location.assign(fetchUrl);
|
||||
// fetch(fetchUrl, {
|
||||
@@ -370,7 +370,7 @@ var clearCaches = __webpack_require__(9137);
|
||||
// let reloads = localStorage.getItem("login_reloads");
|
||||
// if (reloads && parseInt(reloads) >= 1) return;
|
||||
FB.init({
|
||||
appId: "2910275882608968",
|
||||
appId: "",
|
||||
cookie: true,
|
||||
xfbml: true,
|
||||
version: "v13.0"
|
||||
|
||||
Reference in New Issue
Block a user