Browse Source

Fix User Agent overrides for Google properties.

pull/3202/head
TheGoddessInari 5 years ago
parent
commit
4508c9ec9e
No known key found for this signature in database
GPG Key ID: 1209B1B7632D69A
  1. 5
      app/store/ServicesList.js
  2. 15
      app/ux/WebView.js

5
app/store/ServicesList.js

@ -75,7 +75,6 @@ Ext.define('Hamsket.store.ServicesList', {
,type: 'messaging' ,type: 'messaging'
,titleBlink: true ,titleBlink: true
,manual_notifications: true ,manual_notifications: true
,userAgent: 'Mozilla/5.0 (X11; Linux x86_64; rv:71.0) Gecko/20100101 Firefox/71.0'
,js_unread: `let checkUnread=()=>{let myframe=document.getElementById("hangout-landing-chat").lastChild,mydocument=myframe.contentDocument||myframe.contentWindow.document;hamsket.updateBadge(mydocument.body.getElementsByClassName("ee").length)};setInterval(checkUnread,3e3);` ,js_unread: `let checkUnread=()=>{let myframe=document.getElementById("hangout-landing-chat").lastChild,mydocument=myframe.contentDocument||myframe.contentWindow.document;hamsket.updateBadge(mydocument.body.getElementsByClassName("ee").length)};setInterval(checkUnread,3e3);`
}, },
{ {
@ -113,7 +112,6 @@ Ext.define('Hamsket.store.ServicesList', {
,url: 'https://mail.google.com/mail/?labs=0' ,url: 'https://mail.google.com/mail/?labs=0'
,type: 'email' ,type: 'email'
,allow_popups: true ,allow_popups: true
,userAgent: 'Mozilla/5.0 (X11; Linux x86_64; rv:71.0) Gecko/20100101 Firefox/71.0'
,js_unread: `let checkUnread=()=>{const a=document.getElementsByClassName("aim")[0].textContent.split(":");hamsket.updateBadge(parseInt(a[a.length-1].replace(/[^0-9]/g,"")))};setInterval(checkUnread,3e3);` ,js_unread: `let checkUnread=()=>{const a=document.getElementsByClassName("aim")[0].textContent.split(":");hamsket.updateBadge(parseInt(a[a.length-1].replace(/[^0-9]/g,"")))};setInterval(checkUnread,3e3);`
,note: 'To enable desktop notifications, you have to go to Settings inside Gmail. <a href="https://support.google.com/mail/answer/1075549?ref_topic=3394466" target="_blank">Read more...</a>' ,note: 'To enable desktop notifications, you have to go to Settings inside Gmail. <a href="https://support.google.com/mail/answer/1075549?ref_topic=3394466" target="_blank">Read more...</a>'
}, },
@ -810,7 +808,6 @@ Ext.define('Hamsket.store.ServicesList', {
,description: 'A free phone number for life. Stay in touch from any screen. Use your free number to text, call, and check voicemail all from one app. Plus, Google Voice works on all of your devices so you can connect and communicate how you want.' ,description: 'A free phone number for life. Stay in touch from any screen. Use your free number to text, call, and check voicemail all from one app. Plus, Google Voice works on all of your devices so you can connect and communicate how you want.'
,url: 'https://voice.google.com' ,url: 'https://voice.google.com'
,type: 'messaging' ,type: 'messaging'
,userAgent: 'Mozilla/5.0 (X11; Linux x86_64; rv:71.0) Gecko/20100101 Firefox/71.0'
,js_unread: `let parseIntOrZero=e=>isNaN(parseInt(e))?0:parseInt(e),checkUnread=()=>{const e=document.querySelector(".msgCount");let n=0;e?n=parseIntOrZero(e.innerHTML.replace(/[() ]/gi,"")):["Messages","Calls","Voicemail"].forEach(function(e){const r=document.querySelector('gv-nav-tab[tooltip="+e+"] div[aria-label="Unread count"]');r&&(n+=parseIntOrZero(r.innerHTML))}),hamsket.updateBadge(n)};setInterval(checkUnread,3e3);;` ,js_unread: `let parseIntOrZero=e=>isNaN(parseInt(e))?0:parseInt(e),checkUnread=()=>{const e=document.querySelector(".msgCount");let n=0;e?n=parseIntOrZero(e.innerHTML.replace(/[() ]/gi,"")):["Messages","Calls","Voicemail"].forEach(function(e){const r=document.querySelector('gv-nav-tab[tooltip="+e+"] div[aria-label="Unread count"]');r&&(n+=parseIntOrZero(r.innerHTML))}),hamsket.updateBadge(n)};setInterval(checkUnread,3e3);;`
}, },
{ {
@ -866,7 +863,6 @@ Ext.define('Hamsket.store.ServicesList', {
,type: 'messaging' ,type: 'messaging'
,titleBlink: true ,titleBlink: true
,manual_notifications: true ,manual_notifications: true
,userAgent: 'Mozilla/5.0 (X11; Linux x86_64; rv:71.0) Gecko/20100101 Firefox/71.0'
,js_unread: `let checkUnread=()=>{hamsket.updateBadge(document.querySelectorAll(".SSPGKf.EyyDtb.Q6oXP:not(.oCHqfe) .eM5l9e.FVKzAb").length)};setInterval(checkUnread,3e3);` ,js_unread: `let checkUnread=()=>{hamsket.updateBadge(document.querySelectorAll(".SSPGKf.EyyDtb.Q6oXP:not(.oCHqfe) .eM5l9e.FVKzAb").length)};setInterval(checkUnread,3e3);`
}, },
{ {
@ -876,7 +872,6 @@ Ext.define('Hamsket.store.ServicesList', {
,description: 'Text on your computer with Messages for web.' ,description: 'Text on your computer with Messages for web.'
,url: 'https://messages.google.com/web' ,url: 'https://messages.google.com/web'
,type: 'messaging' ,type: 'messaging'
,userAgent: 'Mozilla/5.0 (X11; Linux x86_64; rv:71.0) Gecko/20100101 Firefox/71.0'
,js_unread: `let checkUnread=()=>{hamsket.updateBadge(Array.prototype.slice.apply(document.querySelectorAll(".text-content.unread")).reduce((c,b) => !b.querySelector(".notifications-off")+c,0))};setInterval(checkUnread,3e3);` ,js_unread: `let checkUnread=()=>{hamsket.updateBadge(Array.prototype.slice.apply(document.querySelectorAll(".text-content.unread")).reduce((c,b) => !b.querySelector(".notifications-off")+c,0))};setInterval(checkUnread,3e3);`
} }
] ]

15
app/ux/WebView.js

@ -231,6 +231,21 @@ Ext.define('Hamsket.ux.WebView',{
console.info('Start loading...', me.src); console.info('Start loading...', me.src);
if ( !me.down('statusbar').closed || !me.down('statusbar').keep ) me.down('statusbar').show(); if ( !me.down('statusbar').closed || !me.down('statusbar').keep ) me.down('statusbar').show();
me.down('statusbar').showBusy(); me.down('statusbar').showBusy();
me.getWebContents().session.webRequest.onBeforeSendHeaders(
{
urls: [
'https://accounts.google.com/signin/',
'https://accounts.google.com/signin/*',
'https://accounts.google.com/ServiceLogin?*'
]
},
(details, callback) => {
details.requestHeaders['User-Agent'] =
'Mozilla/5.0 (X11; Linux x86_64; rv:79.0) Gecko/20100101 Firefox/79.0';
callback({ requestHeaders: details.requestHeaders });
}
);
}); });
webview.addEventListener("did-stop-loading", function() { webview.addEventListener("did-stop-loading", function() {
me.down('statusbar').clearStatus({useDefaults: true}); me.down('statusbar').clearStatus({useDefaults: true});

Loading…
Cancel
Save