move devDependencies to dependencies
because bundle installs api/gateway/cdn as npm dep. and the dev packages don't get automatically installed
This commit is contained in:
parent
d791ab37a3
commit
2ca550d0c9
BIN
api/package-lock.json
generated
BIN
api/package-lock.json
generated
Binary file not shown.
@ -41,7 +41,6 @@
|
||||
"atomically": "^1.7.0",
|
||||
"bcrypt": "^5.0.1",
|
||||
"body-parser": "^1.19.0",
|
||||
"canvas": "^2.8.0",
|
||||
"cheerio": "^1.0.0-rc.9",
|
||||
"dot-prop": "^6.0.1",
|
||||
"dotenv": "^8.2.0",
|
||||
@ -61,10 +60,7 @@
|
||||
"mongoose-long": "^0.3.2",
|
||||
"multer": "^1.4.2",
|
||||
"node-fetch": "^2.6.1",
|
||||
"require_optional": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"0x": "^4.10.2",
|
||||
"require_optional": "^1.0.1",
|
||||
"@types/amqplib": "^0.8.1",
|
||||
"@types/bcrypt": "^5.0.0",
|
||||
"@types/express": "^4.17.9",
|
||||
@ -74,10 +70,6 @@
|
||||
"@types/node": "^14.17.9",
|
||||
"@types/node-fetch": "^2.5.7",
|
||||
"@zerollup/ts-transform-paths": "^1.7.18",
|
||||
"caxa": "^2.1.0",
|
||||
"jest": "^26.6.3",
|
||||
"saslprep": "^1.0.3",
|
||||
"ts-node": "^9.1.1",
|
||||
"ts-node-dev": "^1.1.6",
|
||||
"typescript": "^4.1.2"
|
||||
}
|
||||
|
||||
@ -1,372 +0,0 @@
|
||||
// @ts-nocheck
|
||||
import Ajv, { JSONSchemaType } from "ajv";
|
||||
import { getConfigPathForFile } from "@fosscord/util/dist/util/Config";
|
||||
import { Config } from "@fosscord/util";
|
||||
|
||||
export interface RateLimitOptions {
|
||||
count: number;
|
||||
timespan: number;
|
||||
}
|
||||
|
||||
export interface DefaultOptions {
|
||||
gateway: string;
|
||||
general: {
|
||||
instance_id: string;
|
||||
};
|
||||
permissions: {
|
||||
user: {
|
||||
createGuilds: boolean;
|
||||
};
|
||||
};
|
||||
limits: {
|
||||
user: {
|
||||
maxGuilds: number;
|
||||
maxUsername: number;
|
||||
maxFriends: number;
|
||||
};
|
||||
guild: {
|
||||
maxRoles: number;
|
||||
maxMembers: number;
|
||||
maxChannels: number;
|
||||
maxChannelsInCategory: number;
|
||||
hideOfflineMember: number;
|
||||
};
|
||||
message: {
|
||||
characters: number;
|
||||
ttsCharacters: number;
|
||||
maxReactions: number;
|
||||
maxAttachmentSize: number;
|
||||
maxBulkDelete: number;
|
||||
};
|
||||
channel: {
|
||||
maxPins: number;
|
||||
maxTopic: number;
|
||||
};
|
||||
rate: {
|
||||
ip: {
|
||||
enabled: boolean;
|
||||
count: number;
|
||||
timespan: number;
|
||||
};
|
||||
routes: {
|
||||
auth?: {
|
||||
login?: RateLimitOptions;
|
||||
register?: RateLimitOptions;
|
||||
};
|
||||
channel?: string;
|
||||
// TODO: rate limit configuration for all routes
|
||||
};
|
||||
};
|
||||
};
|
||||
security: {
|
||||
jwtSecret: string;
|
||||
forwadedFor: string | null;
|
||||
captcha: {
|
||||
enabled: boolean;
|
||||
service: "recaptcha" | "hcaptcha" | null; // TODO: hcaptcha, custom
|
||||
sitekey: string | null;
|
||||
secret: string | null;
|
||||
};
|
||||
};
|
||||
login: {
|
||||
requireCaptcha: boolean;
|
||||
};
|
||||
register: {
|
||||
email: {
|
||||
necessary: boolean;
|
||||
allowlist: boolean;
|
||||
blocklist: boolean;
|
||||
domains: string[];
|
||||
};
|
||||
dateOfBirth: {
|
||||
necessary: boolean;
|
||||
minimum: number; // in years
|
||||
};
|
||||
requireCaptcha: boolean;
|
||||
requireInvite: boolean;
|
||||
allowNewRegistration: boolean;
|
||||
allowMultipleAccounts: boolean;
|
||||
password: {
|
||||
minLength: number;
|
||||
minNumbers: number;
|
||||
minUpperCase: number;
|
||||
minSymbols: number;
|
||||
blockInsecureCommonPasswords: boolean; // TODO: efficiently save password blocklist in database
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
const schema: JSONSchemaType<DefaultOptions> & {
|
||||
definitions: {
|
||||
rateLimitOptions: JSONSchemaType<RateLimitOptions>;
|
||||
};
|
||||
} = {
|
||||
type: "object",
|
||||
definitions: {
|
||||
rateLimitOptions: {
|
||||
type: "object",
|
||||
properties: {
|
||||
count: { type: "number" },
|
||||
timespan: { type: "number" }
|
||||
},
|
||||
required: ["count", "timespan"]
|
||||
}
|
||||
},
|
||||
properties: {
|
||||
gateway: {
|
||||
type: "string"
|
||||
},
|
||||
general: {
|
||||
type: "object",
|
||||
properties: {
|
||||
instance_id: {
|
||||
type: "string"
|
||||
}
|
||||
},
|
||||
required: ["instance_id"],
|
||||
additionalProperties: false
|
||||
},
|
||||
permissions: {
|
||||
type: "object",
|
||||
properties: {
|
||||
user: {
|
||||
type: "object",
|
||||
properties: {
|
||||
createGuilds: {
|
||||
type: "boolean"
|
||||
}
|
||||
},
|
||||
required: ["createGuilds"],
|
||||
additionalProperties: false
|
||||
}
|
||||
},
|
||||
required: ["user"],
|
||||
additionalProperties: false
|
||||
},
|
||||
limits: {
|
||||
type: "object",
|
||||
properties: {
|
||||
user: {
|
||||
type: "object",
|
||||
properties: {
|
||||
maxFriends: {
|
||||
type: "number"
|
||||
},
|
||||
maxGuilds: {
|
||||
type: "number"
|
||||
},
|
||||
maxUsername: {
|
||||
type: "number"
|
||||
}
|
||||
},
|
||||
required: ["maxFriends", "maxGuilds", "maxUsername"],
|
||||
additionalProperties: false
|
||||
},
|
||||
guild: {
|
||||
type: "object",
|
||||
properties: {
|
||||
maxRoles: {
|
||||
type: "number"
|
||||
},
|
||||
maxMembers: {
|
||||
type: "number"
|
||||
},
|
||||
maxChannels: {
|
||||
type: "number"
|
||||
},
|
||||
maxChannelsInCategory: {
|
||||
type: "number"
|
||||
},
|
||||
hideOfflineMember: {
|
||||
type: "number"
|
||||
}
|
||||
},
|
||||
required: ["maxRoles", "maxMembers", "maxChannels", "maxChannelsInCategory", "hideOfflineMember"],
|
||||
additionalProperties: false
|
||||
},
|
||||
message: {
|
||||
type: "object",
|
||||
properties: {
|
||||
characters: {
|
||||
type: "number"
|
||||
},
|
||||
ttsCharacters: {
|
||||
type: "number"
|
||||
},
|
||||
maxReactions: {
|
||||
type: "number"
|
||||
},
|
||||
maxAttachmentSize: {
|
||||
type: "number"
|
||||
},
|
||||
maxBulkDelete: {
|
||||
type: "number"
|
||||
}
|
||||
},
|
||||
required: ["characters", "ttsCharacters", "maxReactions", "maxAttachmentSize", "maxBulkDelete"],
|
||||
additionalProperties: false
|
||||
},
|
||||
channel: {
|
||||
type: "object",
|
||||
properties: {
|
||||
maxPins: {
|
||||
type: "number"
|
||||
},
|
||||
maxTopic: {
|
||||
type: "number"
|
||||
}
|
||||
},
|
||||
required: ["maxPins", "maxTopic"],
|
||||
additionalProperties: false
|
||||
},
|
||||
rate: {
|
||||
type: "object",
|
||||
properties: {
|
||||
ip: {
|
||||
type: "object",
|
||||
properties: {
|
||||
enabled: { type: "boolean" },
|
||||
count: { type: "number" },
|
||||
timespan: { type: "number" }
|
||||
},
|
||||
required: ["enabled", "count", "timespan"],
|
||||
additionalProperties: false
|
||||
},
|
||||
routes: {
|
||||
type: "object",
|
||||
properties: {
|
||||
auth: {
|
||||
type: "object",
|
||||
properties: {
|
||||
login: { $ref: "#/definitions/rateLimitOptions" },
|
||||
register: { $ref: "#/definitions/rateLimitOptions" }
|
||||
},
|
||||
nullable: true,
|
||||
required: [],
|
||||
additionalProperties: false
|
||||
},
|
||||
channel: {
|
||||
type: "string",
|
||||
nullable: true
|
||||
}
|
||||
},
|
||||
required: [],
|
||||
additionalProperties: false
|
||||
}
|
||||
},
|
||||
required: ["ip", "routes"]
|
||||
}
|
||||
},
|
||||
required: ["channel", "guild", "message", "rate", "user"],
|
||||
additionalProperties: false
|
||||
},
|
||||
security: {
|
||||
type: "object",
|
||||
properties: {
|
||||
jwtSecret: {
|
||||
type: "string"
|
||||
},
|
||||
forwadedFor: {
|
||||
type: "string",
|
||||
nullable: true
|
||||
},
|
||||
captcha: {
|
||||
type: "object",
|
||||
properties: {
|
||||
enabled: { type: "boolean" },
|
||||
service: {
|
||||
type: "string",
|
||||
enum: ["hcaptcha", "recaptcha", null],
|
||||
nullable: true
|
||||
},
|
||||
sitekey: {
|
||||
type: "string",
|
||||
nullable: true
|
||||
},
|
||||
secret: {
|
||||
type: "string",
|
||||
nullable: true
|
||||
}
|
||||
},
|
||||
required: ["enabled", "secret", "service", "sitekey"],
|
||||
additionalProperties: false
|
||||
}
|
||||
},
|
||||
required: ["captcha", "forwadedFor", "jwtSecret"],
|
||||
additionalProperties: false
|
||||
},
|
||||
login: {
|
||||
type: "object",
|
||||
properties: {
|
||||
requireCaptcha: { type: "boolean" }
|
||||
},
|
||||
required: ["requireCaptcha"],
|
||||
additionalProperties: false
|
||||
},
|
||||
register: {
|
||||
type: "object",
|
||||
properties: {
|
||||
email: {
|
||||
type: "object",
|
||||
properties: {
|
||||
necessary: { type: "boolean" },
|
||||
allowlist: { type: "boolean" },
|
||||
blocklist: { type: "boolean" },
|
||||
domains: {
|
||||
type: "array",
|
||||
items: {
|
||||
type: "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
required: ["allowlist", "blocklist", "domains", "necessary"],
|
||||
additionalProperties: false
|
||||
},
|
||||
dateOfBirth: {
|
||||
type: "object",
|
||||
properties: {
|
||||
necessary: { type: "boolean" },
|
||||
minimum: { type: "number" }
|
||||
},
|
||||
required: ["minimum", "necessary"],
|
||||
additionalProperties: false
|
||||
},
|
||||
requireCaptcha: { type: "boolean" },
|
||||
requireInvite: { type: "boolean" },
|
||||
allowNewRegistration: { type: "boolean" },
|
||||
allowMultipleAccounts: { type: "boolean" },
|
||||
password: {
|
||||
type: "object",
|
||||
properties: {
|
||||
minLength: { type: "number" },
|
||||
minNumbers: { type: "number" },
|
||||
minUpperCase: { type: "number" },
|
||||
minSymbols: { type: "number" },
|
||||
blockInsecureCommonPasswords: { type: "boolean" }
|
||||
},
|
||||
required: ["minLength", "minNumbers", "minUpperCase", "minSymbols", "blockInsecureCommonPasswords"],
|
||||
additionalProperties: false
|
||||
}
|
||||
},
|
||||
required: [
|
||||
"allowMultipleAccounts",
|
||||
"allowNewRegistration",
|
||||
"dateOfBirth",
|
||||
"email",
|
||||
"password",
|
||||
"requireCaptcha",
|
||||
"requireInvite"
|
||||
],
|
||||
additionalProperties: false
|
||||
}
|
||||
},
|
||||
required: ["gateway", "general", "limits", "login", "permissions", "register", "security"],
|
||||
additionalProperties: false
|
||||
};
|
||||
|
||||
const ajv = new Ajv();
|
||||
const validator = ajv.compile(schema);
|
||||
|
||||
const configPath = getConfigPathForFile("fosscord", "api", ".json");
|
||||
|
||||
export const apiConfig = new Config<DefaultOptions>({ path: configPath, schemaValidator: validator, schema: schema });
|
||||
@ -37,9 +37,8 @@
|
||||
"missing-native-js-functions": "^1.0.8",
|
||||
"multer": "^1.4.2",
|
||||
"node-fetch": "^2.6.1",
|
||||
"uuid": "^8.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"uuid": "^8.3.2",
|
||||
"typescript": "^4.1.2",
|
||||
"@types/body-parser": "^1.19.0",
|
||||
"@types/btoa": "^1.2.3",
|
||||
"@types/dotenv": "^8.2.0",
|
||||
|
||||
@ -24,9 +24,7 @@
|
||||
"node-fetch": "^2.6.1",
|
||||
"typescript": "^4.2.3",
|
||||
"uuid": "^8.3.2",
|
||||
"ws": "^7.4.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ws": "^7.4.2",
|
||||
"@types/amqplib": "^0.8.1",
|
||||
"@types/jsonwebtoken": "^8.5.0",
|
||||
"@types/mongoose-autopopulate": "^0.10.1",
|
||||
|
||||
@ -1,41 +0,0 @@
|
||||
// @ts-nocheck
|
||||
import { Config } from "@fosscord/util";
|
||||
import { getConfigPathForFile } from "@fosscord/util/dist/util/Config";
|
||||
import Ajv, { JSONSchemaType } from "ajv";
|
||||
|
||||
export interface DefaultOptions {
|
||||
endpoint?: string;
|
||||
security: {
|
||||
jwtSecret: string;
|
||||
};
|
||||
}
|
||||
|
||||
const schema: JSONSchemaType<DefaultOptions> = {
|
||||
type: "object",
|
||||
properties: {
|
||||
endpoint: {
|
||||
type: "string",
|
||||
nullable: true,
|
||||
},
|
||||
security: {
|
||||
type: "object",
|
||||
properties: {
|
||||
jwtSecret: {
|
||||
type: "string",
|
||||
},
|
||||
},
|
||||
required: ["jwtSecret"],
|
||||
},
|
||||
},
|
||||
required: ["security"],
|
||||
};
|
||||
|
||||
const ajv = new Ajv();
|
||||
const validator = ajv.compile(schema);
|
||||
|
||||
const configPath = getConfigPathForFile("fosscord", "gateway", ".json");
|
||||
export const gatewayConfig = new Config<DefaultOptions>({
|
||||
path: configPath,
|
||||
schemaValidator: validator,
|
||||
schema: schema,
|
||||
});
|
||||
BIN
util/package-lock.json
generated
BIN
util/package-lock.json
generated
Binary file not shown.
@ -25,22 +25,24 @@
|
||||
"url": "https://github.com/fosscord/fosscord-server-util/issues"
|
||||
},
|
||||
"homepage": "https://docs.fosscord.com/",
|
||||
"devDependencies": {
|
||||
"dependencies": {
|
||||
"@types/amqplib": "^0.8.1",
|
||||
"@types/jsonwebtoken": "^8.5.0",
|
||||
"@types/mongodb": "^3.6.9",
|
||||
"@types/mongoose-autopopulate": "^0.10.1",
|
||||
"@types/mongoose-lean-virtuals": "^0.5.1",
|
||||
"@types/node": "^14.17.9",
|
||||
"@types/node-fetch": "^2.5.12",
|
||||
"ajv": "^8.5.0",
|
||||
"amqplib": "^0.8.0",
|
||||
"dot-prop": "^6.0.1",
|
||||
"env-paths": "^2.2.1",
|
||||
"typescript": "^4.1.3",
|
||||
"amqplib": "^0.8.0",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"mongoose-autopopulate": "^0.12.3",
|
||||
"mongoose": "^5.13.7",
|
||||
"missing-native-js-functions": "^1.2.2",
|
||||
"mongodb": "^3.6.9",
|
||||
"mongoose": "^5.13.7",
|
||||
"mongoose-autopopulate": "^0.12.3",
|
||||
"typescript": "^4.1.3"
|
||||
"node-fetch": "^2.6.1"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user