mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-29 16:38:37 +00:00
parent
fb4d29eb43
commit
162da189d7
1 changed files with 10 additions and 2 deletions
|
@ -8,14 +8,22 @@ using Microsoft.Net.Http.Headers;
|
|||
|
||||
namespace LBPUnion.ProjectLighthouse.Helpers.Extensions;
|
||||
|
||||
// yoinked and adapted from https://stackoverflow.com/a/68641796
|
||||
public static class RequestExtensions
|
||||
{
|
||||
// yoinked and adapted from https://stackoverflow.com/a/68641796
|
||||
|
||||
#region Mobile Checking
|
||||
|
||||
private static readonly Regex mobileCheck = new
|
||||
("Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Compiled);
|
||||
(
|
||||
"Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|PlayStation Vita",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Compiled
|
||||
);
|
||||
|
||||
public static bool IsMobile(this HttpRequest request) => mobileCheck.IsMatch(request.Headers[HeaderNames.UserAgent].ToString());
|
||||
|
||||
#endregion
|
||||
|
||||
public static async Task<bool> CheckCaptchaValidity(this HttpRequest request)
|
||||
{
|
||||
if (ServerSettings.Instance.HCaptchaEnabled)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue