mirror of
https://github.com/fosrl/pangolin.git
synced 2025-05-13 05:40:38 +01:00
log failed check key
This commit is contained in:
parent
7131dea7a0
commit
d72a8af04b
1 changed files with 15 additions and 17 deletions
|
@ -12,6 +12,8 @@ import { passwordSchema } from "@server/auth/passwordSchema";
|
||||||
import stoi from "./stoi";
|
import stoi from "./stoi";
|
||||||
import db from "@server/db";
|
import db from "@server/db";
|
||||||
import { SupporterKey, supporterKey } from "@server/db/schema";
|
import { SupporterKey, supporterKey } from "@server/db/schema";
|
||||||
|
import { suppressDeprecationWarnings } from "moment";
|
||||||
|
import { eq } from "drizzle-orm";
|
||||||
|
|
||||||
const portSchema = z.number().positive().gt(0).lte(65535);
|
const portSchema = z.number().positive().gt(0).lte(65535);
|
||||||
|
|
||||||
|
@ -243,16 +245,13 @@ export class Config {
|
||||||
: "false";
|
: "false";
|
||||||
process.env.DASHBOARD_URL = parsedConfig.data.app.dashboard_url;
|
process.env.DASHBOARD_URL = parsedConfig.data.app.dashboard_url;
|
||||||
|
|
||||||
try {
|
this.checkSupporterKey()
|
||||||
this.checkSupporterKey();
|
.then(() => {
|
||||||
} catch (error) {
|
console.log("Supporter key checked");
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
console.error("Error checking supporter key:", error);
|
console.error("Error checking supporter key:", error);
|
||||||
}
|
});
|
||||||
|
|
||||||
if (this.supporterData) {
|
|
||||||
process.env.SUPPORTER_DATA = JSON.stringify(this.supporterData);
|
|
||||||
console.log("Thank you for being a supporter of Pangolin!");
|
|
||||||
}
|
|
||||||
|
|
||||||
this.rawConfig = parsedConfig.data;
|
this.rawConfig = parsedConfig.data;
|
||||||
}
|
}
|
||||||
|
@ -331,20 +330,19 @@ export class Config {
|
||||||
|
|
||||||
this.supporterData = {
|
this.supporterData = {
|
||||||
...key,
|
...key,
|
||||||
|
tier: data.data.tier,
|
||||||
valid: true
|
valid: true
|
||||||
};
|
};
|
||||||
|
|
||||||
// update the supporter key in the database
|
// update the supporter key in the database
|
||||||
await db.transaction(async (trx) => {
|
await db
|
||||||
await trx.delete(supporterKey);
|
.update(supporterKey)
|
||||||
await trx.insert(supporterKey).values({
|
.set({
|
||||||
githubUsername,
|
|
||||||
key: licenseKey,
|
|
||||||
tier: data.data.tier || null,
|
tier: data.data.tier || null,
|
||||||
phrase: data.data.cutePhrase || null,
|
phrase: data.data.cutePhrase || null,
|
||||||
valid: true
|
valid: true
|
||||||
});
|
})
|
||||||
});
|
.where(eq(supporterKey.keyId, key.keyId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public getSupporterData() {
|
public getSupporterData() {
|
||||||
|
|
Loading…
Reference in a new issue