Merge branch 'master' into dev/multiple-notes
This commit is contained in:
commit
d73e065805
3
.vscode/launch.json
vendored
3
.vscode/launch.json
vendored
@ -24,7 +24,8 @@
|
|||||||
},
|
},
|
||||||
"sourceFileMap": {
|
"sourceFileMap": {
|
||||||
"/Views": "${workspaceFolder}/Views"
|
"/Views": "${workspaceFolder}/Views"
|
||||||
}
|
},
|
||||||
|
"checkForDevCert": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": ".NET Core Attach",
|
"name": ".NET Core Attach",
|
||||||
|
17
Controllers/ApiController.cs
Normal file
17
Controllers/ApiController.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using BinaryDad.Notes.Services;
|
||||||
|
|
||||||
|
namespace BinaryDad.Notes.Controllers
|
||||||
|
{
|
||||||
|
public class ApiController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly INoteService noteService;
|
||||||
|
|
||||||
|
public ApiController(INoteService noteService)
|
||||||
|
{
|
||||||
|
this.noteService = noteService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Note() => noteService.Get();
|
||||||
|
}
|
||||||
|
}
|
23
Dockerfile
23
Dockerfile
@ -1,22 +1,13 @@
|
|||||||
#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/sdk:7.0 AS build
|
||||||
|
WORKDIR /src
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN dotnet publish "BinaryDad.Notes.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
|
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
COPY --from=build /app/publish .
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
EXPOSE 443
|
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
|
|
||||||
WORKDIR /src
|
|
||||||
COPY ["BinaryDad.Notes.csproj", "."]
|
|
||||||
RUN dotnet restore "./BinaryDad.Notes.csproj"
|
|
||||||
COPY . .
|
|
||||||
WORKDIR "/src/."
|
|
||||||
RUN dotnet build "BinaryDad.Notes.csproj" -c Release -o /app/build
|
|
||||||
|
|
||||||
FROM build AS publish
|
|
||||||
RUN dotnet publish "BinaryDad.Notes.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
|
||||||
|
|
||||||
FROM base AS final
|
|
||||||
WORKDIR /app
|
|
||||||
COPY --from=publish /app/publish .
|
|
||||||
ENTRYPOINT ["dotnet", "BinaryDad.Notes.dll"]
|
ENTRYPOINT ["dotnet", "BinaryDad.Notes.dll"]
|
@ -9,14 +9,11 @@ builder.Services.AddControllersWithViews();
|
|||||||
builder.Services.AddSignalR();
|
builder.Services.AddSignalR();
|
||||||
builder.Services.AddSingleton<INoteService, FileNoteService>();
|
builder.Services.AddSingleton<INoteService, FileNoteService>();
|
||||||
|
|
||||||
builder.Services.AddSession(options =>
|
|
||||||
{
|
|
||||||
options.IdleTimeout = TimeSpan.FromMinutes(30);
|
|
||||||
});
|
|
||||||
|
|
||||||
builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(o =>
|
builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(o =>
|
||||||
{
|
{
|
||||||
o.LoginPath = "/login";
|
o.LoginPath = "/login";
|
||||||
|
o.Cookie.Name = "NotesUser";
|
||||||
|
o.Cookie.MaxAge = TimeSpan.FromDays(3);
|
||||||
});
|
});
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
@{
|
@Html.ValidationSummary()
|
||||||
ViewBag.Title = "Login";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Html.ValidationSummary()
|
|
||||||
|
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<input type="password" name="passphrase" placeholder="Passphrase" />
|
<input type="password" name="passphrase" placeholder="Passphrase" />
|
||||||
|
@ -57,7 +57,7 @@ textarea {
|
|||||||
border-width: 0;
|
border-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark textarea {
|
body.dark, body.dark input, body.dark textarea {
|
||||||
background-color: #222;
|
background-color: #222;
|
||||||
color: #ddd;
|
color: #ddd;
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,15 @@ $(function () {
|
|||||||
showToast('#update-indicator');
|
showToast('#update-indicator');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// update content after reconnected
|
||||||
|
connection.onreconnected(function() {
|
||||||
|
$.get('api/note', function(content) {
|
||||||
|
$textarea.val(content);
|
||||||
|
showToast('#update-indicator');
|
||||||
|
console.log('Refreshed after disconnect');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// set dark mode
|
// set dark mode
|
||||||
if (window.location.hash == '#dark') {
|
if (window.location.hash == '#dark') {
|
||||||
$('body').addClass('dark');
|
$('body').addClass('dark');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user