Compare commits
No commits in common. "e09f3b7d1412f33ac74e70a12383b874ebdce0f8" and "bad6ab1accab91189221b7f5994face263c3c495" have entirely different histories.
e09f3b7d14
...
bad6ab1acc
|
@ -11,7 +11,6 @@ const names = [
|
||||||
"LINGDOCS_ACCOUNT_UPGRADE_PASSWORD",
|
"LINGDOCS_ACCOUNT_UPGRADE_PASSWORD",
|
||||||
"STRIPE_SECRET_KEY",
|
"STRIPE_SECRET_KEY",
|
||||||
"STRIPE_WEBHOOK_SECRET",
|
"STRIPE_WEBHOOK_SECRET",
|
||||||
"NTFY_TOPIC",
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const values = names.map((name) => ({
|
const values = names.map((name) => ({
|
||||||
|
@ -21,10 +20,7 @@ const values = names.map((name) => ({
|
||||||
|
|
||||||
const missing = values.filter((v) => !v.value);
|
const missing = values.filter((v) => !v.value);
|
||||||
if (missing.length) {
|
if (missing.length) {
|
||||||
console.error(
|
console.error("Missing evironment variable(s):", missing.map((m) => m.name).join(", "));
|
||||||
"Missing evironment variable(s):",
|
|
||||||
missing.map((m) => m.name).join(", ")
|
|
||||||
);
|
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,5 +37,4 @@ export default {
|
||||||
upgradePassword: values[9].value,
|
upgradePassword: values[9].value,
|
||||||
stripeSecretKey: values[10].value,
|
stripeSecretKey: values[10].value,
|
||||||
stripeWebhookSecret: values[11].value,
|
stripeWebhookSecret: values[11].value,
|
||||||
ntfyTopic: values[12].value,
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
import fetch from "node-fetch";
|
|
||||||
import envVars from "./env-vars";
|
|
||||||
|
|
||||||
export async function ntfy(message: string) {
|
|
||||||
fetch(`https://ntfy.sh/${envVars.ntfyTopic}`, {
|
|
||||||
method: "POST",
|
|
||||||
body: message,
|
|
||||||
}).catch(console.error);
|
|
||||||
}
|
|
|
@ -15,7 +15,6 @@ import { outsideProviders } from "../middleware/setup-passport";
|
||||||
import * as T from "../../../website/src/types/account-types";
|
import * as T from "../../../website/src/types/account-types";
|
||||||
import env from "../lib/env-vars";
|
import env from "../lib/env-vars";
|
||||||
import Stripe from "stripe";
|
import Stripe from "stripe";
|
||||||
import { ntfy } from "./ntfy";
|
|
||||||
|
|
||||||
const stripe = new Stripe(env.stripeSecretKey, {
|
const stripe = new Stripe(env.stripeSecretKey, {
|
||||||
apiVersion: "2022-08-01",
|
apiVersion: "2022-08-01",
|
||||||
|
@ -164,7 +163,6 @@ export async function createNewUser(
|
||||||
email: input.email || "",
|
email: input.email || "",
|
||||||
token: email.token,
|
token: email.token,
|
||||||
});
|
});
|
||||||
ntfy(`new LingDocs user ${input.name} - ${input.email}`);
|
|
||||||
const user = await insertLingdocsUser(newUser);
|
const user = await insertLingdocsUser(newUser);
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import express, { Response } from "express";
|
import express, { Response } from "express";
|
||||||
import * as T from "../../../website/src/types/account-types";
|
import * as T from "../../../website/src/types/account-types";
|
||||||
import { addFeedback } from "../lib/couch-db";
|
import { addFeedback } from "../lib/couch-db";
|
||||||
import { ntfy } from "../lib/ntfy";
|
|
||||||
// import env from "../lib/env-vars";
|
// import env from "../lib/env-vars";
|
||||||
|
|
||||||
// TODO: ADD PROPER ERROR HANDLING THAT WILL RETURN JSON ALWAYS
|
// TODO: ADD PROPER ERROR HANDLING THAT WILL RETURN JSON ALWAYS
|
||||||
|
@ -25,12 +24,9 @@ feedbackRouter.put("/", (req, res, next) => {
|
||||||
addFeedback({
|
addFeedback({
|
||||||
user,
|
user,
|
||||||
feedback,
|
feedback,
|
||||||
})
|
}).then(() => {
|
||||||
.then(() => {
|
|
||||||
ntfy(JSON.stringify(feedback));
|
|
||||||
res.send({ ok: true, message: "feedback received" });
|
res.send({ ok: true, message: "feedback received" });
|
||||||
})
|
}).catch((e) => {
|
||||||
.catch((e) => {
|
|
||||||
console.error("error receiving feedback");
|
console.error("error receiving feedback");
|
||||||
console.error("feedback missed", feedback);
|
console.error("feedback missed", feedback);
|
||||||
console.error(e);
|
console.error(e);
|
||||||
|
|
Loading…
Reference in New Issue