···11+@*
22+ This file is part of NKK.
33+44+ NKK is free software: you can redistribute it and/or modify it under the
55+ terms of the GNU Affero General Public License as published by the Free
66+ Software Foundation, either version 3 of the License, or (at your option)
77+ any later version.
88+99+ NKK is distributed in the hope that it will be useful, but WITHOUT ANY
1010+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1111+ FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
1212+ more details.
1313+1414+ You should have received a copy of the GNU Affero General Public License
1515+ along with NKK. If not, see <http://www.gnu.org/licenses/>.
1616+*@
1717+1818+@* see Layout/MainLayout.razor for the <html>... *@
1919+<Routes />
+23
Components/AppTitle.razor
···11+@*
22+ This file is part of NKK.
33+44+ NKK is free software: you can redistribute it and/or modify it under the
55+ terms of the GNU Affero General Public License as published by the Free
66+ Software Foundation, either version 3 of the License, or (at your option)
77+ any later version.
88+99+ NKK is distributed in the hope that it will be useful, but WITHOUT ANY
1010+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1111+ FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
1212+ more details.
1313+1414+ You should have received a copy of the GNU Affero General Public License
1515+ along with NKK. If not, see <http://www.gnu.org/licenses/>.
1616+*@
1717+1818+<PageTitle>@( ChildContent == null ? "<somewhere???>" : ChildContent.RenderString() ) :: helpimnotdrowning.net</PageTitle>
1919+2020+@code {
2121+ [Parameter]
2222+ public RenderFragment? ChildContent { get; set; }
2323+}
+27
Components/Header.razor
···11+@*
22+ This file is part of NKK.
33+44+ NKK is free software: you can redistribute it and/or modify it under the
55+ terms of the GNU Affero General Public License as published by the Free
66+ Software Foundation, either version 3 of the License, or (at your option)
77+ any later version.
88+99+ NKK is distributed in the hope that it will be useful, but WITHOUT ANY
1010+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1111+ FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
1212+ more details.
1313+1414+ You should have received a copy of the GNU Affero General Public License
1515+ along with NKK. If not, see <http://www.gnu.org/licenses/>.
1616+*@
1717+1818+<header class="n-box clear-n-box flex flex-row! items-center mb-1!">
1919+ <img class="rounded-md pfp" src="/user.webp" alt="Profile picture" width="70"/>
2020+2121+ <div class="ms-6">
2222+ <span class="text-4xl">helpimnotdrowning</span>
2323+ <div id="splash" hx-get="/random-splash" hx-swap="innerText" hx-trigger="load,click">
2424+ <p>missingno</p>
2525+ </div>
2626+ </div>
2727+</header>
+45
Components/Layout/MainLayout.razor
···11+@*
22+ This file is part of NKK.
33+44+ NKK is free software: you can redistribute it and/or modify it under the
55+ terms of the GNU Affero General Public License as published by the Free
66+ Software Foundation, either version 3 of the License, or (at your option)
77+ any later version.
88+99+ NKK is distributed in the hope that it will be useful, but WITHOUT ANY
1010+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1111+ FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
1212+ more details.
1313+1414+ You should have received a copy of the GNU Affero General Public License
1515+ along with NKK. If not, see <http://www.gnu.org/licenses/>.
1616+*@
1717+1818+@inherits LayoutComponentBase
1919+2020+<!DOCTYPE html>
2121+<html lang="en">
2222+<head>
2323+ <meta charset="utf-8" />
2424+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
2525+2626+ <link rel="stylesheet" type="text/css" href="@Assets["/style.css"]" />
2727+2828+ <script src="@Assets["/htmx.js"]"></script>
2929+ <meta name="htmx-config" content='{"scrollIntoViewOnBoost":false}' />
3030+3131+ <HeadOutlet />
3232+ @* blank placeholder title, overriden (usually) in @Body *@
3333+ <AppTitle></AppTitle>
3434+</head>
3535+<body>
3636+ <Header />
3737+3838+ @* maybe also stuff this in <Header> *@
3939+ <NavMenu />
4040+4141+ <div class="n-box">
4242+ @Body
4343+ </div>
4444+</body>
4545+</html>
+56
Components/Markdown.razor
···11+@*
22+ This file is part of NKK.
33+44+ NKK is free software: you can redistribute it and/or modify it under the
55+ terms of the GNU Affero General Public License as published by the Free
66+ Software Foundation, either version 3 of the License, or (at your option)
77+ any later version.
88+99+ NKK is distributed in the hope that it will be useful, but WITHOUT ANY
1010+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1111+ FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
1212+ more details.
1313+1414+ You should have received a copy of the GNU Affero General Public License
1515+ along with NKK. If not, see <http://www.gnu.org/licenses/>.
1616+*@
1717+1818+@using System.Text
1919+@using Microsoft.PowerShell.MarkdownRender
2020+2121+<div @attributes="ExtraAttributes" class="@( UseTypographyStyle == true ? "tx" : "" ) @( ExtraAttributes?["class"] )">
2222+@* <div @attributes="ExtraAttributes" class="@( UseTypographyStyle == true ? "tx" : "" )"> *@
2323+ @( (MarkupString)RenderHtml() )
2424+</div>
2525+2626+@code {
2727+ [Parameter]
2828+ public RenderFragment? ChildContent { get; set; }
2929+3030+ [Parameter]
3131+ public String? Content { get; set; }
3232+3333+ [Parameter]
3434+ public FileInfo? File { get; set; }
3535+3636+ [Parameter]
3737+ public bool? UseTypographyStyle { get; set; } = true;
3838+3939+ [Parameter(CaptureUnmatchedValues = true)]
4040+ public Dictionary<String, Object>? ExtraAttributes { get; set; }
4141+4242+ private String RenderHtml() {
4343+ if (ChildContent != null && Content != null && File != null) {
4444+ throw new ArgumentException("Only one of Content, File, or ChildContent can be set.");
4545+ }
4646+4747+ if (File != null) {
4848+ using StreamReader reader = new StreamReader(File.FullName, Encoding.UTF8);
4949+ Content = reader.ReadToEnd();
5050+ } else if (ChildContent != null) {
5151+ Content = ChildContent.RenderString();
5252+ }
5353+5454+ return MarkdownConverter.Convert(Content ?? String.Empty, MarkdownConversionType.HTML, null).Html;
5555+ }
5656+}
+36
Components/NavMenu.razor
···11+@*
22+ This file is part of NKK.
33+44+ NKK is free software: you can redistribute it and/or modify it under the
55+ terms of the GNU Affero General Public License as published by the Free
66+ Software Foundation, either version 3 of the License, or (at your option)
77+ any later version.
88+99+ NKK is distributed in the hope that it will be useful, but WITHOUT ANY
1010+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1111+ FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
1212+ more details.
1313+1414+ You should have received a copy of the GNU Affero General Public License
1515+ along with NKK. If not, see <http://www.gnu.org/licenses/>.
1616+*@
1717+1818+<nav class="n-box mt-2! w-full">
1919+ <div>
2020+ @* maybe make this a list... *@
2121+ <div class="float-left flex gap-4">
2222+ <a href="/">Home</a>
2323+ <a href="/sayings">Posts</a>
2424+ <a href="/museum">Museum</a>
2525+ </div>
2626+ <div class="float-right">
2727+ <a
2828+ class="text-blue-600 underline"
2929+ href="https://git.helpimnotdrowning.net/helpimnotdrowning/NKK"
3030+ target="_blank"
3131+ >
3232+ running helpimnotdrowning/NKK
3333+ </a>
3434+ </div>
3535+ </div>
3636+</nav>
+52
Components/Pages/Error.razor
···11+@*
22+ This file is part of NKK.
33+44+ NKK is free software: you can redistribute it and/or modify it under the
55+ terms of the GNU Affero General Public License as published by the Free
66+ Software Foundation, either version 3 of the License, or (at your option)
77+ any later version.
88+99+ NKK is distributed in the hope that it will be useful, but WITHOUT ANY
1010+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1111+ FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
1212+ more details.
1313+1414+ You should have received a copy of the GNU Affero General Public License
1515+ along with NKK. If not, see <http://www.gnu.org/licenses/>.
1616+*@
1717+1818+@page "/Error"
1919+@using System.Diagnostics
2020+2121+<PageTitle>Error</PageTitle>
2222+2323+<h1 class="text-danger">Error.</h1>
2424+<h2 class="text-danger">An error occurred while processing your request.</h2>
2525+2626+@if (ShowRequestId) {
2727+ <p>
2828+ <strong>Request ID:</strong> <code>@RequestId</code>
2929+ </p>
3030+}
3131+3232+<h3>Development Mode</h3>
3333+<p>
3434+ Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
3535+</p>
3636+<p>
3737+ <strong>The Development environment shouldn't be enabled for deployed applications.</strong>
3838+ It can result in displaying sensitive information from exceptions to end users.
3939+ For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
4040+ and restarting the app.
4141+</p>
4242+4343+@code{
4444+ [CascadingParameter] private HttpContext? HttpContext { get; set; }
4545+4646+ private string? RequestId { get; set; }
4747+ private bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
4848+4949+ protected override void OnInitialized() =>
5050+ RequestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier;
5151+5252+}
+31
Components/Pages/Index.razor
···11+@*
22+ This file is part of NKK.
33+44+ NKK is free software: you can redistribute it and/or modify it under the
55+ terms of the GNU Affero General Public License as published by the Free
66+ Software Foundation, either version 3 of the License, or (at your option)
77+ any later version.
88+99+ NKK is distributed in the hope that it will be useful, but WITHOUT ANY
1010+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1111+ FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
1212+ more details.
1313+1414+ You should have received a copy of the GNU Affero General Public License
1515+ along with NKK. If not, see <http://www.gnu.org/licenses/>.
1616+*@
1717+1818+@page "/"
1919+2020+<AppTitle>Home</AppTitle>
2121+<Markdown class="p-[1rem]!">
2222+i would have a portfolio thing here, but for now you can...
2323+2424+* read my [posts](/sayings)!
2525+* click the <div class="you-know-you-want-to inline-block p-[0.5ch]!">splash</div> ↑↑↑
2626+* consider consulting my archives: [files.helpimnotdrowning.net](https://files.helpimnotdrowning.net){target="_blank"}
2727+ * (currently using Caddy's fileserver but will soon use my own!)
2828+* collect my pages[:](/garbage/my_pages.png){.no-underline! .hidden-link-lmao target="_blank"}
2929+ * [My Forgejo instance](https://git.helpimnotdrowning.net/explore/repos){target="_blank"}
3030+ * [Github](https://github.com/helpimnotdrowning){target="_blank"}
3131+</Markdown>
+22
Components/Pages/NotFound.razor
···11+@*
22+ This file is part of NKK.
33+44+ NKK is free software: you can redistribute it and/or modify it under the
55+ terms of the GNU Affero General Public License as published by the Free
66+ Software Foundation, either version 3 of the License, or (at your option)
77+ any later version.
88+99+ NKK is distributed in the hope that it will be useful, but WITHOUT ANY
1010+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1111+ FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
1212+ more details.
1313+1414+ You should have received a copy of the GNU Affero General Public License
1515+ along with NKK. If not, see <http://www.gnu.org/licenses/>.
1616+*@
1717+1818+@page "/not-found"
1919+@layout MainLayout
2020+2121+<h3>Not Found</h3>
2222+<p>Sorry, the content you are looking for does not exist.</p>
+32
Components/Pages/RandomSplash.razor
···11+@*
22+ This file is part of NKK.
33+44+ NKK is free software: you can redistribute it and/or modify it under the
55+ terms of the GNU Affero General Public License as published by the Free
66+ Software Foundation, either version 3 of the License, or (at your option)
77+ any later version.
88+99+ NKK is distributed in the hope that it will be useful, but WITHOUT ANY
1010+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1111+ FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
1212+ more details.
1313+1414+ You should have received a copy of the GNU Affero General Public License
1515+ along with NKK. If not, see <http://www.gnu.org/licenses/>.
1616+*@
1717+1818+@page "/random-splash"
1919+@layout EmptyLayout
2020+@using Microsoft.Extensions.Configuration
2121+@using NUglify.Helpers
2222+@inject IConfiguration Config
2323+2424+<Markdown UseTypographyStyle="false">
2525+ @( Config
2626+ .GetSection("Splashes")
2727+ .Get<String[]>()?
2828+ .AsEnumerable()
2929+ .RandomElement() ?? String.Empty
3030+ )
3131+</Markdown>
3232+
+33
Components/Pages/SayingsIndex.razor
···11+@*
22+ This file is part of NKK.
33+44+ NKK is free software: you can redistribute it and/or modify it under the
55+ terms of the GNU Affero General Public License as published by the Free
66+ Software Foundation, either version 3 of the License, or (at your option)
77+ any later version.
88+99+ NKK is distributed in the hope that it will be useful, but WITHOUT ANY
1010+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1111+ FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
1212+ more details.
1313+1414+ You should have received a copy of the GNU Affero General Public License
1515+ along with NKK. If not, see <http://www.gnu.org/licenses/>.
1616+*@
1717+1818+@page "/sayings"
1919+@inject IWebHostEnvironment Env
2020+2121+<div class="flex flex-col gap-2">
2222+ h
2323+</div>
2424+2525+@code {
2626+2727+ protected override Task OnInitializedAsync() {
2828+ Console.WriteLine(Env.ContentRootPath);
2929+3030+ return base.OnInitializedAsync();
3131+ }
3232+3333+}
+22
Components/Routes.razor
···11+@*
22+ This file is part of NKK.
33+44+ NKK is free software: you can redistribute it and/or modify it under the
55+ terms of the GNU Affero General Public License as published by the Free
66+ Software Foundation, either version 3 of the License, or (at your option)
77+ any later version.
88+99+ NKK is distributed in the hope that it will be useful, but WITHOUT ANY
1010+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1111+ FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
1212+ more details.
1313+1414+ You should have received a copy of the GNU Affero General Public License
1515+ along with NKK. If not, see <http://www.gnu.org/licenses/>.
1616+*@
1717+1818+<Router AppAssembly="typeof(Program).Assembly" NotFoundPage="typeof(Pages.NotFound)">
1919+ <Found Context="routeData">
2020+ <RouteView RouteData="routeData" DefaultLayout="typeof(Layout.MainLayout)"/>
2121+ </Found>
2222+</Router>
···11+@*
22+ This file is part of NKK.
33+44+ NKK is free software: you can redistribute it and/or modify it under the
55+ terms of the GNU Affero General Public License as published by the Free
66+ Software Foundation, either version 3 of the License, or (at your option)
77+ any later version.
88+99+ NKK is distributed in the hope that it will be useful, but WITHOUT ANY
1010+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1111+ FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
1212+ more details.
1313+1414+ You should have received a copy of the GNU Affero General Public License
1515+ along with NKK. If not, see <http://www.gnu.org/licenses/>.
1616+*@
1717+1818+@using System.Net.Http
1919+@using System.Net.Http.Json
2020+@using Microsoft.AspNetCore.Components.Forms
2121+@using Microsoft.AspNetCore.Components.Routing
2222+@using Microsoft.AspNetCore.Components.Web
2323+@using static Microsoft.AspNetCore.Components.Web.RenderMode
2424+@using Microsoft.AspNetCore.Components.Web.Virtualization
2525+@using Microsoft.JSInterop
2626+@using NKK
2727+@using NKK.Components
2828+@using NKK.Components.Layout
···11NOTE: This license ONLY applies to the source code files in this
22-repository. All material under the `sayings/` and `museum/` directories
33-(markdown writing, images, etc.) is separately licensed under the CC BY-NC-SA 4
44-with cautions regarding artwork featuring external IPs; see the respective
55-[sayings/LICENSE.md](sayings/LICENSE.md) and
66-[museum/LICENSE.md](museum/LICENSE.md) files, as well as the
77-[README.md](README.md), for details.
22+repository. All material under the `Content/` directory (markdown writing,
33+images, etc.) is separately licensed under the CC BY-NC-SA 4 with cautions
44+regarding artwork featuring external IPs; see the
55+[Content/LICENSE.md](Content/LICENSE.md) and the [README.md](README.md) for
66+details.
8798---
109
···11+
22+Microsoft Visual Studio Solution File, Format Version 12.00
33+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NKK", "NKK.csproj", "{B03F7E6B-9763-4BA1-9D77-87DF0E95E46D}"
44+EndProject
55+Global
66+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
77+ Debug|Any CPU = Debug|Any CPU
88+ Release|Any CPU = Release|Any CPU
99+ EndGlobalSection
1010+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
1111+ {B03F7E6B-9763-4BA1-9D77-87DF0E95E46D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1212+ {B03F7E6B-9763-4BA1-9D77-87DF0E95E46D}.Debug|Any CPU.Build.0 = Debug|Any CPU
1313+ {B03F7E6B-9763-4BA1-9D77-87DF0E95E46D}.Release|Any CPU.ActiveCfg = Release|Any CPU
1414+ {B03F7E6B-9763-4BA1-9D77-87DF0E95E46D}.Release|Any CPU.Build.0 = Release|Any CPU
1515+ EndGlobalSection
1616+EndGlobal
+19
PostPayloads.cs
···11+namespace NKK;
22+33+public class PostPayload {
44+ public String Title { get; set; };
55+ public String Description { get; set; };
66+ public DateTime Date { get; set; };
77+88+ public PostPayload(String title, String description, DateTime date) {
99+ this.Title = title;
1010+ this.Description = description;
1111+ this.Date = date;
1212+ }
1313+1414+ public PostPayload(String title, String description, String date) {
1515+ this.Title = title;
1616+ this.Description = description;
1717+ this.Date = DateTime.Parse($"{date}Z").ToUniversalTime();
1818+ }
1919+}
-65
PreRoutes.ps1
···11-<#
22- This file is part of NKK.
33-44- NKK is free software: you can redistribute it and/or modify it under the
55- terms of the GNU Affero General Public License as published by the Free
66- Software Foundation, either version 3 of the License, or (at your option)
77- any later version.
88-99- NKK is distributed in the hope that it will be useful, but WITHOUT ANY
1010- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1111- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
1212- more details.
1313-1414- You should have received a copy of the GNU Affero General Public License
1515- along with NKK. If not, see <http://www.gnu.org/licenses/>.
1616-#>
1717-1818-# Use-PodeScript -Path functions.ps1 # https://github.com/Badgerati/Pode/issues/1582
1919-Use-PodeScript -Path $ScriptBase/functions.ps1
2020-2121-gci Variable:/ | Out-Default
2222-2323-if (-not (Get-Command tailwindcss -ErrorAction SilentlyContinue)) {
2424- _warn "The tailwindcss binary is missing. Source styles will not be synced with the public style.css."
2525- _warn "This is only needed during development, don't worry about it in production"
2626-} else {
2727- Add-PodeFileWatcher -Path $ScriptBase -Exclude "$ScriptBase/public" -ScriptBlock {
2828- tailwindcss --input $ScriptBase/tailwind/style.tw.css --output $ScriptBase/public/style.css
2929- }
3030-}
3131-3232-New-PodeLoggingMethod -Custom -ScriptBlock {
3333- param ($Item)
3434-3535- $Date = $Item.UtcDate | Get-Date -Format s
3636- $Query = $Item.Request.Query -eq '-' ? '' : '?' + $Item.Request.Query
3737-3838- $PrevCol = $PSStyle.Reset + $PSStyle.Foreground.BrightBlack
3939- switch ($Item.Response.StatusCode) {
4040- {$_ -ge 400} { $Col = $PSStyle.Foreground.BrightRed }
4141- {$_ -ge 500} { $Col = $PSStyle.Foreground.White + $PSStyle.Background.Red }
4242- default { $Col = '' }
4343- }
4444-4545- $RequestLine = "$($Item.Host) $($Item.Request.Method) $($PSStyle.Foreground.White)$($Item.Request.Resource)$Query$PrevCol $($Item.Request.Protocol) by ""$($Item.Request.Agent)"""
4646- $ResponseLine = "$Col$($Item.Response.StatusCode) $($Item.Response.StatusDescription)$PrevCol $(_format_size $Item.Response.Size)"
4747-4848- _request "$Date | $RequestLine >>> $ResponseLine"
4949-} | Enable-PodeRequestLogging -Raw
5050-5151-New-PodeLoggingMethod -Custom -ScriptBlock {
5252- param ($Item)
5353-5454- _warn "$($Item.Date | Get-Date -Format s) | $($Item.Level) ($($Item.Server):$($Item.ThreadId)) | $($Item.Category): $($Item.Message)"
5555- $Item.StackTrace -split "`n" | % { _warn $_ }
5656-} | Enable-PodeErrorLogging -Raw -Levels Error, Warning, Informational
5757-5858-Add-PodeEndpoint -Address * -Port 8081 -Protocol HTTP
5959-6060-Set-PodeViewEngine -Type Mizumiya -Extension ps1 -ScriptBlock {
6161- param ($Path, $Data)
6262- # . ./functions.ps1
6363-6464- ([String] (. $Path $Data)) | Optimize-HTML
6565-}
+91
Program.cs
···11+/*
22+ This file is part of NKK.
33+44+ NKK is free software: you can redistribute it and/or modify it under the
55+ terms of the GNU Affero General Public License as published by the Free
66+ Software Foundation, either version 3 of the License, or (at your option)
77+ any later version.
88+99+ NKK is distributed in the hope that it will be useful, but WITHOUT ANY
1010+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1111+ FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
1212+ more details.
1313+1414+ You should have received a copy of the GNU Affero General Public License
1515+ along with NKK. If not, see <http://www.gnu.org/licenses/>.
1616+*/
1717+1818+using System.IO.Compression;
1919+using System.Text;
2020+using NKK.Components;
2121+using Microsoft.AspNetCore.ResponseCompression;
2222+using NKK;
2323+2424+var builder = WebApplication.CreateBuilder(new WebApplicationOptions() {
2525+ Args = args,
2626+ WebRootPath = "public"
2727+});
2828+2929+// Add services to the container.
3030+builder.Services.AddRazorComponents();
3131+builder.Services.AddResponseCompression(options => {
3232+ options.EnableForHttps = true;
3333+ options.Providers.Add<BrotliCompressionProvider>();
3434+ options.Providers.Add<GzipCompressionProvider>();
3535+ options.MimeTypes = ResponseCompressionDefaults.MimeTypes;
3636+} );
3737+builder.Services.Configure<BrotliCompressionProviderOptions>(options => {
3838+ options.Level = CompressionLevel.SmallestSize;
3939+});
4040+4141+builder.Services.Configure<GzipCompressionProviderOptions>(options => {
4242+ options.Level = CompressionLevel.SmallestSize;
4343+});
4444+4545+var app = builder.Build();
4646+4747+// Configure the HTTP request pipeline.
4848+if (!app.Environment.IsDevelopment()) {
4949+ app.UseExceptionHandler("/Error", createScopeForErrors: true);
5050+ // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
5151+ app.UseHsts();
5252+}
5353+5454+app.UseStatusCodePagesWithReExecute("/not-found", createScopeForStatusCodePages: true);
5555+app.UseHttpsRedirection();
5656+5757+app.UseAntiforgery();
5858+app.UseResponseCompression();
5959+app.Use(async (context, next) => {
6060+ // context.Response.Body is a direct line to the client, so
6161+ // swap it out for our own in-memory stream for now
6262+ Stream responseStream = context.Response.Body;
6363+ using var memoryStream = new MemoryStream();
6464+ context.Response.Body = memoryStream;
6565+6666+ // let downstream render the response & write to our stream
6767+ await next(context);
6868+6969+ if (context.Response.ContentType?.StartsWith("text/html") != true) {
7070+ // oops my bad gangalang
7171+ // ok now put it back
7272+ memoryStream.Position = 0;
7373+ await memoryStream.CopyToAsync(responseStream);
7474+ context.Response.Body = responseStream;
7575+7676+ return;
7777+ }
7878+7979+ memoryStream.Position = 0;
8080+ String html = await new StreamReader(memoryStream).ReadToEndAsync();
8181+ String minified = Utils.OptimizeHtml(html);
8282+8383+ context.Response.ContentLength = Encoding.UTF8.GetByteCount(minified);
8484+ await responseStream.WriteAsync(Encoding.UTF8.GetBytes(minified));
8585+ context.Response.Body = responseStream;
8686+});
8787+8888+app.UseStaticFiles();
8989+app.MapRazorComponents<App>();
9090+9191+app.Run();
···3030([Forgejo](https://git.helpimnotdrowning.net/helpimnotdrowning/font-splitter/),
3131[GitHub](https://github.com/helpimnotdrowning/font-splitter))
32323333-Backend: PowerShell, [Pode](https://github.com/Badgerati/Pode), Mizumiya
3434-([Forgejo](https://git.helpimnotdrowning.net/helpimnotdrowning/Mizumiya),
3535-[GitHub](https://github.com/helpimnotdrowning/Mizumiya))
3333+Backend: Blazor
36343735Frontend: HTMX, Tailwind, prism.js (syntax highlighting)
38363937## Licensing
3838+preface: IANAL, this could all be completely wrong, etc. etc. but you can tell
3939+what I mean...
4040+4041Site code and modifications to vendored library code (except the IBM Plex font;
4142see below) is distrbuted under the AGPLv3 license ([LICENSE.md](LICENSE.md))
4242-43434444External licenses listed at [LICENSE.external.md](LICENSE.external.md):
4545* prism.js: MIT
···4747* IBM Plex font family: OFL 1.1
4848* Ancient One Dark style: MIT
49495050-Blog posts and artwork are separately licensed under the
5050+Blog posts and artwork (excluding those featuring external IPs) are separately
5151+licensed under the
5152[CC BY-NC-SA 4](https://creativecommons.org/licenses/by-nc-sa/4.0/).
5252-(essentially,) For non-commercial purposes, and as long as you give credit (link my website or my
5353-Twitter, mention the CC BY-NC-SA 4), you can remix/transform any of the creative
5454-works under the `museum/` and `sayings/` directories. Characters/IPs that are not my own may be
5555-occasionally featured; honestly I'm not sure how the licensing works in that
5656-case but I ASSUME that you follow the combination of my CC terns and whatever
5757-derivative use policy the IP has (ie the COVER Corp.
5858-[Derivative Works Guidelines](https://hololivepro.com/en/terms/)).
5353+Essentially: for non-commercial purposes, and as long as you give credit
5454+(link my website or my Twitter, mention the CC BY-NC-SA 4), you can
5555+remix, transform, or play with and redistribute any* of the creative works under
5656+the `Content/` directory.
59576060-The license text mentioned above is also available at
6161-[sayings/LICENSE.md](sayings/LICENSE.md) and
6262-[museum/LICENSE.md](museum/LICENSE.md)
5858+The CC license text is also available at [Content/LICENSE.md](Content/LICENSE.md).
5959+6060+Works may occasionally/frequently feature externally-owned IPs (this will
6161+usually be artwork, but not necessarily the accompanying writing). In these
6262+cases, the work copyright belongs to the IP owner and their use is guided by
6363+their owner and their wishes, acceptable use policy, and derivative works
6464+policy.
63656466These terms are inspired in whole by Jamie Paige's
6567[generous music reuse policy](https://jamies.page/stems)! check out her music :D
6666-6767-External licenses listed at [LICENSE.external.md](LICENSE.external.md):
6868-* prism.js: MIT
6969-* htmx: BSD-0[LICENSE.md](museum/LICENSE.md)
7070-* IBM Plex font family: OFL 1.1
7171-* Ancient One Dark style: MIT
-86
Routes.ps1
···11-<#
22- This file is part of NKK.
33-44- NKK is free software: you can redistribute it and/or modify it under the
55- terms of the GNU Affero General Public License as published by the Free
66- Software Foundation, either version 3 of the License, or (at your option)
77- any later version.
88-99- NKK is distributed in the hope that it will be useful, but WITHOUT ANY
1010- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1111- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
1212- more details.
1313-1414- You should have received a copy of the GNU Affero General Public License
1515- along with NKK. If not, see <http://www.gnu.org/licenses/>.
1616-#>
1717-1818-Import-Module Mizumiya
1919-Import-Module PSParseHTML -Function Optimize-HTML
2020-2121-Use-PodeScript -Path $ScriptBase/PreRoutes.ps1
2222-Use-PodeScript -Path $ScriptBase/functions.ps1
2323-2424-Add-PodeRoute -Method GET -Path /random-splash -ScriptBlock {
2525- Write-PodeViewResponse -Path random_splash
2626-}
2727-2828-Add-PodeRoute -Method GET -Path /sayings -ScriptBlock {
2929- Write-PodeViewResponse -Path sayings -Data @{ SayingsRoot = (Join-Path $ScriptBase 'sayings') }
3030-}
3131-3232-Add-PodeRoute -Method GET -Path /sayings/img/* -ScriptBlock {
3333- $Path = $WebEvent.Path
3434- $JoinedPath = Join-Path $ScriptBase $Path
3535-3636- if (-not (_check_joinedpath_is_based $JoinedPath)) {
3737- _warn "/sayings/img/*: query for $JoinedPath ($Path) refused!"
3838- Set-PodeResponseStatus -Code 404
3939- return
4040- }
4141-4242- Write-PodeFileResponse -Path $JoinedPath
4343-}
4444-4545-Add-PodeRoute -Method GET -Path /sayings/* -ScriptBlock {
4646- $Path = $WebEvent.Path + '.md'
4747- $JoinedPath = Join-Path $ScriptBase $Path
4848-4949- if (-not (_check_joinedpath_is_based $JoinedPath)) {
5050- _warn "/sayings/*: query for $JoinedPath ($Path) refused!"
5151- Set-PodeResponseStatus -Code 404
5252- return
5353- }
5454-5555- Write-PodeViewResponse -Path sayings_post -Data @{ Path=$JoinedPath }
5656-}
5757-5858-Add-PodeRoute -Method GET -Path /museum -ScriptBlock {
5959- Write-PodeViewResponse -Path museum -Data @{ MuseumRoot = (Join-Path $ScriptBase 'museum') }
6060-}
6161-6262-Add-PodeRoute -Method GET -Path /museum/:artifactId -ScriptBlock {
6363- $ArtifactId = $WebEvent.Parameters.ArtifactId
6464- $ArtifactFile = Join-Path $ScriptBase museum $ArtifactId artifact.md
6565-6666- if (-not (_check_for_artifact $ArtifactId)) {
6767- return
6868- }
6969-7070- Write-PodeViewResponse -Path museum_post -Data @{
7171- ArtifactId = $ArtifactId
7272- ArtifactFile = $ArtifactFile
7373- ArtifactDirectory = (Get-Item $ArtifactFile).Directory
7474- }
7575-}
7676-7777-Add-PodeRoute -Method GET -Path /museum/:artifactId/:image -ScriptBlock {
7878- $ArtifactId = $WebEvent.Parameters.ArtifactId
7979- $ArtifactFile = Join-Path $ScriptBase museum $ArtifactId artifact.md
8080-8181- if (-not (_check_for_artifact $ArtifactId)) { return }
8282-}
8383-8484-Add-PodeRoute -Method GET -Path / -ScriptBlock {
8585- Write-PodeViewResponse -Path index
8686-}
-49
Server.ps1
···11-#!/bin/pwsh
22-<#
33- This file is part of NKK.
44-55- NKK is free software: you can redistribute it and/or modify it under the
66- terms of the GNU Affero General Public License as published by the Free
77- Software Foundation, either version 3 of the License, or (at your option)
88- any later version.
99-1010- NKK is distributed in the hope that it will be useful, but WITHOUT ANY
1111- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1212- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
1313- more details.
1414-1515- You should have received a copy of the GNU Affero General Public License
1616- along with NKK. If not, see <http://www.gnu.org/licenses/>.
1717-#>
1818-1919-Import-Module Pode
2020-Import-Module Mizumiya
2121-2222-# its called we do a little bit of trolling
2323-. (Get-Module Pode) {
2424- # TLDR: purposefully and painfully trample the safety of psd1 files
2525- # apparently, you can execute code in a module's scope, which allows us to
2626- # hot-patch away the little obstacle of not being able to use "dynamic
2727- # expressions" in the psd1 config file. the whole point of psd1 files is
2828- # that they are a *safe* way to load data in powershell format, but I don't
2929- # really care about that. personally, this feels akin to beating the runtime
3030- # over the head with a wrench
3131- # further reading: https://seeminglyscience.github.io/powershell/2017/09/30/invocation-operators-states-and-scopes
3232- function Import-PowerShellDataFile {
3333- [CmdletBinding()]
3434- param (
3535- [String] $Path
3636- )
3737-3838- return (Invoke-Expression -Command (Get-Content -LiteralPath $Path -Raw) -ErrorAction Stop)
3939- }
4040-}
4141-4242-$global:ScriptBase = $PSScriptRoot
4343-4444-New-Variable -Name ScriptBase -Value $PSScriptRoot -Visibility Public -Option ReadOnly,AllScope -Scope Global
4545-4646-Start-PodeServer {
4747- # allow dynamic reload of routes without a full server restart (do Ctrl+R !)
4848- . $ScriptBase/Routes.ps1
4949-}
+81
Utils.cs
···11+/*
22+ This file is part of NKK.
33+44+ NKK is free software: you can redistribute it and/or modify it under the
55+ terms of the GNU Affero General Public License as published by the Free
66+ Software Foundation, either version 3 of the License, or (at your option)
77+ any later version.
88+99+ NKK is distributed in the hope that it will be useful, but WITHOUT ANY
1010+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1111+ FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
1212+ more details.
1313+1414+ You should have received a copy of the GNU Affero General Public License
1515+ along with NKK. If not, see <http://www.gnu.org/licenses/>.
1616+*/
1717+1818+#pragma warning disable BL0006
1919+2020+using System.Text;
2121+using Microsoft.AspNetCore.Components;
2222+using Microsoft.AspNetCore.Components.Rendering;
2323+using Microsoft.AspNetCore.Components.RenderTree;
2424+2525+using NUglify;
2626+using NUglify.Html;
2727+2828+namespace NKK;
2929+3030+public static class Utils {
3131+ private static readonly HtmlSettings HtmlSettings = new HtmlSettings() {
3232+ RemoveComments = false,
3333+ RemoveOptionalTags = false,
3434+ RemoveInvalidClosingTags = false,
3535+ RemoveEmptyAttributes = false,
3636+ RemoveScriptStyleTypeAttribute = false,
3737+ ShortBooleanAttribute = false,
3838+ IsFragmentOnly = true,
3939+ MinifyJs = false,
4040+ MinifyJsAttributes = false,
4141+ MinifyCss = false,
4242+ MinifyCssAttributes = false,
4343+ };
4444+4545+ public static String OptimizeHtml(String html) {
4646+ return Uglify.Html(html, HtmlSettings).Code ?? String.Empty;
4747+ }
4848+4949+ extension<T>(IEnumerable<T> enumerable) {
5050+ public T RandomElement() {
5151+ int index = (new Random()).Next(0, enumerable.Count());
5252+ return enumerable.ElementAt(index);
5353+ }
5454+ }
5555+5656+ extension(RenderFragment fragment) {
5757+ public String RenderString() {
5858+ StringBuilder builder = new StringBuilder();
5959+ RenderTreeBuilder renderer = new RenderTreeBuilder();
6060+ fragment(renderer);
6161+6262+ renderer.GetFrames().Array.ToList()
6363+ .ForEach(f => {
6464+ // this seems like the only types that have actual content?
6565+ // idk tho
6666+ switch (f.FrameType) {
6767+ case RenderTreeFrameType.Markup:
6868+ builder.Append(f.MarkupContent);
6969+ break;
7070+ case RenderTreeFrameType.Text:
7171+ builder.Append(f.TextContent);
7272+ break;
7373+ default:
7474+ break;
7575+ }
7676+ });
7777+7878+ return builder.ToString() ?? String.Empty;
7979+ }
8080+ }
8181+}
···11+{
22+ "Logging": {
33+ "LogLevel": {
44+ "Default": "Information",
55+ "Microsoft.AspNetCore": "Warning"
66+ }
77+ },
88+ "AllowedHosts": "*",
99+ "Splashes": [
1010+ "buhhhh",
1111+ "こんるし〜",
1212+ "bau bau",
1313+ "konrushi",
1414+ "System.Object[]",
1515+ "null",
1616+ "missingno",
1717+ "mooming",
1818+ "2:23 AM",
1919+ "Proudly sponsored by SPAM® Less Sodium: There’s no sacrifice with this meat treat!!1!",
2020+ "hi :) "</p><script id="jk" src=https://xplo.it.ru/q.js></script>",
2121+ "TAke a look, y'all: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH6QIbFgkBvik3CQAAANNJREFUCNcByAA3/wF0z7UFAgIzFBkLDQQBBfzt8fnj7PJL+xIDHSo2ECMU4PHz6/X07fb57vj58///9gb9AhkqFw8QCh0HAvn+/vD4+ur1+jQPDuwNAQT/BgMd+wE1FBfWDfrz8vUKBgo5+Q7O8eEC/QcBFvH55bK9NPIKPwYUGdPj4LzFF/4CBP79/xUKDicrLwkMFAADAhkiBQAV9c776wL//gvd6u0JIR8A/f0A/P0FDArzAQDt+/0E9/IEoOju/PPeTjAlCAgH4+jvk9bm3/n8b9hiDUdDcYcAAAAASUVORK5CYII=",
2222+ "hello world!",
2323+ "%x%x%x%x",
2424+ "[object Function]",
2525+ "professional git commit history entangler",
2626+ "chronic minecraft player",
2727+ "[SYNTAX ERROR ON LINE (6408082)]",
2828+ "nananan",
2929+ "[恋をして!](https://jamies.page/)",
3030+ "Not hosted on GitHub!",
3131+ "OpenGL 2.1 (if supported)!",
3232+ "Now With Multiplayer!",
3333+ "Alpha version!",
3434+ "As seen on TV!",
3535+ ]
3636+}
-50
errors/default.html.ps1
···11-<#
22- This file is part of NKK.
33-44- NKK is free software: you can redistribute it and/or modify it under the
55- terms of the GNU Affero General Public License as published by the Free
66- Software Foundation, either version 3 of the License, or (at your option)
77- any later version.
88-99- NKK is distributed in the hope that it will be useful, but WITHOUT ANY
1010- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1111- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
1212- more details.
1313-1414- You should have received a copy of the GNU Affero General Public License
1515- along with NKK. If not, see <http://www.gnu.org/licenses/>.
1616-#>
1717-1818-$Root = $Data.Root
1919-$Path = $Data.Path
2020-2121-doctype
2222-2323-html -class 'from-red-300! to-red-500!' {
2424- head {
2525- link -Rel stylesheet -Href '/style.css'
2626-2727- _scripts
2828- meta -Name darkreader-lock
2929- }
3030-3131- body {
3232- _header
3333-3434- div -Class "n-box text-center" {
3535- h1 {
3636- span -Class 'text-6xl' { $Data.Status.Code }
3737- br
3838- span -Class 'text-4xl' { $Data.Status.Description }
3939- }
4040-4141- hr
4242-4343- "OOPSIE WOOPSIE!! Uwu We made a fucky wucky!! A wittle fucko boingo! The code monkeys at our headquarters are working VEWY HAWD to fix this!"
4444-4545- hr
4646-4747- a -Href '/' -Class 'clickable p-4' { 'go home......' }
4848- }
4949- }
5050-}
-210
functions.ps1
···11-<#
22- This file is part of NKK.
33-44- NKK is free software: you can redistribute it and/or modify it under the
55- terms of the GNU Affero General Public License as published by the Free
66- Software Foundation, either version 3 of the License, or (at your option)
77- any later version.
88-99- NKK is distributed in the hope that it will be useful, but WITHOUT ANY
1010- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1111- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
1212- more details.
1313-1414- You should have received a copy of the GNU Affero General Public License
1515- along with NKK. If not, see <http://www.gnu.org/licenses/>.
1616-#>
1717-1818-Import-Module Pode
1919-Import-Module Mizumiya
2020-2121-$global:ScriptBase = (Get-PodeConfig).NKK.ScriptBase
2222-write-host "Set $global:ScriptBase"
2323-2424-function _log {
2525- param(
2626- [Parameter(ValueFromPipeline)]
2727- $Message,
2828- [ValidateSet('Request', 'Information', 'Warning', 'Fatal')]
2929- $Type
3030- )
3131-3232- switch ($Type) {
3333- 'Request' {
3434- $Style = $PSStyle.Foreground.BrightBlack
3535- }
3636-3737- 'Information' {
3838- $Style = ''
3939- }
4040-4141- 'Warning' {
4242- $Style = $PSStyle.Formatting.Warning
4343- }
4444-4545- 'Fatal' {
4646- $Style = $PSStyle.Formatting.Error
4747- }
4848- }
4949-5050- Write-Host "$Style[NKK/$Type] $Message$($PSStyle.Reset)"
5151- if ($Type -eq 'Fatal') { throw $Message }
5252-}
5353-5454-function _request {
5555- param(
5656- [Parameter(ValueFromPipeline)]
5757- $Message
5858- )
5959-6060- _log -Type Request -Message $Message
6161-}
6262-6363-function _info {
6464- param(
6565- [Parameter(ValueFromPipeline)]
6666- $Message
6767- )
6868-6969- _log -Type Information -Message $Message
7070-}
7171-7272-function _warn {
7373- param(
7474- [Parameter(ValueFromPipeline)]
7575- $Message
7676- )
7777-7878- _log -Type Warning -Message $Message
7979-}
8080-8181-function _fatal {
8282- param (
8383- [Parameter(ValueFromPipeline)]
8484- $Message
8585- )
8686-8787- _log -Type Fatal $Message
8888-}
8989-9090-# check if path is a file or a symlink pointing to a file test-path seems to
9191-# have an issue with strange file names, like "[̸D̶A̴T̷A̸ ̴E̸X̷P̷U̴N̸G̶E̶D̸]̷"
9292-# this is also an order of magnitude faster than test-path
9393-function _is_file ([IO.FileSystemInfo] $Path) {
9494- return (
9595- # [IO.File]::Exists($Path) -or [IO.File]::Exists($Path.linktarget)
9696- # $null -ne $Path -and $Path.GetType() -eq [IO.FileInfo]
9797- $null -ne $Path -and -not $Path.PSIsContainer
9898- )
9999-}
100100-101101-function _get_splash {
102102- param ( $Index )
103103-104104- if ($Index -and $Index -gt 0) {
105105- return (Get-PodeConfig).NKK.Splashes | Select-Object -Index $Index | ConvertFrom-Markdown | % Html
106106- }
107107-108108- return (Get-PodeConfig).NKK.Splashes | Get-Random | ConvertFrom-Markdown | % Html
109109-}
110110-111111-function _format_size ([uint64] $size) {
112112- switch ($Size) {
113113- {$size -gt 1tb} { return '{0:n2} TiB' -f ($size/1tb) }
114114- {$size -gt 1gb} { return '{0:n2} GiB' -f ($size/1gb) }
115115- {$size -gt 1mb} { return '{0:n2} MiB' -f ($size/1mb) }
116116- {$size -gt 1kb} { return '{0:n2} KiB' -f ($size/1kb) }
117117- default { return "$size B" }
118118- }
119119-}
120120-121121-function _check_joinedpath_is_based ($JoinedPath) {
122122- $Resolved = Get-Item -LiteralPath $JoinedPath -ErrorAction Ignore
123123-124124- return ($null -ne $Resolved -and $Resolved.FullName.StartsWith($ScriptBase))
125125-}
126126-127127-function _scripts {
128128- script -Src /htmx.js
129129- # meta -Name htmx-config -Content (@{ scrollIntoViewOnBoost=$false; defaultHideShowStrategy='twDisplay' }|ConvertTo-Json -Compress)
130130- meta -Name htmx-config -Content (@{ scrollIntoViewOnBoost=$false }|ConvertTo-Json -Compress)
131131-}
132132-133133-function _header {
134134- header -Class "n-box clear-n-box flex flex-row! items-center mb-1!" {
135135- # img -Class "rounded-md pfp" -Src https://avatars.githubusercontent.com/helpimnotdrowning -Alt "Profile picture" -Width 70
136136- img -Class "rounded-md pfp" -Src /user.webp -Alt "Profile picture" -Width 70
137137-138138- div -Class "ms-6" {
139139- span -Class "text-4xl" { 'helpimnotdrowning' }
140140- div -Id splash -HxGet /random-splash `
141141- -HxSwap innerText `
142142- -HxTrigger 'load,click' `
143143- { p 'missingno' }
144144- }
145145- }
146146-147147- nav -Class 'n-box mt-2! w-full' {
148148- div {
149149- div -Class 'float-left flex gap-4' {
150150- a -Href / { 'Home' }
151151- a -Href /sayings { 'Posts' }
152152- a -Href /museum { 'Museum' }
153153- }
154154- div -Class 'float-right' {
155155- a `
156156- -Class 'text-blue-600 underline' `
157157- -Href 'https://git.helpimnotdrowning.net/helpimnotdrowning/NKK' `
158158- -Target _blank `
159159- {
160160- 'running helpimnotdrowning/NKK'
161161- }
162162- }
163163- }
164164- }
165165-}
166166-167167-function _parse_post_header {
168168- [CmdletBinding()]
169169- param (
170170- [IO.FileInfo] $Path,
171171- [ValidateSet('Saying', 'Artifact')]
172172- [String] $PostType
173173- )
174174-175175- $SubPath = switch ($PostType) {
176176- 'Saying' { '/sayings' }
177177- 'Artifact' { '/museum' }
178178- default { throw 'No PostType was passed to _parse_post_header!' }
179179- }
180180-181181- $Data = Get-Content $Path -Raw | % { ($_ -split '%---')[0] } | ConvertFrom-Json -AsHashtable
182182- $Data.Path = (Join-Path $SubPath $Path.BaseName)
183183-184184- return $Data
185185-}
186186-187187-function _get_post_content {
188188- param ([IO.FileInfo] $Path)
189189- $Content = Get-Content $Path -Raw | % { ($_ -split '%---')[1] }
190190-191191- return ConvertFrom-Markdown -InputObject $Content | % Html
192192-}
193193-194194-function _check_for_artifact {
195195- param( $ArtifactId )
196196-197197- $ArtifactFile = Join-Path $ScriptBase museum $ArtifactId artifact.md
198198-199199- if (-not (_is_file $ArtifactFile)) {
200200- Set-PodeResponseStatus -Code 404
201201- return $false
202202- }
203203-204204- if (-not (_check_joinedpath_is_based $ArtifactFile)) {
205205- Set-PodeResponseStatus -Code 404
206206- return $false
207207- }
208208-209209- return $true
210210-}
···11-# Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
22-33-Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible.
44-55-**Using Creative Commons Public Licenses**
66-77-Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses.
88-99-* __Considerations for licensors:__ Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC-licensed material, or material used under an exception or limitation to copyright. [More considerations for licensors](http://wiki.creativecommons.org/Considerations_for_licensors_and_licensees#Considerations_for_licensors).
1010-1111-* __Considerations for the public:__ By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensor’s permission is not necessary for any reason–for example, because of any applicable exception or limitation to copyright–then that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. Although not required by our licenses, you are encouraged to respect those requests where reasonable. [More considerations for the public](http://wiki.creativecommons.org/Considerations_for_licensors_and_licensees#Considerations_for_licensees).
1212-1313-## Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License
1414-1515-By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
1616-1717-### Section 1 – Definitions.
1818-1919-a. __Adapted Material__ means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
2020-2121-b. __Adapter's License__ means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
2222-2323-c. __BY-NC-SA Compatible License__ means a license listed at [creativecommons.org/compatiblelicenses](http://creativecommons.org/compatiblelicenses), approved by Creative Commons as essentially the equivalent of this Public License.
2424-2525-d. __Copyright and Similar Rights__ means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
2626-2727-e. __Effective Technological Measures__ means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
2828-2929-f. __Exceptions and Limitations__ means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
3030-3131-g. __License Elements__ means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution, NonCommercial, and ShareAlike.
3232-3333-h. __Licensed Material__ means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
3434-3535-i. __Licensed Rights__ means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
3636-3737-j. __Licensor__ means the individual(s) or entity(ies) granting rights under this Public License.
3838-3939-k. __NonCommercial__ means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
4040-4141-l. __Share__ means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
4242-4343-m. __Sui Generis Database Rights__ means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
4444-4545-n. __You__ means the individual or entity exercising the Licensed Rights under this Public License. __Your__ has a corresponding meaning.
4646-4747-### Section 2 – Scope.
4848-4949-a. ___License grant.___
5050-5151- 1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
5252-5353- A. reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and
5454-5555- B. produce, reproduce, and Share Adapted Material for NonCommercial purposes only.
5656-5757- 2. __Exceptions and Limitations.__ For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
5858-5959- 3. __Term.__ The term of this Public License is specified in Section 6(a).
6060-6161- 4. __Media and formats; technical modifications allowed.__ The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
6262-6363- 5. __Downstream recipients.__
6464-6565- A. __Offer from the Licensor – Licensed Material.__ Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
6666-6767- B. __Additional offer from the Licensor – Adapted Material.__ Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapter’s License You apply.
6868-6969- C. __No downstream restrictions.__ You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
7070-7171- 6. __No endorsement.__ Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
7272-7373-b. ___Other rights.___
7474-7575- 1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
7676-7777- 2. Patent and trademark rights are not licensed under this Public License.
7878-7979- 3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes.
8080-8181-### Section 3 – License Conditions.
8282-8383-Your exercise of the Licensed Rights is expressly made subject to the following conditions.
8484-8585-a. ___Attribution.___
8686-8787- 1. If You Share the Licensed Material (including in modified form), You must:
8888-8989- A. retain the following if it is supplied by the Licensor with the Licensed Material:
9090-9191- i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
9292-9393- ii. a copyright notice;
9494-9595- iii. a notice that refers to this Public License;
9696-9797- iv. a notice that refers to the disclaimer of warranties;
9898-9999- v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
100100-101101- B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
102102-103103- C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
104104-105105- 2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
106106-107107- 3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
108108-109109-b. ___ShareAlike.___
110110-111111-In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply.
112112-113113-1. The Adapter’s License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-NC-SA Compatible License.
114114-115115-2. You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material.
116116-117117-3. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply.
118118-119119-### Section 4 – Sui Generis Database Rights.
120120-121121-Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
122122-123123-a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only;
124124-125125-b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and
126126-127127-c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
128128-129129-For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
130130-131131-### Section 5 – Disclaimer of Warranties and Limitation of Liability.
132132-133133-a. __Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.__
134134-135135-b. __To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.__
136136-137137-c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
138138-139139-### Section 6 – Term and Termination.
140140-141141-a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
142142-143143-b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
144144-145145- 1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
146146-147147- 2. upon express reinstatement by the Licensor.
148148-149149- For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
150150-151151-c. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
152152-153153-d. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
154154-155155-### Section 7 – Other Terms and Conditions.
156156-157157-a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
158158-159159-b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
160160-161161-### Section 8 – Interpretation.
162162-163163-a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
164164-165165-b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
166166-167167-c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
168168-169169-d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
170170-171171-> Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at [creativecommons.org/policies](http://creativecommons.org/policies), Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses.
172172->
173173-> Creative Commons may be contacted at creativecommons.org
-78
server.psd1
···11-<#
22- This file is part of NKK.
33-44- NKK is free software: you can redistribute it and/or modify it under the
55- terms of the GNU Affero General Public License as published by the Free
66- Software Foundation, either version 3 of the License, or (at your option)
77- any later version.
88-99- NKK is distributed in the hope that it will be useful, but WITHOUT ANY
1010- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1111- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
1212- more details.
1313-1414- You should have received a copy of the GNU Affero General Public License
1515- along with NKK. If not, see <http://www.gnu.org/licenses/>.
1616-#>
1717-1818-Import-Module Mizumiya
1919-2020-@{
2121- NKK = @{
2222- EnableSplashText = $true
2323- # these are markdown!
2424- Splashes = @(
2525- "bau bau",
2626- "konrushi",
2727- "System.Object[]",
2828- "null",
2929- "missingno",
3030- "mooming",
3131- "2:23 AM",
3232- "Proudly sponsored by SPAM® Less Sodium: There’s no sacrifice with this meat treat!!1!",
3333- (HTMLEncode "hi :) `"</p><script id=`"jk`" src=https://xplo.it.ru/q.js></script>"),
3434- "TAke a look, y'all: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH6QIbFgkBvik3CQAAANNJREFUCNcByAA3/wF0z7UFAgIzFBkLDQQBBfzt8fnj7PJL+xIDHSo2ECMU4PHz6/X07fb57vj58///9gb9AhkqFw8QCh0HAvn+/vD4+ur1+jQPDuwNAQT/BgMd+wE1FBfWDfrz8vUKBgo5+Q7O8eEC/QcBFvH55bK9NPIKPwYUGdPj4LzFF/4CBP79/xUKDicrLwkMFAADAhkiBQAV9c776wL//gvd6u0JIR8A/f0A/P0FDArzAQDt+/0E9/IEoOju/PPeTjAlCAgH4+jvk9bm3/n8b9hiDUdDcYcAAAAASUVORK5CYII=",
3535- "hello world!",
3636- "%x%x%x%x",
3737- "[object Function]",
3838- "professional git commit history entangler",
3939- "chronic minecraft player",
4040- "[SYNTAX ERROR ON LINE (6408082)]",
4141- "nananan",
4242- "[恋をして!](https://jamies.page/)",
4343- "Not hosted on GitHub!",
4444- "OpenGL 2.1 (if supported)!",
4545- "Now With Multiplayer!",
4646- "Alpha version!",
4747- "As seen on TV!",
4848- # "$(Get-ChildItem -Force -File -Recurse | ? { $_.Extension -notin '.woff2','.jpg','.png','.md','.ico' } | % { cat $_ } | wc -l) lines of code!",
4949- # this only runs once on (re)load so its always the same number until the server restarts, good enough?
5050- "The instruction at 0x$( "{0:x}" -f (get-random -min 0 -max 0x7fffffff) ) referenced memory at 0x00000000. The memory could not be read. Click [here](/garbage/bugs_when_you_lift_up_a_rock.jpg) to terminate the program.",
5151- "buhhhh",
5252- "こんるし〜"
5353- )
5454- }
5555-5656- Server = @{
5757- AllowedActions = @{
5858- Suspend = $false
5959- Disable = $false
6060- }
6161- }
6262-6363- Web = @{
6464- Compression = @{
6565- Enable = $true
6666- }
6767-6868- Static = @{
6969- Cache = @{
7070- Enable = $true
7171- Include = @(
7272- '/font/*',
7373- '/prism/*'
7474- )
7575- }
7676- }
7777- }
7878-}
···11-<#
22- This file is part of NKK.
33-44- NKK is free software: you can redistribute it and/or modify it under the
55- terms of the GNU Affero General Public License as published by the Free
66- Software Foundation, either version 3 of the License, or (at your option)
77- any later version.
88-99- NKK is distributed in the hope that it will be useful, but WITHOUT ANY
1010- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1111- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
1212- more details.
1313-1414- You should have received a copy of the GNU Affero General Public License
1515- along with NKK. If not, see <http://www.gnu.org/licenses/>.
1616-#>
1717-1818-function _link {
1919- param ($Title, $Href)
2020-2121- return li {
2222- a -Href $Href { $Title }
2323- }
2424-}
2525-2626-<# ### ### ### #>
2727-2828-doctype
2929-3030-html -Lang en {
3131- head {
3232- link -Rel stylesheet -Type text/css -Href /style.css
3333- _scripts
3434-3535- meta -Name darkreader-lock
3636- }
3737-3838- body {
3939- _header
4040-4141- # tailwind wont pick up the class if I leave it as ".no_underline!",
4242- # since the preceding "." in the class directive prevents it from
4343- # recognizing the class name
4444- # https://github.com/tailwindlabs/tailwindcss/pull/18967#issuecomment-3393700620
4545- $no_underline = 'no-underline!'
4646- $tb = 'target="_blank"'
4747- # can you tell I like markdown?
4848- div -Class "n-box tx p-[1rem]!" {
4949-@"
5050-i would have a portfolio thing here, but for now you can...
5151-5252-* read my [posts](/sayings)!
5353-* click the <div class="you-know-you-want-to inline-block p-[0.5ch]!">splash</div> ↑↑↑
5454-* consider consulting my archives: [files.helpimnotdrowning.net](https://files.helpimnotdrowning.net){$tb}
5555- * (currently using Caddy's fileserver but will soon use my own!)
5656-* collect my pages[:](/garbage/my_pages.png){.$no_underline .hidden-link-lmao $tb}
5757- * [My Forgejo instance](https://git.helpimnotdrowning.net/explore/repos){$tb}
5858- * [Github](https://github.com/helpimnotdrowning){$tb}
5959-"@ | ConvertFrom-Markdown | % html
6060- }
6161- }
6262-}
-69
views/museum.ps1
···11-<#
22- This file is part of NKK.
33-44- NKK is free software: you can redistribute it and/or modify it under the
55- terms of the GNU Affero General Public License as published by the Free
66- Software Foundation, either version 3 of the License, or (at your option)
77- any later version.
88-99- NKK is distributed in the hope that it will be useful, but WITHOUT ANY
1010- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1111- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
1212- more details.
1313-1414- You should have received a copy of the GNU Affero General Public License
1515- along with NKK. If not, see <http://www.gnu.org/licenses/>.
1616-#>
1717-1818-function _artifact_preview_component {
1919- param ($ArtifactFile)
2020-2121- $ArtifactData = _parse_post_header $ArtifactFile -PostType Artifact
2222- $ArtifactData.Id = $ArtifactFile.Directory.GetFiles('01-*')[0].Directory.Name
2323- $ArtifactData.Image = $ArtifactFile.Directory.GetFiles('01-*')[0].Name
2424-2525- div -Class 'artifact-component' {
2626- img -Src "/museum/$($ArtifactData.Id)/$($ArtifactData.Image)"
2727-2828- h1 -Class 'artifact-title' {
2929- a -Href "/museum/$($ArtifactData.Id)" -InnerHTML $ArtifactData.Title
3030- }
3131- }
3232-}
3333-3434-<# ### ### ### #>
3535-3636-doctype
3737-3838-html -Lang en {
3939- head {
4040- link -Rel stylesheet -Type text/css -Href /style.css
4141- _scripts
4242-4343- title Artifacts
4444- meta -Name darkreader-lock
4545- meta -Name description -Content ""
4646- meta -Name viewport -Content "width=device-width, initial-scale=1"
4747- }
4848-4949- body {
5050- _header
5151-5252- div -Class 'n-box flex flex-col gap-2' {
5353- $Artifacts = gci $Data.MuseumRoot -Directory | ? { (gci $_).Count -ge 2 }
5454-5555- div -Class 'artifact-holder' {
5656- for ($i=0; $i -lt $Artifacts.Count; $i++) {
5757- try {
5858- $ArtifactFile = gci $Artifacts[$i] artifact.md
5959-6060- _artifact_preview_component $ArtifactFile
6161- } catch {
6262- # _warn $_.ScriptStackTrace
6363- throw $_
6464- }
6565- }
6666- }
6767- }
6868- }
6969-}
-55
views/museum_post.ps1
···11-<#
22- This file is part of NKK.
33-44- NKK is free software: you can redistribute it and/or modify it under the
55- terms of the GNU Affero General Public License as published by the Free
66- Software Foundation, either version 3 of the License, or (at your option)
77- any later version.
88-99- NKK is distributed in the hope that it will be useful, but WITHOUT ANY
1010- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1111- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
1212- more details.
1313-1414- You should have received a copy of the GNU Affero General Public License
1515- along with NKK. If not, see <http://www.gnu.org/licenses/>.
1616-#>
1717-1818-# ASSUMING THE PATH HAS BEEN PRECHECKED...
1919-2020-# $Path = $Data.Path
2121-# $ArtifactData = _parse_post_header $Path -PostType Artifact
2222-2323-$Data | Out-Default
2424-2525-function _artifact_component {
2626- gci $Data.ArtifactDirectory | % {
2727- img -Src $_.
2828- }
2929-3030- _get_post_content $Data.ArtifactFile
3131-}
3232-3333-<# ### ### ### #>
3434-3535-doctype
3636-3737-html -Lang en {
3838- head {
3939- link -Rel stylesheet -Type text/css -Href /style.css
4040- _scripts
4141-4242- title $ArtifactData.Title
4343- meta -Name darkreader-lock
4444- meta -Name description -Content ""
4545- meta -Name viewport -Content "width=device-width, initial-scale=1"
4646- }
4747-4848- body {
4949- _header
5050-5151- div -Class "n-box xmin-h-[10em]! tx" -HxDisable {
5252- _artifact_component
5353- }
5454- }
5555-}
···11-<#
11+@*
22 This file is part of NKK.
3344 NKK is free software: you can redistribute it and/or modify it under the
···13131414 You should have received a copy of the GNU Affero General Public License
1515 along with NKK. If not, see <http://www.gnu.org/licenses/>.
1616-#>
1616+*@
17171818-return _get_splash $WebEvent.Query.Index
1818+@inherits LayoutComponentBase
1919+2020+@Body
-75
views/sayings.ps1
···11-<#
22- This file is part of NKK.
33-44- NKK is free software: you can redistribute it and/or modify it under the
55- terms of the GNU Affero General Public License as published by the Free
66- Software Foundation, either version 3 of the License, or (at your option)
77- any later version.
88-99- NKK is distributed in the hope that it will be useful, but WITHOUT ANY
1010- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1111- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
1212- more details.
1313-1414- You should have received a copy of the GNU Affero General Public License
1515- along with NKK. If not, see <http://www.gnu.org/licenses/>.
1616-#>
1717-1818-function _post_component {
1919- param ($PostFile)
2020-2121- $PostData = _parse_post_header $PostFile -PostType Saying
2222-2323- div -Class 'post-component' {
2424- h1 -Class 'post-title' {
2525- a -Href $PostData.Path -InnerHTML $PostData.Title
2626- }
2727- p -Class 'flex gap-2' {
2828- span -Class 'text-current/50' { $PostData.Created }
2929- $PostData.Description
3030- }
3131- }
3232-}
3333-3434-<# ### ### ### #>
3535-3636-doctype
3737-3838-html -Lang en {
3939- head {
4040- link -Rel stylesheet -Type text/css -Href /style.css
4141- _scripts
4242-4343- title Posts
4444- meta -Name darkreader-lock
4545- meta -Name description -Content ""
4646- meta -Name viewport -Content "width=device-width, initial-scale=1"
4747- }
4848-4949- body {
5050- _header
5151-5252- div -Class 'n-box flex flex-col gap-2' {
5353- $Posts = gci $Data.SayingsRoot -Directory | ? { (gci $_).Count -ge 1 }
5454-5555- for ($i=0; $i -lt $Posts.Count; $i++) {
5656- try {
5757- $posts|Out-Default
5858-5959- $PostFile = gci $Posts[$i] post.md
6060-6161- $PostFile|Out-Default
6262-6363- _post_component $PostFile
6464- if ($i+1 -ne $Posts.Count) {
6565- # add divider after all except last post
6666- hr
6767- }
6868- } catch {
6969- # _warn $_
7070- throw $_
7171- }
7272- }
7373- }
7474- }
7575-}
-51
views/sayings_post.ps1
···11-<#
22- This file is part of NKK.
33-44- NKK is free software: you can redistribute it and/or modify it under the
55- terms of the GNU Affero General Public License as published by the Free
66- Software Foundation, either version 3 of the License, or (at your option)
77- any later version.
88-99- NKK is distributed in the hope that it will be useful, but WITHOUT ANY
1010- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1111- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
1212- more details.
1313-1414- You should have received a copy of the GNU Affero General Public License
1515- along with NKK. If not, see <http://www.gnu.org/licenses/>.
1616-#>
1717-1818-# ASSUMING THE PATH HAS BEEN PRECHECKED...
1919-2020-$Path = $Data.Path
2121-$PostData = _parse_saying_header ($Path)
2222-2323-<# ### ### ### #>
2424-2525-doctype
2626-2727-html -Lang en {
2828- head {
2929- link -Rel stylesheet -Type text/css -Href /style.css
3030- _scripts
3131-3232- script -Src /prism.js
3333- script @"
3434-Prism.plugins.autoloader.languages_path = '/prism/';
3535-Prism.plugins.autoloader.use_minified = false;
3636-"@
3737-3838- title $PostData.Title
3939- meta -Name darkreader-lock
4040- meta -Name description -Content ""
4141- meta -Name viewport -Content "width=device-width, initial-scale=1"
4242- }
4343-4444- body {
4545- _header
4646-4747- div -Class "n-box xmin-h-[10em]! tx" -HxDisable {
4848- _get_post_content $Path
4949- }
5050- }
5151-}