Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
sefinek committed Oct 16, 2023
1 parent 1d01098 commit 9909476
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions www/routes/Blocklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@ const router = express.Router();
const autoIndex = require('express-autoindex');
const path = require('path');
const increment = require('../middlewares/increment.js');

// Variables
const SERVE_FILES = process.env.SERVE_FILES;

// Paths
const generated = path.join(__dirname, '..', '..', 'blocklist', 'generated');
const ZeroZeroZeroZero = path.join(__dirname, '..', '..', 'blocklist', 'generated', '0.0.0.0');

const logs = path.join(__dirname, '..', 'public', 'logs');
const options = { customTemplate: path.join(__dirname, '..', 'views', 'autoindex', 'default.html'), dirAtTop: true };

function redirectMiddleware(req, res) {
// Functions
const redirectMiddleware = (req, res) => {
const url = req.url;
return res.status(301).redirect(`https://raw.githubusercontent.com/sefinek24/Sefinek-Blocklist-Collection/main/blocklist/generated/${url}`);
}
};


// Serve block lists
if (SERVE_FILES === 'static') {
Expand All @@ -32,4 +36,5 @@ router.use('/logs', autoIndex(logs, options), express.static(logs));
// Deprecated endpoints
router.get('/generated/0.0.0.0/riotgames.txt', (req, res) => res.sendFile(`${ZeroZeroZeroZero}/sites/riotgames.txt`));


module.exports = router;

0 comments on commit 9909476

Please sign in to comment.