mirror of
https://github.com/fmhy/edit.git
synced 2025-07-31 08:12:23 +10:00
58 lines
1.3 KiB
TypeScript
58 lines
1.3 KiB
TypeScript
const files = (
|
|
[
|
|
'adblockvpnguide.md',
|
|
'ai.md',
|
|
'android-iosguide.md',
|
|
'audiopiracyguide.md',
|
|
'beginners-guide.md',
|
|
'devtools.md',
|
|
'downloadpiracyguide.md',
|
|
'edupiracyguide.md',
|
|
'file-tools.md',
|
|
'gaming-tools.md',
|
|
'gamingpiracyguide.md',
|
|
'img-tools.md',
|
|
'internet-tools.md',
|
|
'linuxguide.md',
|
|
'miscguide.md',
|
|
'non-english.md',
|
|
'readingpiracyguide.md',
|
|
'social-media-tools.md',
|
|
'storage.md',
|
|
'system-tools.md',
|
|
'text-tools.md',
|
|
'torrentpiracyguide.md',
|
|
'unsafesites.md',
|
|
'video-tools.md',
|
|
'videopiracyguide.md'
|
|
] as const
|
|
).map((file) => ({
|
|
name: file,
|
|
url: `https://raw.githubusercontent.com/fmhy/edit/main/docs/${file}`
|
|
}))
|
|
|
|
export default defineCachedEventHandler(
|
|
async (event) => {
|
|
let body = '<!-- This is autogenerated content, do not edit manually. -->\n'
|
|
|
|
const contents = await Promise.all(
|
|
files.map(async (file) => {
|
|
const content = await $fetch<string>(file.url)
|
|
|
|
return content
|
|
})
|
|
)
|
|
body += contents.join('\n\n')
|
|
|
|
appendResponseHeaders(event, {
|
|
'content-type': 'text/markdown;charset=utf-8',
|
|
'cache-control': 'public, max-age=7200'
|
|
})
|
|
return body
|
|
},
|
|
{
|
|
maxAge: 60 * 60,
|
|
name: 'single-page',
|
|
getKey: () => 'default' /* Can be extended in the future */
|
|
}
|
|
)
|