-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support request desktop shortcut.
- Loading branch information
Showing
17 changed files
with
232 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using Microsoft.AspNetCore.Mvc.Filters; | ||
using Microsoft.Extensions.Caching.Memory; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Net; | ||
using System.Threading.Tasks; | ||
|
||
namespace Remotely.Server.Attributes | ||
{ | ||
[AttributeUsage(AttributeTargets.Method)] | ||
public class ActionRateLimiterAttribute : ActionFilterAttribute | ||
{ | ||
public string Action { get; set; } | ||
public int TimeoutInSeconds { get; set; } = 5; | ||
private static MemoryCache RequestCache { get; } = new MemoryCache(new MemoryCacheOptions()); | ||
|
||
|
||
public override void OnActionExecuting(ActionExecutingContext context) | ||
{ | ||
var ip = context.HttpContext.Request.HttpContext.Connection.RemoteIpAddress; | ||
var key = $"Action-{ip}"; | ||
|
||
if (!RequestCache.TryGetValue(key, out _)) | ||
{ | ||
RequestCache.Set(key, true, TimeSpan.FromSeconds(TimeoutInSeconds)); | ||
} | ||
else | ||
{ | ||
context.HttpContext.Response.StatusCode = (int)HttpStatusCode.TooManyRequests; | ||
} | ||
base.OnActionExecuting(context); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
@page | ||
@model Remotely.Server.Pages.GetSupportModel | ||
@{ | ||
ViewData["Title"] = "Get Support"; | ||
} | ||
|
||
@if (!Request.Query.ContainsKey("deviceUuid")) | ||
{ | ||
<h3 class="mb-3">Get Support</h3> | ||
<p> | ||
Device ID is missing. Please use a valid shortcut to the support page, which will include the device ID. | ||
</p> | ||
} | ||
else | ||
{ | ||
<div class="col-sm-6 offset-sm-3"> | ||
@if (!string.IsNullOrWhiteSpace(Model.StatusMessage)) | ||
{ | ||
<div class="alert alert-success alert-dismissible" role="alert"> | ||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> | ||
@Model.StatusMessage | ||
</div> | ||
} | ||
<h3 class="mb-3">Get Support</h3> | ||
<form method="post"> | ||
<div asp-validation-summary="All" class="text-danger"></div> | ||
<div class="form-group"> | ||
<label class="col-form-label">Your Name:</label> | ||
<br /> | ||
<input type="text" class="form-control" asp-for="Input.Name" /> | ||
<span asp-validation-for="Input.Name" class="text-danger"></span> | ||
</div> | ||
<div class="form-group"> | ||
<label class="col-form-label">Email:</label> | ||
<br /> | ||
<input type="email" class="form-control" asp-for="Input.Email" /> | ||
<span asp-validation-for="Input.Email" class="text-danger"></span> | ||
</div> | ||
<div class="form-group"> | ||
<label class="col-form-label">Phone:</label> | ||
<br /> | ||
<input type="tel" class="form-control" asp-for="Input.Phone" /> | ||
<span asp-validation-for="Input.Phone" class="text-danger"></span> | ||
</div> | ||
<div class="form-group"> | ||
<label class="col-form-label">Chat Response OK?</label> | ||
<br /> | ||
<input type="checkbox" checked="checked" asp-for="Input.ChatResponseOk" /> | ||
<span asp-validation-for="Input.ChatResponseOk" class="text-danger"></span> | ||
</div> | ||
<div class="text-right"> | ||
<button type="submit" class="btn btn-primary">Submit</button> | ||
</div> | ||
</form> | ||
</div> | ||
|
||
<style> | ||
input[type='checkbox'] { | ||
width: 25px; | ||
height: 25px; | ||
} | ||
</style> | ||
|
||
@section Scripts { | ||
<partial name="_ValidationScriptsPartial" /> | ||
} | ||
|
||
} |
Oops, something went wrong.