base64 decode, announcement pill

This commit is contained in:
taskylizard 2023-11-05 21:16:17 +05:30
parent 34c1f13d8b
commit b80e26444d
No known key found for this signature in database
GPG Key ID: 5CABA3D642DDC497
10 changed files with 159 additions and 17 deletions

View File

@ -19,7 +19,7 @@ headersData = {
"TOOLSGuide.md": ["Tools", "General Tools, Internet Tools, System Tools"], "TOOLSGuide.md": ["Tools", "General Tools, Internet Tools, System Tools"],
"TorrentPiracyGuide.md": ["Torrenting", "Torrent Clients, Torrent Sites, Trackers"], "TorrentPiracyGuide.md": ["Torrenting", "Torrent Clients, Torrent Sites, Trackers"],
"VideoPiracyGuide.md": ["Movies / TV / Anime", "Stream Videos, Download Videos, Torrent Videos"], "VideoPiracyGuide.md": ["Movies / TV / Anime", "Stream Videos, Download Videos, Torrent Videos"],
"base64.md": ["", ""], "base64.md": ["base64", "Base64 storage"],
"img-tools.md": ["Image Tools", ""], "img-tools.md": ["Image Tools", ""],
"UnsafeSites.md": ["Unsafe Sites", ""] "UnsafeSites.md": ["Unsafe Sites", ""]
} }

View File

@ -6,6 +6,7 @@ import { commitRef, meta } from "./constants";
import { pwa } from "./pwa"; import { pwa } from "./pwa";
import { generateMeta } from "./hooks/meta"; import { generateMeta } from "./hooks/meta";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
import { copyableCodePlugin } from "./markdown";
export default defineConfig({ export default defineConfig({
title: "FMHY", title: "FMHY",
@ -63,8 +64,13 @@ export default defineConfig({
new URL("./theme/components/ThemeSwitch.vue", import.meta.url), new URL("./theme/components/ThemeSwitch.vue", import.meta.url),
), ),
}, },
] ],
} },
},
markdown: {
config(md) {
md.use(copyableCodePlugin);
},
}, },
themeConfig: { themeConfig: {
search: { search: {

26
.vitepress/markdown.ts Normal file
View File

@ -0,0 +1,26 @@
import { type MarkdownRenderer } from "vitepress";
// FIXME: tasky: possibly write less horror jank?
export function copyableCodePlugin(md: MarkdownRenderer) {
const decode = (str: string): string => Buffer.from(str, "base64").toString("binary");
// Save the original rule for backticks
const defaultRender =
md.renderer.rules.code_inline ||
function(tokens, idx, options, env, self) {
return self.renderToken(tokens, idx, options);
};
md.renderer.rules.code_inline = function(tokens, idx, options, env, self) {
// @ts-expect-error shut the fuck up already I HATE THIS
if (!env.frontmatter.title || (env.frontmatter.title && !env.frontmatter.title === "base64")) {
return defaultRender(tokens, idx, options, env, self);
}
const token = tokens[idx];
const content = token.content;
const buttonHTML = `<button class='base64' onclick="navigator.clipboard.writeText('${decode(
content,
)}')"><code>${content}</code></button>`;
return buttonHTML;
};
}

View File

@ -1,6 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import DefaultTheme from "vitepress/theme"; import DefaultTheme from "vitepress/theme";
import Sidebar from "./components/SidebarCard.vue"; import Sidebar from "./components/SidebarCard.vue";
import Announcement from "./components/Announcement.vue";
const { Layout } = DefaultTheme; const { Layout } = DefaultTheme;
</script> </script>
@ -10,9 +11,9 @@ const { Layout } = DefaultTheme;
<template #sidebar-nav-after> <template #sidebar-nav-after>
<Sidebar /> <Sidebar />
</template> </template>
<template> <template #home-hero-prelink>
<Content /> <Announcement />
</template> </template>
<Content />
</Layout> </Layout>
</template> </template>

View File

@ -0,0 +1,15 @@
<script setup lang="ts">
import { useData } from "vitepress";
const { frontmatter } = useData();
</script>
<template>
<a
v-if="frontmatter.hero.prelink"
:href="frontmatter.hero.prelink.link"
target="_blank"
class="inline-flex items-center rounded-lg bg-[var(--vp-c-default-soft)] px-4 py-1 text-sm font-semibold mb-3">
{{ frontmatter.hero.prelink.title }}
</a>
</template>

View File

@ -93,6 +93,20 @@
background-color: var(--vp-button-brand-bg); background-color: var(--vp-button-brand-bg);
} }
.VPFooter a {
text-decoration-line: underline;
text-decoration-style: dashed;
text-underline-offset: 5px;
transition: 0.3s;
}
.VPFooter a:hover {
color: var(--vp-c-text-1);
text-decoration-line: underline;
text-decoration-style: dashed;
text-underline-offset: 5px;
}
/* Custom scrollbar */ /* Custom scrollbar */
.VPSidebar::-webkit-scrollbar { .VPSidebar::-webkit-scrollbar {
block-size: 4px; block-size: 4px;
@ -123,3 +137,9 @@
--vp-home-hero-image-filter: blur(68px); --vp-home-hero-image-filter: blur(68px);
} }
} }
.base64 {
min-width: 100%;
width: 0px;
white-space: pre-wrap;
}

View File

@ -6,6 +6,9 @@ hero:
name: "FMHY" name: "FMHY"
text: "freemediaheckyeah" text: "freemediaheckyeah"
tagline: The Largest Collection Of Free Stuff On The Internet! tagline: The Largest Collection Of Free Stuff On The Internet!
prelink:
title: 🎉 New website!
link: https://tenor.com/view/mauzimice-mauzymice-mauzy-mice-boykisser-cute-gif-16690839224429433467
image: image:
src: /test.png src: /test.png
alt: FMHY Icon alt: FMHY Icon

View File

@ -19,7 +19,7 @@
"nitropack": "latest", "nitropack": "latest",
"pathe": "^1.1.1", "pathe": "^1.1.1",
"unocss": "^0.57.1", "unocss": "^0.57.1",
"vitepress": "1.0.0-rc.24", "vitepress": "1.0.0-rc.25",
"vue": "^3.3.7", "vue": "^3.3.7",
"workbox-window": "^7.0.0" "workbox-window": "^7.0.0"
}, },
@ -29,5 +29,10 @@
"@types/node": "^20.8.9", "@types/node": "^20.8.9",
"@vite-pwa/vitepress": "^0.2.3", "@vite-pwa/vitepress": "^0.2.3",
"prettier": "^3.0.3" "prettier": "^3.0.3"
},
"pnpm": {
"patchedDependencies": {
"vitepress@1.0.0-rc.25": "patches/vitepress@1.0.0-rc.25.patch"
}
} }
} }

View File

@ -0,0 +1,60 @@
diff --git a/dist/client/theme-default/Layout.vue b/dist/client/theme-default/Layout.vue
index 0ecca7ecd6f7e5ab4d576ecaf0cbc8578291a94f..32c9d80e564c42b817950ee2a1c69d62e6b304a3 100644
--- a/dist/client/theme-default/Layout.vue
+++ b/dist/client/theme-default/Layout.vue
@@ -56,6 +56,7 @@ provide('hero-image-slot-exists', heroImageSlotExists)
<template #not-found><slot name="not-found" /></template>
<template #home-hero-before><slot name="home-hero-before" /></template>
+ <template #home-hero-prelink><slot name="home-hero-prelink" /></template>
<template #home-hero-info><slot name="home-hero-info" /></template>
<template #home-hero-image><slot name="home-hero-image" /></template>
<template #home-hero-after><slot name="home-hero-after" /></template>
diff --git a/dist/client/theme-default/components/VPContent.vue b/dist/client/theme-default/components/VPContent.vue
index a1479dc693a8261b30b88663ba1de523cceaf877..1f49bab3aed371b5e8cf12e11870c503da2a9872 100644
--- a/dist/client/theme-default/components/VPContent.vue
+++ b/dist/client/theme-default/components/VPContent.vue
@@ -28,6 +28,7 @@ const { hasSidebar } = useSidebar()
<VPHome v-else-if="frontmatter.layout === 'home'">
<template #home-hero-before><slot name="home-hero-before" /></template>
+ <template #home-hero-prelink><slot name="home-hero-prelink" /></template>
<template #home-hero-info><slot name="home-hero-info" /></template>
<template #home-hero-image><slot name="home-hero-image" /></template>
<template #home-hero-after><slot name="home-hero-after" /></template>
diff --git a/dist/client/theme-default/components/VPHero.vue b/dist/client/theme-default/components/VPHero.vue
index 659c3dbfd36e9fcaf08b659c84c2eb378e8b49f8..2650a2b97e6d0c96f6bf56b478ece2f0c5663101 100644
--- a/dist/client/theme-default/components/VPHero.vue
+++ b/dist/client/theme-default/components/VPHero.vue
@@ -25,6 +25,7 @@ const heroImageSlotExists = inject('hero-image-slot-exists') as Ref<boolean>
<div class="VPHero" :class="{ 'has-image': image || heroImageSlotExists }">
<div class="container">
<div class="main">
+ <slot name="home-hero-prelink"></slot>
<slot name="home-hero-info">
<h1 v-if="name" class="name">
<span v-html="name" class="clip"></span>
diff --git a/dist/client/theme-default/components/VPHome.vue b/dist/client/theme-default/components/VPHome.vue
index a4cda402bf7fde02c1e58b85c5d47daec458220e..d87e6fc69bd6d4b40f12b2fee90d385549583820 100644
--- a/dist/client/theme-default/components/VPHome.vue
+++ b/dist/client/theme-default/components/VPHome.vue
@@ -7,6 +7,7 @@ import VPHomeFeatures from './VPHomeFeatures.vue'
<div class="VPHome">
<slot name="home-hero-before" />
<VPHomeHero>
+ <template #home-hero-prelink><slot name="home-hero-prelink" /></template>
<template #home-hero-info><slot name="home-hero-info" /></template>
<template #home-hero-image><slot name="home-hero-image" /></template>
</VPHomeHero>
diff --git a/dist/client/theme-default/components/VPHomeHero.vue b/dist/client/theme-default/components/VPHomeHero.vue
index 5d482944ff62330939c963f43d71c788e88afa4e..a486fe63bfb4f7e41bcbf3e070ef57e8806cf9a9 100644
--- a/dist/client/theme-default/components/VPHomeHero.vue
+++ b/dist/client/theme-default/components/VPHomeHero.vue
@@ -15,6 +15,7 @@ const { frontmatter: fm } = useData()
:image="fm.hero.image"
:actions="fm.hero.actions"
>
+ <template #home-hero-prelink><slot name="home-hero-prelink" /></template>
<template #home-hero-info><slot name="home-hero-info" /></template>
<template #home-hero-image><slot name="home-hero-image" /></template>
</VPHero>

14
pnpm-lock.yaml generated
View File

@ -4,6 +4,11 @@ settings:
autoInstallPeers: true autoInstallPeers: true
excludeLinksFromLockfile: false excludeLinksFromLockfile: false
patchedDependencies:
vitepress@1.0.0-rc.25:
hash: 3rmcuf2hcpfiqvpp6fmjf4ydmq
path: patches/vitepress@1.0.0-rc.25.patch
dependencies: dependencies:
fast-glob: fast-glob:
specifier: ^3.3.1 specifier: ^3.3.1
@ -21,8 +26,8 @@ dependencies:
specifier: ^0.57.1 specifier: ^0.57.1
version: 0.57.1(postcss@8.4.31)(rollup@2.79.1)(vite@4.5.0) version: 0.57.1(postcss@8.4.31)(rollup@2.79.1)(vite@4.5.0)
vitepress: vitepress:
specifier: 1.0.0-rc.24 specifier: 1.0.0-rc.25
version: 1.0.0-rc.24(@algolia/client-search@4.20.0)(@types/node@20.8.9)(postcss@8.4.31)(search-insights@2.9.0) version: 1.0.0-rc.25(patch_hash=3rmcuf2hcpfiqvpp6fmjf4ydmq)(@algolia/client-search@4.20.0)(@types/node@20.8.9)(postcss@8.4.31)(search-insights@2.9.0)
vue: vue:
specifier: ^3.3.7 specifier: ^3.3.7
version: 3.3.7 version: 3.3.7
@ -5769,8 +5774,8 @@ packages:
optionalDependencies: optionalDependencies:
fsevents: 2.3.3 fsevents: 2.3.3
/vitepress@1.0.0-rc.24(@algolia/client-search@4.20.0)(@types/node@20.8.9)(postcss@8.4.31)(search-insights@2.9.0): /vitepress@1.0.0-rc.25(patch_hash=3rmcuf2hcpfiqvpp6fmjf4ydmq)(@algolia/client-search@4.20.0)(@types/node@20.8.9)(postcss@8.4.31)(search-insights@2.9.0):
resolution: {integrity: sha512-RpnL8cnOGwiRlBbrYQUm9sYkJbtyOt/wYXk2diTcokY4yvks/5lq9LuSt+MURWB6ZqwpSNHvTmxgaSfLoG0/OA==} resolution: {integrity: sha512-1dqWiHNThNrVZ08ixmfEDBEH+764KOgnev9oXga/x6cN++Vb9pnuu8p3K6DQP+KZrYcG+WiX7jxal0iSNpAWuQ==}
hasBin: true hasBin: true
peerDependencies: peerDependencies:
markdown-it-mathjax3: ^4.3.2 markdown-it-mathjax3: ^4.3.2
@ -5822,6 +5827,7 @@ packages:
- typescript - typescript
- universal-cookie - universal-cookie
dev: false dev: false
patched: true
/vscode-oniguruma@1.7.0: /vscode-oniguruma@1.7.0:
resolution: {integrity: sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==} resolution: {integrity: sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==}