diff --git a/Migrations.cs b/Backend/Migrations.cs similarity index 93% rename from Migrations.cs rename to Backend/Migrations.cs index 13405c1..46a78f2 100644 --- a/Migrations.cs +++ b/Backend/Migrations.cs @@ -1,13 +1,15 @@ using LinqToDB; using LinqToDB.Data; -using zotanpw_web.database; -using zotanpw_web.database.Tables; +using zotanpw.Backend.database; +using zotanpw.Backend.database.Tables; -namespace zotanpw_web; +namespace zotanpw.Backend; public static class Migrations { private const int DbVer = 1; + // ReSharper disable once CollectionNeverUpdated.Local + // ReSharper disable once InconsistentNaming private static readonly List _migrations = new(); public static void RunMigrations() { @@ -87,4 +89,4 @@ public static class Migrations { db.Execute(_sql); } } -} \ No newline at end of file +} diff --git a/Program.cs b/Backend/Startup.cs similarity index 79% rename from Program.cs rename to Backend/Startup.cs index 5caa607..fc06b00 100644 --- a/Program.cs +++ b/Backend/Startup.cs @@ -1,14 +1,13 @@ using LinqToDB.Data; using Microsoft.AspNetCore.StaticFiles; -using zotanpw_web; -using zotanpw_web.database; +using zotanpw.Backend; +using zotanpw.Backend.database; DataConnection.DefaultSettings = new Database.Settings(); Migrations.RunMigrations(); var builder = WebApplication.CreateBuilder(args); -// Add services to the container. builder.Services.AddRazorPages(); builder.Services.AddSession(options => { options.IdleTimeout = TimeSpan.MaxValue; @@ -25,10 +24,8 @@ builder.Services.AddControllers(); var app = builder.Build(); -// Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) { app.UseExceptionHandler("/error"); - // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } diff --git a/Utils.cs b/Backend/Utils.cs similarity index 95% rename from Utils.cs rename to Backend/Utils.cs index f06f414..e1beea2 100644 --- a/Utils.cs +++ b/Backend/Utils.cs @@ -1,6 +1,6 @@ using System.Reflection; -namespace zotanpw_web; +namespace zotanpw.Backend; public static class Utils { public static readonly string Version = diff --git a/database/Database.cs b/Backend/database/Database.cs similarity index 94% rename from database/Database.cs rename to Backend/database/Database.cs index 08a1666..bf0c77e 100644 --- a/database/Database.cs +++ b/Backend/database/Database.cs @@ -1,9 +1,9 @@ using LinqToDB; using LinqToDB.Configuration; using LinqToDB.Data; -using zotanpw_web.database.Tables; +using zotanpw.Backend.database.Tables; -namespace zotanpw_web.database; +namespace zotanpw.Backend.database; public class Database { private class ConnectionStringSettings : IConnectionStringSettings { diff --git a/database/Tables/AlbumHistory.cs b/Backend/database/Tables/AlbumHistory.cs similarity index 94% rename from database/Tables/AlbumHistory.cs rename to Backend/database/Tables/AlbumHistory.cs index 703635a..587f2e2 100644 --- a/database/Tables/AlbumHistory.cs +++ b/Backend/database/Tables/AlbumHistory.cs @@ -2,7 +2,7 @@ using LinqToDB.Mapping; #pragma warning disable CS8618 -namespace zotanpw_web.database.Tables; +namespace zotanpw.Backend.database.Tables; [Table(Name = "AlbumHistory")] public class AlbumHistoryEntry { diff --git a/database/Tables/DbInfo.cs b/Backend/database/Tables/DbInfo.cs similarity index 85% rename from database/Tables/DbInfo.cs rename to Backend/database/Tables/DbInfo.cs index 86eff1f..4b7d1d5 100644 --- a/database/Tables/DbInfo.cs +++ b/Backend/database/Tables/DbInfo.cs @@ -1,6 +1,6 @@ using LinqToDB.Mapping; -namespace zotanpw_web.database.Tables; +namespace zotanpw.Backend.database.Tables; [Table(Name = "DbInfo")] public class DbInfo { diff --git a/database/Tables/PlaylistHistory.cs b/Backend/database/Tables/PlaylistHistory.cs similarity index 94% rename from database/Tables/PlaylistHistory.cs rename to Backend/database/Tables/PlaylistHistory.cs index 449219b..5fa54b2 100644 --- a/database/Tables/PlaylistHistory.cs +++ b/Backend/database/Tables/PlaylistHistory.cs @@ -2,7 +2,7 @@ using LinqToDB.Mapping; #pragma warning disable CS8618 -namespace zotanpw_web.database.Tables; +namespace zotanpw.Backend.database.Tables; [Table(Name = "PlaylistHistory")] public class PlaylistHistoryEntry { diff --git a/database/Tables/TravelynxInfo.cs b/Backend/database/Tables/TravelynxInfo.cs similarity index 91% rename from database/Tables/TravelynxInfo.cs rename to Backend/database/Tables/TravelynxInfo.cs index 24c2a57..128f7c6 100644 --- a/database/Tables/TravelynxInfo.cs +++ b/Backend/database/Tables/TravelynxInfo.cs @@ -1,6 +1,6 @@ using LinqToDB.Mapping; -namespace zotanpw_web.database.Tables; +namespace zotanpw.Backend.database.Tables; [Table(Name = "Travelynx")] public class TravelynxInfo { diff --git a/Pages/blog/JsonFeed.cs b/Controllers/JsonFeed.cs similarity index 80% rename from Pages/blog/JsonFeed.cs rename to Controllers/JsonFeed.cs index 6763790..3c02aec 100644 --- a/Pages/blog/JsonFeed.cs +++ b/Controllers/JsonFeed.cs @@ -1,13 +1,15 @@ -using J = System.Text.Json.Serialization.JsonPropertyNameAttribute; using Microsoft.AspNetCore.Mvc; +using zotanpw.Pages.blog; +using J = System.Text.Json.Serialization.JsonPropertyNameAttribute; -namespace zotanpw_web.Pages.blog; +namespace zotanpw.Controllers; [ApiController, Route("/blog/feed.json")] public class JsonFeed : Controller { - public static readonly JsonFeedObject Feedobj = new JsonFeedObject { - Items = BlogModel.Posts.Take(10).Select(post => new JsonFeedItem(post.Shorthand, $"https://zotan.pw/blog/{post.Shorthand}", post.Title, post.Content, - post.PublishedOn.ToDateTime(TimeOnly.MinValue).ToString("yyyy-MM-ddT00:00:00Z"))) + private static readonly JsonFeedObject Feedobj = new() { + Items = BlogModel.Posts.Take(10) + .Select(post => new JsonFeedItem(post.Shorthand, $"https://zotan.pw/blog/{post.Shorthand}", post.Title, post.Content, + post.PublishedOn.ToDateTime(TimeOnly.MinValue).ToString("yyyy-MM-ddT00:00:00Z"))) .ToList() }; @@ -17,6 +19,8 @@ public class JsonFeed : Controller { return Feedobj; } + // Auto-generated JSON mapping + // ReSharper disable All public class JsonFeedObject { [J("version")] public string Version => "https://jsonfeed.org/version/1.1"; [J("language")] public string Language => "en"; diff --git a/PlaybackHistory/LogPlayback.cs b/Controllers/PlaybackHistory/LogPlayback.cs similarity index 92% rename from PlaybackHistory/LogPlayback.cs rename to Controllers/PlaybackHistory/LogPlayback.cs index 2f2ce6b..dde6028 100644 --- a/PlaybackHistory/LogPlayback.cs +++ b/Controllers/PlaybackHistory/LogPlayback.cs @@ -1,9 +1,9 @@ using LinqToDB; using Microsoft.AspNetCore.Mvc; -using zotanpw_web.database; -using zotanpw_web.database.Tables; +using zotanpw.Backend.database; +using zotanpw.Backend.database.Tables; -namespace zotanpw_web.PlaybackHistory; +namespace zotanpw.Controllers.PlaybackHistory; [ApiController, Route("/np/log")] public class LogPlayback : Controller { @@ -38,4 +38,4 @@ public class LogPlayback : Controller { Response.StatusCode = 403; return null!; } -} \ No newline at end of file +} diff --git a/PlaybackHistory/LogPlaybackRequest.cs b/Controllers/PlaybackHistory/LogPlaybackRequest.cs similarity index 63% rename from PlaybackHistory/LogPlaybackRequest.cs rename to Controllers/PlaybackHistory/LogPlaybackRequest.cs index 2164d8a..c35dc9d 100644 --- a/PlaybackHistory/LogPlaybackRequest.cs +++ b/Controllers/PlaybackHistory/LogPlaybackRequest.cs @@ -1,8 +1,11 @@ -namespace zotanpw_web.PlaybackHistory; +// Auto-generated JSON mapping +// ReSharper disable All + +namespace zotanpw.Controllers.PlaybackHistory; public class LogPlaybackRequest { public string? Artist { get; set; } public string? Title { get; set; } public string? Source { get; set; } public string? Link { get; set; } -} \ No newline at end of file +} diff --git a/Travelynx/Travelynx.cs b/Controllers/Travelynx/Travelynx.cs similarity index 80% rename from Travelynx/Travelynx.cs rename to Controllers/Travelynx/Travelynx.cs index ac3c9bd..5e5f2ef 100644 --- a/Travelynx/Travelynx.cs +++ b/Controllers/Travelynx/Travelynx.cs @@ -1,16 +1,16 @@ using LinqToDB; using Microsoft.AspNetCore.Mvc; -using zotanpw_web.database; -using zotanpw_web.database.Tables; +using zotanpw.Backend.database; +using zotanpw.Backend.database.Tables; -namespace zotanpw_web.Travelynx; +namespace zotanpw.Controllers.Travelynx; [ApiController, Route("/travelynx")] public class Travelynx : Controller { private static readonly string TravelynxSecret = System.IO.File.ReadAllLines(".bearer_token")[0]; [HttpPost] - public TravelynxInfo Update([FromBody] WebhookRequest rq) { + public TravelynxInfo Update([FromBody] TravelynxWebhookRequest rq) { var token = Request.Headers.Authorization; if (token == TravelynxSecret) { var db = new Database.DbConn(); diff --git a/Travelynx/WebhookRequest.cs b/Controllers/Travelynx/TravelynxWebhookRequest.cs similarity index 90% rename from Travelynx/WebhookRequest.cs rename to Controllers/Travelynx/TravelynxWebhookRequest.cs index 25b13cb..0092029 100644 --- a/Travelynx/WebhookRequest.cs +++ b/Controllers/Travelynx/TravelynxWebhookRequest.cs @@ -1,6 +1,9 @@ -namespace zotanpw_web.Travelynx; +// Auto-generated JSON mapping +// ReSharper disable All -public class WebhookRequest { +namespace zotanpw.Controllers.Travelynx; + +public class TravelynxWebhookRequest { public string? Reason { get; set; } public Status? Status { get; set; } } diff --git a/well-known/Pronouns.cs b/Controllers/well-known/Pronouns.cs similarity index 79% rename from well-known/Pronouns.cs rename to Controllers/well-known/Pronouns.cs index 9f1432e..8d34618 100644 --- a/well-known/Pronouns.cs +++ b/Controllers/well-known/Pronouns.cs @@ -1,9 +1,9 @@ using Microsoft.AspNetCore.Mvc; -namespace zotanpw_web.well_known; +namespace zotanpw.Controllers.well_known; [ApiController, Route("/.well-known/pronouns")] public class Pronouns : Controller { [HttpGet] public string Get() => "she/they\n"; -} \ No newline at end of file +} diff --git a/Pages/Error.cshtml.cs b/Pages/Error.cshtml.cs index 2bd8828..7d44109 100644 --- a/Pages/Error.cshtml.cs +++ b/Pages/Error.cshtml.cs @@ -2,7 +2,7 @@ using System.Diagnostics; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -namespace zotanpw_web.Pages; +namespace zotanpw.Pages; [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true), IgnoreAntiforgeryToken] public class ErrorModel : PageModel { diff --git a/Pages/Index.cshtml b/Pages/Index.cshtml index 1bf7e9e..5ce4644 100644 --- a/Pages/Index.cshtml +++ b/Pages/Index.cshtml @@ -1,5 +1,5 @@ @page -@using zotanpw_web.database +@using zotanpw.Backend.database @model IndexModel @{ ViewData["title"] = "home"; @@ -154,4 +154,4 @@ @section postfooter { -} +} \ No newline at end of file diff --git a/Pages/Index.cshtml.cs b/Pages/Index.cshtml.cs index 6f93a5c..71e14c9 100644 --- a/Pages/Index.cshtml.cs +++ b/Pages/Index.cshtml.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Mvc.RazorPages; -namespace zotanpw_web.Pages; +namespace zotanpw.Pages; public class IndexModel : PageModel { private readonly ILogger _logger; diff --git a/Pages/NowPlaying.cshtml b/Pages/NowPlaying.cshtml index 0743d5a..95a7195 100644 --- a/Pages/NowPlaying.cshtml +++ b/Pages/NowPlaying.cshtml @@ -1,5 +1,5 @@ @page "/np" -@using zotanpw_web.database +@using zotanpw.Backend.database @model NowPlayingModel @{ @@ -25,4 +25,4 @@ } - + \ No newline at end of file diff --git a/Pages/NowPlaying.cshtml.cs b/Pages/NowPlaying.cshtml.cs index d65ff2e..63150b1 100644 --- a/Pages/NowPlaying.cshtml.cs +++ b/Pages/NowPlaying.cshtml.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Mvc.RazorPages; -namespace zotanpw_web.Pages; +namespace zotanpw.Pages; public class NowPlayingModel : PageModel { public void OnGet() { } diff --git a/Pages/Shared/_Layout.cshtml b/Pages/Shared/_Layout.cshtml index 2e9bf28..30bc9fa 100644 --- a/Pages/Shared/_Layout.cshtml +++ b/Pages/Shared/_Layout.cshtml @@ -1,4 +1,5 @@ - +@using zotanpw.Backend + @@ -52,4 +53,4 @@ @await RenderSectionAsync("postfooter", false) - + \ No newline at end of file diff --git a/Pages/_ViewImports.cshtml b/Pages/_ViewImports.cshtml index e7dc425..06e604c 100644 --- a/Pages/_ViewImports.cshtml +++ b/Pages/_ViewImports.cshtml @@ -1,3 +1,2 @@ -@using zotanpw_web -@namespace zotanpw_web.Pages +@namespace zotanpw.Pages @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers \ No newline at end of file diff --git a/Pages/blog/Blog.cshtml.cs b/Pages/blog/Blog.cshtml.cs index c73b3c9..e5043d2 100644 --- a/Pages/blog/Blog.cshtml.cs +++ b/Pages/blog/Blog.cshtml.cs @@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Mvc.RazorPages; using YamlDotNet.Serialization; using YamlDotNet.Serialization.NamingConventions; -namespace zotanpw_web.Pages.blog; +namespace zotanpw.Pages.blog; public class BlogModel : PageModel { public static readonly List Posts = new(); diff --git a/Pages/blog/BlogPost.cshtml b/Pages/blog/BlogPost.cshtml index ad0f88d..13c4dcc 100644 --- a/Pages/blog/BlogPost.cshtml +++ b/Pages/blog/BlogPost.cshtml @@ -1,4 +1,5 @@ @page "/blog/{post}" +@using zotanpw.Backend @{ if (string.IsNullOrWhiteSpace((string)RouteData.Values["post"]!)) { diff --git a/Pages/blog/posts/tdor-2022.md b/Pages/blog/posts/tdor-2022.md index 5af9ffc..9f2b600 100644 --- a/Pages/blog/posts/tdor-2022.md +++ b/Pages/blog/posts/tdor-2022.md @@ -7,14 +7,21 @@ date: 2022-11-20 I cannot and likely will never be able to comprehend the hate that so many people feel for what we are. -But that’s not what matters today. What matters today is that we’re still fighting, we’re still here, and we’ll keep building each other up when we’re feeling down. And we’ll continue to fight, together. As a community. Because if there’s one thing I want, is to not have to light more candles next year. +But that’s not what matters today. What matters today is that we’re still fighting, we’re still here, and we’ll keep +building each other up when we’re feeling down. And we’ll continue to fight, together. As a community. Because if +there’s one thing I want, is to not have to light more candles next year. -Today is trans day of remembrance, trans day of resistance, trans day of revenge, whatever you want to call it. Because we must never lose sight of what we’ve lost, and never lose sight of what we’re fighting for. A better future for trans people everywhere. Because we shouldn’t just get to survive, we should get to thrive, even in this godforsaken world that’s falling apart. +Today is trans day of remembrance, trans day of resistance, trans day of revenge, whatever you want to call it. Because +we must never lose sight of what we’ve lost, and never lose sight of what we’re fighting for. A better future for trans +people everywhere. Because we shouldn’t just get to survive, we should get to thrive, even in this godforsaken world +that’s falling apart. -So let’s stick together and keep going. Keep being there for each other. Keep being the community that’s become the first place that truly felt like home to me, the first place that I've ever truly felt safe in. +So let’s stick together and keep going. Keep being there for each other. Keep being the community that’s become the +first place that truly felt like home to me, the first place that I've ever truly felt safe in. [#np](/np) Amethystium - Transience - Epilogue -In the last year too many trans lives ended early. I feel like this track carries the emotion of grief I am feeling today. +In the last year too many trans lives ended early. I feel like this track carries the emotion of grief I am feeling +today. -And now, [#np](/np) Left at London - t.i.a.p.f.y.h. \ No newline at end of file +And now, [#np](/np) Left at London - t.i.a.p.f.y.h. diff --git a/README.md b/README.md index 51ba9a6..746b91e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ ## zotan.pw-web + The source code powering my website and blog engine. -Likely not useful without substantial modification, but open source to simplify deployment and allow people to take inspiration. +Likely not useful without substantial modification, but open source to simplify deployment and allow people to take +inspiration. diff --git a/zotan.pw-web.csproj b/zotan.pw-web.csproj index df81f32..e38af5f 100644 --- a/zotan.pw-web.csproj +++ b/zotan.pw-web.csproj @@ -4,25 +4,31 @@ net7.0 enable enable - zotanpw_web + zotanpw - - - - - - + + + + + + - + + + + + + + - +