Skip to content

Commit

Permalink
Normalize all files to LF line endings
Browse files Browse the repository at this point in the history
  • Loading branch information
AlisherAmonulloev committed Nov 19, 2024
1 parent 0ece671 commit d519ba7
Show file tree
Hide file tree
Showing 10 changed files with 844 additions and 841 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
* text=auto eol=lf

VB/* linguist-vendored
scripts linguist-vendored
*.css linguist-detectable=false
Expand Down
436 changes: 218 additions & 218 deletions ASP.NET Core/wwwroot/js/vendor.js

Large diffs are not rendered by default.

50 changes: 25 additions & 25 deletions Amazon_Backend/AmazonS3_Backend.sln
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34714.143
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AmazonS3_Backend", "AmazonS3_Backend\AmazonS3_Backend.csproj", "{90613950-6138-4162-86EE-D33357A0609F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{90613950-6138-4162-86EE-D33357A0609F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{90613950-6138-4162-86EE-D33357A0609F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{90613950-6138-4162-86EE-D33357A0609F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{90613950-6138-4162-86EE-D33357A0609F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A73A541E-D200-43B4-BF12-6B428E40FD83}
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34714.143
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AmazonS3_Backend", "AmazonS3_Backend\AmazonS3_Backend.csproj", "{90613950-6138-4162-86EE-D33357A0609F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{90613950-6138-4162-86EE-D33357A0609F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{90613950-6138-4162-86EE-D33357A0609F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{90613950-6138-4162-86EE-D33357A0609F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{90613950-6138-4162-86EE-D33357A0609F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A73A541E-D200-43B4-BF12-6B428E40FD83}
EndGlobalSection
EndGlobal
32 changes: 16 additions & 16 deletions Amazon_Backend/AmazonS3_Backend/AmazonS3_Backend.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AWSSDK.Extensions.NETCore.Setup" Version="3.7.300" />
<PackageReference Include="AWSSDK.S3" Version="3.7.307.6" />
<PackageReference Include="DevExtreme.AspNet.Core" Version="23.2.5" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup>

</Project>
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AWSSDK.Extensions.NETCore.Setup" Version="3.7.300" />
<PackageReference Include="AWSSDK.S3" Version="3.7.307.6" />
<PackageReference Include="DevExtreme.AspNet.Core" Version="23.2.5" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup>

</Project>
302 changes: 151 additions & 151 deletions Amazon_Backend/AmazonS3_Backend/Controllers/AmazonS3Controller.cs
Original file line number Diff line number Diff line change
@@ -1,151 +1,151 @@
using Amazon.S3;
using Amazon.S3.Model;
using AmazonS3_Backend.Providers;
using Microsoft.AspNetCore.Mvc;

namespace AmazonS3Backend.Controllers {
[Route("api/[controller]")]
[ApiController]
public class AmazonS3Controller : ControllerBase {
AmazonS3Provider provider;
public AmazonS3Controller(IAmazonS3 client) {
provider = new AmazonS3Provider(client, Program.BucketName);
}

[HttpGet("getItems")]
public async Task<IActionResult> GetItems(string? path) {
try {
var items = await provider.GetItemsAsync(path);
return Ok(items);
} catch (Exception ex) {
throw new Exception(ex.Message);
}
}

[HttpPut("createDirectory")]
public async Task<IActionResult> CreateDirectory(string? path, string name) {
try {
await provider.CreateDirectoryAsync(path, name);
return Ok();
} catch (AmazonS3Exception ex) {
return StatusCode(500, ex.Message);
}
}
[HttpPut("renameItem")]
public async Task<IActionResult> RenameItem(string key, string? directory, string newName) {
try {
await provider.RenameItemAsync(key, directory, newName);
return Ok();
} catch (Exception ex) {
return StatusCode(500, ex.Message);
}
}

[HttpPost("moveItem")]
public async Task<IActionResult> MoveItem(string sourceKey, string destinationKey) {
try {
await provider.MoveItemAsync(sourceKey, destinationKey);
return Ok();
} catch (Exception ex) {
return StatusCode(500, ex.Message);
}
}

[HttpPost("deleteItem")]
public async Task<IActionResult> DeleteItem(string item) {
try {
await provider.DeleteItemAsync(item);
return Ok();
} catch (Exception ex) {
return StatusCode(500, ex.Message);
}
}
[HttpPut("copyItem")]
public async Task<IActionResult> CopyItem(string sourceKey, string destinationKey) {
try {
await provider.CopyItemAsync(sourceKey, destinationKey);
return Ok();
} catch (Exception ex) {
return StatusCode(500, ex.Message);
}
}
[HttpPost("downloadItems")]
public async Task<IActionResult> DownloadItems([FromBody] string[] keys) {
try {
var response = await provider.DownloadItemsAsync(keys);
// returning file with Content-Disposition header exposed
return response;
} catch (Exception ex) {
return StatusCode(500, ex.Message);
}
}

[HttpPost("initUpload")]
public async Task<IActionResult> InitUpload(string key) {
try {
var uploadId = await provider.InitUploadAsync(key);
return Ok(uploadId);
} catch (Exception ex) {
return StatusCode(500, ex.Message);
}
}

[HttpPost("getPresignedUrl")]
public async Task<IActionResult> GetPresignedUrl(string uploadId, string key, int partNumber) {
try {
var presignedUrl = await provider.GetPresignedUrlAsync(uploadId, key, partNumber);
return Ok(presignedUrl);
} catch (Exception ex) {
return StatusCode(500, ex.Message);
}
}

[HttpPost("getPresignedDownloadUrl")]
public async Task<IActionResult> GetPresignedDownloadUrl(string key) {
try {
var presignedDownloadUrl = await provider.GetPresignedDownloadUrlAsync(key);
return Ok(presignedDownloadUrl);
} catch (Exception ex) {
return StatusCode(500, ex.Message);
}
}

[HttpPost("uploadPart")]
public async Task<IActionResult> UploadPart([FromForm] IFormFile part, [FromForm] int partNumber, [FromForm] long partSize, [FromForm] string fileName, [FromForm] string uploadId) {
try {
using (var filePart = part.OpenReadStream()) {
var response = await provider.UploadPartAsync(filePart, partNumber, partSize, fileName, uploadId);
// returning result with ETag header exposed
return Ok(response.ETag);
}
} catch (Exception ex) {
return StatusCode(500, ex.Message);
}
}

[HttpPost("completeUpload")]
public async Task<IActionResult> CompleteUpload([FromBody] List<PartETag> parts, string key, string uploadId) {
try {
var response = await provider.CompleteUploadAsync(key, uploadId, parts);
// use `response` if you need to pass ETag or something else when upload is finished
return Ok(response.ETag);
} catch (AmazonS3Exception ex) when (ex.StatusCode == System.Net.HttpStatusCode.NotFound) {
// abort is requested when upload is being completed
return Ok();
} catch (Exception ex) {
return StatusCode(500, ex.Message);
}
}

[HttpPost("abortUpload")]
public async Task<IActionResult> AbortUpload(string uploadId, string key) {
try {
var response = await provider.AbortUploadAsync(uploadId, key);
// use `response` if you need to pass something to the client after aborting upload
return Ok(response.HttpStatusCode);
} catch (Exception ex) {
return StatusCode(500, ex.Message);
}
}
}
}
using Amazon.S3;
using Amazon.S3.Model;
using AmazonS3_Backend.Providers;
using Microsoft.AspNetCore.Mvc;

namespace AmazonS3Backend.Controllers {
[Route("api/[controller]")]
[ApiController]
public class AmazonS3Controller : ControllerBase {
AmazonS3Provider provider;
public AmazonS3Controller(IAmazonS3 client) {
provider = new AmazonS3Provider(client, Program.BucketName);
}

[HttpGet("getItems")]
public async Task<IActionResult> GetItems(string? path) {
try {
var items = await provider.GetItemsAsync(path);
return Ok(items);
} catch (Exception ex) {
throw new Exception(ex.Message);
}
}

[HttpPut("createDirectory")]
public async Task<IActionResult> CreateDirectory(string? path, string name) {
try {
await provider.CreateDirectoryAsync(path, name);
return Ok();
} catch (AmazonS3Exception ex) {
return StatusCode(500, ex.Message);
}
}
[HttpPut("renameItem")]
public async Task<IActionResult> RenameItem(string key, string? directory, string newName) {
try {
await provider.RenameItemAsync(key, directory, newName);
return Ok();
} catch (Exception ex) {
return StatusCode(500, ex.Message);
}
}

[HttpPost("moveItem")]
public async Task<IActionResult> MoveItem(string sourceKey, string destinationKey) {
try {
await provider.MoveItemAsync(sourceKey, destinationKey);
return Ok();
} catch (Exception ex) {
return StatusCode(500, ex.Message);
}
}

[HttpPost("deleteItem")]
public async Task<IActionResult> DeleteItem(string item) {
try {
await provider.DeleteItemAsync(item);
return Ok();
} catch (Exception ex) {
return StatusCode(500, ex.Message);
}
}
[HttpPut("copyItem")]
public async Task<IActionResult> CopyItem(string sourceKey, string destinationKey) {
try {
await provider.CopyItemAsync(sourceKey, destinationKey);
return Ok();
} catch (Exception ex) {
return StatusCode(500, ex.Message);
}
}
[HttpPost("downloadItems")]
public async Task<IActionResult> DownloadItems([FromBody] string[] keys) {
try {
var response = await provider.DownloadItemsAsync(keys);
// returning file with Content-Disposition header exposed
return response;
} catch (Exception ex) {
return StatusCode(500, ex.Message);
}
}

[HttpPost("initUpload")]
public async Task<IActionResult> InitUpload(string key) {
try {
var uploadId = await provider.InitUploadAsync(key);
return Ok(uploadId);
} catch (Exception ex) {
return StatusCode(500, ex.Message);
}
}

[HttpPost("getPresignedUrl")]
public async Task<IActionResult> GetPresignedUrl(string uploadId, string key, int partNumber) {
try {
var presignedUrl = await provider.GetPresignedUrlAsync(uploadId, key, partNumber);
return Ok(presignedUrl);
} catch (Exception ex) {
return StatusCode(500, ex.Message);
}
}

[HttpPost("getPresignedDownloadUrl")]
public async Task<IActionResult> GetPresignedDownloadUrl(string key) {
try {
var presignedDownloadUrl = await provider.GetPresignedDownloadUrlAsync(key);
return Ok(presignedDownloadUrl);
} catch (Exception ex) {
return StatusCode(500, ex.Message);
}
}

[HttpPost("uploadPart")]
public async Task<IActionResult> UploadPart([FromForm] IFormFile part, [FromForm] int partNumber, [FromForm] long partSize, [FromForm] string fileName, [FromForm] string uploadId) {
try {
using (var filePart = part.OpenReadStream()) {
var response = await provider.UploadPartAsync(filePart, partNumber, partSize, fileName, uploadId);
// returning result with ETag header exposed
return Ok(response.ETag);
}
} catch (Exception ex) {
return StatusCode(500, ex.Message);
}
}

[HttpPost("completeUpload")]
public async Task<IActionResult> CompleteUpload([FromBody] List<PartETag> parts, string key, string uploadId) {
try {
var response = await provider.CompleteUploadAsync(key, uploadId, parts);
// use `response` if you need to pass ETag or something else when upload is finished
return Ok(response.ETag);
} catch (AmazonS3Exception ex) when (ex.StatusCode == System.Net.HttpStatusCode.NotFound) {
// abort is requested when upload is being completed
return Ok();
} catch (Exception ex) {
return StatusCode(500, ex.Message);
}
}

[HttpPost("abortUpload")]
public async Task<IActionResult> AbortUpload(string uploadId, string key) {
try {
var response = await provider.AbortUploadAsync(uploadId, key);
// use `response` if you need to pass something to the client after aborting upload
return Ok(response.HttpStatusCode);
} catch (Exception ex) {
return StatusCode(500, ex.Message);
}
}
}
}
Loading

0 comments on commit d519ba7

Please sign in to comment.