Skip to content

Commit

Permalink
Merge pull request #2236 from uProxy/dborkan-invite-fix
Browse files Browse the repository at this point in the history
Fix v1 invites (briefly broke due to Quiver changes)
  • Loading branch information
dborkan committed Feb 9, 2016
2 parents 55256f1 + 6ead0c5 commit 675584b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/generic_ui/scripts/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,19 @@ export class UserInterface implements ui_constants.UiApi {
var token = invite.substr(invite.lastIndexOf('/') + 1);
// Removes any non base64 characters that may appear, e.g. "%E2%80%8E"
token = token.match("[A-Za-z0-9+/=_]+")[0];
return JSON.parse(atob(token));
var parsedObj = JSON.parse(atob(token));
var networkData = parsedObj.networkData;
if (typeof networkData === 'object' && networkData.networkData) {
// Firebase invites have a nested networkData string within a
// networkData object. TODO: move Firebase to use v2 invites.
networkData = networkData.networkData;
}
return {
v: 1,
networkData: networkData,
networkName: parsedObj.networkName,
userName: parsedObj.userName
};
}
} catch(e) {
return null;
Expand Down

0 comments on commit 675584b

Please sign in to comment.