diff options
author | Ognjen Cirkovic <ciraboxkg@gmail.com> | 2022-11-07 22:31:17 +0100 |
---|---|---|
committer | Ognjen Cirkovic <ciraboxkg@gmail.com> | 2022-11-07 22:31:17 +0100 |
commit | 89d526c9e9d28bd2802d9033318e9eac3d507e34 (patch) | |
tree | bdb64ac01f4553518f3efff27f46997fc1fb5267 /Backend/Api | |
parent | 0175a978dcfb5a99441112c22c868122d7099cf6 (diff) |
Napravljen kontroler za preuzimanje aplikacije.
Diffstat (limited to 'Backend/Api')
-rw-r--r-- | Backend/Api/Api/.gitignore | 3 | ||||
-rw-r--r-- | Backend/Api/Api/Controllers/appController.cs | 27 | ||||
-rw-r--r-- | Backend/Api/Api/appsettings.json | 3 |
3 files changed, 31 insertions, 2 deletions
diff --git a/Backend/Api/Api/.gitignore b/Backend/Api/Api/.gitignore index f4b4ba8..5582dbb 100644 --- a/Backend/Api/Api/.gitignore +++ b/Backend/Api/Api/.gitignore @@ -1 +1,2 @@ -Files/*
\ No newline at end of file +Files/* +app-debug.apk
\ No newline at end of file diff --git a/Backend/Api/Api/Controllers/appController.cs b/Backend/Api/Api/Controllers/appController.cs new file mode 100644 index 0000000..004c941 --- /dev/null +++ b/Backend/Api/Api/Controllers/appController.cs @@ -0,0 +1,27 @@ +using Microsoft.AspNetCore.Authorization; +using System.Data; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; + +namespace Api.Controllers +{ + [Route("api/[controller]")] + [ApiController] + public class appController : ControllerBase + { + private readonly IConfiguration _configuration; + public appController(IConfiguration configuration) { + _configuration = configuration; + } + + [HttpGet("download")] + public async Task<ActionResult> getApp() + { + string appPath = _configuration.GetSection("AppSettings:AppName").Value; + if (appPath == null || !System.IO.File.Exists(appPath)) + return BadRequest("Aplikacija ne postoji"); + return File(System.IO.File.ReadAllBytes(appPath), "application/octet-stream", Path.GetFileName(appPath)); + } + + } +} diff --git a/Backend/Api/Api/appsettings.json b/Backend/Api/Api/appsettings.json index 22d91dc..b1bc59c 100644 --- a/Backend/Api/Api/appsettings.json +++ b/Backend/Api/Api/appsettings.json @@ -2,7 +2,8 @@ "AppSettings": { "JwtToken": "PjrVqQJ1P2VOkuWLw7NaZUluT4z7bkau", "EmailToken": "e8X8c0lm9KS7itWi3wgE6BiPXR21WPvO", - "MapQuestApiKey": "47oeviBUoCI2JxWzNARmCtrH9fDp5Mtk" //msbs#556ASDFGGSGSD + "MapQuestApiKey": "47oeviBUoCI2JxWzNARmCtrH9fDp5Mtk", //msbs#556ASDFGGSGSD + "AppName": "app-debug.apk" }, "Logging": { |