diff --git a/.dependabot/config.yml b/.dependabot/config.yml
index 30d2f229..6aab95d4 100644
--- a/.dependabot/config.yml
+++ b/.dependabot/config.yml
@@ -2,17 +2,17 @@ version: 1
update_configs:
- package_manager: "dotnet:nuget"
directory: "/src/shortenerTools"
- update_schedule: "weekly"
+ update_schedule: "monthly"
default_assignees:
- "fboucher"
default_reviewers:
- "fboucher"
- target_branch: "dev"
+ target_branch: "vnext"
- package_manager: "dotnet:nuget"
directory: "/src/adminTools/adminBlazorWebsite/src"
- update_schedule: "weekly"
+ update_schedule: "monthly"
default_assignees:
- "fboucher"
default_reviewers:
- "fboucher"
- target_branch: "dev"
\ No newline at end of file
+ target_branch: "vnext"
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
deleted file mode 100644
index 92056412..00000000
--- a/.vscode/settings.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "workbench.colorCustomizations": {
- "activityBar.background": "#3399ff",
- "activityBar.activeBackground": "#3399ff",
- "activityBar.activeBorder": "#bf0060",
- "activityBar.foreground": "#15202b",
- "activityBar.inactiveForeground": "#15202b99",
- "activityBarBadge.background": "#bf0060",
- "activityBarBadge.foreground": "#e7e7e7",
- "titleBar.activeBackground": "#007fff",
- "titleBar.inactiveBackground": "#007fff99",
- "titleBar.activeForeground": "#e7e7e7",
- "titleBar.inactiveForeground": "#e7e7e799",
- "statusBar.background": "#007fff",
- "statusBarItem.hoverBackground": "#3399ff",
- "statusBar.foreground": "#e7e7e7",
- "statusBar.border": "#007fff",
- "titleBar.border": "#007fff"
- },
- "peacock.color": "#272727"
-}
\ No newline at end of file
diff --git a/src/adminTools/adminBlazorWebsite/src/Data/ShortUrlEntity.cs b/src/adminTools/adminBlazorWebsite/src/Data/ShortUrlEntity.cs
index 0d88ecc6..1a7b2983 100644
--- a/src/adminTools/adminBlazorWebsite/src/Data/ShortUrlEntity.cs
+++ b/src/adminTools/adminBlazorWebsite/src/Data/ShortUrlEntity.cs
@@ -1,3 +1,4 @@
+using System.ComponentModel.DataAnnotations;
using System.Linq;
namespace adminBlazorWebsite.Data
@@ -10,6 +11,8 @@ public class ShortUrlEntity
public string Title { get; set; }
+ [Required]
+ [Url]
public string Url { get; set; }
public string ShortUrl { get; set; }
@@ -32,7 +35,7 @@ public string GetDisplayableUrl(){
var lenght = Url.ToString().Length;
if (lenght >= 50){
- return string.Concat(Url.Substring(1,50), "...");
+ return string.Concat(Url.Substring(0,49), "...");
}
return Url;
}
diff --git a/src/adminTools/adminBlazorWebsite/src/Data/ShortUrlRequest.cs b/src/adminTools/adminBlazorWebsite/src/Data/ShortUrlRequest.cs
index b1f14284..f64ba9e4 100644
--- a/src/adminTools/adminBlazorWebsite/src/Data/ShortUrlRequest.cs
+++ b/src/adminTools/adminBlazorWebsite/src/Data/ShortUrlRequest.cs
@@ -20,6 +20,7 @@ public string Vanity {
}
[Required]
+ [Url]
public string Url { get; set; }
}
diff --git a/src/adminTools/adminBlazorWebsite/src/Pages/Urls.razor b/src/adminTools/adminBlazorWebsite/src/Pages/Urls.razor
index 8da2ee18..92ad6cb6 100644
--- a/src/adminTools/adminBlazorWebsite/src/Pages/Urls.razor
+++ b/src/adminTools/adminBlazorWebsite/src/Pages/Urls.razor
@@ -46,86 +46,65 @@ else
-
-
-
+
+
+
}
-@if(ShowCreatePopup)
+@if (ShowCreatePopup)
{
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
}
-@if(ShowEditPopup)
+@if (ShowEditPopup)
{
-
-
+
+
+
}
diff --git a/src/adminTools/adminBlazorWebsite/src/Shared/Modal.razor b/src/adminTools/adminBlazorWebsite/src/Shared/Modal.razor
new file mode 100644
index 00000000..42f5c504
--- /dev/null
+++ b/src/adminTools/adminBlazorWebsite/src/Shared/Modal.razor
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+@code {
+ [Parameter]
+ public string Title { get; set; }
+
+ [Parameter]
+ public EventCallback ClosePopup { get; set; }
+
+ [Parameter]
+ public RenderFragment ChildContent { get; set; }
+}
diff --git a/src/adminTools/adminBlazorWebsite/src/adminBlazorWebsite.csproj b/src/adminTools/adminBlazorWebsite/src/adminBlazorWebsite.csproj
index 56cd4631..3e6ecd6f 100644
--- a/src/adminTools/adminBlazorWebsite/src/adminBlazorWebsite.csproj
+++ b/src/adminTools/adminBlazorWebsite/src/adminBlazorWebsite.csproj
@@ -10,12 +10,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/src/shortenerTools/UrlShortener/UrlShortener.cs b/src/shortenerTools/UrlShortener/UrlShortener.cs
index 19a55b7b..93a312f6 100644
--- a/src/shortenerTools/UrlShortener/UrlShortener.cs
+++ b/src/shortenerTools/UrlShortener/UrlShortener.cs
@@ -32,8 +32,10 @@
namespace Cloud5mins.Function
{
+
public static class UrlShortener
{
+
[FunctionName("UrlShortener")]
public static async Task
Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]HttpRequestMessage req,
@@ -53,7 +55,13 @@ public static async Task Run(
{
return req.CreateResponse(HttpStatusCode.NotFound);
}
-
+
+ // Validates if input.url is a valid aboslute url, aka is a complete refrence to the resource, ex: http(s)://google.com
+ if (!Uri.IsWellFormedUriString(input.Url, UriKind.Absolute))
+ {
+ return req.CreateErrorResponse(HttpStatusCode.BadRequest, $"{input.Url} is not a valid absolute Url. The Url parameter must start with 'http://' or 'http://'.");
+ }
+
var result = new ShortResponse();
var config = new ConfigurationBuilder()
.SetBasePath(context.FunctionAppDirectory)
@@ -66,8 +74,8 @@ public static async Task Run(
try
{
string longUrl = input.Url.Trim();
- string vanity = input.Vanity.Trim();
- string title = input.Title.Trim();
+ string vanity = string.IsNullOrWhiteSpace(input.Vanity) ? "" : input.Vanity.Trim();
+ string title = string.IsNullOrWhiteSpace(input.Title) ? "" : input.Title.Trim();
ShortUrlEntity newRow;
diff --git a/src/shortenerTools/UrlUpdate/UrlUpdate.cs b/src/shortenerTools/UrlUpdate/UrlUpdate.cs
index c6d89ecd..9aef71f0 100644
--- a/src/shortenerTools/UrlUpdate/UrlUpdate.cs
+++ b/src/shortenerTools/UrlUpdate/UrlUpdate.cs
@@ -62,6 +62,12 @@ public static async Task Run(
return req.CreateResponse(HttpStatusCode.NotFound);
}
+ // Validates if input.url is a valid aboslute url, aka is a complete refrence to the resource, ex: http(s)://google.com
+ if (!Uri.IsWellFormedUriString(input.Url, UriKind.Absolute))
+ {
+ return req.CreateErrorResponse(HttpStatusCode.BadRequest, $"{input.Url} is not a valid absolute Url. The Url parameter must start with 'http://' or 'http://'.");
+ }
+
ShortUrlEntity result;
var config = new ConfigurationBuilder()
.SetBasePath(context.FunctionAppDirectory)
diff --git a/src/shortenerTools/shortenerTools.csproj b/src/shortenerTools/shortenerTools.csproj
index b4ae6d13..b5968608 100644
--- a/src/shortenerTools/shortenerTools.csproj
+++ b/src/shortenerTools/shortenerTools.csproj
@@ -7,7 +7,7 @@
-
+