mirror of
				https://github.com/KevinMidboe/zoff.git
				synced 2025-10-29 18:00:23 +00:00 
			
		
		
		
	Fixed issue with channelnames with weird characters not working
This commit is contained in:
		| @@ -90,8 +90,8 @@ module.exports = function() { | ||||
|                var _list = msg.channel.replace(/ /g,''); | ||||
|                if(_list.length == 0) return; | ||||
|                coll = emojiStrip(_list).toLowerCase(); | ||||
|                coll = coll.replace("_", ""); | ||||
|                coll = encodeURIComponent(coll).replace(/\W/g, ''); | ||||
|                coll = coll.replace(/_/g, ""); | ||||
|  | ||||
|                coll = filter.clean(coll); | ||||
|            } catch(e) { | ||||
|                return; | ||||
| @@ -254,8 +254,8 @@ module.exports = function() { | ||||
|                 var _list = msg.channel.replace(/ /g,''); | ||||
|                 if(_list.length == 0) return; | ||||
|                 coll = emojiStrip(_list).toLowerCase(); | ||||
|                 coll = coll.replace("_", ""); | ||||
|                 coll = encodeURIComponent(coll).replace(/\W/g, ''); | ||||
|                 coll = coll.replace(/_/g, ""); | ||||
|                 // | ||||
|                 coll = filter.clean(coll); | ||||
|             } catch(e) { | ||||
|                 return; | ||||
| @@ -275,8 +275,8 @@ module.exports = function() { | ||||
|                     coll = obj.channel.toLowerCase().replace(/ /g,''); | ||||
|                     if(coll.length == 0) return; | ||||
|                     coll = emojiStrip(coll).toLowerCase(); | ||||
|                     coll = coll.replace("_", ""); | ||||
|                     coll = encodeURIComponent(coll).replace(/\W/g, ''); | ||||
|                     coll = coll.replace(/_/g, ""); | ||||
|  | ||||
|                     coll = filter.clean(coll); | ||||
|                 } catch(e) { | ||||
|                     return; | ||||
| @@ -296,8 +296,8 @@ module.exports = function() { | ||||
|                     coll = arr.list.replace(/ /g,''); | ||||
|                     if(coll.length == 0) return; | ||||
|                     coll = emojiStrip(coll).toLowerCase(); | ||||
|                     coll = coll.replace("_", ""); | ||||
|                     coll = encodeURIComponent(coll).replace(/\W/g, ''); | ||||
|                     coll = coll.replace(/_/g, ""); | ||||
|  | ||||
|                     coll = filter.clean(coll); | ||||
|                 } catch(e) { | ||||
|                     return; | ||||
| @@ -312,8 +312,8 @@ module.exports = function() { | ||||
|                     coll = msg.channel.toLowerCase().replace(/ /g,''); | ||||
|                     if(coll.length == 0) return; | ||||
|                     coll = emojiStrip(coll).toLowerCase(); | ||||
|                     coll = coll.replace("_", ""); | ||||
|                     coll = encodeURIComponent(coll).replace(/\W/g, ''); | ||||
|                     coll = coll.replace(/_/g, ""); | ||||
|  | ||||
|                     coll = filter.clean(coll); | ||||
|                 } catch(e) { | ||||
|                     return; | ||||
| @@ -330,8 +330,8 @@ module.exports = function() { | ||||
|                     coll = msg.channel.toLowerCase().replace(/ /g,''); | ||||
|                     if(coll.length == 0) return; | ||||
|                     coll = emojiStrip(coll).toLowerCase(); | ||||
|                     coll = coll.replace("_", ""); | ||||
|                     coll = encodeURIComponent(coll).replace(/\W/g, ''); | ||||
|                     coll = coll.replace(/_/g, ""); | ||||
|  | ||||
|                     coll = filter.clean(coll); | ||||
|                 } catch(e) { | ||||
|                     return; | ||||
| @@ -363,8 +363,8 @@ module.exports = function() { | ||||
|                     coll = msg.channel.toLowerCase().replace(/ /g,''); | ||||
|                     if(coll.length == 0) return; | ||||
|                     coll = emojiStrip(coll).toLowerCase(); | ||||
|                     coll = coll.replace("_", ""); | ||||
|                     coll = encodeURIComponent(coll).replace(/\W/g, ''); | ||||
|                     coll = coll.replace(/_/g, ""); | ||||
|  | ||||
|                     coll = filter.clean(coll); | ||||
|                 } catch(e) { | ||||
|                     return; | ||||
| @@ -380,8 +380,8 @@ module.exports = function() { | ||||
|                     coll = obj.channel.toLowerCase().replace(/ /g,''); | ||||
|                     if(coll.length == 0) return; | ||||
|                     coll = emojiStrip(coll).toLowerCase(); | ||||
|                     coll = coll.replace("_", ""); | ||||
|                     coll = encodeURIComponent(coll).replace(/\W/g, ''); | ||||
|                     coll = coll.replace(/_/g, ""); | ||||
|  | ||||
|                     coll = filter.clean(coll); | ||||
|                 } catch(e) { | ||||
|                     return; | ||||
| @@ -431,8 +431,8 @@ module.exports = function() { | ||||
|                     coll = obj.channel.toLowerCase().replace(/ /g,''); | ||||
|                     if(coll.length == 0) return; | ||||
|                     coll = emojiStrip(coll).toLowerCase(); | ||||
|                     coll = coll.replace("_", ""); | ||||
|                     coll = encodeURIComponent(coll).replace(/\W/g, ''); | ||||
|                     coll = coll.replace(/_/g, ""); | ||||
|  | ||||
|                     coll = filter.clean(coll); | ||||
|                 } catch(e) { | ||||
|                     return; | ||||
|   | ||||
| @@ -49,8 +49,7 @@ function list(msg, guid, coll, offline, socket) { | ||||
|             coll = msg.channel.toLowerCase().replace(/ /g,''); | ||||
|             var pass = crypto.createHash('sha256').update(Functions.decrypt_string(socketid, msg.pass)).digest("base64"); | ||||
|             db.collection('frontpage_lists').find({"_id": coll}, function(err, frontpage_lists){ | ||||
|                 if(frontpage_lists.length == 1) | ||||
|                 { | ||||
|                 if(frontpage_lists.length == 1) { | ||||
|                     db.collection(coll + "_settings").find(function(err, docs) { | ||||
|                         if(docs.length == 0 || (docs.length > 0 && (docs[0].userpass == undefined || docs[0].userpass == "" || docs[0].userpass == pass))) { | ||||
|                             if(docs.length > 0 && docs[0].hasOwnProperty('userpass') && docs[0].userpass != "" && docs[0].userpass == pass) { | ||||
| @@ -113,8 +112,8 @@ function skip(list, guid, coll, offline, socket) { | ||||
|                 coll = list.channel.toLowerCase().replace(/ /g,''); | ||||
|                 if(coll.length == 0) return; | ||||
|                 coll = emojiStrip(coll).toLowerCase(); | ||||
|                 coll = coll.replace("_", ""); | ||||
|                 coll = encodeURIComponent(coll).replace(/\W/g, ''); | ||||
|                 coll = coll.replace(/_/g, ""); | ||||
|  | ||||
|                 coll = filter.clean(coll); | ||||
|             } catch(e) { | ||||
|                 return; | ||||
|   | ||||
| @@ -336,6 +336,7 @@ function add_function(arr, coll, guid, offline, socket) { | ||||
|             if(userpass != "" || arr.userpass == undefined) { | ||||
|                 arr.userpass = userpass; | ||||
|             } | ||||
|  | ||||
|             db.collection(coll + "_settings").find(function(err, docs){ | ||||
|                 if(docs.length > 0 && (docs[0].userpass == undefined || docs[0].userpass == "" || (arr.hasOwnProperty('pass') && docs[0].userpass == crypto.createHash('sha256').update(Functions.decrypt_string(socketid, arr.pass)).digest("base64")))) { | ||||
|  | ||||
| @@ -599,8 +600,8 @@ function shuffle(msg, coll, guid, offline, socket) { | ||||
| function del(params, socket, socketid) { | ||||
|     if(params.id){ | ||||
|         var coll = emojiStrip(params.channel).toLowerCase(); | ||||
|         coll = coll.replace("_", "").replace(/ /g,''); | ||||
|         coll = encodeURIComponent(coll).replace(/\W/g, ''); | ||||
|         coll = coll.replace(/_/g, "").replace(/ /g,''); | ||||
|  | ||||
|         coll = filter.clean(coll); | ||||
|         db.collection(coll + "_settings").find(function(err, docs){ | ||||
|             if(docs !== null && docs.length !== 0 && docs[0].adminpass == Functions.hash_pass(Functions.hash_pass(Functions.decrypt_string(socketid, params.adminpass),true))) | ||||
|   | ||||
| @@ -23,8 +23,8 @@ function password(inp, coll, guid, offline, socket) { | ||||
|             coll = inp.channel; | ||||
|             if(coll.length == 0) return; | ||||
|             coll = emojiStrip(coll).toLowerCase(); | ||||
|             coll = coll.replace("_", ""); | ||||
|             coll = encodeURIComponent(coll).replace(/\W/g, ''); | ||||
|             coll = coll.replace(/_/g, ""); | ||||
|              | ||||
|             coll = filter.clean(coll); | ||||
|         } catch(e) { | ||||
|             return; | ||||
| @@ -87,8 +87,8 @@ function conf_function(params, coll, guid, offline, socket) { | ||||
|                 coll = params.channel.replace(/ /g,''); | ||||
|                 if(coll.length == 0) return; | ||||
|                 coll = emojiStrip(coll).toLowerCase(); | ||||
|                 coll = coll.replace("_", ""); | ||||
|                 coll = encodeURIComponent(coll).replace(/\W/g, ''); | ||||
|                 coll = coll.replace(/_/g, ""); | ||||
|                  | ||||
|                 coll = filter.clean(coll); | ||||
|             } catch(e) { | ||||
|                 return; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user