This commit is contained in:
2026-04-26 19:24:39 +09:00
parent 21c440a9d1
commit 872f77de3d
17 changed files with 156 additions and 11026 deletions
@@ -16,7 +16,10 @@ body {
flex-direction: column; flex-direction: column;
} }
header { header {
background-color: var(--color-dark-grey); view-transition-name: header;
will-change: transform;
background-image: transparent;
backdrop-filter: blur(16px);
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
@@ -27,13 +30,23 @@ header {
gap: 16px; gap: 16px;
z-index: 10; z-index: 10;
} }
@supports (-webkit-backdrop-filter: blur(1px)) {
header {
background-image: linear-gradient(to bottom, var(--color-dark-grey), transparent);
}
}
main { main {
view-transition-name: main-content;
padding: 24px; padding: 24px;
padding-top: 76px; padding-top: 60px;
padding-bottom: 0px; padding-bottom: 0px;
flex: 1; flex: 1;
} }
main > *:first-child {
margin-top: 16px;
}
footer { footer {
view-transition-name: footer-content;
padding: 24px; padding: 24px;
padding-top: 0px; padding-top: 0px;
display: flex; display: flex;
@@ -105,6 +118,39 @@ code {
} }
/* Fonts */ /* Fonts */
@font-face {
font-family: "MesloLGS Nerd Font";
font-style: normal;
font-weight: 400;
src:
local("MesloLGS Nerd Font"),
url("https://assets.nercone.dev/fonts/MesloLGSNerdFont-Regular.woff2") format("woff2")
}
@font-face {
font-family: "MesloLGS Nerd Font";
font-style: normal;
font-weight: 700;
src:
local("MesloLGS Nerd Font"),
url("https://assets.nercone.dev/fonts/MesloLGSNerdFont-Bold.woff2") format("woff2")
}
@font-face {
font-family: "MesloLGS Nerd Font";
font-style: italic;
font-weight: 400;
src:
local("MesloLGS Nerd Font"),
url("https://assets.nercone.dev/fonts/MesloLGSNerdFont-Italic.woff2") format("woff2")
}
@font-face {
font-family: "MesloLGS Nerd Font";
font-style: italic;
font-weight: 700;
src:
local("MesloLGS Nerd Font"),
url("https://assets.nercone.dev/fonts/MesloLGSNerdFont-BoldItalic.woff2") format("woff2")
}
a { a {
text-decoration: underline; text-decoration: underline;
color: inherit; color: inherit;
@@ -365,6 +411,96 @@ s {
} }
} }
/* View Transition */
@keyframes vt-fade-out {
from { opacity: 1; }
to { opacity: 0; }
}
@keyframes vt-fade-in {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes vt-blur-out {
from { filter: blur(0px); }
to { filter: blur(6px); }
}
@keyframes vt-blur-in {
from { filter: blur(6px); }
to { filter: blur(0px); }
}
@media (prefers-reduced-motion: reduce) {
::view-transition-old(main-content),
::view-transition-new(main-content),
::view-transition-old(footer-content),
::view-transition-new(footer-content) {
z-index: 1;
pointer-events: none;
}
}
/* Cursor */
* { cursor: none; }
#cursor {
view-transition-name: none;
position: fixed;
z-index: 99999;
width: 25px;
height: 25px;
border-radius: 50%;
background: #FFFFFFC0;
pointer-events: none;
transform: translate(-50%, -50%);
opacity: 0;
transition:
left 0.08s ease-out,
top 0.08s ease-out,
width 0.15s cubic-bezier(0.22, 1, 0.36, 1),
height 0.15s cubic-bezier(0.22, 1, 0.36, 1),
border-radius 0.15s cubic-bezier(0.22, 1, 0.36, 1),
background 0.15s ease,
transform 0.08s ease-out,
opacity 0.3s ease;
}
#cursor.visible { opacity: 1; }
#cursor.on-text {
width: 3px;
border-radius: 1.5px;
background: #FFFFFFC0;
}
#cursor.on-link {
border-radius: 6px;
background: #FFFFFF40;
transform: translate(0, 0);
}
/* Loading Overlay */
#loading-overlay {
view-transition-name: none;
position: fixed;
inset: 0;
z-index: 100000;
display: flex;
align-items: center;
justify-content: center;
background-color: var(--color-dark-grey);
backdrop-filter: blur(40px);
-webkit-backdrop-filter: blur(40px);
pointer-events: none;
opacity: 1;
}
#loading-overlay svg {
--size: clamp(340px, 28vmin, 380px);
width: var(--size);
height: calc(var(--size) * 512 / 832);
opacity: 0;
filter: blur(20px);
transform: scale(1);
will-change: opacity, filter, transform;
}
#loading-overlay polyline {
will-change: stroke-dashoffset;
}
/* Miscellaneous */ /* Miscellaneous */
.unselectable { .unselectable {
-webkit-touch-callout: none; -webkit-touch-callout: none;
-146
View File
@@ -1,146 +0,0 @@
header {
view-transition-name: header-content;
will-change: transform;
background-color: transparent;
background-image: transparent;
backdrop-filter: blur(16px);
}
@supports (-webkit-backdrop-filter: blur(1px)) {
header {
background-image: linear-gradient(to bottom, var(--color-dark-grey), transparent);
}
}
main {
view-transition-name: main-content;
padding-top: 60px;
}
main > *:first-child {
margin-top: 16px;
}
footer {
view-transition-name: footer-content;
}
/* Fonts */
@font-face {
font-family: "MesloLGS Nerd Font";
font-style: normal;
font-weight: 400;
src:
local("MesloLGS Nerd Font"),
url("https://assets.nercone.dev/fonts/MesloLGSNerdFont-Regular.woff2") format("woff2")
}
@font-face {
font-family: "MesloLGS Nerd Font";
font-style: normal;
font-weight: 700;
src:
local("MesloLGS Nerd Font"),
url("https://assets.nercone.dev/fonts/MesloLGSNerdFont-Bold.woff2") format("woff2")
}
@font-face {
font-family: "MesloLGS Nerd Font";
font-style: italic;
font-weight: 400;
src:
local("MesloLGS Nerd Font"),
url("https://assets.nercone.dev/fonts/MesloLGSNerdFont-Italic.woff2") format("woff2")
}
@font-face {
font-family: "MesloLGS Nerd Font";
font-style: italic;
font-weight: 700;
src:
local("MesloLGS Nerd Font"),
url("https://assets.nercone.dev/fonts/MesloLGSNerdFont-BoldItalic.woff2") format("woff2")
}
/* View Transition */
@keyframes vt-fade-out {
from { opacity: 1; }
to { opacity: 0; }
}
@keyframes vt-fade-in {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes vt-blur-out {
from { filter: blur(0px); }
to { filter: blur(6px); }
}
@keyframes vt-blur-in {
from { filter: blur(6px); }
to { filter: blur(0px); }
}
@media (prefers-reduced-motion: reduce) {
::view-transition-old(main-content),
::view-transition-new(main-content),
::view-transition-old(footer-content),
::view-transition-new(footer-content) {
z-index: 1;
pointer-events: none;
}
}
/* Cursor */
* { cursor: none; }
#cursor {
view-transition-name: none;
position: fixed;
z-index: 99999;
width: 25px;
height: 25px;
border-radius: 50%;
background: #FFFFFFC0;
pointer-events: none;
transform: translate(-50%, -50%);
opacity: 0;
transition:
left 0.08s ease-out,
top 0.08s ease-out,
width 0.15s cubic-bezier(0.22, 1, 0.36, 1),
height 0.15s cubic-bezier(0.22, 1, 0.36, 1),
border-radius 0.15s cubic-bezier(0.22, 1, 0.36, 1),
background 0.15s ease,
transform 0.08s ease-out,
opacity 0.3s ease;
}
#cursor.visible { opacity: 1; }
#cursor.on-text {
width: 3px;
border-radius: 1.5px;
background: #FFFFFFC0;
}
#cursor.on-link {
border-radius: 6px;
background: #FFFFFF40;
transform: translate(0, 0);
}
/* Loading Overlay */
#loading-overlay {
view-transition-name: none;
position: fixed;
inset: 0;
z-index: 100000;
display: flex;
align-items: center;
justify-content: center;
background-color: var(--color-dark-grey);
backdrop-filter: blur(40px);
-webkit-backdrop-filter: blur(40px);
pointer-events: none;
opacity: 1;
}
#loading-overlay svg {
--size: clamp(340px, 28vmin, 380px);
width: var(--size);
height: calc(var(--size) * 512 / 832);
opacity: 0;
filter: blur(20px);
transform: scale(1);
will-change: opacity, filter, transform;
}
#loading-overlay polyline {
will-change: stroke-dashoffset;
}
File diff suppressed because one or more lines are too long
Binary file not shown.

Before

Width:  |  Height:  |  Size: 989 B

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="_レイヤー_1" data-name="レイヤー 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
<defs>
<style>
.cls-1 {
fill: rgba(147, 147, 147, .85);
}
</style>
</defs>
<path class="cls-1" d="M38.37,46.07l-13.02,16.29c-1.93,2.39-4.98.82-3.87-2.1l8.38-22.69,8.51,8.51ZM49.89,26.3c1.19,0,2.02.85,2.02,1.93,0,.65-.26,1.22-.74,1.82l-5.87,7.35-11.1-11.1h15.7ZM13.89,37.22c-1.19,0-2.05-.82-2.05-1.93,0-.63.28-1.19.77-1.82l5.84-7.3,11.06,11.06h-15.63ZM42.29,3.26l-8.4,22.74-8.52-8.52L38.43,1.19c1.93-2.42,4.95-.85,3.87,2.08Z"/>
<path class="cls-1" d="M51.79,54.76c.85.85,2.28.85,3.1,0,.85-.82.85-2.22,0-3.1L11.98,8.75c-.85-.85-2.3-.85-3.13,0-.82.82-.82,2.28,0,3.1l42.94,42.91Z"/>
</svg>

Before

Width:  |  Height:  |  Size: 769 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 832 B

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="_レイヤー_1" data-name="レイヤー 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
<defs>
<style>
.cls-1 {
fill: rgba(255, 255, 255, .85);
}
</style>
</defs>
<path class="cls-1" d="M11.88,35.28c0,1.11.85,1.93,2.05,1.93h16.07l-8.47,23.03c-1.11,2.93,1.93,4.49,3.84,2.1l25.85-32.31c.48-.6.74-1.17.74-1.82,0-1.08-.85-1.93-2.05-1.93h-16.07L42.31,3.26c1.11-2.93-1.93-4.49-3.84-2.08L12.62,33.46c-.48.63-.74,1.19-.74,1.82Z"/>
</svg>

Before

Width:  |  Height:  |  Size: 523 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

View File
-66
View File
@@ -1,66 +0,0 @@
<!DOCTYPE html>
<html lang="ja-JP">
<head>
<!--
$ curl https://nercone.dev/welcome/?lightweight=1
■ ■ ■■■■■ ■■■■ ■■■■ ■■■ ■ ■ ■■■■■
■■ ■ ■ ■ ■ ■ ■ ■ ■■ ■ ■
■■ ■ ■ ■ ■ ■ ■ ■ ■■ ■ ■
■ ■ ■ ■■■■ ■■■■ ■ ■ ■ ■ ■ ■ ■■■■
■ ■■ ■ ■ ■ ■ ■ ■ ■ ■■ ■
■ ■■ ■ ■ ■ ■ ■ ■ ■ ■■ ■
■ ■ ■■■■■ ■ ■ ■■■■ ■■■ ■ ■ ■■■■■
nercone.dev ({{ server_version }})
welcome to nercone.dev!
-->
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}nercone's website{% endblock %}</title>
<meta name="description" content="{% block description %}No description.{% endblock %}">
<!-- Favicons -->
<link rel="apple-touch-icon" href="https://assets.nercone.dev/images/favicon.png" sizes="1200x1200">
<link rel="icon" type="image/png" href="https://assets.nercone.dev/images/favicon.png" sizes="1200x1200">
<link rel="icon" type="image/svg+xml" href="https://assets.nercone.dev/images/favicon.svg" sizes="1200x1200">
<!-- Stylesheets / Scripts -->
<script src="https://assets.nercone.dev/js/script.js" defer></script>
<link rel="stylesheet" href="https://assets.nercone.dev/css/style.css">
{% block extra_head %}{% endblock %}
</head>
<body>
<div id="cursor"></div>
<header class="flex">
<div class="flex-1 flex">
<a href="/" class="text-no-decoration text-white" style="gap: 8px;">{% block title_prefix %}{% endblock %} <span class="font-bold">Nercone</span> {% block title_suffix %}{% endblock %}</a>
<p class="hide show-on-medium show-on-large">{% block header_desc %}<a href="/daily-quote/" class="text-no-decoration">{{ get_daily_quote() }}</a>{% endblock %}</p>
</div>
<div class="flex">
<a href="/access-counter/" class="text-no-decoration hide show-on-medium show-on-large">あなたは{{ get_access_count() }}番目の訪問者です。</a>
<a href="?lightweight=0" class="hide show-on-small"><img alt="lightweight-mode" src="https://assets.nercone.dev/images/icons/lightweight-mode.svg" class="small-icon"></a>
</div>
</header>
<main>{% block content %}{% endblock %}</main>
<footer class="flex text-light-grey-alt">
<div class="flex-1 flex">
<a href="/" class="text-no-decoration hide show-on-medium show-on-large font-bold">nercone.dev</a>
<a href="/about/" class="text-no-decoration bold-on-small">about</a>
<a href="/links/" class="text-no-decoration bold-on-small">links</a>
<a href="/projects/" class="text-no-decoration bold-on-small">projects</a>
<a href="{{ onion_site_url }}" class="text-no-decoration hide show-on-large">onion</a>
<a href="mailto:nercone@nercone.dev" class="text-no-decoration hide show-on-large">email</a>
<a href="/public-key/" class="text-no-decoration hide show-on-large">public-key</a>
<a href="/vulnerability-reporters/" class="text-no-decoration hide show-on-large">vulnerability-reporters</a>
<a href="?lightweight=0" class="text-no-decoration hide show-on-medium show-on-large font-bold">lightweight-mode</a>
</div>
<div class="flex">
<a href="https://github.com/nercone-dev/"><img alt="github" src="https://assets.nercone.dev/images/icons/github.svg" class="small-icon"></a>
<a href="https://orcid.org/0009-0001-3615-0962/"><img alt="orcid" src="https://assets.nercone.dev/images/icons/orcid.svg" class="small-icon">
<a href="https://twitter.com/nercone_x/"><img alt="twitter" src="https://assets.nercone.dev/images/icons/twitter.svg" class="small-icon">
<a href="https://qiita.com/DiamondGotCat/"><img alt="qiita" src="https://assets.nercone.dev/images/icons/qiita.svg" class="small-icon">
<a href="https://zenn.dev/techcat56/"><img alt="zenn" src="https://assets.nercone.dev/images/icons/zenn.svg" class="small-icon">
<!-- qiita kotonai -->
<a href="/server-version/" class="font-bold text-no-decoration hide show-on-medium show-on-large">{{ server_version }}</a>
</div>
</footer>
</body>
</html>
+7 -11
View File
@@ -43,10 +43,8 @@
<link rel="icon" type="image/png" href="https://assets.nercone.dev/images/favicon.png" sizes="1200x1200"> <link rel="icon" type="image/png" href="https://assets.nercone.dev/images/favicon.png" sizes="1200x1200">
<link rel="icon" type="image/svg+xml" href="https://assets.nercone.dev/images/favicon.svg" sizes="1200x1200"> <link rel="icon" type="image/svg+xml" href="https://assets.nercone.dev/images/favicon.svg" sizes="1200x1200">
<!-- Stylesheets / Scripts --> <!-- Stylesheets / Scripts -->
<script src="https://assets.nercone.dev/js/script.js" defer></script> <script src="https://assets.nercone.dev/js/main.js" defer></script>
<script src="https://assets.nercone.dev/js/script-extra.js" defer></script> <link rel="stylesheet" href="https://assets.nercone.dev/css/main.css">
<link rel="stylesheet" href="https://assets.nercone.dev/css/style.css">
<link rel="stylesheet" href="https://assets.nercone.dev/css/style-extra.css">
<!-- External Stylesheets / Scripts --> <!-- External Stylesheets / Scripts -->
<link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
@@ -69,7 +67,6 @@
</div> </div>
<div class="flex"> <div class="flex">
<a href="/access-counter/" class="text-no-decoration hide show-on-medium show-on-large">あなたは{{ get_access_count() }}番目の訪問者です。</a> <a href="/access-counter/" class="text-no-decoration hide show-on-medium show-on-large">あなたは{{ get_access_count() }}番目の訪問者です。</a>
<a href="?lightweight=1" class="hide show-on-small"><img alt="lightweight-mode" src="https://assets.nercone.dev/images/icons/lightweight-mode-false.svg" class="small-icon"></a>
</div> </div>
</header> </header>
{% endblock %} {% endblock %}
@@ -86,16 +83,15 @@
<a href="mailto:nercone@nercone.dev" class="text-no-decoration hide show-on-large">email</a> <a href="mailto:nercone@nercone.dev" class="text-no-decoration hide show-on-large">email</a>
<a href="/public-key/" class="text-no-decoration hide show-on-large">public-key</a> <a href="/public-key/" class="text-no-decoration hide show-on-large">public-key</a>
<a href="/vulnerability-reporters/" class="text-no-decoration hide show-on-large">vulnerability-reporters</a> <a href="/vulnerability-reporters/" class="text-no-decoration hide show-on-large">vulnerability-reporters</a>
<a href="?lightweight=1" class="text-no-decoration hide show-on-medium show-on-large">lightweight-mode</a>
{% block extra_footer_links %}{% endblock %} {% block extra_footer_links %}{% endblock %}
{% endblock %} {% endblock %}
</div> </div>
<div class="flex"> <div class="flex">
<a href="https://github.com/nercone-dev/"><img alt="github" src="https://assets.nercone.dev/images/icons/github.svg" class="small-icon"></a> <a href="https://nercone.dev/github/"><img alt="github" src="https://assets.nercone.dev/images/icons/github.svg" class="small-icon"></a>
<a href="https://orcid.org/0009-0001-3615-0962/"><img alt="orcid" src="https://assets.nercone.dev/images/icons/orcid.svg" class="small-icon"> <a href="https://nercone.dev/orcid/"><img alt="orcid" src="https://assets.nercone.dev/images/icons/orcid.svg" class="small-icon">
<a href="https://twitter.com/nercone_x/"><img alt="twitter" src="https://assets.nercone.dev/images/icons/twitter.svg" class="small-icon"> <a href="https://nercone.dev/twitter/"><img alt="twitter" src="https://assets.nercone.dev/images/icons/twitter.svg" class="small-icon">
<a href="https://qiita.com/DiamondGotCat/"><img alt="qiita" src="https://assets.nercone.dev/images/icons/qiita.svg" class="small-icon"> <a href="https://nercone.dev/qiita/"><img alt="qiita" src="https://assets.nercone.dev/images/icons/qiita.svg" class="small-icon">
<a href="https://zenn.dev/techcat56/"><img alt="zenn" src="https://assets.nercone.dev/images/icons/zenn.svg" class="small-icon"> <a href="https://nercone.dev/zenn/"><img alt="zenn" src="https://assets.nercone.dev/images/icons/zenn.svg" class="small-icon">
<!-- qiita kotonai --> <!-- qiita kotonai -->
<a href="/server-version/" class="font-bold text-no-decoration hide show-on-medium show-on-large">{{ server_version }}</a> <a href="/server-version/" class="font-bold text-no-decoration hide show-on-medium show-on-large">{{ server_version }}</a>
</div> </div>
+4 -1
View File
@@ -4,7 +4,10 @@
"twitter": {"type": "redirect", "content": "https://twitter.com/nercone_x/"}, "twitter": {"type": "redirect", "content": "https://twitter.com/nercone_x/"},
"bluesky": {"type": "redirect", "content": "https://bsky.app/profile/nercone.dev/"}, "bluesky": {"type": "redirect", "content": "https://bsky.app/profile/nercone.dev/"},
"youtube": {"type": "redirect", "content": "https://youtube.com/@nercone-ch/"}, "youtube": {"type": "redirect", "content": "https://youtube.com/@nercone-ch/"},
"nicovideo": {"type": "redirect", "content": "https://nicovideo.jp/user/132818887/"},
"gitea": {"type": "redirect", "content": "https://gitea.nercone.dev/nercone-dev/"}, "gitea": {"type": "redirect", "content": "https://gitea.nercone.dev/nercone-dev/"},
"orcid": {"type": "redirect", "content": "https://orcid.org/0009-0001-3615-0962/"}, "qiita": {"type": "redirect", "content": "https://orcid.org/0009-0001-3615-0962/"},
"zenn": {"type": "redirect", "content": "https://qiita.com/DiamondGotCat/"},
"orcid": {"type": "redirect", "content": "https://zenn.dev/techcat56/"},
"justuuid": {"type": "redirect", "content": "https://justuuid.pages.dev/u/7b70a75e-d72f-4bba-8e55-1c3c9e032678/"} "justuuid": {"type": "redirect", "content": "https://justuuid.pages.dev/u/7b70a75e-d72f-4bba-8e55-1c3c9e032678/"}
} }
-1
View File
@@ -4,7 +4,6 @@
{% block header_desc %}These people found and pointed out security vulnerabilities in my system/service.{% endblock %} {% block header_desc %}These people found and pointed out security vulnerabilities in my system/service.{% endblock %}
{% block description %}People who found and pointed out security vulnerabilities in my system/service{% endblock %} {% block description %}People who found and pointed out security vulnerabilities in my system/service{% endblock %}
{% block content %} {% block content %}
<p class="font-small font-bold"><a href="/.well-known/security.txt" class="text-no-decoration">← security.txt</a></p>
<h3>Thank you for Helping!</h3> <h3>Thank you for Helping!</h3>
<p>These people found and pointed out security vulnerabilities in my system/service.</p> <p>These people found and pointed out security vulnerabilities in my system/service.</p>
<p>As I'm just a student, I occasionally overlook vulnerabilities while writing code.</p> <p>As I'm just a student, I occasionally overlook vulnerabilities while writing code.</p>
+3 -49
View File
@@ -162,28 +162,6 @@ async def default_response(request: Request, full_path: str) -> Response:
markdown_mode = True markdown_mode = True
full_path = full_path[:-3] + ".html" full_path = full_path[:-3] + ".html"
lightweight_query = request.query_params.get("lightweight", "").lower()
lightweight_header = request.headers.get("lightweight", "").lower()
lightweight_signal = lightweight_query or lightweight_header
if lightweight_signal in ["1", "y", "yes", "true"]:
lightweight_mode = True
elif lightweight_signal in ["0", "n", "no", "false"]:
lightweight_mode = False
else:
lightweight_mode = request.cookies.get("lightweight_mode", "") == "true"
donotcount_query = request.query_params.get("donotcount", "").lower()
donotcount_header = request.headers.get("donotcount", "").lower()
donotcount_signal = donotcount_query or donotcount_header
if donotcount_signal in ["1", "y", "yes", "true"]:
donotcount_mode = True
elif donotcount_signal in ["0", "n", "no", "false"]:
donotcount_mode = False
else:
donotcount_mode = request.cookies.get("donotcount_mode", "") == "true"
if full_path in ["", "/"]: if full_path in ["", "/"]:
template_candidates = ["index.html"] template_candidates = ["index.html"]
elif full_path.endswith(".html"): elif full_path.endswith(".html"):
@@ -199,24 +177,10 @@ async def default_response(request: Request, full_path: str) -> Response:
main = str(soup.find("main")) if soup.find("main") else content main = str(soup.find("main")) if soup.find("main") else content
markdown = markitdown.convert_stream(io.BytesIO(main.encode("utf-8")), file_extension=".html") markdown = markitdown.convert_stream(io.BytesIO(main.encode("utf-8")), file_extension=".html")
response = PlainTextResponse(markdown.text_content, status_code=200, media_type="text/markdown") response = PlainTextResponse(markdown.text_content, status_code=200, media_type="text/markdown")
else:
if lightweight_mode:
source = templates.env.loader.get_source(templates.env, name)[0]
source = source.replace('{% extends "/base.html" %}', '{% extends "/base-light.html" %}')
content = templates.env.from_string(source).render(request=request)
response = Response(content=content, status_code=200, media_type="text/html")
response.set_cookie("lightweight_mode", "true", samesite="lax")
else: else:
response = templates.TemplateResponse(status_code=200, request=request, name=name) response = templates.TemplateResponse(status_code=200, request=request, name=name)
if request.cookies.get("lightweight_mode", "") == "true":
response.set_cookie("lightweight_mode", "false", samesite="lax")
if donotcount_mode:
response.set_cookie("donotcount_mode", "true", samesite="lax")
elif request.cookies.get("donotcount_mode", "") == "true":
accesscounter.increase() accesscounter.increase()
response.set_cookie("donotcount_mode", "false", samesite="lax")
return response return response
except TemplateNotFound: except TemplateNotFound:
continue continue
@@ -252,25 +216,15 @@ async def default_response(request: Request, full_path: str) -> Response:
body = markdown[end+4:].lstrip("\n") body = markdown[end+4:].lstrip("\n")
html = htmlitdown(body) html = htmlitdown(body)
source = f'{{% extends "{"/base-light.html" if lightweight_mode else "/base.html"}" %}}\n' source = "{{% extends \"/base.html\" %}}\n"
for block in front: for block in front:
source += f'{{% block {block} %}}{front[block]}{{% endblock %}}\n' source += f"{{% block {block} %}}{front[block]}{{% endblock %}}\n"
source += f'{{% block content %}}\n{html}\n{{% endblock %}}\n' source += f"{{% block content %}}\n{html}\n{{% endblock %}}\n"
content = templates.env.from_string(source).render(request=request) content = templates.env.from_string(source).render(request=request)
response = Response(content=content, status_code=200, media_type="text/html") response = Response(content=content, status_code=200, media_type="text/html")
if lightweight_mode:
response.set_cookie("lightweight_mode", "true", samesite="lax")
elif request.cookies.get("lightweight_mode", "") == "true":
response.set_cookie("lightweight_mode", "false", samesite="lax")
if donotcount_mode:
response.set_cookie("donotcount_mode", "true", samesite="lax")
elif request.cookies.get("donotcount_mode", "") == "true":
accesscounter.increase() accesscounter.increase()
response.set_cookie("donotcount_mode", "false", samesite="lax")
return response return response
except FileNotFoundError: except FileNotFoundError:
continue continue