mirror of
https://github.com/zkldi/Tachi.git
synced 2026-09-28 18:08:15 +03:00
Define OPTIONS_ALWAYS_SUCCEEDS for development purposes
This commit is contained in:
@@ -65,6 +65,7 @@ export interface TachiConfig {
|
|||||||
CLIENT_DEV_SERVER?: string | null;
|
CLIENT_DEV_SERVER?: string | null;
|
||||||
SERVER_TYPE_INFO: StaticConfig.ServerConfig;
|
SERVER_TYPE_INFO: StaticConfig.ServerConfig;
|
||||||
RATE_LIMIT: integer;
|
RATE_LIMIT: integer;
|
||||||
|
OPTIONS_ALWAYS_SUCCEEDS?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const isValidOauth2 = p.optional({
|
const isValidOauth2 = p.optional({
|
||||||
@@ -93,6 +94,7 @@ const err = p(config, {
|
|||||||
CLIENT_DEV_SERVER: "*?string",
|
CLIENT_DEV_SERVER: "*?string",
|
||||||
TYPE: p.isIn("ktchi", "btchi", "omni"),
|
TYPE: p.isIn("ktchi", "btchi", "omni"),
|
||||||
RATE_LIMIT: p.optional(p.isPositiveInteger),
|
RATE_LIMIT: p.optional(p.isPositiveInteger),
|
||||||
|
OPTIONS_ALWAYS_SUCCEEDS: "*boolean",
|
||||||
});
|
});
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|||||||
@@ -54,7 +54,9 @@ if (process.env.NODE_ENV !== "production" && ServerConfig.CLIENT_DEV_SERVER) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// hack to allow all OPTIONS requests. Remember that this setting should not be on in production!
|
// hack to allow all OPTIONS requests. Remember that this setting should not be on in production!
|
||||||
// app.options("*", (req, res) => res.send());
|
if (ServerConfig.OPTIONS_ALWAYS_SUCCEEDS) {
|
||||||
|
app.options("*", (req, res) => res.send());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (process.env.NODE_ENV !== "test") {
|
if (process.env.NODE_ENV !== "test") {
|
||||||
logger.info("Enabling Helmet, as no CLIENT_DEV_SERVER was set, or we are in production.");
|
logger.info("Enabling Helmet, as no CLIENT_DEV_SERVER was set, or we are in production.");
|
||||||
|
|||||||
Reference in New Issue
Block a user