Skip to content

Commit

Permalink
auth proxy change+refresh main thread on tab chg/back nav
Browse files Browse the repository at this point in the history
  • Loading branch information
bulk88 committed Jan 11, 2024
1 parent 0a8c247 commit 7b9da12
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 23 deletions.
16 changes: 8 additions & 8 deletions client.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ function wvDrawUserList(d) { //jsonText
for (var e = 0; e < d.length; e++) {
var u = d[e]; //user
var n = frag.appendChild(document.createElement('a'));
n.href = wvProxyPrefix + '//p.saproxy.us.to/o/oauth2/auth?response_type=permission%20id_token%20token&scope=openid%20profile%20email%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgooglevoice%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fnotifications%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fpeopleapi.readwrite%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fsipregistrar-3p&redirect_uri=storagerelay%3A%2F%2Fhttps%2Fvoice.google.com%3Fid%3D' + ("auth" + Math.floor(1E6 * Math.random() + 1)) + '&client_id=301778431048-buvei725iuqqkne1ao8it4lm0gmel7ce.apps.googleusercontent.com&authuser='+e+'&login_hint=' + encodeURIComponent(u[3]);
n.href = wvProxyPrefix + '//proxya6d0.us.to/o/oauth2/auth?response_type=permission%20id_token%20token&scope=openid%20profile%20email%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgooglevoice%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fnotifications%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fpeopleapi.readwrite%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fsipregistrar-3p&redirect_uri=storagerelay%3A%2F%2Fhttps%2Fvoice.google.com%3Fid%3D' + ("auth" + Math.floor(1E6 * Math.random() + 1)) + '&client_id=301778431048-buvei725iuqqkne1ao8it4lm0gmel7ce.apps.googleusercontent.com&authuser='+e+'&login_hint=' + encodeURIComponent(u[3]);
wvPickerTokenRefresh(n);
n.target = "_blank";
n.rel = "opener";
Expand Down Expand Up @@ -456,7 +456,7 @@ function wvPickerTokenRefresh(buttonElement) {
= new URL(buttonElement.href).searchParams.get('authuser');
authResult_tok = response[0].access_token;
response = {
origin: "https://p.saproxy.us.to",
origin: "https://proxya6d0.us.to",
data: JSON.stringify({
params: {
authResult: response[0],
Expand Down Expand Up @@ -497,7 +497,7 @@ function wvPickerTokenRefresh(buttonElement, user) {
var myRequest = new XMLHttpRequest();
debugger;
//https://accounts.google.com/o/oauth2/iframerpc?action=issueToken&response_type=token%20id_token&login_hint=AJDLj6KEP9MzDcsaSxXgEfSczj3V-Al96OoAboO9hrh7Jy9wgL5c-3hYtG3iPXgOzw2cJUgmFPCVzMxAN7bUwf5PLWlYn0Sz5A&client_id=301778431048-buvei725iuqqkne1ao8it4lm0gmel7ce.apps.googleusercontent.com&origin=https%3A%2F%2Fvoice.google.com&scope=openid%20profile%20email%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgooglevoice%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fnotifications%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fpeopleapi.readwrite%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fsipregistrar-3p&ss_domain=https%3A%2F%2Fvoice.google.com
myRequest.open('GET', wvProxyPrefix + '//p.saproxy.us.to/o/oauth2/iframerpc?action=issueToken&response_type=token%20id_token&client_id=301778431048-buvei725iuqqkne1ao8it4lm0gmel7ce.apps.googleusercontent.com&origin=https%3A%2F%2Fvoice.google.com&scope=openid%20profile%20email%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgooglevoice%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fnotifications%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fpeopleapi.readwrite%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fsipregistrar-3p&ss_domain=https%3A%2F%2Fvoice.google.com&login_hint=' +user[10], !0);
myRequest.open('GET', wvProxyPrefix + '//proxya6d0.us.to/o/oauth2/iframerpc?action=issueToken&response_type=token%20id_token&client_id=301778431048-buvei725iuqqkne1ao8it4lm0gmel7ce.apps.googleusercontent.com&origin=https%3A%2F%2Fvoice.google.com&scope=openid%20profile%20email%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgooglevoice%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fnotifications%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fpeopleapi.readwrite%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fsipregistrar-3p&ss_domain=https%3A%2F%2Fvoice.google.com&login_hint=' +user[10], !0);
myRequest.onreadystatechange = function() {
if (4 == myRequest.readyState) {
if (200 == myRequest.status) {
Expand All @@ -523,7 +523,7 @@ function wvDrawAccountPicker(suppressTokRefresh) {
}
var myRequest = new XMLHttpRequest();
//mo=1 prop required for profile pics to be user specific vs generic
myRequest.open('GET', wvProxyPrefix + '//p.saproxy.us.to/ListAccounts?mo=1', !0);
myRequest.open('GET', wvProxyPrefix + '//proxya6d0.us.to/ListAccounts?mo=1', !0);
myRequest.onreadystatechange = function() {
if (4 == myRequest.readyState) {
if (200 == myRequest.status) {
Expand Down Expand Up @@ -599,7 +599,7 @@ window.getAuthToken = function (callbackFunc) {
var textareaNode_clipboard_clipboard = newBodyNode.appendChild(document.createElement('textarea'));
textareaNode_clipboard_clipboard.placeholder = "Paste GV Auth Token here";
var wvMsgEvtCB = function (e) {
if(e.origin == "https://p.saproxy.us.to" || e.origin == "http://p.saproxy.us.to"){
if(e.origin == "https://proxya6d0.us.to" || e.origin == "http://proxya6d0.us.to"){
e = JSON.parse(e.data).params.authResult;
/*this logic is in client origin GAPI JS framework typ, not over wire */
e.first_issued_at = (new Date).getTime();
Expand Down Expand Up @@ -671,7 +671,7 @@ window.getAuthToken = function (callbackFunc) {
var u = '/o/oauth2/auth?response_type=permission%20id_token%20token&scope=openid%20profile%20email%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgooglevoice%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fnotifications%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fpeopleapi.readwrite%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fsipregistrar-3p'+(email?'':'&prompt=select_account')+'&redirect_uri=storagerelay%3A%2F%2Fhttps%2Fvoice.google.com%3Fid%3D'+("auth" + Math.floor(1E6 * Math.random() + 1))+'&client_id=301778431048-buvei725iuqqkne1ao8it4lm0gmel7ce.apps.googleusercontent.com'+(email?'&login_hint='+encodeURIComponent(email):'');
//https://accounts.google.com/o/oauth2/auth?response_type=permission%20id_token&scope=openid%20profile%20email%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgooglevoice%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fnotifications%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fpeopleapi.readwrite%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fsipregistrar-3p&openid.realm=&login_hint=bulk88%40hotmail.com&redirect_uri=storagerelay%3A%2F%2Fhttps%2Fvoice.google.com%3Fid%3Dauth973431&client_id=301778431048-buvei725iuqqkne1ao8it4lm0gmel7ce.apps.googleusercontent.com&ss_domain=https%3A%2F%2Fvoice.google.com&gsiwebsdk=2
window.open('https://accounts.google.com'+u);
window.open(wvProxyPrefix+'//p.saproxy.us.to'+u);
window.open(wvProxyPrefix+'//proxya6d0.us.to'+u);
};
if((textareaNode_clipboard_clipboard = navigator.clipboard) && textareaNode_clipboard_clipboard.readText) { /* old browser or HTTPS failure */
buttonNode = newBodyNode.appendChild(document.createElement('button'));
Expand All @@ -696,7 +696,7 @@ window.getAuthToken = function (callbackFunc) {
buttonNode.id = 'picker';
newBodyNode.appendChild(document.createElement('br'));
buttonNode = newBodyNode.appendChild(document.createElement('a'));
buttonNode.href = wvProxyPrefix+'//p.saproxy.us.to/AddSession?service=grandcentral&continue=https%3A%2F%2Fvoice.google.com%2Fu%2F0%2Fa%2Fi%2F4e01281e272a1ccb11ceff9704b131e5-1';
buttonNode.href = wvProxyPrefix+'//proxya6d0.us.to/AddSession?service=grandcentral&continue=https%3A%2F%2Fvoice.google.com%2Fu%2F0%2Fa%2Fi%2F4e01281e272a1ccb11ceff9704b131e5-1';
buttonNode.target = '_blank';
buttonNode.rel = 'opener';
buttonNode.textContent = 'Add Account';
Expand Down Expand Up @@ -731,7 +731,7 @@ window.getAuthToken = function (callbackFunc) {
}
};
x.withCredentials = true;
x.open('GET', wvProxyPrefix+'//p.saproxy.us.to/delete_cookies', !0);
x.open('GET', wvProxyPrefix+'//proxya6d0.us.to/delete_cookies', !0);
x.send();
};
wvDrawAccountPicker();
Expand Down
2 changes: 1 addition & 1 deletion docs/ac.appcache
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CACHE MANIFEST
# v Thu Dec 14 08:31:34 2023
# v Thu Jan 11 14:26:55 2024

CACHE:
index.html
Expand Down
2 changes: 1 addition & 1 deletion docs/client.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<html manifest=ac.appcache><link href=https://www.googleapis.com rel=preconnect crossorigin><link href=//carrier.natasha.cat rel=preconnect><link href=https://content-people-pa.googleapis.com rel=preconnect crossorigin><link href=https://p.saproxy.us.to rel=preconnect><meta charset=utf-8 content=0 name=mobileoptimized><style>body{margin-top:0px;}button{line-height:1.5}</style><script src=client.js></script><script>initLnkFmt();var d,t=0;function l(e,n,s,o){getAuthToken(function(t){r(!0,t,e,n,s,o)})}function r(t,e,n,s,o,a){var i=new XMLHttpRequest;i.open("POST","https://www.googleapis.com/voice/v1/voiceclient/api2thread/list?alt="+(n?"json&prettyPrint=false":"protojson"),1),i.setRequestHeader("Content-Type","application/json+protobuf"),i.setRequestHeader("Authorization","Bearer "+e),i.onreadystatechange=function(){4==i.readyState&&(503==i.status?r(t,e,n,s,o,a):t&&401==i.status&&resp401Unauth(i.response)?(wvWipeAuthToken(),getAuthToken(function(t){r(!1,t,n,s,o,a)})):200!=i.status?(401!=i.status&&alert("status: "+i.status+"\nresp:"+i.response),a(i.response||-1)):a(!1,n?JSON.parse(i.response):i.response))},i.send((n?"["+(o?6:2)+",100,1":"["+(o?6:2)+",1,1")+(s?',"'+s+'"]':"]"))}function g(h){(h=h.target).textContent=" ▽⌛";var p,f=h.getAttribute("data-pgtok");l(f,f,sessionStorage.getItem("wvArchView"),function(t,e){if(t)h.textContent=" ▽✘";else if(f)a(f,e,p);else{var s=document.getElementById("threadList"),o=s.firstChild&&s.firstChild.getAttribute("data-mid");if(e.substr(25,40)!=o)l(1,0,sessionStorage.getItem("wvArchView"),function(t,e){t?h.textContent=" ▽✘":(a(0,e,p),h.textContent=" ▽✔")}),p=n();else{h.textContent=" ▽✔";for(var i,r=0;r<s.children.length;r++)"DIV"===(t=s.children[r]).nodeName&&(i=(t=t.firstChild.firstChild).firstChild).nodeValue.match(/^\+\d+$/)&&u(t,i.nodeValue)}}}),f&&(p=n())}function refreshNoUI(){g({target:{textContent:0,getAttribute:function(){}}})}lazySignedInEmail()&&(d=1,refreshNoUI())</script>Welcome To Whogle Voice<button style=visibility:hidden>B</button><div id=sign-in-bar></div><button onclick=g(event) style=width:4em;height:2em;text-align:left; title=Refresh> ▽</button> <label><input type=checkbox id=archive onchange='sessionStorage.setItem("wvArchView",this.checked?"1":""),document.getElementById("threadList").innerHTML=localStorage.getItem(this.checked?"wvThdListA":"wvThdListM");var e=this.parentNode.previousSibling.previousSibling;e.onclick({target:e})'title=Archive>A</label> <input type=tel placeholder="New num here"size=10><button onclick='window.location="thread.html#"+c(event.target.previousSibling.value)'>ㅤGo #ㅤ</button><div id=threadList></div><script>function u(a,e){t++,getContactName(e.slice(2),function(e,n){t--,n&&((e=a.firstChild).nodeValue!==n[0]&&(e.nodeValue=n[0]),a.setAttribute("data-pid",n[1]),n[2]&&a.setAttribute("data-url",n[2]),n[3]&&a.setAttribute("data-lec",n[3]),t||localStorage.setItem(sessionStorage.getItem("wvArchView")?"wvThdListA":"wvThdListM",document.getElementById("threadList").innerHTML))})}function c(e){return/1?\(?([0-9]{3})\)?[-.\s]?([0-9]{3})[-.\s]?([0-9]{4})/.exec(e)[0].replace(/\D/g,"").substr(-10,10)}function n(){for(var e,t,n=0,a={},i=document.getElementById("threadList").querySelectorAll("a");n<i.length;n++)(e=(t=i[n]).firstChild.nodeValue).match(/^\+?\d+$/)||(a["+1"+t.hash.slice(1)]=e);return a}function a(e,t,n){var a,i=document.createDocumentFragment();t.paginationToken&&((a=document.createElement("button")).textContent=" Load More ",a.setAttribute("data-pgtok",t.paginationToken),a.setAttribute("onclick","g(event)")),t=t.thread;for(var r=0;r<t.length;r++){var o=document.createElement("div"),l=t[r].item[0],s=(r||o.setAttribute("data-mid",l.id),i.appendChild(o),l.isArtificialErrorMessage?o.style.backgroundColor="red":o.style.outline="1px solid black",o.appendChild(document.createElement("div"))),m=(s.align="left",s=s.appendChild(document.createElement("a")),l.contact.phoneNumber);12===m.length&&"+"===m[0]&&"1"===m[1]&&(m=m.slice(2)),s.href="thread.html#"+m,m=l.contact.name,s.textContent=n[m]||m,m.match(/^\+\d+$/)&&u(s,m),(s=o.appendChild(document.createElement("div"))).align="smsIn"==l.type?"left":"right",s.textContent=l.mmsMessage?"[IMG]"+l.mmsMessage.text:l.messageText}a&&i.appendChild(a);var h=document.getElementById("threadList");if(e)h.replaceChild(i,h.lastChild);else{for(;h.lastChild;)h.removeChild(h.lastChild);h.appendChild(i),localStorage.setItem(sessionStorage.getItem("wvArchView")?"wvThdListA":"wvThdListM",h.innerHTML)}}!function(){var e=sessionStorage.getItem("wvArchView"),t=(document.getElementById("archive").checked=e,document.getElementById("threadList").innerHTML=localStorage.getItem(e?"wvThdListA":"wvThdListM"),navigator.clipboard);t&&t.readText&&((e=(e=document).body.insertBefore(e.createElement("button"),e.getElementById("threadList"))).textContent="ㅤPasteㅤ",e.onclick=function(){t.readText().then(function(e){window.location="thread.html#"+c(e)})}),drawLoginBar()}(),d||refreshNoUI(),window.ononline=refreshNoUI</script>
<html manifest=ac.appcache><link href=https://www.googleapis.com rel=preconnect crossorigin><link href=//carrier.natasha.cat rel=preconnect><link href=https://content-people-pa.googleapis.com rel=preconnect crossorigin><link href=https://proxya6d0.us.to rel=preconnect><meta charset=utf-8 content=0 name=mobileoptimized><style>body{margin-top:0px;}button{line-height:1.5}</style><script src=client.js></script><script>initLnkFmt();var d,t=0;function l(e,n,s,o){getAuthToken(function(t){r(!0,t,e,n,s,o)})}function r(t,e,n,s,o,a){var i=new XMLHttpRequest;i.open("POST","https://www.googleapis.com/voice/v1/voiceclient/api2thread/list?alt="+(n?"json&prettyPrint=false":"protojson"),1),i.setRequestHeader("Content-Type","application/json+protobuf"),i.setRequestHeader("Authorization","Bearer "+e),i.onreadystatechange=function(){4==i.readyState&&(503==i.status?r(t,e,n,s,o,a):t&&401==i.status&&resp401Unauth(i.response)?(wvWipeAuthToken(),getAuthToken(function(t){r(!1,t,n,s,o,a)})):200!=i.status?(401!=i.status&&alert("status: "+i.status+"\nresp:"+i.response),a(i.response||-1)):a(!1,n?JSON.parse(i.response):i.response))},i.send((n?"["+(o?6:2)+",100,1":"["+(o?6:2)+",1,1")+(s?',"'+s+'"]':"]"))}function g(h){(h=h.target).textContent=" ▽⌛";var p,f=h.getAttribute("data-pgtok");l(f,f,sessionStorage.getItem("wvArchView"),function(t,e){if(t)h.textContent=" ▽✘";else if(f)i(f,e,p);else{var s=document.getElementById("threadList"),o=s.firstChild&&s.firstChild.getAttribute("data-mid");if(e.substr(25,40)!=o)l(1,0,sessionStorage.getItem("wvArchView"),function(t,e){t?h.textContent=" ▽✘":(i(0,e,p),h.textContent=" ▽✔")}),p=n();else{h.textContent=" ▽✔";for(var a,r=0;r<s.children.length;r++)"DIV"===(t=s.children[r]).nodeName&&(a=(t=t.firstChild.firstChild).firstChild).nodeValue.match(/^\+\d+$/)&&u(t,a.nodeValue)}}}),f&&(p=n())}function refreshNoUI(){g({target:{textContent:0,getAttribute:function(){}}})}lazySignedInEmail()&&(d=1,refreshNoUI())</script>Welcome To Whogle Voice<button style=visibility:hidden>B</button><div id=sign-in-bar></div><button onclick=g(event) id=rfsh style=width:4em;height:2em;text-align:left; title=Refresh> ▽</button> <label><input type=checkbox id=archive onchange='sessionStorage.setItem("wvArchView",this.checked?"1":""),document.getElementById("threadList").innerHTML=localStorage.getItem(this.checked?"wvThdListA":"wvThdListM");var e=this.parentNode.previousSibling.previousSibling;e.onclick({target:e})'title=Archive>A</label> <input type=tel placeholder="New num here"size=10><button onclick='window.location="thread.html#"+c(event.target.previousSibling.value)'>ㅤGo #ㅤ</button><div id=threadList></div><script>function u(i,e){t++,getContactName(e.slice(2),function(e,n){t--,n&&((e=i.firstChild).nodeValue!==n[0]&&(e.nodeValue=n[0]),i.setAttribute("data-pid",n[1]),n[2]&&i.setAttribute("data-url",n[2]),n[3]&&i.setAttribute("data-lec",n[3]),t||localStorage.setItem(sessionStorage.getItem("wvArchView")?"wvThdListA":"wvThdListM",document.getElementById("threadList").innerHTML))})}function c(e){return/1?\(?([0-9]{3})\)?[-.\s]?([0-9]{3})[-.\s]?([0-9]{4})/.exec(e)[0].replace(/\D/g,"").substr(-10,10)}function n(){for(var e,t,n=0,i={},a=document.getElementById("threadList").querySelectorAll("a");n<a.length;n++)(e=(t=a[n]).firstChild.nodeValue).match(/^\+?\d+$/)||(i["+1"+t.hash.slice(1)]=e);return i}function i(e,t,n){var i,a=document.createDocumentFragment();t.paginationToken&&((i=document.createElement("button")).textContent=" Load More ",i.setAttribute("data-pgtok",t.paginationToken),i.setAttribute("onclick","g(event)")),t=t.thread;for(var o=0;o<t.length;o++){var r=document.createElement("div"),l=t[o].item[0],s=(o||r.setAttribute("data-mid",l.id),a.appendChild(r),l.isArtificialErrorMessage?r.style.backgroundColor="red":r.style.outline="1px solid black",r.appendChild(document.createElement("div"))),m=(s.align="left",s=s.appendChild(document.createElement("a")),l.contact.phoneNumber);12===m.length&&"+"===m[0]&&"1"===m[1]&&(m=m.slice(2)),s.href="thread.html#"+m,m=l.contact.name,s.textContent=n[m]||m,m.match(/^\+\d+$/)&&u(s,m),(s=r.appendChild(document.createElement("div"))).align="smsIn"==l.type?"left":"right",s.textContent=l.mmsMessage?"[IMG]"+l.mmsMessage.text:l.messageText}i&&a.appendChild(i);var h=document.getElementById("threadList");if(e)h.replaceChild(a,h.lastChild);else{for(;h.lastChild;)h.removeChild(h.lastChild);h.appendChild(a),localStorage.setItem(sessionStorage.getItem("wvArchView")?"wvThdListA":"wvThdListM",h.innerHTML)}}!function(){var e=sessionStorage.getItem("wvArchView"),t=(document.getElementById("archive").checked=e,document.getElementById("threadList").innerHTML=localStorage.getItem(e?"wvThdListA":"wvThdListM"),navigator.clipboard);t&&t.readText&&((e=(e=document).body.insertBefore(e.createElement("button"),e.getElementById("threadList"))).textContent="ㅤPasteㅤ",e.onclick=function(){t.readText().then(function(e){window.location="thread.html#"+c(e)})}),drawLoginBar()}(),d||refreshNoUI(),window.ononline=refreshNoUI,window.onpageshow=function(e){e.persisted&&document.getElementById("rfsh").click()},document.addEventListener("visibilitychange",function(e){"visible"===e.target.visibilityState&&document.getElementById("rfsh").click()})</script>
Loading

0 comments on commit 7b9da12

Please sign in to comment.