Further remove bridge functionality

This commit is contained in:
Declan Chidlow 2024-07-14 15:43:17 +08:00
parent bf6cff8f61
commit 6beeffe0fb
7 changed files with 0 additions and 2062 deletions

View file

@ -45,14 +45,6 @@ async function databaseMigrations() {
} }
} }
await setIndexes(dbs.BRIDGE_CONFIG, ["discord", "revolt"]);
await setIndexes(dbs.BRIDGE_REQUESTS, ["id", "revolt"]);
await setIndexes(dbs.BRIDGED_MESSAGES, [
"discord.messageId",
"revolt.messageId",
"revolt.nonce",
"origin",
]);
await setIndexes(dbs.INFRACTIONS, ["createdBy", "user", "server"]); await setIndexes(dbs.INFRACTIONS, ["createdBy", "user", "server"]);
await setIndexes(dbs.PENDING_LOGINS, ["code", "user"]); await setIndexes(dbs.PENDING_LOGINS, ["code", "user"]);
await setIndexes(dbs.SERVERS, ["id"]); await setIndexes(dbs.SERVERS, ["id"]);
@ -60,17 +52,6 @@ async function databaseMigrations() {
await setIndexes(dbs.TEMPBANS, ["id", "until"]); await setIndexes(dbs.TEMPBANS, ["id", "until"]);
await setIndexes(dbs.USERS, ["id"]); await setIndexes(dbs.USERS, ["id"]);
await setIndexes(dbs.VOTEKICKS, ["id", "server", "target"]); await setIndexes(dbs.VOTEKICKS, ["id", "server", "target"]);
// Migrate `disallowIfOptedOut` to `config.disallow_opt_out` on bridge_config
await dbs.BRIDGE_CONFIG.update(
{
disallowIfOptedOut: { $exists: true },
"config.disallow_opt_out": { $exists: false },
},
{
$rename: { disallowIfOptedOut: "config.disallow_opt_out" },
}
);
} }
export { databaseMigrations } export { databaseMigrations }

View file

@ -10,9 +10,6 @@ import Infraction from 'automod/dist/types/antispam/Infraction';
import PendingLogin from 'automod/dist/types/PendingLogin'; import PendingLogin from 'automod/dist/types/PendingLogin';
import TempBan from 'automod/dist/types/TempBan'; import TempBan from 'automod/dist/types/TempBan';
import { VoteEntry } from './bot/commands/moderation/votekick'; import { VoteEntry } from './bot/commands/moderation/votekick';
import BridgeRequest from 'automod/dist/types/BridgeRequest';
import BridgeConfig from 'automod/dist/types/BridgeConfig';
import BridgedMessage from 'automod/dist/types/BridgedMessage';
logger.info('Initializing client'); logger.info('Initializing client');
@ -30,9 +27,6 @@ const dbs = {
SESSIONS: db.get('sessions'), SESSIONS: db.get('sessions'),
TEMPBANS: db.get<TempBan>('tempbans'), TEMPBANS: db.get<TempBan>('tempbans'),
VOTEKICKS: db.get<VoteEntry>('votekicks'), VOTEKICKS: db.get<VoteEntry>('votekicks'),
BRIDGE_CONFIG: db.get<BridgeConfig>('bridge_config'),
BRIDGED_MESSAGES: db.get<BridgedMessage>('bridged_messages'),
BRIDGE_REQUESTS: db.get<BridgeRequest>('bridge_requests'),
} }
export { client, dbs } export { client, dbs }

View file

@ -1,26 +0,0 @@
export const CONFIG_KEYS = {
bridge_nicknames: {
friendlyName: "Bridge Nicknames",
description:
"If enabled, nicknames and avatar overrides will be bridged.",
},
disallow_opt_out: {
friendlyName: "Disallow users who opted out of message bridging",
description:
"If enabled, all messages by users who opted out of their messages being bridged (`/bridge opt_out`) will be deleted. " +
"You should enable this if your Revolt server is bridged to a mostly unmoderated Discord server.",
},
disable_system_messages: {
friendlyName: "Don't bridge system messages",
description:
"If enabled, system messages (e.g. join/leave events) won't be bridged.",
},
read_only_revolt: {
friendlyName: "Revolt read only",
description: "Don't bridge Revolt messages to Discord",
},
read_only_discord: {
friendlyName: "Discord read only",
description: "Don't bridge Discord messages to Revolt",
},
};

File diff suppressed because it is too large Load diff

View file

@ -1,23 +0,0 @@
import { CONFIG_KEYS } from "../misc/bridge_config_keys";
export default class {
// Revolt channel ID
revolt?: string;
// Discord channel ID
discord?: string;
// Discord webhook
discordWebhook?: {
id: string;
token: string;
};
config?: { [key in keyof typeof CONFIG_KEYS]: boolean | undefined };
/**
* @deprecated Use config.disallow_opt_out
* Will be automatically removed by database migrations
*/
disallowIfOptedOut?: boolean;
}

View file

@ -1,9 +0,0 @@
export default class {
// Bridge request ID, needed to confirm link from Discord side
id: string;
// The Revolt channel ID
revolt: string;
expires: number;
}

View file

@ -1,18 +0,0 @@
export default class {
origin: 'discord'|'revolt';
discord: {
messageId?: string;
}
revolt: {
messageId?: string;
nonce?: string;
}
// Required to sync message deletions
channels?: {
discord: string;
revolt: string;
}
}