mirror of
https://github.com/Spengreb/sync.git
synced 2026-05-16 20:42:06 +00:00
20 lines
539 B
JavaScript
20 lines
539 B
JavaScript
|
|
import { sendJade } from '../jade';
|
||
|
|
|
||
|
|
export default function initialize(app, channelIndex) {
|
||
|
|
app.get('/', (req, res) => {
|
||
|
|
channelIndex.listPublicChannels().then((channels) => {
|
||
|
|
channels.sort((a, b) => {
|
||
|
|
if (a.usercount === b.usercount) {
|
||
|
|
return a.uniqueName > b.uniqueName ? -1 : 1;
|
||
|
|
}
|
||
|
|
|
||
|
|
return b.usercount - a.usercount;
|
||
|
|
});
|
||
|
|
|
||
|
|
sendJade(res, 'index', {
|
||
|
|
channels: channels
|
||
|
|
});
|
||
|
|
});
|
||
|
|
});
|
||
|
|
}
|