Compare commits

..

No commits in common. "e09f3b7d1412f33ac74e70a12383b874ebdce0f8" and "bad6ab1accab91189221b7f5994face263c3c495" have entirely different histories.

4 changed files with 45 additions and 65 deletions

View File

@ -11,7 +11,6 @@ const names = [
"LINGDOCS_ACCOUNT_UPGRADE_PASSWORD",
"STRIPE_SECRET_KEY",
"STRIPE_WEBHOOK_SECRET",
"NTFY_TOPIC",
];
const values = names.map((name) => ({
@ -21,10 +20,7 @@ const values = names.map((name) => ({
const missing = values.filter((v) => !v.value);
if (missing.length) {
console.error(
"Missing evironment variable(s):",
missing.map((m) => m.name).join(", ")
);
console.error("Missing evironment variable(s):", missing.map((m) => m.name).join(", "));
process.exit(1);
}
@ -41,5 +37,4 @@ export default {
upgradePassword: values[9].value,
stripeSecretKey: values[10].value,
stripeWebhookSecret: values[11].value,
ntfyTopic: values[12].value,
};

View File

@ -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);
}

View File

@ -15,7 +15,6 @@ import { outsideProviders } from "../middleware/setup-passport";
import * as T from "../../../website/src/types/account-types";
import env from "../lib/env-vars";
import Stripe from "stripe";
import { ntfy } from "./ntfy";
const stripe = new Stripe(env.stripeSecretKey, {
apiVersion: "2022-08-01",
@ -164,7 +163,6 @@ export async function createNewUser(
email: input.email || "",
token: email.token,
});
ntfy(`new LingDocs user ${input.name} - ${input.email}`);
const user = await insertLingdocsUser(newUser);
return user;
}

View File

@ -1,7 +1,6 @@
import express, { Response } from "express";
import * as T from "../../../website/src/types/account-types";
import { addFeedback } from "../lib/couch-db";
import { ntfy } from "../lib/ntfy";
// import env from "../lib/env-vars";
// TODO: ADD PROPER ERROR HANDLING THAT WILL RETURN JSON ALWAYS
@ -25,12 +24,9 @@ feedbackRouter.put("/", (req, res, next) => {
addFeedback({
user,
feedback,
})
.then(() => {
ntfy(JSON.stringify(feedback));
}).then(() => {
res.send({ ok: true, message: "feedback received" });
})
.catch((e) => {
}).catch((e) => {
console.error("error receiving feedback");
console.error("feedback missed", feedback);
console.error(e);