diff --git a/Areas/MyFeature/Pages/Page1.cshtml b/Areas/MyFeature/Pages/Page1.cshtml
deleted file mode 100644
index 25e0304..0000000
--- a/Areas/MyFeature/Pages/Page1.cshtml
+++ /dev/null
@@ -1,13 +0,0 @@
-@page
-@model yawaflua.ru.MyFeature.Pages.Page1Model
-
-
-
-
-
-
- Page1
-
-
-
-
diff --git a/Areas/MyFeature/Pages/Page1.cshtml.cs b/Areas/MyFeature/Pages/Page1.cshtml.cs
deleted file mode 100644
index 476d05b..0000000
--- a/Areas/MyFeature/Pages/Page1.cshtml.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Mvc.RazorPages;
-
-namespace yawaflua.ru.MyFeature.Pages
-{
- public class Page1Model : PageModel
- {
- public void OnGet()
- {
-
- }
- }
-}
\ No newline at end of file
diff --git a/Controllers/RedirectController.cs b/Controllers/RedirectController.cs
index c9193be..65584d3 100644
--- a/Controllers/RedirectController.cs
+++ b/Controllers/RedirectController.cs
@@ -20,14 +20,13 @@ namespace yawaflua.ru.Controllers
this.cache = cache;
}
[HttpGet("{uri}")]
- public async Task FromGitHub(string uri)
+ public async Task FromGitHub(string uri, [FromQuery(Name = "to")] string? to, [FromQuery(Name = "debug")] string debug = "false")
{
- Console.WriteLine(uri);
Redirects redirects;
- if (!cache.TryGetValue($"redirectsWithUrl-{uri}", out redirects) || ctx.Redirects.TryGetValue(k => k.uri == uri, out redirects))
- cache.Set($"redirectsWithUrl-{uri}", redirects, DateTime.Now.AddMinutes(10));
+ if (!cache.TryGetValue($"redirectsWithUrl-{uri}", out redirects) || ctx.Redirects.TryGetValue(k => k.uri == uri, out redirects) )
+ cache.Set($"redirectsWithUrl-{uri}", redirects, DateTime.Now.AddMinutes(20));
- return Redirect(redirects?.redirectTo ?? "/404");
+ return Redirect(redirects?.redirectTo + to?.Replace("%", "/") ?? "/404");
}
}
diff --git a/Dockerfile b/Dockerfile
index fba78db..2fbb145 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,31 +1,33 @@
-FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
+# ASP.NET Core SDK
+FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
+
+#
WORKDIR /app
+
+#
+COPY . ./
+RUN dotnet restore "api.yawaflua.ru.csproj"
+
+#
+RUN dotnet publish -c Release -o /app/out "api.yawaflua.ru.csproj"
+
+
+# , ASP.NET Core runtime
+FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
+WORKDIR /app
+COPY --from=build /app/out ./
+# ,
EXPOSE 80
-EXPOSE 443
+#
+ENV CLIENTID=123
+ENV CLIENTSECRET=aAbB
+ENV REDIRECTURL=http://example.org/
+ENV PSQL_HOST=localhost
+ENV PSQL_USER=root
+ENV PSQL_PASSWORD=root
+ENV PSQL_DATABASE=database
+ENV OWNERID=1111111
+ENV READMEFILE=https://raw.githubusercontent.com/yawaflua/yawaflua/main/README.md
-FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
-
-
-WORKDIR /src
-COPY ["yaflay.ru.csproj", "."]
-RUN dotnet restore "./yaflay.ru.csproj"
-COPY . .
-WORKDIR "/src/."
-RUN dotnet build "yaflay.ru.csproj" -c Release -o /app/build
-
-FROM build AS publish
-ENV CLIENTID 123
-ENV CLIENTSECRET aAbB
-ENV REDIRECTURL http://example.org/
-ENV PSQL_HOST localhost
-ENV PSQL_USER root
-ENV PSQL_PASSWORD root
-ENV PSQL_DATABASE database
-ENV OWNERID 1111111
-ENV READMEFILE https://raw.githubusercontent.com/yawaflua/yawaflua/main/README.md
-RUN dotnet publish "yaflay.ru.csproj" -c Release -o /app/publish /p:UseAppHost=false
-
-FROM base AS final
-WORKDIR /app
-COPY --from=publish /app/publish .
-ENTRYPOINT ["dotnet", "yaflay.ru.dll"]
\ No newline at end of file
+# ASP.NET Core
+ENTRYPOINT ["dotnet", "api.yawaflua.ru.dll"]
diff --git a/Pages/Authorize.cshtml b/Pages/Authorize.cshtml
index b9b9bcc..cc22814 100644
--- a/Pages/Authorize.cshtml
+++ b/Pages/Authorize.cshtml
@@ -53,7 +53,7 @@
message = await Startup.client.SendAsync(requestMessage);
}
string responseBody = await message.Content.ReadAsStringAsync();
- JsonNode body = JsonNode.Parse(responseBody);
+ JsonNode? body = JsonNode.Parse(responseBody);
if (body["access_token"]?.ToString() == null)
{
Ошибка! Попробуй авторизоваться заново
diff --git a/Pages/rrobotsTxt.cshtml b/Pages/rrobotsTxt.cshtml
deleted file mode 100644
index 263d25e..0000000
--- a/Pages/rrobotsTxt.cshtml
+++ /dev/null
@@ -1,12 +0,0 @@
-@page
-@{
- Layout = null;
- this.Response.ContentType = "text/plain";
-}
-User-agent: *
-Disallow: /*
-Disallow: /*
-Allow: /Blog
-Allow: /Blog/*
-Allow: /Privacy
-Allow: /
\ No newline at end of file
diff --git a/Program.cs b/Program.cs
index 7eccd3b..d7fbad2 100644
--- a/Program.cs
+++ b/Program.cs
@@ -22,8 +22,7 @@ public class Program
}
public static class StaticProgram
{
- public static bool isNull(this object? value)
- {
- return value == null;
- }
+ public static bool isNull(this object? value) =>
+ value == null;
+
}
\ No newline at end of file
diff --git a/Properties/launchSettings.json b/Properties/launchSettings.json
index 58d7044..332116a 100644
--- a/Properties/launchSettings.json
+++ b/Properties/launchSettings.json
@@ -20,6 +20,17 @@
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.SpaProxy"
}
},
+ "Docker": {
+ "commandName": "Docker",
+ "dotnetRunMessages": true,
+ "launchBrowser": true,
+ "launchUrl": ".",
+ "applicationUrl": "http://localhost:5144",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development",
+ "ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.SpaProxy"
+ }
+ },
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
diff --git a/Startup.cs b/Startup.cs
index 9ba3bfc..5492098 100644
--- a/Startup.cs
+++ b/Startup.cs
@@ -47,7 +47,7 @@ namespace yawaflua.ru
services.AddControllers()
.AddRazorPagesOptions(options =>
{
- options.Conventions.AddPageRoute("/RobotsTxt", "/Robots.txt");
+
options.Conventions.AddPageRoute("/RobotsTxt", "/robots.txt");
options.Conventions.AddPageRoute("/NotFound", "/404");
options.Conventions.AddPageRoute("/IternalErrorPage", "/500");
@@ -83,8 +83,7 @@ namespace yawaflua.ru
services.AddMvc()
.AddRazorPagesOptions(options =>
{
- options.Conventions.AddPageRoute("/RobotsTxt", "/Robots.txt");
- options.Conventions.AddPageRoute("/rrobotsTxt", "/robots.txt");
+ options.Conventions.AddPageRoute("/RobotsTxt", "/robots.txt");
options.Conventions.AddPageRoute("/NotFound", "/404");
options.Conventions.AddPageRoute("/IternalErrorPage", "/500");
options.Conventions.AddPageRoute("/Authorize", "/authorize");
@@ -106,6 +105,7 @@ namespace yawaflua.ru
{
app.UseDeveloperExceptionPage();
app.UseHsts();
+ app.UseSpa(x => x.UseProxyToSpaDevelopmentServer("http://localhost:8080"));
}
// Configure the HTTP request pipeline.
diff --git a/api.yawaflua.ru.csproj b/api.yawaflua.ru.csproj
index efdbc0d..8461100 100644
--- a/api.yawaflua.ru.csproj
+++ b/api.yawaflua.ru.csproj
@@ -1,4 +1,4 @@
-
+
net8.0
@@ -10,15 +10,16 @@
true
yawaflua
yawaflua
- npm run serve -- --host 0.0.0.0 --port 8080
- http://localhost:8080
- ..\frontend.yawaflua.ru
+
+
8.*-*
+
+
@@ -26,6 +27,7 @@
false
+
diff --git a/libman.json b/libman.json
new file mode 100644
index 0000000..ceee271
--- /dev/null
+++ b/libman.json
@@ -0,0 +1,5 @@
+{
+ "version": "1.0",
+ "defaultProvider": "cdnjs",
+ "libraries": []
+}
\ No newline at end of file
diff --git a/wwwroot/favicon.ico b/wwwroot/favicon.ico
deleted file mode 100644
index 6270ab1..0000000
Binary files a/wwwroot/favicon.ico and /dev/null differ