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