updates to backend and 10.2.0.1

This commit is contained in:
Kim 2023-07-27 13:23:17 +02:00
parent c23149c5cc
commit 22e2561f14
10 changed files with 26 additions and 1183 deletions

View File

@ -9,7 +9,7 @@ namespace InnovEnergy.App.Backend;
using Token = String; using Token = String;
[ApiController] [Controller]
[Route("api/")] [Route("api/")]
public class Controller : ControllerBase public class Controller : ControllerBase
{ {
@ -260,7 +260,7 @@ public class Controller : ControllerBase
} }
[HttpPost(nameof(CreateInstallation))] [HttpPost(nameof(CreateInstallation))]
public async Task<ActionResult<Installation>> CreateInstallation(Installation installation, Token authToken) public async Task<ActionResult<Installation>> CreateInstallation([FromBody]Installation installation, Token authToken)
{ {
var session = Db.GetSession(authToken); var session = Db.GetSession(authToken);

View File

@ -7,7 +7,7 @@ namespace InnovEnergy.App.Backend.DataTypes.Methods;
public static class InstallationMethods public static class InstallationMethods
{ {
private const String BucketNameSalt = "3e5b3069-214a-43ee-8d85-57d72000c19d"; private const String BucketNameSalt = "3e5b3069-214a-43ee-8d85-57d72000c10d";
public static String BucketName(this Installation installation) public static String BucketName(this Installation installation)
{ {
@ -37,7 +37,7 @@ public static class InstallationMethods
public static Task<Boolean> CreateBucket(this Installation installation) public static Task<Boolean> CreateBucket(this Installation installation)
{ {
return S3Access return S3Access
.ReadWrite .Admin
.CreateBucket(installation.BucketName()); .CreateBucket(installation.BucketName());
} }

View File

@ -0,0 +1,9 @@
<?xml version="1.0" ?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>HEAD</AllowedMethod>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>

View File

@ -1,4 +1,4 @@
{ {
"Key": "EXO1abcb772bf43ab72951ba1dc", "Key": "EXO1abcb772bf43ab72951ba1dc",
"Secret": "_ym1KsGBSp90S5dwhZn18XD-u9Y4ghHvyIxg5gv5fHw" "Secret": "_ym1KsGBSp90S5dwhZn18XD-u9Y4ghHvyIxg5gv5fHw"
} }

View File

@ -46,15 +46,7 @@ public class S3Cmd
public async Task<Boolean> CreateBucket(String bucketName) public async Task<Boolean> CreateBucket(String bucketName)
{ {
var cors = @"<?xml version=""1.0"" ?> const String cors = "./Resources/CORS";
<CORSConfiguration xmlns=""http://s3.amazonaws.com/doc/2006-03-01/"">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>HEAD</AllowedMethod>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>";
var result = await Run(bucketName, "mb"); var result = await Run(bucketName, "mb");
var setCors = await Run(bucketName, "setcors", cors); var setCors = await Run(bucketName, "setcors", cors);
@ -91,8 +83,8 @@ public class S3Cmd
var args = credentials var args = credentials
.Append(operation) .Append(operation)
.Append(bucketName.EnsureStartsWith(S3Prefix)) .Concat(optionalArgs)
.Concat(optionalArgs); .Append(bucketName.EnsureStartsWith(S3Prefix));
return Python return Python
.WithArguments(args) .WithArguments(args)

View File

@ -24,7 +24,7 @@ public static class Program
app.MapControllers(); app.MapControllers();
// app.MapGet("/", () => Controller.Index()); // app.MapGet("/", () => Controller.Index());
var webTask = app.RunAsync(); var webTask = app.RunAsync();
await Task.WhenAll(webTask, updateTask); await Task.WhenAll(webTask);
} }
private static OpenApiInfo OpenApiInfo { get; } = new OpenApiInfo private static OpenApiInfo OpenApiInfo { get; } = new OpenApiInfo

Binary file not shown.

View File

@ -79,6 +79,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IEM3kGridMeter", "Lib\Devic
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "S3Explorer", "App\S3Explorer\S3Explorer.csproj", "{EB56EF94-D8A7-4111-A8E7-A87EF13596DA}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "S3Explorer", "App\S3Explorer\S3Explorer.csproj", "{EB56EF94-D8A7-4111-A8E7-A87EF13596DA}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VrmGrabber", "App\VrmGrabber\VrmGrabber.csproj", "{88633C71-D701-49B3-A6DE-9D7CED9046E3}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -202,6 +204,10 @@ Global
{EB56EF94-D8A7-4111-A8E7-A87EF13596DA}.Debug|Any CPU.Build.0 = Debug|Any CPU {EB56EF94-D8A7-4111-A8E7-A87EF13596DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EB56EF94-D8A7-4111-A8E7-A87EF13596DA}.Release|Any CPU.ActiveCfg = Release|Any CPU {EB56EF94-D8A7-4111-A8E7-A87EF13596DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EB56EF94-D8A7-4111-A8E7-A87EF13596DA}.Release|Any CPU.Build.0 = Release|Any CPU {EB56EF94-D8A7-4111-A8E7-A87EF13596DA}.Release|Any CPU.Build.0 = Release|Any CPU
{88633C71-D701-49B3-A6DE-9D7CED9046E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{88633C71-D701-49B3-A6DE-9D7CED9046E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{88633C71-D701-49B3-A6DE-9D7CED9046E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{88633C71-D701-49B3-A6DE-9D7CED9046E3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(NestedProjects) = preSolution GlobalSection(NestedProjects) = preSolution
{CF4834CB-91B7-4172-AC13-ECDA8613CD17} = {145597B4-3E30-45E6-9F72-4DD43194539A} {CF4834CB-91B7-4172-AC13-ECDA8613CD17} = {145597B4-3E30-45E6-9F72-4DD43194539A}
@ -237,5 +243,6 @@ Global
{A3C79247-4CAA-44BE-921E-7285AB39E71F} = {4931A385-24DC-4E78-BFF4-356F8D6D5183} {A3C79247-4CAA-44BE-921E-7285AB39E71F} = {4931A385-24DC-4E78-BFF4-356F8D6D5183}
{1391165D-51F1-45B4-8B7F-042A20AA0277} = {4931A385-24DC-4E78-BFF4-356F8D6D5183} {1391165D-51F1-45B4-8B7F-042A20AA0277} = {4931A385-24DC-4E78-BFF4-356F8D6D5183}
{EB56EF94-D8A7-4111-A8E7-A87EF13596DA} = {145597B4-3E30-45E6-9F72-4DD43194539A} {EB56EF94-D8A7-4111-A8E7-A87EF13596DA} = {145597B4-3E30-45E6-9F72-4DD43194539A}
{88633C71-D701-49B3-A6DE-9D7CED9046E3} = {145597B4-3E30-45E6-9F72-4DD43194539A}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

File diff suppressed because it is too large Load Diff

View File

@ -28,7 +28,7 @@ const S3CredentialsContextProvider = ({
const [s3Credentials, setS3Credentials] = useState<S3Credentials>(); const [s3Credentials, setS3Credentials] = useState<S3Credentials>();
const saveS3Credentials = (credentials: S3Credentials, id: string) => { const saveS3Credentials = (credentials: S3Credentials, id: string) => {
const s3Bucket = id + "-3e5b3069-214a-43ee-8d85-57d72000c19d"; const s3Bucket = id + "-3e5b3069-214a-43ee-8d85-57d72000c10d";
setS3Credentials({ s3Bucket, ...credentials }); setS3Credentials({ s3Bucket, ...credentials });
/* setS3Credentials({ /* setS3Credentials({
s3Region: "sos-ch-dk-2", s3Region: "sos-ch-dk-2",