feat(bot): add proxy error config (#544)
This commit is contained in:
@@ -29,4 +29,5 @@ public class MessageContext
|
||||
public bool AllowAutoproxy { get; }
|
||||
public int? LatchTimeout { get; }
|
||||
public bool CaseSensitiveProxyTags { get; }
|
||||
public bool ProxyErrorMessageEnabled { get; }
|
||||
}
|
@@ -15,13 +15,14 @@ create function message_context(account_id bigint, guild_id bigint, channel_id b
|
||||
system_avatar text,
|
||||
allow_autoproxy bool,
|
||||
latch_timeout integer,
|
||||
case_sensitive_proxy_tags bool
|
||||
case_sensitive_proxy_tags bool,
|
||||
proxy_error_message_enabled bool
|
||||
)
|
||||
as $$
|
||||
-- CTEs to query "static" (accessible only through args) data
|
||||
with
|
||||
system as (select systems.*, system_config.latch_timeout, system_guild.tag as guild_tag, system_guild.tag_enabled as tag_enabled,
|
||||
allow_autoproxy as account_autoproxy, system_config.case_sensitive_proxy_tags from accounts
|
||||
allow_autoproxy as account_autoproxy, system_config.case_sensitive_proxy_tags, system_config.proxy_error_message_enabled from accounts
|
||||
left join systems on systems.id = accounts.system
|
||||
left join system_config on system_config.system = accounts.system
|
||||
left join system_guild on system_guild.system = accounts.system and system_guild.guild = guild_id
|
||||
@@ -43,7 +44,8 @@ as $$
|
||||
system.avatar_url as system_avatar,
|
||||
system.account_autoproxy as allow_autoproxy,
|
||||
system.latch_timeout as latch_timeout,
|
||||
system.case_sensitive_proxy_tags as case_sensitive_proxy_tags
|
||||
system.case_sensitive_proxy_tags as case_sensitive_proxy_tags,
|
||||
system.proxy_error_message_enabled as proxy_error_message_enabled
|
||||
-- We need a "from" clause, so we just use some bogus data that's always present
|
||||
-- This ensure we always have exactly one row going forward, so we can left join afterwards and still get data
|
||||
from (select 1) as _placeholder
|
||||
|
6
PluralKit.Core/Database/Migrations/34.sql
Normal file
6
PluralKit.Core/Database/Migrations/34.sql
Normal file
@@ -0,0 +1,6 @@
|
||||
-- database version 34
|
||||
-- add proxy_error_message_enabled to system config
|
||||
|
||||
alter table system_config add column proxy_error_message_enabled bool default true;
|
||||
|
||||
update info set schema_version = 34;
|
@@ -9,7 +9,7 @@ namespace PluralKit.Core;
|
||||
internal class DatabaseMigrator
|
||||
{
|
||||
private const string RootPath = "PluralKit.Core.Database"; // "resource path" root for SQL files
|
||||
private const int TargetSchemaVersion = 33;
|
||||
private const int TargetSchemaVersion = 34;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public DatabaseMigrator(ILogger logger)
|
||||
|
Reference in New Issue
Block a user