Add configurable autoproxy latch timeout

This commit is contained in:
spiral
2020-11-20 19:44:15 -05:00
parent 37294b68da
commit 8e5fb6520b
8 changed files with 70 additions and 10 deletions

View File

@@ -25,5 +25,6 @@ namespace PluralKit.Core
public string? SystemTag { get; }
public string? SystemAvatar { get; }
public bool AllowAutoproxy { get; }
public int LatchTimeout { get; }
}
}

View File

@@ -15,7 +15,8 @@
last_switch_timestamp timestamp,
system_tag text,
system_avatar text,
allow_autoproxy bool
allow_autoproxy bool,
latch_timeout integer
)
as $$
-- CTEs to query "static" (accessible only through args) data
@@ -39,7 +40,8 @@ as $$
system_last_switch.timestamp as last_switch_timestamp,
system.tag as system_tag,
system.avatar_url as system_avatar,
system.account_autoproxy as allow_autoproxy
system.account_autoproxy as allow_autoproxy,
system.latch_timeout as latch_timeout
-- 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

View File

@@ -1,7 +1,9 @@
-- SCHEMA VERSION 12: <insert date> --
-- Add disabling front/latch autoproxy per-member --
-- Add disabling autoproxy per-account --
-- Add configurable latch timeout --
alter table members add column allow_autoproxy bool not null default true;
alter table accounts add column allow_autoproxy bool not null default true;
alter table systems add column latch_timeout int not null default -1;
update info set schema_version = 12;

View File

@@ -18,6 +18,7 @@ namespace PluralKit.Core {
public Instant Created { get; }
public string UiTz { get; set; }
public bool PingsEnabled { get; }
public int LatchTimeout { get; }
public PrivacyLevel DescriptionPrivacy { get; }
public PrivacyLevel MemberListPrivacy { get;}
public PrivacyLevel FrontPrivacy { get; }

View File

@@ -15,6 +15,7 @@ namespace PluralKit.Core
public Partial<PrivacyLevel> FrontPrivacy { get; set; }
public Partial<PrivacyLevel> FrontHistoryPrivacy { get; set; }
public Partial<bool> PingsEnabled { get; set; }
public Partial<int> LatchTimeout { get; set; }
public override UpdateQueryBuilder Apply(UpdateQueryBuilder b) => b
.With("name", Name)
@@ -28,6 +29,7 @@ namespace PluralKit.Core
.With("group_list_privacy", GroupListPrivacy)
.With("front_privacy", FrontPrivacy)
.With("front_history_privacy", FrontHistoryPrivacy)
.With("pings_enabled", PingsEnabled);
.With("pings_enabled", PingsEnabled)
.With("latch_timeout", LatchTimeout);
}
}