Redo the auth system and implement rate limits

This commit is contained in:
Infi
2024-08-25 15:37:13 +02:00
parent 19f10b09c8
commit 1d7153fc50
7 changed files with 108 additions and 54 deletions
+8
View File
@@ -8,4 +8,12 @@ public class WebinterfaceUtil
{
return (100000 + Rng.Next() % 100000).ToString()[1..];
}
public static string GenerateSimpleToken()
{
var buffer = new byte[15];
Rng.NextBytes(buffer);
return Convert.ToHexString(buffer);
}
}
+3
View File
@@ -8,4 +8,7 @@ public static class WrapperUtil
{
Plugin.Notification.AddNotification(new Notification { Content = content, Type = type, Minimized = minimized });
}
public static IEnumerable<(T Value, int Index)> WithIndex<T>(this IEnumerable<T> list)
=> list.Select((x, i) => (x, i));
}