-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into bugfix/reject-zero-bytes-files
- Loading branch information
Showing
86 changed files
with
4,030 additions
and
178 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": ".NET Core Launch (web)", | ||
"type": "coreclr", | ||
"request": "launch", | ||
"preLaunchTask": "build", | ||
"program": "${workspaceFolder}/src/bin/Debug/net6.0/LocalTest.dll", | ||
"args": [], | ||
"cwd": "${workspaceFolder}/src", | ||
"stopAtEntry": false, | ||
"serverReadyAction": { | ||
"action": "openExternally", | ||
"pattern": "\\bNow listening on:\\s+(https?://\\S+)" | ||
}, | ||
"env": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
}, | ||
"sourceFileMap": { | ||
"/Views": "${workspaceFolder}/Views" | ||
} | ||
}, | ||
{ | ||
"name": ".NET Core Attach", | ||
"type": "coreclr", | ||
"request": "attach" | ||
} | ||
] | ||
} |
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,41 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "build", | ||
"command": "dotnet", | ||
"type": "process", | ||
"args": [ | ||
"build", | ||
"${workspaceFolder}/LocalTest.sln", | ||
"/property:GenerateFullPaths=true", | ||
"/consoleloggerparameters:NoSummary" | ||
], | ||
"problemMatcher": "$msCompile" | ||
}, | ||
{ | ||
"label": "publish", | ||
"command": "dotnet", | ||
"type": "process", | ||
"args": [ | ||
"publish", | ||
"${workspaceFolder}/LocalTest.sln", | ||
"/property:GenerateFullPaths=true", | ||
"/consoleloggerparameters:NoSummary" | ||
], | ||
"problemMatcher": "$msCompile" | ||
}, | ||
{ | ||
"label": "watch", | ||
"command": "dotnet", | ||
"type": "process", | ||
"args": [ | ||
"watch", | ||
"run", | ||
"--project", | ||
"${workspaceFolder}/LocalTest.sln" | ||
], | ||
"problemMatcher": "$msCompile" | ||
} | ||
] | ||
} |
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,65 @@ | ||
#nullable enable | ||
|
||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.Extensions.Options; | ||
|
||
|
||
using LocalTest.Configuration; | ||
|
||
using LocalTest.Services.TestData; | ||
using Microsoft.AspNetCore.Authorization; | ||
|
||
namespace LocalTest.Controllers; | ||
|
||
[Route("Home/[controller]/[action]")] | ||
public class DebugUsersController : Controller | ||
{ | ||
private readonly LocalPlatformSettings _localPlatformSettings; | ||
private readonly TenorDataRepository _tenorDataRepository; | ||
|
||
public DebugUsersController( | ||
IOptions<LocalPlatformSettings> localPlatformSettings, | ||
TenorDataRepository tenorDataRepository) | ||
{ | ||
_localPlatformSettings = localPlatformSettings.Value; | ||
_tenorDataRepository = tenorDataRepository; | ||
} | ||
|
||
// Debugging endpoint | ||
[AllowAnonymous] | ||
public async Task<IActionResult> LocalTestUsersRaw() | ||
{ | ||
var localData = await TestDataDiskReader.ReadFromDisk(_localPlatformSettings.LocalTestingStaticTestDataPath); | ||
|
||
return Json(localData); | ||
} | ||
|
||
//Debugging endpoint | ||
[AllowAnonymous] | ||
public async Task<IActionResult> LocalTestUsers() | ||
{ | ||
var localData = await TestDataDiskReader.ReadFromDisk(_localPlatformSettings.LocalTestingStaticTestDataPath); | ||
var constructedAppData = AppTestDataModel.FromTestDataModel(localData); | ||
|
||
return Json(constructedAppData); | ||
} | ||
|
||
// Debugging endpoint | ||
[AllowAnonymous] | ||
public async Task<IActionResult> LocalTestUsersRoundTrip() | ||
{ | ||
var localData = await TestDataDiskReader.ReadFromDisk(_localPlatformSettings.LocalTestingStaticTestDataPath); | ||
var constructedAppData = AppTestDataModel.FromTestDataModel(localData); | ||
|
||
return Json(constructedAppData.GetTestDataModel()); | ||
} | ||
|
||
// Debugging endpoint | ||
[AllowAnonymous] | ||
public async Task<IActionResult> ShowTenorUsers() | ||
{ | ||
var localData = await _tenorDataRepository.GetAppTestDataModel(); | ||
|
||
return Json(localData); | ||
} | ||
} |
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,87 @@ | ||
#nullable enable | ||
using System.Text.Json; | ||
|
||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.Extensions.Options; | ||
|
||
using LocalTest.Configuration; | ||
using LocalTest.Models; | ||
using LocalTest.Services.LocalApp.Interface; | ||
|
||
using LocalTest.Services.TestData; | ||
using Microsoft.AspNetCore.Authentication.Cookies; | ||
using Microsoft.AspNetCore.Mvc.Rendering; | ||
|
||
namespace LocalTest.Controllers; | ||
|
||
[Route("Home/[controller]/[action]")] | ||
public class FrontendVersionController : Controller | ||
{ | ||
/// <summary> | ||
/// See src\development\loadbalancer\nginx.conf | ||
/// </summary> | ||
public static readonly string FRONTEND_URL_COOKIE_NAME = "frontendVersion"; | ||
|
||
[HttpGet] | ||
public async Task<ActionResult> Index([FromServices] HttpClient client) | ||
{ | ||
var versionFromCookie = HttpContext.Request.Cookies[FRONTEND_URL_COOKIE_NAME]; | ||
|
||
var frontendVersion = new FrontendVersion() | ||
{ | ||
Version = versionFromCookie, | ||
Versions = new List<SelectListItem>() | ||
{ | ||
new () | ||
{ | ||
Text = "Keep as is", | ||
Value = "", | ||
}, | ||
new () | ||
{ | ||
Text = "localhost:8080 (local dev)", | ||
Value = "http://localhost:8080/" | ||
} | ||
} | ||
}; | ||
var cdnVersionsString = await client.GetStringAsync("https://altinncdn.no/toolkits/altinn-app-frontend/index.json"); | ||
var groupCdnVersions = new SelectListGroup() { Name = "Specific version from cdn" }; | ||
var versions = JsonSerializer.Deserialize<List<string>>(cdnVersionsString)!; | ||
versions.Reverse(); | ||
versions.ForEach(version => | ||
{ | ||
frontendVersion.Versions.Add(new() | ||
{ | ||
Text = version, | ||
Value = $"https://altinncdn.no/toolkits/altinn-app-frontend/{version}/", | ||
Group = groupCdnVersions | ||
}); | ||
}); | ||
|
||
return View(frontendVersion); | ||
} | ||
public ActionResult Index(FrontendVersion frontendVersion) | ||
{ | ||
var options = new CookieOptions | ||
{ | ||
Expires = DateTime.MaxValue, | ||
HttpOnly = true, | ||
}; | ||
ICookieManager cookieManager = new ChunkingCookieManager(); | ||
if (string.IsNullOrWhiteSpace(frontendVersion.Version)) | ||
{ | ||
cookieManager.DeleteCookie(HttpContext, FRONTEND_URL_COOKIE_NAME, options); | ||
} | ||
else | ||
{ | ||
cookieManager.AppendResponseCookie( | ||
HttpContext, | ||
FRONTEND_URL_COOKIE_NAME, | ||
frontendVersion.Version, | ||
options | ||
); | ||
} | ||
|
||
return RedirectToAction("Index", "Home"); | ||
} | ||
} |
Oops, something went wrong.