diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bcde96..5b47d40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/README.md b/README.md index 0d5a678..e05c1ac 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/build/icons/icon.png b/build/icons/icon.png new file mode 100644 index 0000000..68bf547 Binary files /dev/null and b/build/icons/icon.png differ diff --git a/package-lock.json b/package-lock.json index 38300cb..0b6a090 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "google-chat-linux", - "version": "5.24.19-3", + "version": "5.24.19-4", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/package.json b/package.json index 123ad48..e998fe5 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/window.js b/src/window.js index e059a48..d340e0f 100644 --- a/src/window.js +++ b/src/window.js @@ -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) { @@ -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; } }