-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: make sure anidb events are in universal time
- Make sure AniDB events in the SignalR streams are in universal time (so they have a time zone attached when stringified).
- Loading branch information
Showing
3 changed files
with
62 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
Shoko.Server/API/SignalR/Models/AniDBStatusUpdateSignalRModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using System; | ||
using Shoko.Server.Providers.AniDB; | ||
|
||
#nullable enable | ||
namespace Shoko.Server.API.SignalR.Models; | ||
|
||
public class AniDBStatusUpdateSignalRModel | ||
{ | ||
/// <summary> | ||
/// The value of the UpdateType, is the ban active, is it waiting on a response, etc | ||
/// </summary> | ||
public bool Value { get; set; } | ||
|
||
/// <summary> | ||
/// Auxiliary Message for some states | ||
/// </summary> | ||
public string Message { get; set; } | ||
|
||
/// <summary> | ||
/// Update type, Ban, Invalid Session, Waiting on Response, etc | ||
/// </summary> | ||
public UpdateType UpdateType { get; set; } | ||
|
||
/// <summary> | ||
/// When was it updated, usually Now, but may not be | ||
/// </summary> | ||
public DateTime UpdateTime { get; set; } | ||
|
||
/// <summary> | ||
/// If we are pausing the queue, then for how long(er) | ||
/// </summary> | ||
public int PauseTimeSecs { get; set; } | ||
|
||
public AniDBStatusUpdateSignalRModel(UpdateType updateType, bool value, DateTime updateTime, int pauseTimeSecs, string message = "") | ||
{ | ||
Value = value; | ||
Message = message; | ||
UpdateType = updateType; | ||
UpdateTime = updateTime.ToUniversalTime(); | ||
PauseTimeSecs = pauseTimeSecs; | ||
} | ||
|
||
public AniDBStatusUpdateSignalRModel(AniDBStateUpdate update) | ||
{ | ||
Value = update.Value; | ||
Message = update.Message; | ||
UpdateType = update.UpdateType; | ||
UpdateTime = update.UpdateTime.ToUniversalTime(); | ||
PauseTimeSecs = update.PauseTimeSecs; | ||
} | ||
} |