fix: revert readme content from being proxied

This commit is contained in:
spencerwooo 2023-01-26 13:09:32 +08:00
parent 0684f04546
commit e568fdd185
No known key found for this signature in database
GPG key ID: 24CD550268849CA0
3 changed files with 6 additions and 15 deletions

View file

@ -1,7 +1,7 @@
<div align="center">
<img src="./public/header.png" alt="onedrive-vercel-index" />
<h3><a href="https://drive.swo.moe">onedrive-vercel-index</a></h3>
<p><a href="https://ovi.swo.moe/docs/getting-started">Get started</a> · <a href="https://ovi.swo.moe/blog/whats-new">What's new?</a> · <a href="https://ovi.swo.moe/sponsor">Sponsoring</a></p>
<p><a href="https://ovi.swo.moe/docs/getting-started">Get started</a> · <a href="https://ovi.swo.moe/blog/whats-new">What's new?</a> · <a href="https://ovi.swo.moe/sponsor/ways">Sponsoring</a></p>
<p><em>OneDrive public directory listing, powered by Vercel and Next.js</em></p>
<img src="https://img.shields.io/badge/OneDrive-2C68C3?style=flat&logo=microsoft-onedrive&logoColor=white" alt="OneDrive" />
@ -32,7 +32,7 @@ Please go to our [discussion forum](https://github.com/spencerwooo/onedrive-verc
*If you happen to like this project, please give it a star!* :3
*If you really, really like this project, please send money! -> [Sponsors 🤑 and donations 💰](https://ovi.swo.moe/sponsor)*
*If you really, really like this project, please send money! -> [Sponsors 🤑 and donations 💰](https://ovi.swo.moe/sponsor/ways)*
## Demo
@ -134,11 +134,7 @@ Yes! Completely free with no backend server what-so-ever. (Well, we use Redis, b
Open-source is hard! If you happen to like this project and want me to keep going, please consider sponsoring me or providing a single donation! Thanks for all the love and support!
[🧸 Please donate - 微信/支付宝](https://ovi.swo.moe/sponsor) · [Patreon](https://www.patreon.com/spencerwoo) · [爱发电](https://afdian.net/@spencerwoo)
### Sponsors
*Your name will appear here if you sponsor or donate 😀*
[🧸 Please donate - 微信/支付宝](https://ovi.swo.moe/sponsor/ways) · [Patreon](https://www.patreon.com/spencerwoo) · [爱发电](https://afdian.net/@spencerwoo)
## License

View file

@ -370,7 +370,7 @@ const FileListing: FC<{ query?: ParsedUrlQuery }> = ({ query }) => {
{readmeFile && (
<div className="mt-4">
<MarkdownPreview file={readmeFile} path={path} standalone={false} proxy={true} />
<MarkdownPreview file={readmeFile} path={path} standalone={false} />
</div>
)}
</>

View file

@ -20,16 +20,11 @@ const MarkdownPreview: FC<{
file: any
path: string
standalone?: boolean
proxy?: boolean
}> = ({ file, path, standalone = true, proxy = false }) => {
}> = ({ file, path, standalone = true }) => {
// The parent folder of the markdown file, which is also the relative image folder
const parentPath = standalone ? path.substring(0, path.lastIndexOf('/')) : path
const {
response: content,
error,
validating,
} = useFileContent(`/api/raw/?path=${parentPath}/${file.name}${proxy ? `&proxy=true` : ''}`, path)
const { response: content, error, validating } = useFileContent(`/api/raw/?path=${parentPath}/${file.name}`, path)
const { t } = useTranslation()
// Check if the image is relative path instead of a absolute url