/**
Copyright (c) taskylizard. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import type { DefaultTheme } from 'vitepress'
import { transform, transformGuide } from './transformer'
// @unocss-include
export const meta = {
name: 'freemediaheckyeah',
description: 'The largest collection of free stuff on the internet!',
hostname: 'https://fmhy.net',
keywords: ['stream', 'movies', 'gaming', 'reading', 'anime']
}
export const commitRef =
process.env.CF_PAGES && process.env.CF_PAGES_COMMIT_SHA
? `${process.env.CF_PAGES_COMMIT_SHA.slice(0, 8)}`
: 'dev'
export const feedback = ``
export const search: DefaultTheme.Config['search'] = {
options: {
_render(src, env, md) {
let contents = src
// I do this as env.frontmatter is not available until I call `md.render`
if (contents.includes('Beginners Guide'))
contents = transformGuide(contents)
contents = transform(contents)
const html = md.render(contents, env)
return html
},
miniSearch: {
options: {
tokenize: (text) => text.split(/[\n\r #%*,=/:;?[\]{}()&]+/u), // simplified charset: removed [-_.@] and non-english chars (diacritics etc.)
processTerm: (term, fieldName) => {
// biome-ignore lint/style/noParameterAssign: h
term = term
.trim()
.toLowerCase()
.replace(/^\.+/, '')
.replace(/\.+$/, '')
const stopWords = [
'frontmatter',
'$frontmatter.synopsis',
'and',
'about',
'but',
'now',
'the',
'with',
'you'
]
if (term.length < 2 || stopWords.includes(term)) return false
if (fieldName === 'text') {
const parts = term.split('.')
if (parts.length > 1) {
const newTerms = [term, ...parts]
.filter((t) => t.length >= 2)
.filter((t) => !stopWords.includes(t))
return newTerms
}
}
return term
}
},
searchOptions: {
combineWith: 'AND',
fuzzy: true,
// @ts-ignore
boostDocument: (
documentId,
term,
storedFields: Record
) => {
const titles = (storedFields?.titles as string[])
.filter((t) => Boolean(t))
.map((t) => t.toLowerCase())
// Downrank posts
if (documentId.match(/\/posts/)) return -5
// Downrank /other
if (documentId.match(/\/other/)) return -5
// 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: 'discord', link: 'https://discord.gg/Stz6y6NgNg' },
{
icon: 'reddit',
link: 'https://reddit.com/r/FREEMEDIAHECKYEAH'
},
{
ariaLabel: 'Bluesky',
icon: {
svg: ''
},
link: 'https://bsky.app/profile/fmhy.bsky.social'
}
]
export const sidebar: DefaultTheme.Sidebar | DefaultTheme.NavItemWithLink[] = [
{
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: '/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: ' Storage',
link: '/storage'
}
]
}
]