Limit the number of channels displayed on the index page
This commit is contained in:
parent
beb99c5632
commit
aedd0df228
5 changed files with 17 additions and 3 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { sendJade } from '../jade';
|
||||
|
||||
export default function initialize(app, channelIndex) {
|
||||
export default function initialize(app, channelIndex, maxEntries) {
|
||||
app.get('/', (req, res) => {
|
||||
channelIndex.listPublicChannels().then((channels) => {
|
||||
channels.sort((a, b) => {
|
||||
|
|
@ -11,6 +11,8 @@ export default function initialize(app, channelIndex) {
|
|||
return b.usercount - a.usercount;
|
||||
});
|
||||
|
||||
channels = channels.slice(0, maxEntries);
|
||||
|
||||
sendJade(res, 'index', {
|
||||
channels: channels
|
||||
});
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ module.exports = {
|
|||
}
|
||||
|
||||
require('./routes/channel')(app, ioConfig);
|
||||
require('./routes/index')(app, channelIndex);
|
||||
require('./routes/index')(app, channelIndex, webConfig.getMaxIndexEntries());
|
||||
app.get('/sioconfig(.json)?', handleLegacySocketConfig);
|
||||
require('./routes/socketconfig')(app, clusterClient);
|
||||
app.get('/useragreement', handleUserAgreement);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue