From 5b6e31677e7a52b156ab8bbb65b80c16e67f5b17 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Tue, 1 Jun 2021 23:23:49 -0700 Subject: [PATCH] Implement ISO8601 style dates for backup filenames This partially implements ISO8601 + RFC3389 dates for backup filenames. As noted in the changelog, this was a sponsor request, and also, it's impossible to put the `:` literal in most files in most filesystems. So as a result, this is technically not compliant with ISO8601 or RFC3389 but it is closer. Also, wait, I don't even know because I don't have enough money to buy ISO8601 so we'll just assume this is compliant. Job = done. --- CHANGELOG.md | 1 + TShockAPI/BackupManager.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6d2218c..9bb15a64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * Changed `TSPlayer.FindByNameOrID` so that it will continue searching for players and return a list of many players whem ambiguous matches exist in all cases. Specifically, this avoids a scenario where a griefer names themselves `1` and is difficult to enact justice on, because their name will not be found by the matching system used to kick players. To help with ambiguity, this method now processes requests with prefixes `tsi:` and `tsn:`. `tsi:[number]` will process the search as looking for an exact player by ID. `tsn:` will process the search as looking for an exact name, case sensitive. In both cases, the system will return an exact result in the "old-style" result, i.e., a `List` with exactly one result. For example, `/kick tsid:1` will match the player with the ID `1`. `/kick tsn:1` will match the username `1`. In addition, players who attempt to join the server with the name prefixes `tsn:` and `tsi:` will be rejected for having invalid names. (@hakusaro, @Onusai) * Added warnings for conditions where a password is set at runtime but can be bypassed. The thinking is that if a user sets a password when they're booting the server, that's what they expect to be the password. The only thing is that sometimes, other config options can basically defeat this as a security feature. The goal is just to communicate more and make things clearer. The server also warns users when UUID login is enabled, because it can be confusing and insecure. (@hakusaro, @Onusai) * Fixed Torch God's Favor biome torch placement being rejected by the server. (@moisterrific) +* Backups created by the backup manager now use ISO8601-style timestamps. I say "style" because it's impossible to implement ISO8601 or RFC3389 dates in a filename on most modern filesystems. So instead of the proper ISO separators, we've got dashes and dots. (@hakusaro, change sponsored by @drunderscore) ## TShock 4.5.3 * Added permissions for using Teleportation Potions, Magic Conch, and Demon Conch. (@drunderscore) diff --git a/TShockAPI/BackupManager.cs b/TShockAPI/BackupManager.cs index 510b4260..3eec4e6f 100644 --- a/TShockAPI/BackupManager.cs +++ b/TShockAPI/BackupManager.cs @@ -62,7 +62,7 @@ namespace TShockAPI string worldname = Main.worldPathName; string name = Path.GetFileName(worldname); - Main.ActiveWorldFileData._path = Path.Combine(BackupPath, string.Format("{0}.{1:dd.MM.yy-HH.mm.ss}.bak", name, DateTime.UtcNow)); + Main.ActiveWorldFileData._path = Path.Combine(BackupPath, string.Format("{0}.{1:yyyy-MM-ddTHH.mm.ssZ}.bak", name, DateTime.UtcNow)); string worldpath = Path.GetDirectoryName(Main.worldPathName); if (worldpath != null && !Directory.Exists(worldpath))