try different cors config
This commit is contained in:
parent
81107feaae
commit
39600a7646
|
@ -18,10 +18,7 @@ app.use("/payment/webhook", express.raw({type: "*/*"}));
|
||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
app.use(express.urlencoded({ extended: true }));
|
app.use(express.urlencoded({ extended: true }));
|
||||||
app.use(express.static("public"));
|
app.use(express.static("public"));
|
||||||
app.use(cors({
|
|
||||||
origin: inProd ? /\.lingdocs\.com$/ : "*",
|
|
||||||
credentials: true,
|
|
||||||
}));
|
|
||||||
if (inProd) app.set('trust proxy', 1);
|
if (inProd) app.set('trust proxy', 1);
|
||||||
setupSession(app);
|
setupSession(app);
|
||||||
app.use(passport.initialize());
|
app.use(passport.initialize());
|
||||||
|
@ -29,12 +26,20 @@ app.use(passport.session());
|
||||||
setupPassport(passport);
|
setupPassport(passport);
|
||||||
|
|
||||||
// Web Interface - returning html (mostly)
|
// Web Interface - returning html (mostly)
|
||||||
|
app.use(cors({
|
||||||
|
origin: inProd ? /\.lingdocs\.com$/ : "*",
|
||||||
|
credentials: true,
|
||||||
|
}));
|
||||||
app.use("/", authRouter(passport));
|
app.use("/", authRouter(passport));
|
||||||
// REST API - returning json
|
// REST API - returning json
|
||||||
app.use("/api", apiRouter);
|
app.use("/api", apiRouter);
|
||||||
app.use("/feedback", feedbackRouter);
|
app.use("/feedback", feedbackRouter);
|
||||||
app.use("/payment", paymentRouter);
|
app.use("/payment", paymentRouter);
|
||||||
// Dictionary API
|
app.use(cors({
|
||||||
|
origin: "*", // inProd ? /\.lingdocs\.com$/ : "*",
|
||||||
|
credentials: false,
|
||||||
|
}));
|
||||||
|
// Dictionary API
|
||||||
app.use("/dictionary", dictionaryRouter)
|
app.use("/dictionary", dictionaryRouter)
|
||||||
|
|
||||||
// START 💨 //
|
// START 💨 //
|
||||||
|
|
|
@ -54,6 +54,10 @@ export async function updateDictionary(): Promise<"no update" | "updated"> {
|
||||||
collection?.clear();
|
collection?.clear();
|
||||||
lokidb.removeCollection(collectionName);
|
lokidb.removeCollection(collectionName);
|
||||||
collection?.insert(dictionary.entries);
|
collection?.insert(dictionary.entries);
|
||||||
|
const allWords = await fetchAllWords();
|
||||||
|
allWordsCollection?.clear();
|
||||||
|
lokidb.removeCollection(allWordsCollectionName);
|
||||||
|
allWordsCollection?.insert(allWords.words);
|
||||||
return "updated";
|
return "updated";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue