From 71bbfd0c467118b6fa2162ea85290f244f88353e Mon Sep 17 00:00:00 2001 From: Ognjen Cirkovic Date: Wed, 9 Nov 2022 23:48:30 +0100 Subject: Napravljena html stranica sa formom za preuzimanje aplikacije. Dodata provera lozinke prilokom preuzimanja aplikacije. --- Backend/Api/Api.sln | 2 +- Backend/Api/Api/Assets/appDownload.html | 18 ++++++++++++++++++ Backend/Api/Api/Controllers/appController.cs | 18 ++++++++++++++++-- Backend/Api/Api/appsettings.json | 3 ++- 4 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 Backend/Api/Api/Assets/appDownload.html (limited to 'Backend') diff --git a/Backend/Api/Api.sln b/Backend/Api/Api.sln index 006fcf6..3ad9dd0 100644 --- a/Backend/Api/Api.sln +++ b/Backend/Api/Api.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.3.32825.248 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Api", "Api\Api.csproj", "{98D1F700-C988-4F19-89D1-9B7D002D702D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Api", "Api\Api.csproj", "{98D1F700-C988-4F19-89D1-9B7D002D702D}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/Backend/Api/Api/Assets/appDownload.html b/Backend/Api/Api/Assets/appDownload.html new file mode 100644 index 0000000..0d18e98 --- /dev/null +++ b/Backend/Api/Api/Assets/appDownload.html @@ -0,0 +1,18 @@ + + + + + Verification Successful + + +
+ +

Preuzimanje aplikacije

+
+
+
+

+
+
+ + \ No newline at end of file diff --git a/Backend/Api/Api/Controllers/appController.cs b/Backend/Api/Api/Controllers/appController.cs index 004c941..f16cf29 100644 --- a/Backend/Api/Api/Controllers/appController.cs +++ b/Backend/Api/Api/Controllers/appController.cs @@ -14,14 +14,28 @@ namespace Api.Controllers _configuration = configuration; } - [HttpGet("download")] - public async Task getApp() + [HttpPost("download")] + public async Task getApp([FromForm] string password) { string appPath = _configuration.GetSection("AppSettings:AppName").Value; + string truePassword = _configuration.GetSection("AppSettings:AppPassword").Value; if (appPath == null || !System.IO.File.Exists(appPath)) return BadRequest("Aplikacija ne postoji"); + if (password == null || password!=truePassword) + return BadRequest("Pogresna sifra"); return File(System.IO.File.ReadAllBytes(appPath), "application/octet-stream", Path.GetFileName(appPath)); } + [HttpGet("download")] + public async Task> getForm() + { + + var html = await System.IO.File.ReadAllTextAsync(@"./Assets/appDownload.html"); + html = html.Replace("{{name}}", "test"); + return base.Content(html, "text/html"); + + } } + } + diff --git a/Backend/Api/Api/appsettings.json b/Backend/Api/Api/appsettings.json index b1bc59c..d212dda 100644 --- a/Backend/Api/Api/appsettings.json +++ b/Backend/Api/Api/appsettings.json @@ -3,7 +3,8 @@ "JwtToken": "PjrVqQJ1P2VOkuWLw7NaZUluT4z7bkau", "EmailToken": "e8X8c0lm9KS7itWi3wgE6BiPXR21WPvO", "MapQuestApiKey": "47oeviBUoCI2JxWzNARmCtrH9fDp5Mtk", //msbs#556ASDFGGSGSD - "AppName": "app-debug.apk" + "AppName": "app-debug.apk", + "AppPassword": "jabukakruska123" }, "Logging": { -- cgit v1.2.3