mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Fix bug in time conversion, implement update endpoint for nexus cache
This commit is contained in:
parent
f7a36bf20e
commit
0ddcaa8241
@ -23,6 +23,14 @@ namespace Wabbajack.CacheServer
|
|||||||
Get("/v1/games/{GameName}/mods/{ModID}.json", HandleModInfo);
|
Get("/v1/games/{GameName}/mods/{ModID}.json", HandleModInfo);
|
||||||
Get("/nexus_api_cache/{request}.json", HandleCacheCall);
|
Get("/nexus_api_cache/{request}.json", HandleCacheCall);
|
||||||
Get("/nexus_api_cache", ListCache);
|
Get("/nexus_api_cache", ListCache);
|
||||||
|
Get("/nexus_api_cache/update", UpdateCache);
|
||||||
|
}
|
||||||
|
|
||||||
|
private object UpdateCache(object arg)
|
||||||
|
{
|
||||||
|
var api = new NexusApiClient(Request.Headers["apikey"].FirstOrDefault());
|
||||||
|
api.ClearUpdatedModsInCache();
|
||||||
|
return "Done";
|
||||||
}
|
}
|
||||||
|
|
||||||
private string ListCache(object arg)
|
private string ListCache(object arg)
|
||||||
|
@ -211,7 +211,7 @@ namespace Wabbajack.Common
|
|||||||
public static DateTime AsUnixTime(this long timestamp)
|
public static DateTime AsUnixTime(this long timestamp)
|
||||||
{
|
{
|
||||||
DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||||
dtDateTime = dtDateTime.AddSeconds(timestamp).ToLocalTime();
|
dtDateTime = dtDateTime.AddSeconds(timestamp);
|
||||||
return dtDateTime;
|
return dtDateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,7 +398,12 @@ namespace Wabbajack.Lib.NexusApi
|
|||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
Utils.Log($"Purging {to_purge.Count} cache entries");
|
Utils.Log($"Purging {to_purge.Count} cache entries");
|
||||||
to_purge.PMap(queue, f => File.Delete(f.f));
|
to_purge.PMap(queue, f =>
|
||||||
|
{
|
||||||
|
var uri = new Uri(Encoding.UTF8.GetString(Path.GetFileNameWithoutExtension(f.f).FromHex()));
|
||||||
|
Utils.Log($"Purging {uri}");
|
||||||
|
File.Delete(f.f);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user