This commit is contained in:
Eugenio Chiodo
2022-02-14 01:51:52 +01:00
parent ba4a4b14c8
commit 5cba76554a
84 changed files with 18148 additions and 11553 deletions

View File

@ -1 +1,34 @@

using decePubClient.Models;
namespace decePubClient.Helpers;
public static class Faker
{
static IReadOnlyList<MessageUser> Users => new List<MessageUser>
{
new(),
new()
{
UserId = "7b5703dc-aee8-46b1-aed2-cd06021a1c0c",
DisplayName = "loweel",
UserName = "@loweel@bbs.keinpfusch.net",
PictureUrl = "https://bbs.keinpfusch.net/media/4729611f9aaef76399600ba2f117e5da609e5bf46dd7d502dae3e7b9fdc5cc78.WBMX2L9V1D00",
BackgroundUrl = "https://bbs.keinpfusch.net/media/6e283b943ca297629cb35b7fdfc790907dfd24b6303518e10992b2b5a6658947.3EUB6O4OMR2X",
ProfileUrl = "https://letsrulethe.world/users/AG6rE2nRya826QEJFY"
},
new()
{
UserId = "bc9c2a2b-fc5f-42fc-b907-ac30203eed45",
DisplayName = "Valentina Nappi",
UserName = "@valentina.nappi@mastodon.uno",
PictureUrl = "https://cdn.masto.host/mastodonuno/cache/accounts/avatars/106/816/797/491/758/442/original/2b2995b82af966fb.jpg",
BackgroundUrl = "https://cdn.masto.host/mastodonuno/cache/accounts/headers/106/816/797/491/758/442/original/898aedf6cd3a2da3.jpeg",
ProfileUrl = "https://mastodon.uno/web/@valenappi@beta.birdsite.live"
}
};
public static MessageUser GetRandomUser()
{
return Users[Random.Shared.Next(0, Users.Count)];
}
}

View File

@ -1,10 +1,6 @@
using collAnon.Shared;
using System;
using System.IO;
using System.Net.Mail;
using System.Text.Json;
using System.Net.Mail;
namespace collAnon.Client.Helpers
namespace decePubClient.Helpers
{
public static class SUtility
{
@ -27,12 +23,6 @@ namespace collAnon.Client.Helpers
return !(end < now && now < start);
}
public static bool CacheHasExpired(long? lastTimeCacheTimeTicks)
{
if (!lastTimeCacheTimeTicks.HasValue) return true;
return (DateTime.Now.Ticks - lastTimeCacheTimeTicks.Value) > VConstants.CacheExpirationPeriod.Ticks;
}
public static string GetFileIcon(string fileName)
{
switch (Path.GetExtension(fileName))
@ -62,21 +52,6 @@ namespace collAnon.Client.Helpers
}
}
public static string GetMissingMimeType(string fileName)
{
switch (Path.GetExtension(fileName))
{
case ".docx":
return "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
case ".xlsx":
return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
default:
return string.Empty;
}
}
public static bool IsValidEmail(string email)
{
try
@ -89,18 +64,5 @@ namespace collAnon.Client.Helpers
return false;
}
}
public static string GetQrCodeBase64(string base64String) => $"data:image/png;base64,{base64String}";
public static int GetRand()
{
var random = new Random(DateTime.Now.Millisecond);
return random.Next(0, random.Next(10, 1000));
}
public static T Deserialize<T>(string value)
{
return JsonSerializer.Deserialize<T>(value, new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
}
}
}