Compare commits
No commits in common. "9d46d6495e6a3e7dc1eede5c48364ec12b511d00" and "e93917404071a4ff59c3eeb3b0571dc3483a40fe" have entirely different histories.
9d46d6495e
...
e939174040
@ -28,7 +28,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ts", "ts", "{BB9F76AC-292A-
|
||||
src\ts\Author.ts = src\ts\Author.ts
|
||||
src\ts\TimeUtility.ts = src\ts\TimeUtility.ts
|
||||
src\ts\UI.ts = src\ts\UI.ts
|
||||
src\ts\Input.ts = src\ts\Input.ts
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
|
@ -29,6 +29,7 @@ public sealed class BlogApiController : ControllerBase
|
||||
if (take == -1) take = _blogService.AllPosts.Count;
|
||||
|
||||
var referer = Request.Headers["Referer"].ToString();
|
||||
Console.WriteLine($"Referer: {referer}");
|
||||
if (!referer.StartsWith(Url.PageLink("/Blog/Index")!))
|
||||
{
|
||||
return NotFound();
|
||||
@ -50,9 +51,9 @@ public sealed class BlogApiController : ControllerBase
|
||||
url = Url.Page("/Blog/Article",
|
||||
new
|
||||
{
|
||||
year = post.Published.ToString("yyyy"),
|
||||
month = post.Published.ToString("MM"),
|
||||
day = post.Published.ToString("dd"),
|
||||
year = post.Published.Year,
|
||||
month = post.Published.Month,
|
||||
day = post.Published.Day,
|
||||
slug = post.Slug
|
||||
})
|
||||
}));
|
||||
|
@ -18,6 +18,7 @@
|
||||
<PackageReference Include="Humanizer.Core" Version="2.14.1"/>
|
||||
<PackageReference Include="Markdig" Version="0.32.0"/>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="7.0.9"/>
|
||||
<PackageReference Include="NLog" Version="5.2.3"/>
|
||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.3"/>
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="7.0.0"/>
|
||||
<PackageReference Include="SmartFormat.NET" Version="3.2.2"/>
|
||||
|
@ -1,5 +1,5 @@
|
||||
using Markdig;
|
||||
using NLog;
|
||||
using Markdig.Extensions.MediaLinks;
|
||||
using NLog.Extensions.Logging;
|
||||
using OliverBooth.Data;
|
||||
using OliverBooth.Markdown;
|
||||
@ -53,5 +53,3 @@ app.MapRazorPages();
|
||||
app.MapRssFeed("/blog/feed");
|
||||
|
||||
app.Run();
|
||||
|
||||
LogManager.Shutdown();
|
||||
|
@ -1,33 +0,0 @@
|
||||
class Input {
|
||||
public static readonly KONAMI_CODE = [
|
||||
"ArrowUp",
|
||||
"ArrowUp",
|
||||
"ArrowDown",
|
||||
"ArrowDown",
|
||||
"ArrowLeft",
|
||||
"ArrowRight",
|
||||
"ArrowLeft",
|
||||
"ArrowRight",
|
||||
"b",
|
||||
"a",
|
||||
"Enter"
|
||||
];
|
||||
|
||||
public static registerShortcut(shortcut: string | string[], callback: Function) {
|
||||
let keys: string[];
|
||||
if (typeof shortcut === 'string') keys = shortcut.split(' ');
|
||||
else keys = shortcut;
|
||||
|
||||
let sequence: string[] = [];
|
||||
document.addEventListener('keydown', e => {
|
||||
sequence.push(e.key);
|
||||
|
||||
if (sequence.slice(-keys.length).join(' ') === keys.join(' ')) {
|
||||
callback();
|
||||
sequence = [];
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default Input;
|
@ -193,11 +193,6 @@ class UI {
|
||||
element = element || document.body;
|
||||
element.querySelectorAll("pre code").forEach((block) => {
|
||||
let content = block.innerHTML;
|
||||
|
||||
// but ugly fucking hack. I hate this
|
||||
content = content.replaceAll('<span class="token operator"><</span>mark<span class="token operator">></span>', "<mark>");
|
||||
content = content.replaceAll('<span class="token operator"><</span><span class="token operator">/</span>mark<span class="token operator">></span>', "</mark>");
|
||||
|
||||
content = content.replaceAll("<mark>", "<mark>");
|
||||
content = content.replaceAll("</mark>", "</mark>");
|
||||
block.innerHTML = content;
|
||||
|
@ -1,29 +1,9 @@
|
||||
import API from "./API";
|
||||
import API from "./API";
|
||||
import UI from "./UI";
|
||||
import Input from "./Input";
|
||||
|
||||
const pkg = require("../../package.json");
|
||||
|
||||
declare const Handlebars: any;
|
||||
|
||||
(() => {
|
||||
let isCtrl = false;
|
||||
document.addEventListener('keyup', (e) => {
|
||||
if (e.ctrlKey) isCtrl = false;
|
||||
});
|
||||
|
||||
document.addEventListener('keydown', (e) => {
|
||||
if (e.ctrlKey) isCtrl = true;
|
||||
if (isCtrl && e.key === "u") {
|
||||
window.open(pkg.repository.url, "_blank");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
Input.registerShortcut(Input.KONAMI_CODE, () => {
|
||||
window.open("https://www.youtube.com/watch?v=dQw4w9WgXcQ", "_blank");
|
||||
});
|
||||
|
||||
const blogPostContainer = UI.blogPostContainer;
|
||||
if (blogPostContainer) {
|
||||
const template = Handlebars.compile(UI.blogPostTemplate.innerHTML);
|
||||
|
@ -1,7 +1,6 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["ES2022", "DOM"],
|
||||
"target": "ES2022",
|
||||
"moduleResolution": "nodenext"
|
||||
"target": "ES2022"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user