3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-07-06 18:47:20 +00:00

Merge branch 'master' into timeout_validations

This commit is contained in:
Tiago R 2023-12-27 19:26:53 +00:00 committed by GitHub
commit a8f9ed1372
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 22 additions and 11 deletions

View file

@ -126,7 +126,7 @@ export function initGuildsAPI(app: express.Express) {
if (type !== ApiPermissionTypes.User) { if (type !== ApiPermissionTypes.User) {
return clientError(res, "Invalid type"); return clientError(res, "Invalid type");
} }
if (!isSnowflake(targetId)) { if (!isSnowflake(targetId) || targetId === req.user!.userId) {
return clientError(res, "Invalid targetId"); return clientError(res, "Invalid targetId");
} }
const validPermissions = new Set(Object.values(ApiPermissions)); const validPermissions = new Set(Object.values(ApiPermissions));

View file

@ -285,7 +285,11 @@ export class GuildCounters extends BaseGuildRepository {
reverse_comparison_value: reverseComparisonValue, reverse_comparison_value: reverseComparisonValue,
}); });
return (await entityManager.findOne(CounterTrigger, insertResult.identifiers[0].id))!; return (await entityManager.findOne(CounterTrigger, {
where: {
id: insertResult.identifiers[0].id,
},
}))!;
}); });
} }

View file

@ -8,7 +8,7 @@ import { Mute } from "./entities/Mute";
const OLD_EXPIRED_MUTE_THRESHOLD = 7 * DAYS; const OLD_EXPIRED_MUTE_THRESHOLD = 7 * DAYS;
export const MAX_TIMEOUT_DURATION = 28 * DAYS; export const MAX_TIMEOUT_DURATION = 27 * DAYS;
// When a timeout is under this duration but the mute expires later, the timeout will be reset to max duration // When a timeout is under this duration but the mute expires later, the timeout will be reset to max duration
export const TIMEOUT_RENEWAL_THRESHOLD = 21 * DAYS; export const TIMEOUT_RENEWAL_THRESHOLD = 21 * DAYS;

View file

@ -1,5 +1,6 @@
import { escapeInlineCode, Snowflake } from "discord.js"; import { escapeInlineCode, Snowflake } from "discord.js";
import * as t from "io-ts"; import * as t from "io-ts";
import { extname } from "path";
import { asSingleLine, messageSummary, verboseChannelMention } from "../../../utils"; import { asSingleLine, messageSummary, verboseChannelMention } from "../../../utils";
import { automodTrigger } from "../helpers"; import { automodTrigger } from "../helpers";
@ -33,7 +34,7 @@ export const MatchAttachmentTypeTrigger = automodTrigger<MatchResultType>()({
} }
for (const attachment of context.message.data.attachments) { for (const attachment of context.message.data.attachments) {
const attachmentType = attachment.url.split(".").pop()!.toLowerCase(); const attachmentType = extname(new URL(attachment.url).pathname).slice(1).toLowerCase();
const blacklist = trigger.blacklist_enabled const blacklist = trigger.blacklist_enabled
? (trigger.filetype_blacklist || []).map((_t) => _t.toLowerCase()) ? (trigger.filetype_blacklist || []).map((_t) => _t.toLowerCase())

View file

@ -8,6 +8,7 @@ import { GuildMutes } from "../../data/GuildMutes";
import { makeIoTsConfigParser, mapToPublicFn } from "../../pluginUtils"; import { makeIoTsConfigParser, mapToPublicFn } from "../../pluginUtils";
import { CasesPlugin } from "../Cases/CasesPlugin"; import { CasesPlugin } from "../Cases/CasesPlugin";
import { LogsPlugin } from "../Logs/LogsPlugin"; import { LogsPlugin } from "../Logs/LogsPlugin";
import { RoleManagerPlugin } from "../RoleManager/RoleManagerPlugin.js";
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint"; import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
import { ClearBannedMutesCmd } from "./commands/ClearBannedMutesCmd"; import { ClearBannedMutesCmd } from "./commands/ClearBannedMutesCmd";
import { ClearMutesCmd } from "./commands/ClearMutesCmd"; import { ClearMutesCmd } from "./commands/ClearMutesCmd";
@ -68,7 +69,7 @@ export const MutesPlugin = zeppelinGuildPlugin<MutesPluginType>()({
configSchema: ConfigSchema, configSchema: ConfigSchema,
}, },
dependencies: () => [CasesPlugin, LogsPlugin], dependencies: () => [CasesPlugin, LogsPlugin, RoleManagerPlugin],
configParser: makeIoTsConfigParser(ConfigSchema), configParser: makeIoTsConfigParser(ConfigSchema),
defaultOptions, defaultOptions,

View file

@ -205,9 +205,14 @@ export async function getServerInfoEmbed(
[GuildPremiumTier.Tier3]: 60, [GuildPremiumTier.Tier3]: 60,
}[restGuild.premiumTier] ?? 0; }[restGuild.premiumTier] ?? 0;
const availableEmojis = restGuild.emojis.cache.filter((e) => e.available);
otherStats.push( otherStats.push(
`Emojis: **${restGuild.emojis.cache.size}** / ${maxEmojis * 2}${ `Emojis: **${availableEmojis.size}** / ${maxEmojis * 2}${
roleLockedEmojis ? ` (__${roleLockedEmojis} role-locked__)` : "" roleLockedEmojis ? ` (__${roleLockedEmojis} role-locked__)` : ""
}${
availableEmojis.size < restGuild.emojis.cache.size
? ` (__+${restGuild.emojis.cache.size - availableEmojis.size} unavailable__)`
: ""
}`, }`,
); );
otherStats.push(`Stickers: **${restGuild.stickers.cache.size}** / ${maxStickers}`); otherStats.push(`Stickers: **${restGuild.stickers.cache.size}** / ${maxStickers}`);

View file

@ -20,7 +20,7 @@
"172950000412655616": 50 # Example mod "172950000412655616": 50 # Example mod
plugins: plugins:
mod_plugin: mod_actions:
config: config:
kick_message: 'You have been kicked' kick_message: 'You have been kicked'
can_kick: false can_kick: false

View file

@ -21,7 +21,7 @@ services:
MYSQL_USER: zeppelin MYSQL_USER: zeppelin
MYSQL_PASSWORD: ${DOCKER_PROD_MYSQL_PASSWORD?:Missing DOCKER_PROD_MYSQL_PASSWORD} MYSQL_PASSWORD: ${DOCKER_PROD_MYSQL_PASSWORD?:Missing DOCKER_PROD_MYSQL_PASSWORD}
ports: ports:
- ${DOCKER_PROD_MYSQL_PORT:?Missing DOCKER_PROD_MYSQL_PORT}:3306 - 127.0.0.1:${DOCKER_PROD_MYSQL_PORT:?Missing DOCKER_PROD_MYSQL_PORT}:3306
volumes: volumes:
- ./docker/production/data/mysql:/var/lib/mysql - ./docker/production/data/mysql:/var/lib/mysql
command: --authentication-policy=mysql_native_password command: --authentication-policy=mysql_native_password

View file

@ -4,9 +4,9 @@
"description": "", "description": "",
"private": true, "private": true,
"scripts": { "scripts": {
"format": "prettier --write './backend/src/**/*.{css,html,js,json,ts,tsx}' './dashboard/src/**/*.{css,html,js,json,ts,tsx}'", "format": "prettier --write \"./backend/src/**/*.{css,html,js,json,ts,tsx}\" \"./dashboard/src/**/*.{css,html,js,json,ts,tsx}\"",
"lint": "eslint './backend/src/**/*.{js,ts,tsx}' './dashboard/src/**/*.{js,ts,tsx}'", "lint": "eslint \"./backend/src/**/*.{js,ts,tsx}\" \"./dashboard/src/**/*.{js,ts,tsx}\"",
"codestyle-check": "prettier --check './backend/src/**/*.{css,html,js,json,ts,tsx}' './dashboard/src/**/*.{css,html,js,json,ts,tsx}'" "codestyle-check": "prettier --check \"./backend/src/**/*.{css,html,js,json,ts,tsx}\" \"./dashboard/src/**/*.{css,html,js,json,ts,tsx}\""
}, },
"devDependencies": { "devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.59.5", "@typescript-eslint/eslint-plugin": "^5.59.5",