Fix empty notification images, Linux crash and feed GPS timer alignment

This commit is contained in:
Natsumi
2025-03-08 18:21:03 +13:00
parent c97b9745e6
commit 3cbe0a7047
3 changed files with 11 additions and 7 deletions
+5 -5
View File
@@ -69,7 +69,7 @@ internal static class ImageCache
if (!string.IsNullOrEmpty(cookieString))
request.Headers.Add("Cookie", cookieString);
using var response = await httpClient.SendAsync(request);
var response = await httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();
return await response.Content.ReadAsStreamAsync();
}
@@ -78,8 +78,8 @@ internal static class ImageCache
{
var directoryLocation = Path.Join(cacheLocation, fileId);
var fileLocation = Path.Join(directoryLocation, $"{version}.png");
if (File.Exists(fileLocation))
if (File.Exists(fileLocation) && new FileInfo(fileLocation).Length > 0)
{
Directory.SetLastWriteTimeUtc(directoryLocation, DateTime.UtcNow);
return fileLocation;
@@ -91,7 +91,7 @@ internal static class ImageCache
try
{
var stream = await FetchImage(url);
await using var stream = await FetchImage(url);
await using var fileStream =
new FileStream(fileLocation, FileMode.Create, FileAccess.Write, FileShare.None);
await stream.CopyToAsync(fileStream);
@@ -111,7 +111,7 @@ internal static class ImageCache
public static async Task SaveImageToFile(string url, string path)
{
var stream = await FetchImage(url);
await using var stream = await FetchImage(url);
await using var fileStream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None);
await stream.CopyToAsync(fileStream);
}
+2 -1
View File
@@ -40,7 +40,8 @@ namespace VRCX
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
}
private WebApi()
// leave this as public, private makes nodeapi angry
public WebApi()
{
#if LINUX
if (Instance == null)
+4 -1
View File
@@ -31,7 +31,10 @@ mixin feedTab
template(#default='scope')
div(style='position: relative; font-size: 14px')
template(v-if='scope.row.type === "GPS"')
location(v-if='scope.row.previousLocation' :location='scope.row.previousLocation')
location(
v-if='scope.row.previousLocation'
:location='scope.row.previousLocation'
style='display: inline-block')
el-tag(type='info' effect='plain' size='mini' style='margin-left: 5px') {{ timeToText(scope.row.time) }}
br
span(style='margin-right: 5px')