|
@@ -51,7 +51,7 @@ app.get('/img/ava/:username', (req, res) => {
|
|
if (fs.existsSync(__dirname + '/www/img/ava/' + req.params.username + '.png')) {
|
|
if (fs.existsSync(__dirname + '/www/img/ava/' + req.params.username + '.png')) {
|
|
file = __dirname + '/www/img/ava/' + req.params.username + '.png';
|
|
file = __dirname + '/www/img/ava/' + req.params.username + '.png';
|
|
} else {
|
|
} else {
|
|
- const files = fs.readdirSync(__dirname + '/www/img/ava/random/');
|
|
|
|
|
|
+ const files = fs.readdirSync(__dirname + '/www/img/ava/random/').filter((f) => f.toLowerCase().endsWith('.png'));
|
|
|
|
|
|
const seededRandom = seedrandom(req.params.username)();
|
|
const seededRandom = seedrandom(req.params.username)();
|
|
const randomFile = files[Math.floor(seededRandom * files.length)];
|
|
const randomFile = files[Math.floor(seededRandom * files.length)];
|