This commit is contained in:
2025-12-26 06:37:30 +01:00
parent 98aaa94b80
commit b02399c64d
50 changed files with 112 additions and 105 deletions
@@ -20,7 +20,7 @@ function postLoginResponseHandler({ database, httpResponse, response, encryption
const COOKIE_EXPIRY_DATE = (0, grab_cookie_expirt_date_1.default)();
if (httpResponse === null || httpResponse === void 0 ? void 0 : httpResponse.success) {
let encryptedPayload = (0, encrypt_1.default)({
data: JSON.stringify(httpResponse.payload),
data: JSON.stringify(httpResponse.singleRes),
encryptionKey,
encryptionSalt,
});
@@ -35,8 +35,8 @@ function postLoginResponseHandler({ database, httpResponse, response, encryption
database,
});
if (httpResponse.csrf && !skipWriteAuthFile) {
(0, write_auth_files_1.writeAuthFile)(httpResponse.csrf, JSON.stringify(httpResponse.payload), cleanupTokens && ((_a = httpResponse.payload) === null || _a === void 0 ? void 0 : _a.id)
? { userId: httpResponse.payload.id }
(0, write_auth_files_1.writeAuthFile)(httpResponse.csrf, JSON.stringify(httpResponse.singleRes), cleanupTokens && ((_a = httpResponse.singleRes) === null || _a === void 0 ? void 0 : _a.id)
? { userId: httpResponse.singleRes.id }
: undefined);
}
httpResponse["cookieNames"] = cookieNames;
@@ -50,7 +50,7 @@ function postLoginResponseHandler({ database, httpResponse, response, encryption
}
response === null || response === void 0 ? void 0 : response.setHeader("Set-Cookie", [
`${authKeyName}=${encryptedPayload};samesite=strict;path=/;HttpOnly=true;Expires=${COOKIE_EXPIRY_DATE}${secureCookie ? ";Secure=true" : ""}`,
`${csrfName}=${(_b = httpResponse.payload) === null || _b === void 0 ? void 0 : _b.csrf_k};samesite=strict;path=/;HttpOnly=true;Expires=${COOKIE_EXPIRY_DATE}`,
`${csrfName}=${(_b = httpResponse.singleRes) === null || _b === void 0 ? void 0 : _b.csrf_k};samesite=strict;path=/;HttpOnly=true;Expires=${COOKIE_EXPIRY_DATE}`,
]);
if (debug) {
debugFn("Response Sent!");
@@ -38,7 +38,7 @@ function suAddBackup(_a) {
tableName: "backups",
data: newBackup,
});
if (!((_b = newBackupEntry === null || newBackupEntry === void 0 ? void 0 : newBackupEntry.payload) === null || _b === void 0 ? void 0 : _b.insertId)) {
if (!((_b = newBackupEntry === null || newBackupEntry === void 0 ? void 0 : newBackupEntry.postInsertReturn) === null || _b === void 0 ? void 0 : _b.insertId)) {
return {
success: false,
msg: `Couldn't create new backup entry`,
@@ -46,7 +46,7 @@ function suAddBackup(_a) {
}
const { single: newlyAddedBackup } = yield (0, grab_user_resource_1.default)({
tableName: "backups",
targetID: (_c = newBackupEntry.payload) === null || _c === void 0 ? void 0 : _c.insertId,
targetID: (_c = newBackupEntry.postInsertReturn) === null || _c === void 0 ? void 0 : _c.insertId,
isSuperUser: true,
});
if (!(newlyAddedBackup === null || newlyAddedBackup === void 0 ? void 0 : newlyAddedBackup.id)) {
+1 -1
View File
@@ -53,7 +53,7 @@ function deleteDbEntry(_a) {
*/
return {
success: Boolean(deletedEntry.affectedRows),
payload: deletedEntry,
postInsertReturn: deletedEntry,
queryObject: {
sql: (0, sql_formatter_1.format)(query),
params: values,
+1 -1
View File
@@ -115,7 +115,7 @@ function updateDbEntry(_a) {
*/
return {
success: Boolean(updatedEntry === null || updatedEntry === void 0 ? void 0 : updatedEntry.affectedRows),
payload: updatedEntry,
postInsertReturn: updatedEntry,
queryObject: {
sql: (0, sql_formatter_1.format)(query),
params: updateValues,