| @@ -0,0 +1,25 @@ | |||
| **/.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 | |||
| @@ -0,0 +1,24 @@ | |||
| #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"] | |||
| @@ -1,10 +1,12 @@ | |||
| namespace SecureSharing.Business.Dtos; | |||
| using SecureSharing.Data.Data; | |||
| namespace SecureSharing.Business.Dtos; | |||
| public sealed class MessageDto : BaseDto | |||
| { | |||
| public string Text { get; set; } | |||
| public bool IsValid { get; set; } = true; | |||
| public Guid Code { get; set; } = Guid.NewGuid(); | |||
| public string FileName { get; set; } | |||
| public List<FileModel> FileNames { get; set; } = new(); | |||
| public DateTime? ExpiryDate { get; set; } | |||
| } | |||
| @@ -10,4 +10,5 @@ public sealed class MapperProfile : Profile | |||
| { | |||
| CreateMap<Message, MessageDto>().ReverseMap(); | |||
| } | |||
| } | |||
| @@ -0,0 +1,7 @@ | |||
| namespace SecureSharing.Data.Data; | |||
| public class FileModel | |||
| { | |||
| public int Id { get; set; } | |||
| public string Name { get; set; } | |||
| } | |||
| @@ -4,7 +4,7 @@ public sealed class Message : BaseEntity | |||
| { | |||
| public string Text { get; set; } | |||
| public string Code { get; set; } | |||
| public string FileName { get; set; } | |||
| public List<FileModel> FileNames { get; set; } | |||
| public bool IsValid { get; set; } | |||
| public DateTime? ExpiryDate { get; set; } | |||
| } | |||
| @@ -0,0 +1,340 @@ | |||
| // <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 | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,32 @@ | |||
| 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"); | |||
| } | |||
| } | |||
| } | |||
| @@ -224,6 +224,27 @@ namespace SecureSharing.Data.Migrations | |||
| 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") | |||
| @@ -238,9 +259,6 @@ namespace SecureSharing.Data.Migrations | |||
| b.Property<DateTime?>("ExpiryDate") | |||
| .HasColumnType("datetime2"); | |||
| b.Property<string>("FileName") | |||
| .HasColumnType("nvarchar(max)"); | |||
| b.Property<bool>("IsValid") | |||
| .HasColumnType("bit"); | |||
| @@ -302,6 +320,18 @@ namespace SecureSharing.Data.Migrations | |||
| .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 | |||
| } | |||
| } | |||
| @@ -8,17 +8,17 @@ | |||
| </PropertyGroup> | |||
| <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"> | |||
| <PrivateAssets>all</PrivateAssets> | |||
| <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | |||
| </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> | |||
| </Project> | |||
| @@ -2,6 +2,7 @@ | |||
| using Microsoft.AspNetCore.Mvc; | |||
| using SecureSharing.Business.Dtos; | |||
| using SecureSharing.Business.Interfaces; | |||
| using SecureSharing.Data.Data; | |||
| using SecureSharing.Infrastructure; | |||
| using SecureSharing.Models; | |||
| @@ -13,13 +14,15 @@ public sealed class HomeController : Controller | |||
| private readonly ILogger<HomeController> _logger; | |||
| private readonly IMessageService _messageService; | |||
| 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; | |||
| _messageService = messageService; | |||
| _modelFactory = modelFactory; | |||
| _webHostEnvironment = webHostEnvironment; | |||
| } | |||
| public IActionResult Index() | |||
| @@ -32,6 +35,23 @@ public sealed class HomeController : Controller | |||
| public async Task<IActionResult> CreateMessage(MessageModel model) | |||
| { | |||
| 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); | |||
| return RedirectToAction("Link", "Home", new { code = code, share = true }); | |||
| } | |||
| @@ -8,6 +8,7 @@ public sealed class MessageModel | |||
| public string Text { get; set; } | |||
| public Guid Code { get; set; } | |||
| public PeriodOfValidity ChosenPeriod { get; set; } | |||
| public List<IFormFile> Files { get; init; } = new(); | |||
| // public Dictionary<int, string> AvailablePeriods { get; set; } | |||
| } | |||
| @@ -1,4 +1,4 @@ | |||
| { | |||
| { | |||
| "iisSettings": { | |||
| "windowsAuthentication": false, | |||
| "anonymousAuthentication": true, | |||
| @@ -18,13 +18,20 @@ | |||
| }, | |||
| "SecureSharing": { | |||
| "commandName": "Project", | |||
| "dotnetRunMessages": "true", | |||
| "launchBrowser": true, | |||
| "applicationUrl": "https://localhost:44336;http://localhost:5000", | |||
| "environmentVariables": { | |||
| "ASPNETCORE_ENVIRONMENT": "Development", | |||
| "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 | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -6,6 +6,8 @@ | |||
| <Nullable>disable</Nullable> | |||
| <CopyRefAssembliesToPublishDirectory>false</CopyRefAssembliesToPublishDirectory> | |||
| <RootNamespace>SecureSharing</RootNamespace> | |||
| <UserSecretsId>7f4608f1-6c17-4907-960a-3aee94c83a31</UserSecretsId> | |||
| <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> | |||
| </PropertyGroup> | |||
| <ItemGroup> | |||
| @@ -20,6 +22,7 @@ | |||
| <PrivateAssets>all</PrivateAssets> | |||
| <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | |||
| </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="Quartz" Version="3.5.0" /> | |||
| <PackageReference Include="Serilog" Version="2.12.0" /> | |||
| @@ -33,6 +36,7 @@ | |||
| <ItemGroup> | |||
| <Folder Include="AppData\Errors\" /> | |||
| <Folder Include="wwwroot\files" /> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| @@ -2,11 +2,12 @@ | |||
| Layout = "~/Views/Shared/_Layout.cshtml"; | |||
| } | |||
| @using SecureSharing.Business.Infrastructure | |||
| @using System.Text.Json | |||
| @model MessageModel | |||
| <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> | |||
| <div class="button-box col-lg-12"> | |||
| <div class="single-button-input"> | |||
| @@ -26,17 +27,57 @@ | |||
| <label class="label-text">Message (optional)</label> | |||
| <textarea asp-for="Text" class="input-message"></textarea> | |||
| <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 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> | |||
| </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> | |||
| @@ -1797,6 +1797,13 @@ | |||
| "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": { | |||
| "type": "package", | |||
| "dependencies": { | |||
| @@ -6216,6 +6223,86 @@ | |||
| "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": { | |||
| "sha512": "br/qV/aHqLqVlqtcMKglCC8MHMMLey0yMkKSplnMl58F5gKjwnh7wjs8+g0j/vf4T6h4KK7JWrC0+oN70pbugg==", | |||
| "type": "package", | |||
| @@ -11396,6 +11483,7 @@ | |||
| "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation >= 6.0.9", | |||
| "Microsoft.EntityFrameworkCore.SqlServer >= 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", | |||
| "Quartz >= 3.5.0", | |||
| "SecureSharing.Business >= 1.0.0", | |||
| @@ -11484,6 +11572,10 @@ | |||
| "target": "Package", | |||
| "version": "[6.0.9, )" | |||
| }, | |||
| "Microsoft.VisualStudio.Azure.Containers.Tools.Targets": { | |||
| "target": "Package", | |||
| "version": "[1.15.1, )" | |||
| }, | |||
| "Microsoft.VisualStudio.Web.CodeGeneration.Design": { | |||
| "target": "Package", | |||
| "version": "[6.0.9, )" | |||
| @@ -1,6 +1,6 @@ | |||
| { | |||
| "version": 2, | |||
| "dgSpecHash": "Sm0OUd2oFeRQfP2x9Hc316VrFwOciAM1sd50sI0THzjwNojg57Kg5f6UuNyby8YR0g6WtFdJlVtr9+uxdyhJBw==", | |||
| "dgSpecHash": "9QUwszTqNNxFZcVJwVvY+ZUMfocSvw5Ug0yfKxrmDDdzmgroNhiiJgSgvrdMzFKBo6PD4sBuZ2u+92+auWnx6g==", | |||
| "success": true, | |||
| "projectFilePath": "D:\\secure-sharing\\SecureSharing\\SecureSharing.csproj", | |||
| "expectedPackageFiles": [ | |||
| @@ -80,6 +80,7 @@ | |||
| "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.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.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", | |||
| @@ -241,4 +241,20 @@ body{ | |||
| border-radius: 10px; | |||
| color: #0D1C52; | |||
| 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; | |||
| } | |||