This commit is contained in:
2025-11-13 06:16:55 +01:00
parent e6b4b09277
commit 90c36f2345
28 changed files with 145 additions and 75 deletions
@@ -5,6 +5,7 @@ import encrypt from "../../../functions/dsql/encrypt";
import grabHostNames from "../../../utils/grab-host-names";
import apiGithubLogin from "../../../functions/api/users/social/api-github-login";
import grabCookieExpiryDate from "../../../utils/grab-cookie-expirt-date";
import grabDbNames from "../../../utils/grab-db-names";
interface FunctionReturn {
success: boolean;
@@ -23,7 +24,7 @@ type Param = {
key: string;
code: string;
email: string | null;
database: string;
database?: string;
clientId: string;
clientSecret: string;
response: http.ServerResponse;
@@ -96,15 +97,8 @@ export default async function githubAuth({
*
* @description Look for local db settings in `.env` file and by pass the http request if available
*/
const {
DSQL_DB_HOST,
DSQL_DB_USERNAME,
DSQL_DB_PASSWORD,
DSQL_DB_NAME,
DSQL_KEY,
DSQL_REF_DB_NAME,
DSQL_FULL_SYNC,
} = process.env;
const { DSQL_DB_HOST, DSQL_DB_USERNAME, DSQL_DB_PASSWORD, DSQL_DB_NAME } =
process.env;
if (
DSQL_DB_HOST?.match(/./) &&
@@ -126,13 +120,15 @@ export default async function githubAuth({
dbSchema = JSON.parse(fs.readFileSync(localDbSchemaPath, "utf8"));
} catch (error) {}
const { dbFullName } = grabDbNames({ dbName: database });
httpResponse = await apiGithubLogin({
code,
email: email || undefined,
clientId,
clientSecret,
additionalFields,
database: DSQL_DB_NAME,
database: dbFullName,
additionalData,
});
} else {