chore: simplify configs
This commit is contained in:
parent
57b8152f8d
commit
a3e889ff8a
@ -1,8 +1,7 @@
|
|||||||
import { defineConfig } from "vitepress";
|
import { defineConfig } from "vitepress";
|
||||||
import UnoCSS from "unocss/vite";
|
import UnoCSS from "unocss/vite";
|
||||||
import { presetUno, presetAttributify, presetIcons } from "unocss";
|
|
||||||
import consola from "consola";
|
import consola from "consola";
|
||||||
import { commitRef, feedback, meta, socials } from "./constants";
|
import { commitRef, feedback, meta, search, sidebar, socialLinks } from "./constants";
|
||||||
import { generateImages, generateMeta, generateFeed } from "./hooks";
|
import { generateImages, generateMeta, generateFeed } from "./hooks";
|
||||||
import { toggleStarredPlugin } from "./markdown/toggleStarred";
|
import { toggleStarredPlugin } from "./markdown/toggleStarred";
|
||||||
import { base64DecodePlugin } from "./markdown/base64";
|
import { base64DecodePlugin } from "./markdown/base64";
|
||||||
@ -17,7 +16,6 @@ export default defineConfig({
|
|||||||
appearance: "dark",
|
appearance: "dark",
|
||||||
srcExclude: ["readme.md", "single-page"],
|
srcExclude: ["readme.md", "single-page"],
|
||||||
ignoreDeadLinks: true,
|
ignoreDeadLinks: true,
|
||||||
metaChunk: true,
|
|
||||||
sitemap: {
|
sitemap: {
|
||||||
hostname: meta.hostname,
|
hostname: meta.hostname,
|
||||||
},
|
},
|
||||||
@ -43,28 +41,7 @@ export default defineConfig({
|
|||||||
vite: {
|
vite: {
|
||||||
plugins: [
|
plugins: [
|
||||||
UnoCSS({
|
UnoCSS({
|
||||||
theme: {
|
configFile: "../unocss.config.ts",
|
||||||
colors: {
|
|
||||||
primary: "var(--vp-c-brand-1)",
|
|
||||||
bg: "var(--vp-c-bg)",
|
|
||||||
"bg-alt": "var(--vp-c-bg-alt)",
|
|
||||||
"bg-elv": "var(--vp-c-bg-elv)",
|
|
||||||
text: "var(--vp-c-text-1)",
|
|
||||||
"text-2": "var(--vp-c-text-2)",
|
|
||||||
div: "var(--vp-c-divider)",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
presets: [
|
|
||||||
presetUno(),
|
|
||||||
presetAttributify(),
|
|
||||||
presetIcons({
|
|
||||||
scale: 1.2,
|
|
||||||
extraProperties: {
|
|
||||||
display: "inline-block",
|
|
||||||
"vertical-align": "middle",
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
build: {
|
build: {
|
||||||
@ -79,30 +56,7 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
themeConfig: {
|
themeConfig: {
|
||||||
search: {
|
search,
|
||||||
options: {
|
|
||||||
miniSearch: {
|
|
||||||
searchOptions: {
|
|
||||||
combineWith: "AND",
|
|
||||||
fuzzy: false,
|
|
||||||
// @ts-ignore
|
|
||||||
boostDocument: (_, term, storedFields: Record<string, string | string[]>) => {
|
|
||||||
const titles = (storedFields?.titles as string[])
|
|
||||||
.filter((t) => Boolean(t))
|
|
||||||
.map((t) => t.toLowerCase());
|
|
||||||
// Uprate if term appears in titles. Add bonus for higher levels (i.e. lower index)
|
|
||||||
const titleIndex =
|
|
||||||
titles.map((t, i) => (t?.includes(term) ? i : -1)).find((i) => i >= 0) ?? -1;
|
|
||||||
if (titleIndex >= 0) return 10000 - titleIndex;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
detailedView: true,
|
|
||||||
},
|
|
||||||
provider: "local",
|
|
||||||
},
|
|
||||||
footer: {
|
footer: {
|
||||||
message: `${feedback} (rev: ${commitRef})`,
|
message: `${feedback} (rev: ${commitRef})`,
|
||||||
},
|
},
|
||||||
@ -114,48 +68,7 @@ export default defineConfig({
|
|||||||
{ text: "Guides", link: "https://rentry.co/fmhy-guides" },
|
{ text: "Guides", link: "https://rentry.co/fmhy-guides" },
|
||||||
{ text: "Backups", link: "https://www.reddit.com/r/FREEMEDIAHECKYEAH/wiki/backups" },
|
{ text: "Backups", link: "https://www.reddit.com/r/FREEMEDIAHECKYEAH/wiki/backups" },
|
||||||
],
|
],
|
||||||
sidebar: [
|
sidebar,
|
||||||
{ text: "📛 Adblocking / Privacy", link: "/adblockvpnguide" },
|
socialLinks,
|
||||||
{ text: "🤖 Artificial Intelligence", link: "/ai" },
|
|
||||||
{ text: "📺 Movies / TV / Anime", link: "/videopiracyguide" },
|
|
||||||
{ text: "🎵 Music / Podcasts / Radio", link: "/audiopiracyguide" },
|
|
||||||
{ text: "🎮 Gaming / Emulation", link: "/gamingpiracyguide" },
|
|
||||||
{ text: "📗 Books / Comics / Manga", link: "/readingpiracyguide" },
|
|
||||||
{ text: "💾 Downloading", link: "/downloadpiracyguide" },
|
|
||||||
{ text: "🌀 Torrenting", link: "/torrentpiracyguide" },
|
|
||||||
{ text: "🧠 Educational", link: "/edupiracyguide" },
|
|
||||||
{ text: "📱 Android / iOS", link: "/android-iosguide" },
|
|
||||||
{ text: "🐧 Linux / MacOS", link: "/linuxguide" },
|
|
||||||
{ text: "🌍 Non-English", link: "/non-english" },
|
|
||||||
{ text: "📂 Miscellaneous", link: "/miscguide" },
|
|
||||||
{
|
|
||||||
text: "🔧 Tools",
|
|
||||||
collapsed: false,
|
|
||||||
items: [
|
|
||||||
{ text: "💻 System Tools", link: "/system-tools" },
|
|
||||||
{ text: "🗃️ File Tools", link: "/file-tools" },
|
|
||||||
{ text: "🔗 Internet Tools", link: "/internet-tools" },
|
|
||||||
{ text: "💬 Social Media Tools", link: "/social-media-tools" },
|
|
||||||
{ text: "📝 Text Tools", link: "/text-tools" },
|
|
||||||
{ text: "👾 Gaming Tools", link: "/gamingpiracyguide#gaming-tools" },
|
|
||||||
{ text: "📷 Image Tools", link: "/img-tools" },
|
|
||||||
{ text: "📼 Video Tools", link: "/video-tools" },
|
|
||||||
{ text: "🔊 Audio Tools", link: "/audiopiracyguide#audio-tools" },
|
|
||||||
{ text: "🍎 Educational Tools", link: "/edupiracyguide#educational-tools" },
|
|
||||||
{ text: "👨💻 Developer Tools", link: "/devtools" },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: "➕️ More",
|
|
||||||
collapsed: true,
|
|
||||||
items: [
|
|
||||||
{ text: "🔞 NSFW", link: "/nsfwpiracy" },
|
|
||||||
{ text: "⚠️ Unsafe Sites", link: "/unsafesites" },
|
|
||||||
{ text: "🔑 Base64", link: "/base64" },
|
|
||||||
{ text: "📦 Storage", link: "/storage" },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
socialLinks: socials,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -7,12 +7,7 @@ export const meta = {
|
|||||||
keywords: ["stream", "movies", "gaming", "reading", "anime"],
|
keywords: ["stream", "movies", "gaming", "reading", "anime"],
|
||||||
};
|
};
|
||||||
|
|
||||||
// Netlify to Cloudflare otherwise dev
|
export const commitRef = process.env.CF_PAGES
|
||||||
export const commitRef = process.env.COMMIT_REF
|
|
||||||
? `<a href="https://github.com/fmhy/FMHYEdit/commit/${
|
|
||||||
process.env.COMMIT_REF
|
|
||||||
}">${process.env.COMMIT_REF.slice(0, 8)}</a>`
|
|
||||||
: process.env.CF_PAGES
|
|
||||||
? `<a href="https://github.com/fmhy/FMHYEdit/commit/${
|
? `<a href="https://github.com/fmhy/FMHYEdit/commit/${
|
||||||
process.env.CF_PAGES_COMMIT_SHA
|
process.env.CF_PAGES_COMMIT_SHA
|
||||||
}">${process.env.CF_PAGES_COMMIT_SHA.slice(0, 8)}</a>`
|
}">${process.env.CF_PAGES_COMMIT_SHA.slice(0, 8)}</a>`
|
||||||
@ -20,7 +15,32 @@ export const commitRef = process.env.COMMIT_REF
|
|||||||
|
|
||||||
export const feedback = `<a href="/feedback" class="feedback-footer">Made with ❤️</a>`;
|
export const feedback = `<a href="/feedback" class="feedback-footer">Made with ❤️</a>`;
|
||||||
|
|
||||||
export const socials: DefaultTheme.SocialLink[] = [
|
export const search: DefaultTheme.Config["search"] = {
|
||||||
|
options: {
|
||||||
|
miniSearch: {
|
||||||
|
searchOptions: {
|
||||||
|
combineWith: "AND",
|
||||||
|
fuzzy: false,
|
||||||
|
// @ts-ignore
|
||||||
|
boostDocument: (_, term, storedFields: Record<string, string | string[]>) => {
|
||||||
|
const titles = (storedFields?.titles as string[])
|
||||||
|
.filter((t) => Boolean(t))
|
||||||
|
.map((t) => t.toLowerCase());
|
||||||
|
// Uprate if term appears in titles. Add bonus for higher levels (i.e. lower index)
|
||||||
|
const titleIndex =
|
||||||
|
titles.map((t, i) => (t?.includes(term) ? i : -1)).find((i) => i >= 0) ?? -1;
|
||||||
|
if (titleIndex >= 0) return 10000 - titleIndex;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
detailedView: true,
|
||||||
|
},
|
||||||
|
provider: "local",
|
||||||
|
};
|
||||||
|
|
||||||
|
export const socialLinks: DefaultTheme.SocialLink[] = [
|
||||||
{ icon: "github", link: "https://github.com/fmhy/FMHYEdit" },
|
{ icon: "github", link: "https://github.com/fmhy/FMHYEdit" },
|
||||||
{ icon: "discord", link: "https://discord.gg/Stz6y6NgNg" },
|
{ icon: "discord", link: "https://discord.gg/Stz6y6NgNg" },
|
||||||
{
|
{
|
||||||
@ -31,3 +51,46 @@ export const socials: DefaultTheme.SocialLink[] = [
|
|||||||
link: "https://reddit.com/r/FREEMEDIAHECKYEAH",
|
link: "https://reddit.com/r/FREEMEDIAHECKYEAH",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
export const sidebar: DefaultTheme.Sidebar = [
|
||||||
|
{ text: "📛 Adblocking / Privacy", link: "/adblockvpnguide" },
|
||||||
|
{ text: "🤖 Artificial Intelligence", link: "/ai" },
|
||||||
|
{ text: "📺 Movies / TV / Anime", link: "/videopiracyguide" },
|
||||||
|
{ text: "🎵 Music / Podcasts / Radio", link: "/audiopiracyguide" },
|
||||||
|
{ text: "🎮 Gaming / Emulation", link: "/gamingpiracyguide" },
|
||||||
|
{ text: "📗 Books / Comics / Manga", link: "/readingpiracyguide" },
|
||||||
|
{ text: "💾 Downloading", link: "/downloadpiracyguide" },
|
||||||
|
{ text: "🌀 Torrenting", link: "/torrentpiracyguide" },
|
||||||
|
{ text: "🧠 Educational", link: "/edupiracyguide" },
|
||||||
|
{ text: "📱 Android / iOS", link: "/android-iosguide" },
|
||||||
|
{ text: "🐧 Linux / MacOS", link: "/linuxguide" },
|
||||||
|
{ text: "🌍 Non-English", link: "/non-english" },
|
||||||
|
{ text: "📂 Miscellaneous", link: "/miscguide" },
|
||||||
|
{
|
||||||
|
text: "🔧 Tools",
|
||||||
|
collapsed: false,
|
||||||
|
items: [
|
||||||
|
{ text: "💻 System Tools", link: "/system-tools" },
|
||||||
|
{ text: "🗃️ File Tools", link: "/file-tools" },
|
||||||
|
{ text: "🔗 Internet Tools", link: "/internet-tools" },
|
||||||
|
{ text: "💬 Social Media Tools", link: "/social-media-tools" },
|
||||||
|
{ text: "📝 Text Tools", link: "/text-tools" },
|
||||||
|
{ text: "👾 Gaming Tools", link: "/gamingpiracyguide#gaming-tools" },
|
||||||
|
{ text: "📷 Image Tools", link: "/img-tools" },
|
||||||
|
{ text: "📼 Video Tools", link: "/video-tools" },
|
||||||
|
{ text: "🔊 Audio Tools", link: "/audiopiracyguide#audio-tools" },
|
||||||
|
{ text: "🍎 Educational Tools", link: "/edupiracyguide#educational-tools" },
|
||||||
|
{ text: "👨💻 Developer Tools", link: "/devtools" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: "➕️ More",
|
||||||
|
collapsed: true,
|
||||||
|
items: [
|
||||||
|
{ text: "🔞 NSFW", link: "/nsfwpiracy" },
|
||||||
|
{ text: "⚠️ Unsafe Sites", link: "/unsafesites" },
|
||||||
|
{ text: "🔑 Base64", link: "/base64" },
|
||||||
|
{ text: "📦 Storage", link: "/storage" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
26
unocss.config.ts
Normal file
26
unocss.config.ts
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import { defineConfig, presetUno, presetAttributify, presetIcons } from "unocss";
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
theme: {
|
||||||
|
colors: {
|
||||||
|
primary: "var(--vp-c-brand-1)",
|
||||||
|
bg: "var(--vp-c-bg)",
|
||||||
|
"bg-alt": "var(--vp-c-bg-alt)",
|
||||||
|
"bg-elv": "var(--vp-c-bg-elv)",
|
||||||
|
text: "var(--vp-c-text-1)",
|
||||||
|
"text-2": "var(--vp-c-text-2)",
|
||||||
|
div: "var(--vp-c-divider)",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
presets: [
|
||||||
|
presetUno(),
|
||||||
|
presetAttributify(),
|
||||||
|
presetIcons({
|
||||||
|
scale: 1.2,
|
||||||
|
extraProperties: {
|
||||||
|
display: "inline-block",
|
||||||
|
"vertical-align": "middle",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user