mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-16 10:40:12 +00:00
Fix autoproxy timeout overflow
This commit is contained in:
parent
c3f6becea4
commit
ad921e17e3
1 changed files with 4 additions and 0 deletions
|
|
@ -154,6 +154,10 @@ namespace PluralKit.Bot
|
||||||
else if (ctx.Match("reset", "default")) newTimeoutHours = -1;
|
else if (ctx.Match("reset", "default")) newTimeoutHours = -1;
|
||||||
else if (!int.TryParse(ctx.RemainderOrNull(), out newTimeoutHours)) throw new PKError("Duration must be a number of hours.");
|
else if (!int.TryParse(ctx.RemainderOrNull(), out newTimeoutHours)) throw new PKError("Duration must be a number of hours.");
|
||||||
|
|
||||||
|
if (newTimeoutHours > 100000)
|
||||||
|
// sanity check to prevent seconds overflow if someone types in 999999999
|
||||||
|
newTimeoutHours = 0;
|
||||||
|
|
||||||
var newTimeout = newTimeoutHours > -1 ? Duration.FromHours(newTimeoutHours) : (Duration?) null;
|
var newTimeout = newTimeoutHours > -1 ? Duration.FromHours(newTimeoutHours) : (Duration?) null;
|
||||||
await _db.Execute(conn => _repo.UpdateSystem(conn, ctx.System.Id,
|
await _db.Execute(conn => _repo.UpdateSystem(conn, ctx.System.Id,
|
||||||
new SystemPatch { LatchTimeout = (int?) newTimeout?.TotalSeconds }));
|
new SystemPatch { LatchTimeout = (int?) newTimeout?.TotalSeconds }));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue