mirror of
https://github.com/fosrl/pangolin.git
synced 2025-05-12 21:30:35 +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 db from "@server/db";
|
||||
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);
|
||||
|
||||
|
@ -243,16 +245,13 @@ export class Config {
|
|||
: "false";
|
||||
process.env.DASHBOARD_URL = parsedConfig.data.app.dashboard_url;
|
||||
|
||||
try {
|
||||
this.checkSupporterKey();
|
||||
} catch (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.checkSupporterKey()
|
||||
.then(() => {
|
||||
console.log("Supporter key checked");
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Error checking supporter key:", error);
|
||||
});
|
||||
|
||||
this.rawConfig = parsedConfig.data;
|
||||
}
|
||||
|
@ -331,20 +330,19 @@ export class Config {
|
|||
|
||||
this.supporterData = {
|
||||
...key,
|
||||
tier: data.data.tier,
|
||||
valid: true
|
||||
};
|
||||
|
||||
// update the supporter key in the database
|
||||
await db.transaction(async (trx) => {
|
||||
await trx.delete(supporterKey);
|
||||
await trx.insert(supporterKey).values({
|
||||
githubUsername,
|
||||
key: licenseKey,
|
||||
await db
|
||||
.update(supporterKey)
|
||||
.set({
|
||||
tier: data.data.tier || null,
|
||||
phrase: data.data.cutePhrase || null,
|
||||
valid: true
|
||||
});
|
||||
});
|
||||
})
|
||||
.where(eq(supporterKey.keyId, key.keyId));
|
||||
}
|
||||
|
||||
public getSupporterData() {
|
||||
|
|
Loading…
Reference in a new issue