This commit is contained in:
Benjamin Toby
2024-11-15 15:37:53 +01:00
parent ee35543885
commit 5e13f064aa
18 changed files with 74 additions and 151 deletions
+4 -13
View File
@@ -1,10 +1,5 @@
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
const https = require("https");
const http = require("http");
const path = require("path");
@@ -12,13 +7,6 @@ const fs = require("fs");
const localAddUser = require("../engine/user/add-user");
const grabHostNames = require("../package-shared/utils/grab-host-names");
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/**
* Add User to Database
* ==============================================================================
@@ -102,7 +90,10 @@ async function addUser({
headers: {
"Content-Type": "application/json",
"Content-Length": Buffer.from(reqPayload).length,
Authorization: key,
Authorization:
key ||
process.env.DSQL_FULL_ACCESS_API_KEY ||
process.env.DSQL_API_KEY,
},
port,
hostname: host,
+4 -1
View File
@@ -118,7 +118,10 @@ async function getUser({ key, userId, database, fields }) {
headers: {
"Content-Type": "application/json",
"Content-Length": Buffer.from(reqPayload).length,
Authorization: key,
Authorization:
key ||
process.env.DSQL_FULL_ACCESS_API_KEY ||
process.env.DSQL_API_KEY,
},
port,
hostname: host,
+4 -1
View File
@@ -176,7 +176,10 @@ async function loginUser({
headers: {
"Content-Type": "application/json",
"Content-Length": Buffer.from(reqPayloadJSON).length,
Authorization: key,
Authorization:
key ||
process.env.DSQL_FULL_ACCESS_API_KEY ||
process.env.DSQL_API_KEY,
},
port,
hostname: host,
+4 -1
View File
@@ -139,7 +139,10 @@ async function reauthUser({
headers: {
"Content-Type": "application/json",
"Content-Length": Buffer.from(reqPayload).length,
Authorization: key,
Authorization:
key ||
process.env.DSQL_FULL_ACCESS_API_KEY ||
process.env.DSQL_API_KEY,
},
port,
hostname: host,
+4 -1
View File
@@ -169,7 +169,10 @@ async function sendEmailCode({
headers: {
"Content-Type": "application/json",
"Content-Length": Buffer.from(reqPayload).length,
Authorization: key,
Authorization:
key ||
process.env.DSQL_FULL_ACCESS_API_KEY ||
process.env.DSQL_API_KEY,
},
port,
hostname: host,
+4 -1
View File
@@ -198,7 +198,10 @@ async function githubAuth({
headers: {
"Content-Type": "application/json",
"Content-Length": Buffer.from(reqPayload).length,
Authorization: key,
Authorization:
key ||
process.env.DSQL_FULL_ACCESS_API_KEY ||
process.env.DSQL_API_KEY,
},
port,
hostname: host,
+4 -1
View File
@@ -194,7 +194,10 @@ async function googleAuth({
headers: {
"Content-Type": "application/json",
"Content-Length": Buffer.from(reqPayload).length,
Authorization: key,
Authorization:
key ||
process.env.DSQL_FULL_ACCESS_API_KEY ||
process.env.DSQL_API_KEY,
},
port,
hostname: host,
+5 -16
View File
@@ -1,10 +1,5 @@
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
const http = require("http");
const https = require("https");
const path = require("path");
@@ -12,17 +7,8 @@ const fs = require("fs");
const localUpdateUser = require("../engine/user/update-user");
const grabHostNames = require("../package-shared/utils/grab-host-names");
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/**
* ==============================================================================
* Main Function
* ==============================================================================
* # Update User
* @async
*
* @param {object} params - API Key
@@ -92,7 +78,10 @@ async function updateUser({ key, payload, database }) {
headers: {
"Content-Type": "application/json",
"Content-Length": Buffer.from(reqPayload).length,
Authorization: key,
Authorization:
process.env.DSQL_FULL_ACCESS_API_KEY ||
process.env.DSQL_API_KEY ||
key,
},
port,
hostname: host,