Disable csv downloads

This commit is contained in:
Ajay
2022-11-07 16:24:43 -05:00
parent 5139c7aaf0
commit 9b509e7289
2 changed files with 7 additions and 2 deletions

View File

@@ -211,7 +211,7 @@ function setupRoutes(router: Router) {
router.get("/database", (req, res) => dumpDatabase(req, res, true)); router.get("/database", (req, res) => dumpDatabase(req, res, true));
router.get("/database.json", (req, res) => dumpDatabase(req, res, false)); router.get("/database.json", (req, res) => dumpDatabase(req, res, false));
router.get("/database/*", downloadFile); router.get("/database/*", downloadFile);
router.use("/download", express.static(appExportPath)); router.use("/download", (req, res) => res.status(404).send("CSV downloads disabled. Please use sb-mirror rsync"));
} else { } else {
router.get("/database.db", function (req: Request, res: Response) { router.get("/database.db", function (req: Request, res: Response) {
res.sendFile("./databases/sponsorTimes.db", { root: "./" }); res.sendFile("./databases/sponsorTimes.db", { root: "./" });

View File

@@ -124,7 +124,7 @@ export default async function dumpDatabase(req: Request, res: Response, showPage
if (showPage) { if (showPage) {
res.send(`${styleHeader} res.send(`${styleHeader}
<h1>SponsorBlock database dumps</h1>${licenseHeader} <h1>SponsorBlock database dumps</h1>${licenseHeader}
<h3>How this works</h3> <s><h3>How this works</h3>
Send a request to <code>https://sponsor.ajay.app/database.json</code>, or visit this page to get a list of urls and the update status database dump to run. Send a request to <code>https://sponsor.ajay.app/database.json</code>, or visit this page to get a list of urls and the update status database dump to run.
Then, you can download the csv files below, or use the links returned from the JSON request. Then, you can download the csv files below, or use the links returned from the JSON request.
@@ -135,6 +135,11 @@ export default async function dumpDatabase(req: Request, res: Response, showPage
If you want a live dump, please do not continually fetch this url. If you want a live dump, please do not continually fetch this url.
Please instead use the <a href="https://github.com/mchangrh/sb-mirror">sb-mirror</a> project. Please instead use the <a href="https://github.com/mchangrh/sb-mirror">sb-mirror</a> project.
This can automatically fetch new data and will not require a redownload each time, saving bandwidth. This can automatically fetch new data and will not require a redownload each time, saving bandwidth.
</s>
<h3>Please use sb-mirror</h3>
For bandwidth reasons, CSV downloads have been disabled. Please use the <a href="https://github.com/mchangrh/sb-mirror">sb-mirror</a> project.
<h3>Links</h3> <h3>Links</h3>
<table> <table>