This commit is contained in:
Benjamin Toby 2025-02-05 19:34:03 +01:00
parent 1acdad97a2
commit 06de31dcb2
10 changed files with 23 additions and 15 deletions

View File

@ -69,6 +69,7 @@ function userAuth({ request, req, encryptionKey, encryptionSalt, level, database
success: false, success: false,
payload: null, payload: null,
msg: "Couldn't Decrypt cookie", msg: "Couldn't Decrypt cookie",
cookieNames: keyNames,
}; };
} }
/** /**
@ -86,6 +87,7 @@ function userAuth({ request, req, encryptionKey, encryptionSalt, level, database
success: false, success: false,
payload: null, payload: null,
msg: "No CSRF_K in decrypted payload", msg: "No CSRF_K in decrypted payload",
cookieNames: keyNames,
}; };
} }
if (!(0, write_auth_files_1.checkAuthFile)(userObject.csrf_k)) { if (!(0, write_auth_files_1.checkAuthFile)(userObject.csrf_k)) {
@ -93,6 +95,7 @@ function userAuth({ request, req, encryptionKey, encryptionSalt, level, database
success: false, success: false,
payload: null, payload: null,
msg: "Auth file doesn't exist", msg: "Auth file doesn't exist",
cookieNames: keyNames,
}; };
} }
/** /**
@ -107,6 +110,7 @@ function userAuth({ request, req, encryptionKey, encryptionSalt, level, database
success: false, success: false,
payload: null, payload: null,
msg: "CSRF_K mismatch", msg: "CSRF_K mismatch",
cookieNames: keyNames,
}; };
} }
} }
@ -117,6 +121,7 @@ function userAuth({ request, req, encryptionKey, encryptionSalt, level, database
success: false, success: false,
payload: null, payload: null,
msg: "Payload Creation Date is not a number", msg: "Payload Creation Date is not a number",
cookieNames: keyNames,
}; };
} }
const timeElapsed = Date.now() - payloadCreationDate; const timeElapsed = Date.now() - payloadCreationDate;
@ -128,6 +133,7 @@ function userAuth({ request, req, encryptionKey, encryptionSalt, level, database
success: false, success: false,
payload: null, payload: null,
msg: "Session has expired", msg: "Session has expired",
cookieNames: keyNames,
}; };
} }
/** /**

View File

@ -41,7 +41,6 @@ function sqlGenerator({ tableName, genObject, dbFullName }) {
} }
} }
else if (Array.isArray(queryObj.value)) { else if (Array.isArray(queryObj.value)) {
/** @type {string[]} */
const strArray = []; const strArray = [];
queryObj.value.forEach((val) => { queryObj.value.forEach((val) => {
const valueParsed = val; const valueParsed = val;
@ -62,13 +61,11 @@ function sqlGenerator({ tableName, genObject, dbFullName }) {
return str; return str;
} }
const sqlSearhString = queryKeys === null || queryKeys === void 0 ? void 0 : queryKeys.map((field) => { const sqlSearhString = queryKeys === null || queryKeys === void 0 ? void 0 : queryKeys.map((field) => {
const queryObj = const queryObj = finalQuery === null || finalQuery === void 0 ? void 0 : finalQuery[field];
/** @type {import("../../../types").ServerQueryQueryObject} */ finalQuery === null || finalQuery === void 0 ? void 0 : finalQuery[field];
if (!queryObj) if (!queryObj)
return; return;
if (queryObj.__query) { if (queryObj.__query) {
const subQueryGroup = const subQueryGroup = queryObj.__query;
/** @type {import("../../../types").ServerQueryQueryObject}} */ queryObj.__query;
const subSearchKeys = Object.keys(subQueryGroup); const subSearchKeys = Object.keys(subQueryGroup);
const subSearchString = subSearchKeys.map((_field) => { const subSearchString = subSearchKeys.map((_field) => {
const newSubQueryObj = subQueryGroup === null || subQueryGroup === void 0 ? void 0 : subQueryGroup[_field]; const newSubQueryObj = subQueryGroup === null || subQueryGroup === void 0 ? void 0 : subQueryGroup[_field];

View File

@ -55,6 +55,9 @@ export declare const TextFieldTypesArray: readonly [{
}, { }, {
readonly title: "Javascript"; readonly title: "Javascript";
readonly value: "javascript"; readonly value: "javascript";
}, {
readonly title: "Shell";
readonly value: "shell";
}]; }];
export type DSQL_FieldSchemaType = { export type DSQL_FieldSchemaType = {
fieldName?: string; fieldName?: string;

View File

@ -9,6 +9,7 @@ exports.TextFieldTypesArray = [
{ title: "HTML", value: "html" }, { title: "HTML", value: "html" },
{ title: "CSS", value: "css" }, { title: "CSS", value: "css" },
{ title: "Javascript", value: "javascript" }, { title: "Javascript", value: "javascript" },
{ title: "Shell", value: "shell" },
]; ];
exports.ServerQueryOperators = ["AND", "OR"]; exports.ServerQueryOperators = ["AND", "OR"];
exports.ServerQueryEqualities = ["EQUAL", "LIKE", "NOT EQUAL"]; exports.ServerQueryEqualities = ["EQUAL", "LIKE", "NOT EQUAL"];

View File

@ -9,7 +9,6 @@ import {
DSQL_DatabaseSchemaType, DSQL_DatabaseSchemaType,
GetReqQueryObject, GetReqQueryObject,
GetReturn, GetReturn,
ServerQueryParam,
} from "../types"; } from "../types";
import apiGetGrabQueryAndValues from "../utils/grab-query-and-values"; import apiGetGrabQueryAndValues from "../utils/grab-query-and-values";

View File

@ -105,6 +105,7 @@ export default function userAuth({
success: false, success: false,
payload: null, payload: null,
msg: "Couldn't Decrypt cookie", msg: "Couldn't Decrypt cookie",
cookieNames: keyNames,
}; };
} }
@ -127,6 +128,7 @@ export default function userAuth({
success: false, success: false,
payload: null, payload: null,
msg: "No CSRF_K in decrypted payload", msg: "No CSRF_K in decrypted payload",
cookieNames: keyNames,
}; };
} }
@ -135,6 +137,7 @@ export default function userAuth({
success: false, success: false,
payload: null, payload: null,
msg: "Auth file doesn't exist", msg: "Auth file doesn't exist",
cookieNames: keyNames,
}; };
} }
@ -152,6 +155,7 @@ export default function userAuth({
success: false, success: false,
payload: null, payload: null,
msg: "CSRF_K mismatch", msg: "CSRF_K mismatch",
cookieNames: keyNames,
}; };
} }
} }
@ -166,6 +170,7 @@ export default function userAuth({
success: false, success: false,
payload: null, payload: null,
msg: "Payload Creation Date is not a number", msg: "Payload Creation Date is not a number",
cookieNames: keyNames,
}; };
} }
@ -180,6 +185,7 @@ export default function userAuth({
success: false, success: false,
payload: null, payload: null,
msg: "Session has expired", msg: "Session has expired",
cookieNames: keyNames,
}; };
} }

View File

@ -1,4 +1,4 @@
import fs, { glob } from "fs"; import fs from "fs";
import handleNodemailer from "../../backend/handleNodemailer"; import handleNodemailer from "../../backend/handleNodemailer";
import path from "path"; import path from "path";
import addMariadbUser from "../../backend/addMariadbUser"; import addMariadbUser from "../../backend/addMariadbUser";

View File

@ -73,7 +73,6 @@ export default function sqlGenerator<
sqlSearhValues.push(valueParsed); sqlSearhValues.push(valueParsed);
} }
} else if (Array.isArray(queryObj.value)) { } else if (Array.isArray(queryObj.value)) {
/** @type {string[]} */
const strArray: string[] = []; const strArray: string[] = [];
queryObj.value.forEach((val) => { queryObj.value.forEach((val) => {
const valueParsed = val; const valueParsed = val;
@ -97,15 +96,11 @@ export default function sqlGenerator<
} }
const sqlSearhString = queryKeys?.map((field) => { const sqlSearhString = queryKeys?.map((field) => {
const queryObj = const queryObj = finalQuery?.[field];
/** @type {import("../../../types").ServerQueryQueryObject} */ finalQuery?.[
field
];
if (!queryObj) return; if (!queryObj) return;
if (queryObj.__query) { if (queryObj.__query) {
const subQueryGroup = const subQueryGroup = queryObj.__query;
/** @type {import("../../../types").ServerQueryQueryObject}} */ queryObj.__query;
const subSearchKeys = Object.keys(subQueryGroup); const subSearchKeys = Object.keys(subQueryGroup);
const subSearchString = subSearchKeys.map((_field) => { const subSearchString = subSearchKeys.map((_field) => {

View File

@ -49,6 +49,7 @@ export const TextFieldTypesArray = [
{ title: "HTML", value: "html" }, { title: "HTML", value: "html" },
{ title: "CSS", value: "css" }, { title: "CSS", value: "css" },
{ title: "Javascript", value: "javascript" }, { title: "Javascript", value: "javascript" },
{ title: "Shell", value: "shell" },
] as const; ] as const;
export type DSQL_FieldSchemaType = { export type DSQL_FieldSchemaType = {

View File

@ -1,6 +1,6 @@
{ {
"name": "@moduletrace/datasquirel", "name": "@moduletrace/datasquirel",
"version": "3.9.7", "version": "3.9.8",
"description": "Cloud-based SQL data management tool", "description": "Cloud-based SQL data management tool",
"main": "dist/index.js", "main": "dist/index.js",
"bin": { "bin": {