mirror of
				https://github.com/KevinMidboe/zoff.git
				synced 2025-10-29 18:00:23 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			32 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| function frontpage_lists(msg, socket) {
 | |
|     if(msg == undefined || !msg.hasOwnProperty('version') || msg.version != VERSION || msg.version == undefined) {
 | |
|         var result = {
 | |
|             version: {
 | |
|                 expected: VERSION,
 | |
|                 got: msg.hasOwnProperty("version") ? msg.version : undefined,
 | |
|             }
 | |
|         };
 | |
|         socket.emit('update_required', result);
 | |
|         return;
 | |
|     }
 | |
| 
 | |
|     db.collection("frontpage_lists").find({frontpage:true}, function(err, docs){
 | |
|         db.collection("connected_users").find({"_id": "total_users"}, function(err, tot){
 | |
|             socket.compress(true).emit("playlists", {channels: docs, viewers: tot[0].total_users.length});
 | |
|         });
 | |
|     });
 | |
| }
 | |
| 
 | |
| function update_frontpage(coll, id, title, callback) {
 | |
|     db.collection("frontpage_lists").update({_id: coll}, {$set: {
 | |
|         id: id,
 | |
|         title: title,
 | |
|         accessed: Functions.get_time()}
 | |
|     },{upsert: true}, function(err, returnDocs){
 | |
|         if(typeof(callback) == "function") callback();
 | |
|     });
 | |
| }
 | |
| 
 | |
| module.exports.frontpage_lists = frontpage_lists;
 | |
| module.exports.update_frontpage = update_frontpage;
 |