feat(transform): implement custom transformer

This commit is contained in:
taskylizard 2024-08-03 21:58:46 +00:00
parent dfc5ce5881
commit b1dc663035
No known key found for this signature in database
GPG key ID: 1820131ED1A24120
8 changed files with 388 additions and 412 deletions

View file

@ -1,99 +0,0 @@
import os
headers = {
"adblockvpnguide.md": [
"Adblocking / Privacy",
"Adblocking, Privacy, VPN's, Proxies, Antivirus",
],
"ai.md": [
"Artificial Intelligence",
"Chat Bots, Text Generators, Image Generators, ChatGPT Tools",
],
"android-iosguide.md": ["Android / iOS", "Apps, Jailbreaking, Android Emulators"],
"audiopiracyguide.md": [
"Music / Podcasts / Radio",
"Stream Audio, Download Audio, Torrent Audio",
],
"beginners-guide.md": ["Beginners Guide", "A Guide for Beginners to Piracy"],
"downloadpiracyguide.md": [
"Downloading",
"Download Sites, Software Sites, Open Directories",
],
"edupiracyguide.md": ["Educational", "Courses, Documentaries, Learning Resources"],
"gamingpiracyguide.md": [
"Gaming / Emulation",
"Download Games, ROMs, Gaming Tools",
],
"linuxguide.md": ["Linux / MacOS", "Apps, Software Sites, Gaming"],
"miscguide.md": ["Miscellaneous", "Extensions, Indexes, News, Health, Food, Fun"],
"nsfwpiracy.md": ["NSFW", "NSFW Indexes, Streaming, Downloading"],
"non-english.md": ["Non-English", "International Piracy Sites"],
"readingpiracyguide.md": [
"Books / Comics / Manga",
"Books, Comics, Magazines, Newspapers",
],
"gaming-tools.md": [
"Gaming Tools",
"Gaming Optimization, Game Launchers, Multiplayer",
],
"devtools.md": ["Developer Tools", "Git, Hosting, App Dev, Software Dev"],
"img-tools.md": ["Image Tools", "Image Editors, Generators, Compress"],
"audio-tools.md": [
"Audio Tools",
"Audio Players, Audio Editors, Audio Downloaders",
],
"system-tools.md": [
"System Tools",
"System Tools, Hardware Tools, Windows ISOs, Customization",
],
"file-tools.md": ["File Tools", "Download Managers, File Hosting, File Archivers"],
"video-tools.md": [
"Video Tools",
"Video Players, Video Editors, Live Streaming, Animation",
],
"text-tools.md": ["Text Tools", "Text Editors, Pastebins, Fonts, Translators"],
# "internet-tools.md": ["Internet Tools", "Browsers, Extensions, Search Engines"],
"social-media-tools.md": [
"Social Media Tools",
"Discord Tools, Reddit Tools, YouTube Tools",
],
"storage.md": ["Storage", "Sections too big to fit on main pages"],
"torrentpiracyguide.md": ["Torrenting", "Torrent Clients, Torrent Sites, Trackers"],
"videopiracyguide.md": [
"Movies / TV / Anime",
"Stream Videos, Download Videos, Torrent Videos",
],
"base64.md": ["Base64", "Base64 storage"],
"unsafesites.md": ["Unsafe Sites", "Unsafe/harmful sites to avoid."],
}
title = '<div class="space-y-2 not-prose"><h1 class="text-4xl font-extrabold tracking-tight text-primary underline lg:text-5xl lg:leading-[3.5rem]">'
description = '<p class="text-black dark:text-text-2">'
def getHeader(page: str):
data = headers[page]
header = "---\n"
header += f'title: "{data[0]}"\n'
header += f"description: {data[1]}\n"
header += "---\n"
header += f"{title}{data[0]}</h1>\n"
header += f"{description}{data[1]}</p></div>\n\n"
return header
def main():
files = os.listdir("docs/")
for file in files:
if file in headers:
with open(f"docs/{file}", "r", encoding="utf-8") as f:
content = f.read()
if not content.startswith("---"):
with open(f"docs/{file}", "w", encoding="utf-8") as f2:
header = getHeader(file)
f2.write(header + content)
main()

285
.github/replace.py vendored
View file

@ -1,285 +0,0 @@
import re
import os
def beginners_guide(text: str):
text = re.sub("\[TOC\]\n", "", text, flags=re.MULTILINE)
text = re.sub("\*\*Table of Contents\*\*\n\[TOC2\]\n", "", text, flags=re.MULTILINE)
text = re.sub(
"# -> \*\*\*Beginners Guide to Piracy\*\*\* <-\n", "", text, flags=re.MULTILINE
)
text = re.sub(r"!!!note\s(.+?)\n", r":::info\n\1\n:::\n", text, flags=re.MULTILINE)
text = re.sub(r"!!!info\s(.+?)\n", r":::info\n\1\n:::\n", text, flags=re.MULTILINE)
text = re.sub(
r"!!!warning\s(.+?)\n", r":::warning\n\1\n:::\n", text, flags=re.MULTILINE
)
text = re.sub(r">\s(.+?)\n", r"> \1\n\n", text, flags=re.MULTILINE)
text = re.sub(
"\*\*\[\^ Back to Top\]\(#beginners-guide-to-piracy\)\*\*",
"",
text,
flags=re.MULTILINE,
)
text = re.sub(r"!!!\s(.+?)\n", r":::info\n\1\n:::\n", text, flags=re.MULTILINE)
text = re.sub("\n\*\*\[", "\n* **[", text, flags=re.MULTILINE)
text = re.sub(r">(.*)\n\n(.*)", r":::details \1\n\2\n:::", text, flags=re.MULTILINE)
return text
def individual(text: str):
# special cases of link not replaced correctly
text = re.sub(
"/storage/#encode--decode_urls", "/storage/#encode--decode-urls", text
)
text = re.sub("/base64/#do-k-ument", "/base64/#do_k_ument", text)
text = re.sub("/devtools/#machine-learning2", "/devtools/#machine-learning-1", text)
text = re.sub("/linuxguide#software-sites2", "/linuxguide#software-sites-1", text)
text = re.sub("/linuxguide#software_sites", "/linuxguide#software-sites", text)
text = re.sub("/non-english#reading10", "/non-english#reading-9", text)
text = re.sub(
"/storage#satellite-.26amp.3B_street_view_maps",
"/storage#satellite-street-view-maps",
text,
)
# Base64-decoder script link
text = re.sub(
"(.+?) site or extension\.\n",
"Click on the texts to copy them decoded.\n",
text,
flags=re.MULTILINE,
)
return text
def general(text: str):
text = re.sub("\*\*\*\n\n", "", text, flags=re.MULTILINE)
text = re.sub("\*\*\*\n", "", text, flags=re.MULTILINE)
text = re.sub("# ►", "##", text)
text = re.sub("## ▷", "###", text)
text = re.sub("####", "###", text)
text = re.sub("", ":star:", text)
text = re.sub("🌐", ":globe-with-meridians: ", text)
text = re.sub("↪️ ", ":repeat-button: ", text)
text = re.sub(
r"^\*\*Note\*\* - (.+)$", r":::tip\n\1\n:::", text, flags=re.MULTILINE
)
text = re.sub(
r"^\* \*\*Note\*\* - (.+)$", r":::tip\n\1\n:::", text, flags=re.MULTILINE
)
text = re.sub(r"^Note - (.+)$", r":::tip\n\1\n:::", text, flags=re.MULTILINE)
text = re.sub(
r"^\*\*Warning\*\* - (.+)$", r":::warning\n\1\n:::", text, flags=re.MULTILINE
)
text = re.sub(r"^\*\s([^*])", "- \\1", text, 0, re.MULTILINE)
return text
def remove_backtowiki_toc(text):
text = re.sub(
"\*\*\[◄◄ Back to Wiki Index\]\(https://www\.reddit\.com/r/FREEMEDIAHECKYEAH/wiki/index\)\*\*\n",
"",
text,
flags=re.MULTILINE,
)
text = re.sub(
"\*\*\[◄◄ Back to Wiki Index\]\(https://www\.reddit\.com/r/FREEMEDIAHECKYEAH/wiki/tools-index\)\*\*\n",
"",
text,
flags=re.MULTILINE,
)
text = re.sub(
r"\*\*\[Table of Contents\]\(https?:\/\/.*?ibb\.co.*\)\*\* - For mobile users\n",
"",
text,
flags=re.MULTILINE,
)
text = re.sub(
"\*\*\*\n\*\*\*\n\*\*\*\n\*\*\*\n\n\n\*\*\*\n\*\*\*\n\n",
"",
text,
flags=re.MULTILINE,
)
text = re.sub(
"\*\*\*\n\*\*\*\n\*\*\*\n\*\*\*\n\n\n\*\*\*\n\*\*\* \n\n",
"",
text,
flags=re.MULTILINE,
)
text = re.sub(
"\*\*\*\n\*\*\*\n\*\*\*\n\n\n\*\*\*\n\*\*\*\n\n", "", text, flags=re.MULTILINE
)
text = re.sub(
"\*\*\*\n\*\*\*\n\*\*\*\n\*\*\*\n\n\n\*\*\*\n\n", "", text, flags=re.MULTILINE
)
text = re.sub("\*\*\*\n\*\*\*\n\n\n\*\*\*\n\n", "", text, flags=re.MULTILINE)
return text
def replace_pages(text):
text = re.sub("https://www.reddit.com/r/FREEMEDIAHECKYEAH/wiki/ai", "/ai", text)
text = re.sub(
"https://www.reddit.com/r/FREEMEDIAHECKYEAH/wiki/adblock-vpn-privacy",
"/adblockvpnguide",
text,
)
text = re.sub(
"https://www.reddit.com/r/FREEMEDIAHECKYEAH/wiki/android",
"/android-iosguide",
text,
)
text = re.sub(
"https://www.reddit.com/r/FREEMEDIAHECKYEAH/wiki/games",
"/gamingpiracyguide",
text,
)
text = re.sub(
"https://www.reddit.com/r/FREEMEDIAHECKYEAH/wiki/reading",
"/readingpiracyguide",
text,
)
text = re.sub(
"https://www.reddit.com/r/FREEMEDIAHECKYEAH/wiki/download",
"/downloadpiracyguide",
text,
)
text = re.sub(
"https://www.reddit.com/r/FREEMEDIAHECKYEAH/wiki/torrent",
"/torrentpiracyguide",
text,
)
text = re.sub(
"https://www.reddit.com/r/FREEMEDIAHECKYEAH/wiki/edu", "/edupiracyguide", text
)
text = re.sub(
"https://www.reddit.com/r/FREEMEDIAHECKYEAH/wiki/system-tools",
"/system-tools",
text,
)
text = re.sub(
"https://www.reddit.com/r/FREEMEDIAHECKYEAH/wiki/file-tools",
"/file-tools",
text,
)
text = re.sub(
"https://www.reddit.com/r/FREEMEDIAHECKYEAH/wiki/internet-tools",
"/internet-tools",
text,
)
text = re.sub(
"https://www.reddit.com/r/FREEMEDIAHECKYEAH/wiki/social-media",
"/social-media-tools",
text,
)
text = re.sub(
"https://www.reddit.com/r/FREEMEDIAHECKYEAH/wiki/text-tools",
"/text-tools",
text,
)
text = re.sub(
"https://www.reddit.com/r/FREEMEDIAHECKYEAH/wiki/video-tools",
"/video-tools",
text,
)
text = re.sub(
"https://www.reddit.com/r/FREEMEDIAHECKYEAH/wiki/audio-tools",
"/audio-tools",
text,
)
text = re.sub(
"https://www.reddit.com/r/FREEMEDIAHECKYEAH/wiki/game-tools",
"/gaming-tools",
text,
)
text = re.sub(
"https://www.reddit.com/r/FREEMEDIAHECKYEAH/wiki/video",
"/videopiracyguide",
text,
) # This replace has to go after the /video-tools replace
text = re.sub(
"https://www.reddit.com/r/FREEMEDIAHECKYEAH/wiki/audio",
"/audiopiracyguide",
text,
) # This replace has to go after the /audio-tools replace
text = re.sub(
"https://www.reddit.com/r/FREEMEDIAHECKYEAH/wiki/linux", "/linuxguide", text
)
text = re.sub(
"https://www.reddit.com/r/FREEMEDIAHECKYEAH/wiki/non-eng", "/non-english", text
)
text = re.sub(
"https://www.reddit.com/r/FREEMEDIAHECKYEAH/wiki/misc", "/miscguide", text
)
text = re.sub(
"https://www.reddit.com/r/FREEMEDIAHECKYEAH/wiki/storage", "/storage", text
)
text = re.sub(
"https://www.reddit.com/r/FREEMEDIAHECKYEAH/wiki/dev-tools", "/devtools", text
)
text = re.sub(
"https://www.reddit.com/r/FREEMEDIAHECKYEAH/wiki/img-tools", "/img-tools", text
)
text = re.sub(
"https://github.com/nbats/FMHYedit/blob/main/base64.md#", "/base64/#", text
)
return text
def replace_underscore(text):
pattern = r"(/#[\w\-]+(?:_[\w]+)*)"
matches = re.findall(pattern, text)
for match in matches:
replacement = match.replace("_", "-")
text = text.replace(match, replacement)
return text
def reformat_subsections(text):
text = re.sub("/#wiki_", "/#", text)
text = re.sub("#wiki_", "/#", text)
text = re.sub(".25BA_", "", text)
text = re.sub(".25B7_", "", text)
text = re.sub("_.2F_", "-", text)
text = replace_underscore(text)
return text
def replace_urls(text):
text = remove_backtowiki_toc(text)
text = replace_pages(text)
text = reformat_subsections(text)
text = re.sub("/#", "#", text)
text = general(text)
text = individual(text)
return text
def main():
files = os.listdir("docs")
for file in files:
if file.endswith(".md"):
with open(f"docs/{file}", "r", encoding="utf-8") as f:
content = f.read()
content = replace_urls(content)
if file == "beginners-guide.md":
content = beginners_guide(content)
with open(f"docs/{file}", "w", encoding="utf-8") as f2:
f2.write(content)
main()
what = """
![meow](https://files.catbox.moe/901c40.gif)
"""
with open("docs/meow.md", "w", encoding="utf-8") as file:
file.write(what)

6
.github/script.sh vendored
View file

@ -1,6 +0,0 @@
set -e
python .github/replace.py
python .github/add-headers.py
exit 0

View file

@ -30,14 +30,8 @@ jobs:
cache: pnpm
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: pnpm install
- name: Preprocess files
run: bash .github/script.sh
- name: Build with VitePress
run: |
pnpm docs:build

View file

@ -1,6 +1,7 @@
import { defineConfig } from 'vitepress'
import UnoCSS from 'unocss/vite'
import consola from 'consola'
import { basename } from 'pathe'
import UnoCSS from 'unocss/vite'
import { defineConfig } from 'vitepress'
import {
commitRef,
feedback,
@ -9,9 +10,10 @@ import {
sidebar,
socialLinks
} from './constants'
import { generateImages, generateMeta, generateFeed } from './hooks'
import { generateFeed, generateImages, generateMeta } from './hooks'
import { defs, emojiRender, movePlugin } from './markdown/emoji'
import { toggleStarredPlugin } from './markdown/toggleStarred'
import { movePlugin, emojiRender, defs } from './markdown/emoji'
import { transformer } from './transformer'
// @unocss-include
@ -55,6 +57,7 @@ export default defineConfig({
UnoCSS({
configFile: '../unocss.config.ts'
}),
transformer(),
{
name: 'custom:adjust-order',
configResolved(c) {
@ -64,6 +67,12 @@ export default defineConfig({
'before',
'unocss:transformers:pre'
)
movePlugin(
c.plugins as any,
'custom:transform-content',
'before',
'vitepress'
)
}
}
],
@ -104,7 +113,10 @@ export default defineConfig({
{ text: '📋 snowbin', link: 'https://pastes.fmhy.net' },
{ text: '🔍 SearXNG', link: 'https://searx.fmhy.net/' },
{ text: '🔍 Whoogle', link: 'https://whoogle.fmhy.net/' },
{ text: '🔗 Bookmarks', link: 'https://github.com/Rust1667/make-fmhy-bookmarks' }
{
text: '🔗 Bookmarks',
link: 'https://github.com/Rust1667/make-fmhy-bookmarks'
}
]
}
],

View file

@ -0,0 +1,352 @@
import { basename } from 'pathe'
import type { Plugin } from 'vitepress'
interface Header {
[key: string]: { title: string; description: string }
}
const headers: Header = {
'adblockvpnguide.md': {
title: 'Adblocking / Privacy',
description: "Adblocking, Privacy, VPN's, Proxies, Antivirus"
},
'ai.md': {
title: 'Artificial Intelligence',
description: 'Chat Bots, Text Generators, Image Generators, ChatGPT Tools'
},
'android-iosguide.md': {
title: 'Android / iOS',
description: 'Apps, Jailbreaking, Android Emulators'
},
'audiopiracyguide.md': {
title: 'Music / Podcasts / Radio',
description: 'Stream Audio, Download Audio, Torrent Audio'
},
'beginners-guide.md': {
title: 'Beginners Guide',
description: 'A Guide for Beginners to Piracy'
},
'downloadpiracyguide.md': {
title: 'Downloading',
description: 'Download Sites, Software Sites, Open Directories'
},
'edupiracyguide.md': {
title: 'Educational',
description: 'Courses, Documentaries, Learning Resources'
},
'gamingpiracyguide.md': {
title: 'Gaming / Emulation',
description: 'Download Games, ROMs, Gaming Tools'
},
'linuxguide.md': {
title: 'Linux / MacOS',
description: 'Apps, Software Sites, Gaming'
},
'miscguide.md': {
title: 'Miscellaneous',
description: 'Extensions, Indexes, News, Health, Food, Fun'
},
'nsfwpiracy.md': {
title: 'NSFW',
description: 'NSFW Indexes, Streaming, Downloading'
},
'non-english.md': {
title: 'Non-English',
description: 'International Piracy Sites'
},
'readingpiracyguide.md': {
title: 'Books / Comics / Manga',
description: 'Books, Comics, Magazines, Newspapers'
},
'gaming-tools.md': {
title: 'Gaming Tools',
description: 'Gaming Optimization, Game Launchers, Multiplayer'
},
'devtools.md': {
title: 'Developer Tools',
description: 'Git, Hosting, App Dev, Software Dev'
},
'img-tools.md': {
title: 'Image Tools',
description: 'Image Editors, Generators, Compress'
},
'audio-tools.md': {
title: 'Audio Tools',
description: 'Audio Players, Audio Editors, Audio Downloaders'
},
'system-tools.md': {
title: 'System Tools',
description: 'System Tools, Hardware Tools, Windows ISOs, Customization'
},
'file-tools.md': {
title: 'File Tools',
description: 'Download Managers, File Hosting, File Archivers'
},
'video-tools.md': {
title: 'Video Tools',
description: 'Video Players, Video Editors, Live Streaming, Animation'
},
'text-tools.md': {
title: 'Text Tools',
description: 'Text Editors, Pastebins, Fonts, Translators'
},
'internet-tools.md': {
title: 'Internet Tools',
description: 'Browsers, Extensions, Search Engines'
},
'social-media-tools.md': {
title: 'Social Media Tools',
description: 'Discord Tools, Reddit Tools, YouTube Tools'
},
'storage.md': {
title: 'Storage',
description: 'Sections too big to fit on main pages'
},
'torrentpiracyguide.md': {
title: 'Torrenting',
description: 'Torrent Clients, Torrent Sites, Trackers'
},
'videopiracyguide.md': {
title: 'Movies / TV / Anime',
description: 'Stream Videos, Download Videos, Torrent Videos'
},
'base64.md': {
title: 'Base64',
description: 'Base64 storage'
},
'unsafesites.md': {
title: 'Unsafe Sites',
description: 'Unsafe/harmful sites to avoid.'
}
}
const excluded = ['readme.md', 'single-page', 'feedback.md', 'index.md']
export function transformer(): Plugin {
return {
name: 'custom:transform-content',
enforce: 'pre',
transform(code, id) {
const _id = basename(id)
if (
id.endsWith('.md') &&
!excluded.includes(_id) &&
// check if it's a post
!id.includes('posts') &&
!id.includes('other')
) {
const header = getHeader(id)
const contents = transform(code)
if (_id === 'beginners-guide.md') {
const _contents = transformGuide(contents)
return header + _contents
}
return header + contents
}
}
}
}
function getHeader(id: string) {
const title =
'<div class="space-y-2 not-prose"><h1 class="text-4xl font-extrabold tracking-tight text-primary underline lg:text-5xl lg:leading-[3.5rem]">'
const description = '<p class="text-black dark:text-text-2">'
const _id = basename(id)
const data = headers[_id]
let header = '---\n'
header += `title: "${data.title}"\n`
header += `description: ${data.description}\n`
header += '---\n'
header += `${title}${data.title}</h1>\n`
header += `${description}${data.description}</p></div>\n\n`
return header
}
function transformGuide(text: string): string {
const _text = text
.replace(/\[TOC\]\n/gm, '')
.replace(/\*\*Table of Contents\*\*\n\[TOC2\]\n/gm, '')
.replace(/# -> \*\*\*Beginners Guide to Piracy\*\*\* <-\n/gm, '')
.replace(/!!!note\s(.+?)\n/gm, '\n:::info\n$1\n:::\n')
.replace(/!!!info\s(.+?)\n/gm, '\n:::info\n$1\n:::\n')
.replace(/!!!warning\s(.+?)\n/gm, ':::warning\n$1\n:::\n')
.replace(/>\s(.+?)\n/gm, '> $1\n\n')
.replace(/\*\*\[\^ Back to Top\]\(#beginners-guide-to-piracy\)\*\*/gm, '')
.replace(/!!!\s(.+?)\n/gm, ':::info\n$1\n:::\n')
.replace(/\n\*\*\[/gm, '\n* **[')
.replace(/>(.*)\n\n(.*)/gm, ':::details $1\n$2\n:::')
return _text
}
function replaceUnderscore(text: string): string {
const pattern = /\/#[\w\-]+(?:_[\w]+)*/g
const matches = text.match(pattern) || []
for (const match of matches) {
const replacement = match.replace(/_/g, '-')
text = text.replace(match, replacement)
}
return text
}
function transform(text: string): string {
let _text = text
.replace(
/\*\*\[◄◄ Back to Wiki Index\]\(https:\/\/www\.reddit\.com\/r\/FREEMEDIAHECKYEAH\/wiki\/index\)\*\*\n/gm,
''
)
.replace(
/\*\*\[◄◄ Back to Wiki Index\]\(https:\/\/www\.reddit\.com\/r\/FREEMEDIAHECKYEAH\/wiki\/tools-index\)\*\*\n/gm,
''
)
.replace(
/\*\*\[Table of Contents\]\(https?:\/\/.*?ibb\.co.*\)\*\* - For mobile users\n/gm,
''
)
.replace(/\*\*\*\n\*\*\*\n\*\*\*\n\*\*\*\n\n\n\*\*\*\n\*\*\*\n\n/gm, '')
.replace(/\*\*\*\n\*\*\*\n\*\*\*\n\*\*\*\n\n\n\*\*\*\n\*\*\* \n\n/gm, '')
.replace(/\*\*\*\n\*\*\*\n\*\*\*\n\n\n\*\*\*\n\*\*\*\n\n/gm, '')
.replace(/\*\*\*\n\*\*\*\n\*\*\*\n\*\*\*\n\n\n\*\*\*\n\n/gm, '')
.replace(/\*\*\*\n\*\*\*\n\n\n\*\*\*\n\n/gm, '')
.replace(/https:\/\/www.reddit.com\/r\/FREEMEDIAHECKYEAH\/wiki\/ai/g, '/ai')
.replace(
/https:\/\/www.reddit.com\/r\/FREEMEDIAHECKYEAH\/wiki\/adblock-vpn-privacy/g,
'/adblockvpnguide'
)
.replace(
/https:\/\/www.reddit.com\/r\/FREEMEDIAHECKYEAH\/wiki\/android/g,
'/android-iosguide'
)
.replace(
/https:\/\/www.reddit.com\/r\/FREEMEDIAHECKYEAH\/wiki\/games/g,
'/gamingpiracyguide'
)
.replace(
/https:\/\/www.reddit.com\/r\/FREEMEDIAHECKYEAH\/wiki\/reading/g,
'/readingpiracyguide'
)
.replace(
/https:\/\/www.reddit.com\/r\/FREEMEDIAHECKYEAH\/wiki\/download/g,
'/downloadpiracyguide'
)
.replace(
/https:\/\/www.reddit.com\/r\/FREEMEDIAHECKYEAH\/wiki\/torrent/g,
'/torrentpiracyguide'
)
.replace(
/https:\/\/www.reddit.com\/r\/FREEMEDIAHECKYEAH\/wiki\/edu/g,
'/edupiracyguide'
)
.replace(
/https:\/\/www.reddit.com\/r\/FREEMEDIAHECKYEAH\/wiki\/system-tools/g,
'/system-tools'
)
.replace(
/https:\/\/www.reddit.com\/r\/FREEMEDIAHECKYEAH\/wiki\/file-tools/g,
'/file-tools'
)
.replace(
/https:\/\/www.reddit.com\/r\/FREEMEDIAHECKYEAH\/wiki\/internet-tools/g,
'/internet-tools'
)
.replace(
/https:\/\/www.reddit.com\/r\/FREEMEDIAHECKYEAH\/wiki\/social-media/g,
'/social-media-tools'
)
.replace(
/https:\/\/www.reddit.com\/r\/FREEMEDIAHECKYEAH\/wiki\/text-tools/g,
'/text-tools'
)
.replace(
/https:\/\/www.reddit.com\/r\/FREEMEDIAHECKYEAH\/wiki\/video-tools/g,
'/video-tools'
)
.replace(
/https:\/\/www.reddit.com\/r\/FREEMEDIAHECKYEAH\/wiki\/audio-tools/g,
'/audio-tools'
)
.replace(
/https:\/\/www.reddit.com\/r\/FREEMEDIAHECKYEAH\/wiki\/game-tools/g,
'/gaming-tools'
)
.replace(
/https:\/\/www.reddit.com\/r\/FREEMEDIAHECKYEAH\/wiki\/video/g,
'/videopiracyguide'
)
.replace(
/https:\/\/www.reddit.com\/r\/FREEMEDIAHECKYEAH\/wiki\/audio/g,
'/audiopiracyguide'
)
.replace(
/https:\/\/www.reddit.com\/r\/FREEMEDIAHECKYEAH\/wiki\/linux/g,
'/linuxguide'
)
.replace(
/https:\/\/www.reddit.com\/r\/FREEMEDIAHECKYEAH\/wiki\/non-eng/g,
'/non-english'
)
.replace(
/https:\/\/www.reddit.com\/r\/FREEMEDIAHECKYEAH\/wiki\/misc/g,
'/miscguide'
)
.replace(
/https:\/\/www.reddit.com\/r\/FREEMEDIAHECKYEAH\/wiki\/storage/g,
'/storage'
)
.replace(
/https:\/\/www.reddit.com\/r\/FREEMEDIAHECKYEAH\/wiki\/dev-tools/g,
'/devtools'
)
.replace(
/https:\/\/www.reddit.com\/r\/FREEMEDIAHECKYEAH\/wiki\/img-tools/g,
'/img-tools'
)
.replace(
/https:\/\/github.com\/nbats\/FMHYedit\/blob\/main\/base64.md#/g,
'/base64/#'
)
.replace(/\/#wiki_/g, '/#')
.replace(/#wiki_/g, '/#')
.replace(/.25BA_/g, '')
.replace(/.25B7_/g, '')
.replace(/_.2F_/g, '-')
_text = replaceUnderscore(_text)
.replace(/\/#(\d)/g, '/#_$1') // Prefix headings starting with numbers
.replace(/#(\d)/g, '#_$1') // Prefix headings starting with numbers
.replace(/\/#/g, '#')
.replace(/\*\*\*\n\n/gm, '')
.replace(/\*\*\*\n/gm, '')
.replace(/# ►/g, '##')
.replace(/## ▷/g, '###')
.replace(/####/g, '###')
.replace(/⭐/g, ':star:')
.replace(/🌐/g, ':globe-with-meridians: ')
.replace(/↪ /g, ':repeat-button: ')
.replace(/^\*\*Note\*\* - (.+)$/gm, ':::tip\n$1\n:::')
.replace(/^\* \*\*Note\*\* - (.+)$/gm, ':::tip\n$1\n:::')
.replace(/^Note - (.+)$/gm, ':::tip\n$1\n:::')
.replace(/^\*\*Warning\*\* - (.+)$/gm, ':::warning\n$1\n:::')
.replace(/^\*\s([^*])/gm, '- $1')
.replace(
/\/storage\/#encode--decode_urls/g,
'/storage/#encode--decode-urls'
)
.replace(/\/base64\/#do-k-ument/g, '/base64/#do_k_ument')
.replace(/\/devtools\/#machine-learning2/g, '/devtools/#machine-learning-1')
.replace(/\/linuxguide#software-sites2/g, '/linuxguide#software-sites-1')
.replace(/\/linuxguide#software_sites/g, '/linuxguide#software-sites')
.replace(/\/non-english#reading10/g, '/non-english#reading-9')
.replace(
/\/storage#satellite-.26amp.3B_street_view_maps/g,
'/storage#satellite-street-view-maps'
)
.replace(
/(.+?) site or extension\.\n/gm,
'Click on the texts to copy them decoded.\n'
)
return _text
}

View file

@ -44,5 +44,13 @@
"@types/nprogress": "^0.2.3",
"prettier": "^3.3.3",
"wrangler": "^3.68.0"
},
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
"@algolia/client-search",
"search-insights"
]
}
}
}

22
pnpm-lock.yaml generated
View file

@ -4858,7 +4858,7 @@ snapshots:
c12@1.5.1:
dependencies:
chokidar: 3.6.0
defu: 6.1.3
defu: 6.1.4
dotenv: 16.3.1
giget: 1.1.3
jiti: 1.20.0
@ -5586,7 +5586,7 @@ snapshots:
citty: 0.1.4
clipboardy: 3.0.0
consola: 3.2.3
defu: 6.1.3
defu: 6.1.4
get-port-please: 3.1.1
h3: 1.8.2
http-shutdown: 1.2.2
@ -5595,7 +5595,7 @@ snapshots:
node-forge: 1.3.1
pathe: 1.1.2
std-env: 3.4.3
ufo: 1.3.1
ufo: 1.5.4
untun: 0.1.2
uqr: 0.1.2
@ -5724,7 +5724,7 @@ snapshots:
acorn: 8.11.0
pathe: 1.1.2
pkg-types: 1.0.3
ufo: 1.3.1
ufo: 1.5.4
mlly@1.5.0:
dependencies:
@ -5883,8 +5883,8 @@ snapshots:
ofetch@1.3.3:
dependencies:
destr: 2.0.2
node-fetch-native: 1.4.1
ufo: 1.3.1
node-fetch-native: 1.6.4
ufo: 1.5.4
ofetch@1.3.4:
dependencies:
@ -6191,7 +6191,7 @@ snapshots:
serve-placeholder@2.0.1:
dependencies:
defu: 6.1.3
defu: 6.1.4
serve-static@1.15.0:
dependencies:
@ -6408,9 +6408,9 @@ snapshots:
unenv@1.7.4:
dependencies:
consola: 3.2.3
defu: 6.1.3
defu: 6.1.4
mime: 3.0.0
node-fetch-native: 1.4.1
node-fetch-native: 1.6.4
pathe: 1.1.2
unicode-trie@2.0.0:
@ -6483,9 +6483,9 @@ snapshots:
listhen: 1.5.5
lru-cache: 10.0.1
mri: 1.2.0
node-fetch-native: 1.4.1
node-fetch-native: 1.6.4
ofetch: 1.3.3
ufo: 1.3.1
ufo: 1.5.4
transitivePeerDependencies:
- supports-color