Skip to content

Commit 8b03310

Browse files
author
Devendra
committed
fixing wildcard grant
1 parent 095266c commit 8b03310

File tree

23 files changed

+477
-350
lines changed

23 files changed

+477
-350
lines changed

core/pubnub-common.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,13 @@ function map( list, fun ) {
163163
return fin;
164164
}
165165

166+
167+
function pam_encode(str) {
168+
return encodeURIComponent(str).replace(/[!'()*~]/g, function(c) {
169+
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
170+
});
171+
}
172+
166173
/**
167174
* ENCODE
168175
* ======
@@ -354,7 +361,7 @@ function PN_API(setup) {
354361

355362
for (var i in l) {
356363
var k = l[i]
357-
si += k + "=" + encode(params[k]) ;
364+
si += k + "=" + pam_encode(params[k]) ;
358365
if (i != l.length - 1) si += "&"
359366
}
360367
return si;

modern/pubnub.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,13 @@ function map( list, fun ) {
164164
return fin;
165165
}
166166

167+
168+
function pam_encode(str) {
169+
return encodeURIComponent(str).replace(/[!'()*~]/g, function(c) {
170+
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
171+
});
172+
}
173+
167174
/**
168175
* ENCODE
169176
* ======
@@ -355,7 +362,7 @@ function PN_API(setup) {
355362

356363
for (var i in l) {
357364
var k = l[i]
358-
si += k + "=" + encode(params[k]) ;
365+
si += k + "=" + pam_encode(params[k]) ;
359366
if (i != l.length - 1) si += "&"
360367
}
361368
return si;

modern/pubnub.min.js

+38-38
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node.js/examples/grant.js

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/* ---------------------------------------------------------------------------
2+
3+
Init PubNub and Get your PubNub API Keys:
4+
http://www.pubnub.com/account#api-keys
5+
6+
--------------------------------------------------------------------------- */
7+
8+
var pubnub = require("./../pubnub.js").init({
9+
publish_key : "pam",
10+
ssl : true,
11+
subscribe_key : "pam",
12+
secret_key : "pam"
13+
});
14+
15+
function log(r) {
16+
console.log(JSON.stringify(r));
17+
}
18+
19+
/* ---------------------------------------------------------------------------
20+
Listen for Messages
21+
--------------------------------------------------------------------------- */
22+
23+
pubnub.grant({
24+
channel : "foo.*",
25+
callback : log,
26+
error : log,
27+
auth_key : "abcd"
28+
});
29+

node.js/pubnub.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,13 @@ function map( list, fun ) {
164164
return fin;
165165
}
166166

167+
168+
function pam_encode(str) {
169+
return encodeURIComponent(str).replace(/[!'()*~]/g, function(c) {
170+
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
171+
});
172+
}
173+
167174
/**
168175
* ENCODE
169176
* ======
@@ -355,7 +362,7 @@ function PN_API(setup) {
355362

356363
for (var i in l) {
357364
var k = l[i]
358-
si += k + "=" + encode(params[k]) ;
365+
si += k + "=" + pam_encode(params[k]) ;
359366
if (i != l.length - 1) si += "&"
360367
}
361368
return si;

phonegap/pubnub.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,13 @@ function map( list, fun ) {
164164
return fin;
165165
}
166166

167+
168+
function pam_encode(str) {
169+
return encodeURIComponent(str).replace(/[!'()*~]/g, function(c) {
170+
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
171+
});
172+
}
173+
167174
/**
168175
* ENCODE
169176
* ======
@@ -355,7 +362,7 @@ function PN_API(setup) {
355362

356363
for (var i in l) {
357364
var k = l[i]
358-
si += k + "=" + encode(params[k]) ;
365+
si += k + "=" + pam_encode(params[k]) ;
359366
if (i != l.length - 1) si += "&"
360367
}
361368
return si;

phonegap/pubnub.min.js

+38-38
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sencha/pubnub.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,13 @@ function map( list, fun ) {
164164
return fin;
165165
}
166166

167+
168+
function pam_encode(str) {
169+
return encodeURIComponent(str).replace(/[!'()*~]/g, function(c) {
170+
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
171+
});
172+
}
173+
167174
/**
168175
* ENCODE
169176
* ======
@@ -355,7 +362,7 @@ function PN_API(setup) {
355362

356363
for (var i in l) {
357364
var k = l[i]
358-
si += k + "=" + encode(params[k]) ;
365+
si += k + "=" + pam_encode(params[k]) ;
359366
if (i != l.length - 1) si += "&"
360367
}
361368
return si;

sencha/pubnub.min.js

+38-38
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

smart-tv/pubnub.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,13 @@ function map( list, fun ) {
314314
return fin;
315315
}
316316

317+
318+
function pam_encode(str) {
319+
return encodeURIComponent(str).replace(/[!'()*~]/g, function(c) {
320+
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
321+
});
322+
}
323+
317324
/**
318325
* ENCODE
319326
* ======
@@ -505,7 +512,7 @@ function PN_API(setup) {
505512

506513
for (var i in l) {
507514
var k = l[i]
508-
si += k + "=" + encode(params[k]) ;
515+
si += k + "=" + pam_encode(params[k]) ;
509516
if (i != l.length - 1) si += "&"
510517
}
511518
return si;

smart-tv/pubnub.min.js

+46-46
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

socket.io/socket.io.min.js

+46-46
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

titanium/examples/desktop/pubnub.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,13 @@ function map( list, fun ) {
165165
return fin;
166166
}
167167

168+
169+
function pam_encode(str) {
170+
return encodeURIComponent(str).replace(/[!'()*~]/g, function(c) {
171+
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
172+
});
173+
}
174+
168175
/**
169176
* ENCODE
170177
* ======
@@ -356,7 +363,7 @@ function PN_API(setup) {
356363

357364
for (var i in l) {
358365
var k = l[i]
359-
si += k + "=" + encode(params[k]) ;
366+
si += k + "=" + pam_encode(params[k]) ;
360367
if (i != l.length - 1) si += "&"
361368
}
362369
return si;

titanium/examples/mobile/chat-example-app/Resources/pubnub.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,13 @@ function map( list, fun ) {
165165
return fin;
166166
}
167167

168+
169+
function pam_encode(str) {
170+
return encodeURIComponent(str).replace(/[!'()*~]/g, function(c) {
171+
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
172+
});
173+
}
174+
168175
/**
169176
* ENCODE
170177
* ======
@@ -356,7 +363,7 @@ function PN_API(setup) {
356363

357364
for (var i in l) {
358365
var k = l[i]
359-
si += k + "=" + encode(params[k]) ;
366+
si += k + "=" + pam_encode(params[k]) ;
360367
if (i != l.length - 1) si += "&"
361368
}
362369
return si;

titanium/examples/mobile/detailed-history-example-app/Resources/pubnub.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,13 @@ function map( list, fun ) {
165165
return fin;
166166
}
167167

168+
169+
function pam_encode(str) {
170+
return encodeURIComponent(str).replace(/[!'()*~]/g, function(c) {
171+
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
172+
});
173+
}
174+
168175
/**
169176
* ENCODE
170177
* ======
@@ -356,7 +363,7 @@ function PN_API(setup) {
356363

357364
for (var i in l) {
358365
var k = l[i]
359-
si += k + "=" + encode(params[k]) ;
366+
si += k + "=" + pam_encode(params[k]) ;
360367
if (i != l.length - 1) si += "&"
361368
}
362369
return si;

titanium/examples/mobile/here-now-example-app/Resources/pubnub.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,13 @@ function map( list, fun ) {
165165
return fin;
166166
}
167167

168+
169+
function pam_encode(str) {
170+
return encodeURIComponent(str).replace(/[!'()*~]/g, function(c) {
171+
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
172+
});
173+
}
174+
168175
/**
169176
* ENCODE
170177
* ======
@@ -356,7 +363,7 @@ function PN_API(setup) {
356363

357364
for (var i in l) {
358365
var k = l[i]
359-
si += k + "=" + encode(params[k]) ;
366+
si += k + "=" + pam_encode(params[k]) ;
360367
if (i != l.length - 1) si += "&"
361368
}
362369
return si;

titanium/pubnub.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,13 @@ function map( list, fun ) {
165165
return fin;
166166
}
167167

168+
169+
function pam_encode(str) {
170+
return encodeURIComponent(str).replace(/[!'()*~]/g, function(c) {
171+
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
172+
});
173+
}
174+
168175
/**
169176
* ENCODE
170177
* ======
@@ -356,7 +363,7 @@ function PN_API(setup) {
356363

357364
for (var i in l) {
358365
var k = l[i]
359-
si += k + "=" + encode(params[k]) ;
366+
si += k + "=" + pam_encode(params[k]) ;
360367
if (i != l.length - 1) si += "&"
361368
}
362369
return si;

web/pubnub-3.7.10.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,13 @@ function map( list, fun ) {
314314
return fin;
315315
}
316316

317+
318+
function pam_encode(str) {
319+
return encodeURIComponent(str).replace(/[!'()*~]/g, function(c) {
320+
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
321+
});
322+
}
323+
317324
/**
318325
* ENCODE
319326
* ======
@@ -505,7 +512,7 @@ function PN_API(setup) {
505512

506513
for (var i in l) {
507514
var k = l[i]
508-
si += k + "=" + encode(params[k]) ;
515+
si += k + "=" + pam_encode(params[k]) ;
509516
if (i != l.length - 1) si += "&"
510517
}
511518
return si;

0 commit comments

Comments
 (0)