radivoje.milutinovic 3 years ago
parent
commit
00f00051b9

+ 25
- 0
.dockerignore View File

**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md

+ 24
- 0
Dockerfile View File

#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["SecureSharing/SecureSharing.csproj", "SecureSharing/"]
COPY ["SecureSharing.Business/SecureSharing.Business.csproj", "SecureSharing.Business/"]
COPY ["SecureSharing.Data/SecureSharing.Data.csproj", "SecureSharing.Data/"]
RUN dotnet restore "SecureSharing/SecureSharing.csproj"
COPY . .
WORKDIR "/src/SecureSharing"
RUN dotnet build "SecureSharing.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "SecureSharing.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "SecureSharing.dll"]

+ 4
- 2
SecureSharing.Business/Dtos/MessageDto.cs View File

namespace SecureSharing.Business.Dtos;
using SecureSharing.Data.Data;

namespace SecureSharing.Business.Dtos;


public sealed class MessageDto : BaseDto public sealed class MessageDto : BaseDto
{ {
public string Text { get; set; } public string Text { get; set; }
public bool IsValid { get; set; } = true; public bool IsValid { get; set; } = true;
public Guid Code { get; set; } = Guid.NewGuid(); public Guid Code { get; set; } = Guid.NewGuid();
public string FileName { get; set; }
public List<FileModel> FileNames { get; set; } = new();
public DateTime? ExpiryDate { get; set; } public DateTime? ExpiryDate { get; set; }
} }

+ 1
- 0
SecureSharing.Business/Infrastructure/MapperProfile.cs View File

{ {
CreateMap<Message, MessageDto>().ReverseMap(); CreateMap<Message, MessageDto>().ReverseMap();
} }
} }

+ 7
- 0
SecureSharing.Data/Data/FileModel.cs View File

namespace SecureSharing.Data.Data;

public class FileModel
{
public int Id { get; set; }
public string Name { get; set; }
}

+ 1
- 1
SecureSharing.Data/Data/Message.cs View File

{ {
public string Text { get; set; } public string Text { get; set; }
public string Code { get; set; } public string Code { get; set; }
public string FileName { get; set; }
public List<FileModel> FileNames { get; set; }
public bool IsValid { get; set; } public bool IsValid { get; set; }
public DateTime? ExpiryDate { get; set; } public DateTime? ExpiryDate { get; set; }
} }

+ 340
- 0
SecureSharing.Data/Migrations/20220928065754_Changed for filename to be list of FileModels.Designer.cs View File

// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using SecureSharing.Data.DbContexts;

#nullable disable

namespace SecureSharing.Data.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20220928065754_Changed for filename to be list of FileModels")]
partial class ChangedforfilenametobelistofFileModels
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 128);

SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");

b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");

b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");

b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");

b.HasKey("Id");

b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");

b.ToTable("AspNetRoles", (string)null);
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");

SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);

b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");

b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");

b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("nvarchar(450)");

b.HasKey("Id");

b.HasIndex("RoleId");

b.ToTable("AspNetRoleClaims", (string)null);
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");

b.Property<int>("AccessFailedCount")
.HasColumnType("int");

b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");

b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");

b.Property<bool>("EmailConfirmed")
.HasColumnType("bit");

b.Property<bool>("LockoutEnabled")
.HasColumnType("bit");

b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");

b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");

b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");

b.Property<string>("PasswordHash")
.HasColumnType("nvarchar(max)");

b.Property<string>("PhoneNumber")
.HasColumnType("nvarchar(max)");

b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit");

b.Property<string>("SecurityStamp")
.HasColumnType("nvarchar(max)");

b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit");

b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");

b.HasKey("Id");

b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");

b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");

b.ToTable("AspNetUsers", (string)null);
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");

SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);

b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");

b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");

b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");

b.HasKey("Id");

b.HasIndex("UserId");

b.ToTable("AspNetUserClaims", (string)null);
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");

b.Property<string>("ProviderKey")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");

b.Property<string>("ProviderDisplayName")
.HasColumnType("nvarchar(max)");

b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");

b.HasKey("LoginProvider", "ProviderKey");

b.HasIndex("UserId");

b.ToTable("AspNetUserLogins", (string)null);
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");

b.Property<string>("RoleId")
.HasColumnType("nvarchar(450)");

b.HasKey("UserId", "RoleId");

b.HasIndex("RoleId");

b.ToTable("AspNetUserRoles", (string)null);
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");

b.Property<string>("LoginProvider")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");

b.Property<string>("Name")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");

b.Property<string>("Value")
.HasColumnType("nvarchar(max)");

b.HasKey("UserId", "LoginProvider", "Name");

b.ToTable("AspNetUserTokens", (string)null);
});

modelBuilder.Entity("SecureSharing.Data.Data.FileModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");

SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);

b.Property<int?>("MessageId")
.HasColumnType("int");

b.Property<string>("Name")
.HasColumnType("nvarchar(max)");

b.HasKey("Id");

b.HasIndex("MessageId");

b.ToTable("FileModel");
});

modelBuilder.Entity("SecureSharing.Data.Data.Message", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");

SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);

b.Property<string>("Code")
.HasColumnType("nvarchar(max)");

b.Property<DateTime?>("ExpiryDate")
.HasColumnType("datetime2");

b.Property<bool>("IsValid")
.HasColumnType("bit");

b.Property<string>("Text")
.HasColumnType("nvarchar(max)");

b.HasKey("Id");

b.ToTable("Messages");
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();

b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});

modelBuilder.Entity("SecureSharing.Data.Data.FileModel", b =>
{
b.HasOne("SecureSharing.Data.Data.Message", null)
.WithMany("FileNames")
.HasForeignKey("MessageId");
});

modelBuilder.Entity("SecureSharing.Data.Data.Message", b =>
{
b.Navigation("FileNames");
});
#pragma warning restore 612, 618
}
}
}

+ 32
- 0
SecureSharing.Data/Migrations/20220928065754_Changed for filename to be list of FileModels.cs View File

using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace SecureSharing.Data.Migrations
{
public partial class ChangedforfilenametobelistofFileModels : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(name: "FileModel");
migrationBuilder.CreateTable(
name: "FileModel",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_FileModel", x => x.Id);
});
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(name: "FileModel");
}
}
}

+ 33
- 3
SecureSharing.Data/Migrations/AppDbContextModelSnapshot.cs View File

b.ToTable("AspNetUserTokens", (string)null); b.ToTable("AspNetUserTokens", (string)null);
}); });


modelBuilder.Entity("SecureSharing.Data.Data.FileModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");

SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);

b.Property<int?>("MessageId")
.HasColumnType("int");

b.Property<string>("Name")
.HasColumnType("nvarchar(max)");

b.HasKey("Id");

b.HasIndex("MessageId");

b.ToTable("FileModel");
});

modelBuilder.Entity("SecureSharing.Data.Data.Message", b => modelBuilder.Entity("SecureSharing.Data.Data.Message", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
b.Property<DateTime?>("ExpiryDate") b.Property<DateTime?>("ExpiryDate")
.HasColumnType("datetime2"); .HasColumnType("datetime2");


b.Property<string>("FileName")
.HasColumnType("nvarchar(max)");

b.Property<bool>("IsValid") b.Property<bool>("IsValid")
.HasColumnType("bit"); .HasColumnType("bit");


.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
}); });

modelBuilder.Entity("SecureSharing.Data.Data.FileModel", b =>
{
b.HasOne("SecureSharing.Data.Data.Message", null)
.WithMany("FileNames")
.HasForeignKey("MessageId");
});

modelBuilder.Entity("SecureSharing.Data.Data.Message", b =>
{
b.Navigation("FileNames");
});
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }
} }

+ 7
- 7
SecureSharing.Data/SecureSharing.Data.csproj View File

</PropertyGroup> </PropertyGroup>


<ItemGroup> <ItemGroup>
<PackageReference Include="AutoMapper" Version="11.0.1"/>
<PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="6.0.9"/>
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.9"/>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.9"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.9"/>
<PackageReference Include="AutoMapper" Version="11.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="6.0.9" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.9"> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.9">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1"/>
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0"/>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
</ItemGroup> </ItemGroup>


</Project> </Project>

+ 23
- 3
SecureSharing/Controllers/HomeController.cs View File

using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using SecureSharing.Business.Dtos; using SecureSharing.Business.Dtos;
using SecureSharing.Business.Interfaces; using SecureSharing.Business.Interfaces;
using SecureSharing.Data.Data;
using SecureSharing.Infrastructure; using SecureSharing.Infrastructure;
using SecureSharing.Models; using SecureSharing.Models;


private readonly ILogger<HomeController> _logger; private readonly ILogger<HomeController> _logger;
private readonly IMessageService _messageService; private readonly IMessageService _messageService;
private readonly IModelFactory _modelFactory; private readonly IModelFactory _modelFactory;


public HomeController(ILogger<HomeController> logger, IMessageService messageService, IModelFactory modelFactory)
private readonly IWebHostEnvironment _webHostEnvironment;
private const string DefaultPath = "files";
public HomeController(ILogger<HomeController> logger, IMessageService messageService, IModelFactory modelFactory, IWebHostEnvironment webHostEnvironment)
{ {
_logger = logger; _logger = logger;
_messageService = messageService; _messageService = messageService;
_modelFactory = modelFactory; _modelFactory = modelFactory;
_webHostEnvironment = webHostEnvironment;
} }


public IActionResult Index() public IActionResult Index()
public async Task<IActionResult> CreateMessage(MessageModel model) public async Task<IActionResult> CreateMessage(MessageModel model)
{ {
var message = new MessageDto { Text = model.Text }; var message = new MessageDto { Text = model.Text };
var currentPath = _webHostEnvironment.WebRootPath.Split('/')[0];
// var filePath = $@"{currentPath}\{DefaultPath}\{message.Code}";
var filePath = Path.Combine(currentPath, DefaultPath, message.Code.ToString());
Directory.CreateDirectory(filePath);

foreach (var formFile in model.Files)
{
if (formFile.Length > 0)
{
using var stream = new FileStream(filePath, FileMode.Create);
await formFile.CopyToAsync(stream);
message.FileNames.Add(new FileModel { Name = formFile.Name });
}
}


var code = await _messageService.Create(message, model.ChosenPeriod); var code = await _messageService.Create(message, model.ChosenPeriod);
return RedirectToAction("Link", "Home", new { code = code, share = true }); return RedirectToAction("Link", "Home", new { code = code, share = true });
} }

+ 1
- 0
SecureSharing/Models/MessageModel.cs View File

public string Text { get; set; } public string Text { get; set; }
public Guid Code { get; set; } public Guid Code { get; set; }
public PeriodOfValidity ChosenPeriod { get; set; } public PeriodOfValidity ChosenPeriod { get; set; }
public List<IFormFile> Files { get; init; } = new();


// public Dictionary<int, string> AvailablePeriods { get; set; } // public Dictionary<int, string> AvailablePeriods { get; set; }
} }

+ 12
- 5
SecureSharing/Properties/launchSettings.json View File

{
{
"iisSettings": { "iisSettings": {
"windowsAuthentication": false, "windowsAuthentication": false,
"anonymousAuthentication": true, "anonymousAuthentication": true,
}, },
"SecureSharing": { "SecureSharing": {
"commandName": "Project", "commandName": "Project",
"dotnetRunMessages": "true",
"launchBrowser": true, "launchBrowser": true,
"applicationUrl": "https://localhost:44336;http://localhost:5000",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development", "ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" "ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation"
}
},
"applicationUrl": "https://localhost:44336;http://localhost:5000",
"dotnetRunMessages": "true"
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
"publishAllPorts": true,
"useSSL": true
} }
} }
}
}

+ 4
- 0
SecureSharing/SecureSharing.csproj View File

<Nullable>disable</Nullable> <Nullable>disable</Nullable>
<CopyRefAssembliesToPublishDirectory>false</CopyRefAssembliesToPublishDirectory> <CopyRefAssembliesToPublishDirectory>false</CopyRefAssembliesToPublishDirectory>
<RootNamespace>SecureSharing</RootNamespace> <RootNamespace>SecureSharing</RootNamespace>
<UserSecretsId>7f4608f1-6c17-4907-960a-3aee94c83a31</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup> </PropertyGroup>


<ItemGroup> <ItemGroup>
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.15.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.9" /> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.9" />
<PackageReference Include="Quartz" Version="3.5.0" /> <PackageReference Include="Quartz" Version="3.5.0" />
<PackageReference Include="Serilog" Version="2.12.0" /> <PackageReference Include="Serilog" Version="2.12.0" />


<ItemGroup> <ItemGroup>
<Folder Include="AppData\Errors\" /> <Folder Include="AppData\Errors\" />
<Folder Include="wwwroot\files" />
</ItemGroup> </ItemGroup>


<ItemGroup> <ItemGroup>

+ 51
- 10
SecureSharing/Views/Home/Index.cshtml View File

Layout = "~/Views/Shared/_Layout.cshtml"; Layout = "~/Views/Shared/_Layout.cshtml";
} }
@using SecureSharing.Business.Infrastructure @using SecureSharing.Business.Infrastructure
@using System.Text.Json
@model MessageModel @model MessageModel




<h1>Share files</h1> <h1>Share files</h1>
<form method="post" asp-controller="Home" asp-action="CreateMessage" class="share-files-form">
<form method="post" enctype="multipart/form-data" asp-controller="Home" asp-action="CreateMessage" class="share-files-form">
<label class="label-text">Sharing link avaliability</label> <label class="label-text">Sharing link avaliability</label>
<div class="button-box col-lg-12"> <div class="button-box col-lg-12">
<div class="single-button-input"> <div class="single-button-input">
<label class="label-text">Message (optional)</label> <label class="label-text">Message (optional)</label>
<textarea asp-for="Text" class="input-message"></textarea> <textarea asp-for="Text" class="input-message"></textarea>
<label class="label-text">Upload files</label> <label class="label-text">Upload files</label>
<div class="drop-here">
<div class="default-text">
<img src="img/file-upload-image.png" alt=""/>
<p>Drag and drop files here or <span style="color: dodgerblue">browse</span></p>
<div id="dropContainer" class="drop-here">
<img class="image-file-upload" src="~/img/file-upload-image.png" alt=""/>
<div class="default-text text-files-upload">
<label for="fileInput" class="btn browse-button">
<span style="color:#0D1C52">Drag and drop files here or</span> browse
</label>
<input asp-for="Files" id="fileInput" type="file" multiple style="display: none"/>
</div> </div>
</div> </div>
@{ @{
@* <div class="files hidden"> *@
@* <div class="label-text">Your files: </div> *@
@* *@
@* </div> *@
if (Model is not null && Model.Files.Count > 0)
{
<div class="files hidden">
<div class="label-text">Your files: </div>
@foreach (var file in Model.Files)
{
<div class="label-text">@file.Name</div>
}
</div>
}
} }
<button class=" btn btn-light share-button" type="submit">Share</button> <button class=" btn btn-light share-button" type="submit">Share</button>
</form>
</form>

<script src="~/plugins/jquery/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
var selectedFiles;

$(document).ready(() => {
var box;
box = document.getElementById("dropContainer");
box.addEventListener("dragenter", OnDragEnter, false);
box.addEventListener("dragover", OnDragOver, false);
box.addEventListener("drop", OnDrop, false);
})

function OnDragEnter(e) {
e.stopPropagation();
e.preventDefault();
}

function OnDragOver(e) {
e.stopPropagation();
e.preventDefault();
}

function OnDrop(e) {
e.stopPropagation();
e.preventDefault();
selectedFiles = e.dataTransfer.files;
//TODO: add Your files: with file uploading in it
// $("#dropContainer").text(selectedFiles.length + " file(s) selected for uploading!");
}
</script>

+ 92
- 0
SecureSharing/obj/project.assets.json View File

"lib/netstandard1.0/_._": {} "lib/netstandard1.0/_._": {}
} }
}, },
"Microsoft.VisualStudio.Azure.Containers.Tools.Targets/1.15.1": {
"type": "package",
"build": {
"build/Microsoft.VisualStudio.Azure.Containers.Tools.Targets.props": {},
"build/Microsoft.VisualStudio.Azure.Containers.Tools.Targets.targets": {}
}
},
"Microsoft.VisualStudio.Debugger.Contracts/17.2.0": { "Microsoft.VisualStudio.Debugger.Contracts/17.2.0": {
"type": "package", "type": "package",
"dependencies": { "dependencies": {
"runtime.json" "runtime.json"
] ]
}, },
"Microsoft.VisualStudio.Azure.Containers.Tools.Targets/1.15.1": {
"sha512": "dcsF7rjxvMnqtfckpzWYvBsZsJD51yQVHSSgd2EN5/CJ/zQigJrfo313lvAwf0VL9ZOHLnJthuboadjnBAU7Ng==",
"type": "package",
"path": "microsoft.visualstudio.azure.containers.tools.targets/1.15.1",
"hasTools": true,
"files": [
".nupkg.metadata",
".signature.p7s",
"EULA.md",
"ThirdPartyNotices.txt",
"build/Container.props",
"build/Container.targets",
"build/Microsoft.VisualStudio.Azure.Containers.Tools.Targets.props",
"build/Microsoft.VisualStudio.Azure.Containers.Tools.Targets.targets",
"build/Rules/GeneralBrowseObject.xaml",
"build/Rules/cs-CZ/GeneralBrowseObject.xaml",
"build/Rules/de-DE/GeneralBrowseObject.xaml",
"build/Rules/es-ES/GeneralBrowseObject.xaml",
"build/Rules/fr-FR/GeneralBrowseObject.xaml",
"build/Rules/it-IT/GeneralBrowseObject.xaml",
"build/Rules/ja-JP/GeneralBrowseObject.xaml",
"build/Rules/ko-KR/GeneralBrowseObject.xaml",
"build/Rules/pl-PL/GeneralBrowseObject.xaml",
"build/Rules/pt-BR/GeneralBrowseObject.xaml",
"build/Rules/ru-RU/GeneralBrowseObject.xaml",
"build/Rules/tr-TR/GeneralBrowseObject.xaml",
"build/Rules/zh-CN/GeneralBrowseObject.xaml",
"build/Rules/zh-TW/GeneralBrowseObject.xaml",
"build/ToolsTarget.props",
"build/ToolsTarget.targets",
"icon.png",
"microsoft.visualstudio.azure.containers.tools.targets.1.15.1.nupkg.sha512",
"microsoft.visualstudio.azure.containers.tools.targets.nuspec",
"tools/Microsoft.VisualStudio.Containers.Tools.Common.dll",
"tools/Microsoft.VisualStudio.Containers.Tools.Shared.dll",
"tools/Microsoft.VisualStudio.Containers.Tools.Tasks.dll",
"tools/Newtonsoft.Json.dll",
"tools/System.Security.Principal.Windows.dll",
"tools/cs/Microsoft.VisualStudio.Containers.Tools.Common.resources.dll",
"tools/cs/Microsoft.VisualStudio.Containers.Tools.Shared.resources.dll",
"tools/cs/Microsoft.VisualStudio.Containers.Tools.Tasks.resources.dll",
"tools/de/Microsoft.VisualStudio.Containers.Tools.Common.resources.dll",
"tools/de/Microsoft.VisualStudio.Containers.Tools.Shared.resources.dll",
"tools/de/Microsoft.VisualStudio.Containers.Tools.Tasks.resources.dll",
"tools/es/Microsoft.VisualStudio.Containers.Tools.Common.resources.dll",
"tools/es/Microsoft.VisualStudio.Containers.Tools.Shared.resources.dll",
"tools/es/Microsoft.VisualStudio.Containers.Tools.Tasks.resources.dll",
"tools/fr/Microsoft.VisualStudio.Containers.Tools.Common.resources.dll",
"tools/fr/Microsoft.VisualStudio.Containers.Tools.Shared.resources.dll",
"tools/fr/Microsoft.VisualStudio.Containers.Tools.Tasks.resources.dll",
"tools/it/Microsoft.VisualStudio.Containers.Tools.Common.resources.dll",
"tools/it/Microsoft.VisualStudio.Containers.Tools.Shared.resources.dll",
"tools/it/Microsoft.VisualStudio.Containers.Tools.Tasks.resources.dll",
"tools/ja/Microsoft.VisualStudio.Containers.Tools.Common.resources.dll",
"tools/ja/Microsoft.VisualStudio.Containers.Tools.Shared.resources.dll",
"tools/ja/Microsoft.VisualStudio.Containers.Tools.Tasks.resources.dll",
"tools/ko/Microsoft.VisualStudio.Containers.Tools.Common.resources.dll",
"tools/ko/Microsoft.VisualStudio.Containers.Tools.Shared.resources.dll",
"tools/ko/Microsoft.VisualStudio.Containers.Tools.Tasks.resources.dll",
"tools/pl/Microsoft.VisualStudio.Containers.Tools.Common.resources.dll",
"tools/pl/Microsoft.VisualStudio.Containers.Tools.Shared.resources.dll",
"tools/pl/Microsoft.VisualStudio.Containers.Tools.Tasks.resources.dll",
"tools/pt-BR/Microsoft.VisualStudio.Containers.Tools.Common.resources.dll",
"tools/pt-BR/Microsoft.VisualStudio.Containers.Tools.Shared.resources.dll",
"tools/pt-BR/Microsoft.VisualStudio.Containers.Tools.Tasks.resources.dll",
"tools/ru/Microsoft.VisualStudio.Containers.Tools.Common.resources.dll",
"tools/ru/Microsoft.VisualStudio.Containers.Tools.Shared.resources.dll",
"tools/ru/Microsoft.VisualStudio.Containers.Tools.Tasks.resources.dll",
"tools/tr/Microsoft.VisualStudio.Containers.Tools.Common.resources.dll",
"tools/tr/Microsoft.VisualStudio.Containers.Tools.Shared.resources.dll",
"tools/tr/Microsoft.VisualStudio.Containers.Tools.Tasks.resources.dll",
"tools/utils/KillProcess.exe",
"tools/zh-Hans/Microsoft.VisualStudio.Containers.Tools.Common.resources.dll",
"tools/zh-Hans/Microsoft.VisualStudio.Containers.Tools.Shared.resources.dll",
"tools/zh-Hans/Microsoft.VisualStudio.Containers.Tools.Tasks.resources.dll",
"tools/zh-Hant/Microsoft.VisualStudio.Containers.Tools.Common.resources.dll",
"tools/zh-Hant/Microsoft.VisualStudio.Containers.Tools.Shared.resources.dll",
"tools/zh-Hant/Microsoft.VisualStudio.Containers.Tools.Tasks.resources.dll"
]
},
"Microsoft.VisualStudio.Debugger.Contracts/17.2.0": { "Microsoft.VisualStudio.Debugger.Contracts/17.2.0": {
"sha512": "br/qV/aHqLqVlqtcMKglCC8MHMMLey0yMkKSplnMl58F5gKjwnh7wjs8+g0j/vf4T6h4KK7JWrC0+oN70pbugg==", "sha512": "br/qV/aHqLqVlqtcMKglCC8MHMMLey0yMkKSplnMl58F5gKjwnh7wjs8+g0j/vf4T6h4KK7JWrC0+oN70pbugg==",
"type": "package", "type": "package",
"Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation >= 6.0.9", "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation >= 6.0.9",
"Microsoft.EntityFrameworkCore.SqlServer >= 6.0.9", "Microsoft.EntityFrameworkCore.SqlServer >= 6.0.9",
"Microsoft.EntityFrameworkCore.Tools >= 6.0.9", "Microsoft.EntityFrameworkCore.Tools >= 6.0.9",
"Microsoft.VisualStudio.Azure.Containers.Tools.Targets >= 1.15.1",
"Microsoft.VisualStudio.Web.CodeGeneration.Design >= 6.0.9", "Microsoft.VisualStudio.Web.CodeGeneration.Design >= 6.0.9",
"Quartz >= 3.5.0", "Quartz >= 3.5.0",
"SecureSharing.Business >= 1.0.0", "SecureSharing.Business >= 1.0.0",
"target": "Package", "target": "Package",
"version": "[6.0.9, )" "version": "[6.0.9, )"
}, },
"Microsoft.VisualStudio.Azure.Containers.Tools.Targets": {
"target": "Package",
"version": "[1.15.1, )"
},
"Microsoft.VisualStudio.Web.CodeGeneration.Design": { "Microsoft.VisualStudio.Web.CodeGeneration.Design": {
"target": "Package", "target": "Package",
"version": "[6.0.9, )" "version": "[6.0.9, )"

+ 2
- 1
SecureSharing/obj/project.nuget.cache View File

{ {
"version": 2, "version": 2,
"dgSpecHash": "Sm0OUd2oFeRQfP2x9Hc316VrFwOciAM1sd50sI0THzjwNojg57Kg5f6UuNyby8YR0g6WtFdJlVtr9+uxdyhJBw==",
"dgSpecHash": "9QUwszTqNNxFZcVJwVvY+ZUMfocSvw5Ug0yfKxrmDDdzmgroNhiiJgSgvrdMzFKBo6PD4sBuZ2u+92+auWnx6g==",
"success": true, "success": true,
"projectFilePath": "D:\\secure-sharing\\SecureSharing\\SecureSharing.csproj", "projectFilePath": "D:\\secure-sharing\\SecureSharing\\SecureSharing.csproj",
"expectedPackageFiles": [ "expectedPackageFiles": [
"C:\\Users\\radivoje.milutinovic\\.nuget\\packages\\microsoft.net.stringtools\\1.0.0\\microsoft.net.stringtools.1.0.0.nupkg.sha512", "C:\\Users\\radivoje.milutinovic\\.nuget\\packages\\microsoft.net.stringtools\\1.0.0\\microsoft.net.stringtools.1.0.0.nupkg.sha512",
"C:\\Users\\radivoje.milutinovic\\.nuget\\packages\\microsoft.netcore.platforms\\3.1.0\\microsoft.netcore.platforms.3.1.0.nupkg.sha512", "C:\\Users\\radivoje.milutinovic\\.nuget\\packages\\microsoft.netcore.platforms\\3.1.0\\microsoft.netcore.platforms.3.1.0.nupkg.sha512",
"C:\\Users\\radivoje.milutinovic\\.nuget\\packages\\microsoft.netcore.targets\\1.1.3\\microsoft.netcore.targets.1.1.3.nupkg.sha512", "C:\\Users\\radivoje.milutinovic\\.nuget\\packages\\microsoft.netcore.targets\\1.1.3\\microsoft.netcore.targets.1.1.3.nupkg.sha512",
"C:\\Users\\radivoje.milutinovic\\.nuget\\packages\\microsoft.visualstudio.azure.containers.tools.targets\\1.15.1\\microsoft.visualstudio.azure.containers.tools.targets.1.15.1.nupkg.sha512",
"C:\\Users\\radivoje.milutinovic\\.nuget\\packages\\microsoft.visualstudio.debugger.contracts\\17.2.0\\microsoft.visualstudio.debugger.contracts.17.2.0.nupkg.sha512", "C:\\Users\\radivoje.milutinovic\\.nuget\\packages\\microsoft.visualstudio.debugger.contracts\\17.2.0\\microsoft.visualstudio.debugger.contracts.17.2.0.nupkg.sha512",
"C:\\Users\\radivoje.milutinovic\\.nuget\\packages\\microsoft.visualstudio.web.codegeneration\\6.0.9\\microsoft.visualstudio.web.codegeneration.6.0.9.nupkg.sha512", "C:\\Users\\radivoje.milutinovic\\.nuget\\packages\\microsoft.visualstudio.web.codegeneration\\6.0.9\\microsoft.visualstudio.web.codegeneration.6.0.9.nupkg.sha512",
"C:\\Users\\radivoje.milutinovic\\.nuget\\packages\\microsoft.visualstudio.web.codegeneration.core\\6.0.9\\microsoft.visualstudio.web.codegeneration.core.6.0.9.nupkg.sha512", "C:\\Users\\radivoje.milutinovic\\.nuget\\packages\\microsoft.visualstudio.web.codegeneration.core\\6.0.9\\microsoft.visualstudio.web.codegeneration.core.6.0.9.nupkg.sha512",

+ 16
- 0
SecureSharing/wwwroot/css/site.css View File

border-radius: 10px; border-radius: 10px;
color: #0D1C52; color: #0D1C52;
margin-bottom: 15px; margin-bottom: 15px;
}

.browse-button {
color: dodgerblue;
margin-bottom: 3px;
margin-left: 0px;
}
.image-file-upload {
position: center;
margin-top: 12px;
margin-bottom: 3px;
padding: 0 !important;
}
.text-files-upload {
margin-top: 2px;
margin-right: 0;
} }

Loading…
Cancel
Save