Skip to content

Commit

Permalink
fix #66 clean MORE links from google-added-decorations before opening…
Browse files Browse the repository at this point in the history
… them
  • Loading branch information
squalou committed Jun 13, 2023
1 parent 2d526a3 commit 38108f6
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ An electron-base client for Google Hangouts Chat, since Google didn't see fit to

## CHANGELOG

### 5.24.19-4

Clean MORE links (https://github.com/squalou/google-chat-linux/issues/66)
### 5.24.19-3

Clean links from google decoration before opening them (https://github.com/squalou/google-chat-linux/issues/66)
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ So, **to use electron's Wayland rendering** edit `/usr/share/applciations/google

See full [CHANGELOG](./CHANGELOG.md).

### 5.24.19-4

Clean MORE links (https://github.com/squalou/google-chat-linux/issues/66)

### 5.24.19-3

Clean links from google decoration before opening them (https://github.com/squalou/google-chat-linux/issues/66)
Expand Down
Binary file added build/icons/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "google-chat-linux",
"version": "5.24.19-3",
"version": "5.24.19-4",
"description": "Google Hangouts Chat unofficial linux app",
"main": "src/index.js",
"scripts": {
Expand Down
24 changes: 17 additions & 7 deletions src/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ const noRedirectUrlArrayHardcoded = ["accounts/SetOSID?authuser=0&continue=https
, "https://chat.google.com/"
];

const dirty_start_redirect_url = 'https://www.google.com/url?q=';
const dirty_end_end_redirect_url = '&source=chat&';
const dirty_start_redirect_url = 'https://www.google.com/url?';
const dirty_end_redirect_url_array = ['&source=chat&', '&uct=', '&usg='];

let urlNotRedirectedTmp;
if (process.env.NO_REDIRECT_URL) {
Expand All @@ -37,19 +37,29 @@ console.log("not redirected urls:");
console.log(urlNotRedirected);

const clean_url = (url) => {
//console.log("cleaning url "+url);
init_url=url;
try{
if (url.startsWith(dirty_start_redirect_url)){
url = url.substr(dirty_start_redirect_url.length);
// now that initial dirt is away, there are still chars to remove. Find first http string and remove what's before
ht = url.indexOf('http');
url = url.substr(ht);
}
e = url.indexOf(dirty_end_end_redirect_url);
if(e>0){
url = url.substr(0, e);
}
//console.log("cleaning url step 1 "+url);
dirty_end_redirect_url_array.forEach(d=>{
e = url.indexOf(d);
if(e>0){
url = url.substr(0, e);
}
})
url = decodeURIComponent(url);
//console.log("cleaning url step 2 "+url);
console.log("cleaning url from "+init_url+" to "+url);
return url;
}
catch (e){
console.log("erreur au nettoyage d'url " +e);
console.log("error while cleaning url " +url +"\n" +e);
return init_url;
}
}
Expand Down

0 comments on commit 38108f6

Please sign in to comment.