diff --git a/images/migrated_app_icons/docs.png b/images/migrated_app_icons/docs.png new file mode 100644 index 0000000..b8f9865 Binary files /dev/null and b/images/migrated_app_icons/docs.png differ diff --git a/images/migrated_app_icons/drive.png b/images/migrated_app_icons/drive.png new file mode 100644 index 0000000..f568ae9 Binary files /dev/null and b/images/migrated_app_icons/drive.png differ diff --git a/images/migrated_app_icons/gmail.png b/images/migrated_app_icons/gmail.png new file mode 100644 index 0000000..0981b3e Binary files /dev/null and b/images/migrated_app_icons/gmail.png differ diff --git a/images/migrated_app_icons/sheets.png b/images/migrated_app_icons/sheets.png new file mode 100644 index 0000000..fffd882 Binary files /dev/null and b/images/migrated_app_icons/sheets.png differ diff --git a/images/migrated_app_icons/slides.png b/images/migrated_app_icons/slides.png new file mode 100644 index 0000000..fa89b2e Binary files /dev/null and b/images/migrated_app_icons/slides.png differ diff --git a/images/migrated_app_icons/youtube.png b/images/migrated_app_icons/youtube.png new file mode 100644 index 0000000..f393e87 Binary files /dev/null and b/images/migrated_app_icons/youtube.png differ diff --git a/js/app.js b/js/app.js index 7cd6c03..06d88b0 100644 --- a/js/app.js +++ b/js/app.js @@ -2,7 +2,7 @@ 'use strict'; var app = angular.module('newTab', ['newTab.controllers', 'newTab.directives', 'newTab.filters']); - app.constant('IMAGE_SOURCES', /^\s*(https?|ftp|file|blob|chrome):|data:image\//); + app.constant('IMAGE_SOURCES', /^\s*(https?|ftp|file|blob|chrome|chrome-extension):|data:image\//); app.constant('ANCHOR_HREFS', /^\s*(https?|ftp|mailto|tel|file|chrome|about|chrome-extension):/); app.constant('ANCHOR_HREFS_REQ_UPDATE', /^\s*(file|chrome|chrome-extension):/); diff --git a/js/controllers.js b/js/controllers.js index c6ac6b2..7b8e4df 100644 --- a/js/controllers.js +++ b/js/controllers.js @@ -78,9 +78,32 @@ $scope.apps = results.filter(function (result) { return (/^(extension|theme)$/).test(result.type) === false; }); + }).then(async function() { + $scope.apps.push(...await getMigratedApps()) }); } + async function getMigratedApps() { + const basePath = "../migrated_apps/"; + const jsonPaths = ["slides.json", "docs.json", "drive.json", "youtube.json", "sheets.json", "gmail.json"]; + let migratedApps = []; + + for (const path of jsonPaths) { + const i = jsonPaths.indexOf(path); + let url = basePath + path; + await fetch(url) + .then(res => res.json()) + .then(function(data) { + migratedApps.push(data); + }) + .catch((error) => { + console.error(error); + }) + } + + return migratedApps; + } + $scope.$on('UninstalledApp', loadApps); // initial page setup diff --git a/js/filters.js b/js/filters.js index b825237..5c1da70 100644 --- a/js/filters.js +++ b/js/filters.js @@ -28,6 +28,9 @@ append = '?grayscale=true'; } + // Replace $CHROME_EXT_ID$ with extensionID if it exists. + found.url = found.url.replace("$CHROME_EXT_ID$", chrome.runtime.id); + return found.url + append; } return void 0; diff --git a/manifest.json b/manifest.json index 46e1be4..e2d6869 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "name": "New Tab Redirect", "short_name": "NTR!", "description": "Allows a user to provide the URL of the page that loads in a new tab.", - "version": "3.1.5", + "version": "3.1.6", "background": { "scripts" : ["js/background.js"], "persistent": false @@ -20,5 +20,6 @@ "19":"images/icon19.png" }, "incognito": "split", - "minimum_chrome_version" : "22" + "minimum_chrome_version" : "22", + "web_accessible_resources": ["images/migrated_app_icons/*.png"] } diff --git a/migrated_apps/README.md b/migrated_apps/README.md new file mode 100644 index 0000000..6906fea --- /dev/null +++ b/migrated_apps/README.md @@ -0,0 +1,29 @@ +At some point Google decided to migrate some of their apps from the chrome webstore to their new G-Suite. + +This meant that the "default" Google and YouTube apps were no longer getting returned by the API. + +As of the current time of writing this the only non-code-change workaround for this problem is to disable the following chrome flags: + +``#enable-migrate-default-chrome-app-to-web-apps-gsuite`` + +``#enable-migrate-default-chrome-app-to-web-apps-non-gsuite`` + +Going under the assumption that Google will eventually remove these flags I have made the following workaround: + +1. Copied the API responses for all the 6 now missing Apps, and put them in the ``migrated_apps`` directory. + +2. Downloaded the icons for all 6 Apps and put them in the ``images/migrated_app_icons`` directory. + +3. Modified the icon url with a regex substring that will be replaced with extension id. + +4. Concatenated the app list in loadApps with the migrated apps + + +Pros of this workaround: + +1. It Works. + +Cons of this workaround: + +1. It involves keeping snapshots of these App API responses +2. Some features like "Uninstall" will be rendered useless on these specific migrated apps \ No newline at end of file diff --git a/migrated_apps/docs.json b/migrated_apps/docs.json new file mode 100644 index 0000000..8830b93 --- /dev/null +++ b/migrated_apps/docs.json @@ -0,0 +1,28 @@ +{ + "appLaunchUrl": "chrome-extension://aohghmighlieiainnegkcijnfilokake/main.html", + "availableLaunchTypes": [ + "OPEN_AS_REGULAR_TAB", + "OPEN_AS_WINDOW" + ], + "description": "Create and edit documents ", + "enabled": true, + "homepageUrl": "https://chrome.google.com/webstore/detail/aohghmighlieiainnegkcijnfilokake", + "hostPermissions": [], + "icons": [ + { + "size": 128, + "url": "chrome-extension://$CHROME_EXT_ID$/images/migrated_app_icons/docs.png" + } + ], + "id": "aohghmighlieiainnegkcijnfilokake", + "installType": "normal", + "isApp": true, + "launchType": "OPEN_AS_REGULAR_TAB", + "mayDisable": true, + "name": "Docs", + "offlineEnabled": true, + "optionsUrl": "", + "permissions": [], + "shortName": "Docs", + "type": "legacy_packaged_app" +} \ No newline at end of file diff --git a/migrated_apps/drive.json b/migrated_apps/drive.json new file mode 100644 index 0000000..17ed4e9 --- /dev/null +++ b/migrated_apps/drive.json @@ -0,0 +1,32 @@ +{ + "appLaunchUrl": "https://drive.google.com/?usp=chrome_app", + "availableLaunchTypes": [ + "OPEN_AS_REGULAR_TAB", + "OPEN_AS_WINDOW" + ], + "description": "Google Drive: create, share and keep all your stuff in one place.", + "enabled": true, + "homepageUrl": "https://chrome.google.com/webstore/detail/apdfllckaahabafndbhieahigkjlhalf", + "hostPermissions": [], + "icons": [ + { + "size": 128, + "url": "chrome-extension://$CHROME_EXT_ID$/images/migrated_app_icons/drive.png" + } + ], + "id": "apdfllckaahabafndbhieahigkjlhalf", + "installType": "normal", + "isApp": true, + "launchType": "OPEN_AS_REGULAR_TAB", + "mayDisable": true, + "name": "Google Drive", + "offlineEnabled": true, + "optionsUrl": "https://drive.google.com/drive/settings", + "permissions": [ + "clipboardRead", + "clipboardWrite", + "notifications" + ], + "shortName": "Google Drive", + "type": "hosted_app" +} \ No newline at end of file diff --git a/migrated_apps/gmail.json b/migrated_apps/gmail.json new file mode 100644 index 0000000..736ab65 --- /dev/null +++ b/migrated_apps/gmail.json @@ -0,0 +1,30 @@ +{ + "appLaunchUrl": "https://mail.google.com/mail", + "availableLaunchTypes": [ + "OPEN_AS_REGULAR_TAB", + "OPEN_AS_WINDOW" + ], + "description": "Fast, searchable email with less spam.", + "enabled": true, + "homepageUrl": "https://chrome.google.com/webstore/detail/pjkljhegncpnkpknbcohdijeoejaedia", + "hostPermissions": [], + "icons": [ + { + "size": 128, + "url": "chrome-extension://$CHROME_EXT_ID$/images/migrated_app_icons/gmail.png" + } + ], + "id": "pjkljhegncpnkpknbcohdijeoejaedia", + "installType": "normal", + "isApp": true, + "launchType": "OPEN_AS_REGULAR_TAB", + "mayDisable": true, + "name": "Gmail", + "offlineEnabled": false, + "optionsUrl": "https://mail.google.com/mail/#settings", + "permissions": [ + "notifications" + ], + "shortName": "Gmail", + "type": "hosted_app" +} \ No newline at end of file diff --git a/migrated_apps/sheets.json b/migrated_apps/sheets.json new file mode 100644 index 0000000..0cea08d --- /dev/null +++ b/migrated_apps/sheets.json @@ -0,0 +1,28 @@ +{ + "appLaunchUrl": "chrome-extension://felcaaldnbdncclmgdcncolpebgiejap/main.html", + "availableLaunchTypes": [ + "OPEN_AS_REGULAR_TAB", + "OPEN_AS_WINDOW" + ], + "description": "Create and edit spreadsheets", + "enabled": true, + "homepageUrl": "https://chrome.google.com/webstore/detail/felcaaldnbdncclmgdcncolpebgiejap", + "hostPermissions": [], + "icons": [ + { + "size": 128, + "url": "chrome-extension://$CHROME_EXT_ID$/images/migrated_app_icons/sheets.png" + } + ], + "id": "felcaaldnbdncclmgdcncolpebgiejap", + "installType": "normal", + "isApp": true, + "launchType": "OPEN_AS_REGULAR_TAB", + "mayDisable": true, + "name": "Sheets", + "offlineEnabled": true, + "optionsUrl": "", + "permissions": [], + "shortName": "Sheets", + "type": "legacy_packaged_app" +} \ No newline at end of file diff --git a/migrated_apps/slides.json b/migrated_apps/slides.json new file mode 100644 index 0000000..000cc50 --- /dev/null +++ b/migrated_apps/slides.json @@ -0,0 +1,28 @@ +{ + "appLaunchUrl": "chrome-extension://aapocclcgogkmnckokdopfmhonfmgoek/main.html", + "availableLaunchTypes": [ + "OPEN_AS_REGULAR_TAB", + "OPEN_AS_WINDOW" + ], + "description": "Create and edit presentations ", + "enabled": true, + "homepageUrl": "https://chrome.google.com/webstore/detail/aapocclcgogkmnckokdopfmhonfmgoek", + "hostPermissions": [], + "icons": [ + { + "size": 128, + "url": "chrome-extension://$CHROME_EXT_ID$/images/migrated_app_icons/slides.png" + } + ], + "id": "aapocclcgogkmnckokdopfmhonfmgoek", + "installType": "normal", + "isApp": true, + "launchType": "OPEN_AS_REGULAR_TAB", + "mayDisable": false, + "name": "Slides", + "offlineEnabled": true, + "optionsUrl": "", + "permissions": [], + "shortName": "Slides", + "type": "legacy_packaged_app" +} \ No newline at end of file diff --git a/migrated_apps/youtube.json b/migrated_apps/youtube.json new file mode 100644 index 0000000..c91228e --- /dev/null +++ b/migrated_apps/youtube.json @@ -0,0 +1,28 @@ +{ + "appLaunchUrl": "http://www.youtube.com/", + "availableLaunchTypes": [ + "OPEN_AS_REGULAR_TAB", + "OPEN_AS_WINDOW" + ], + "description": "", + "enabled": true, + "homepageUrl": "https://chrome.google.com/webstore/detail/blpcfgokakmgnkcojhhkbfbldkacnbeo", + "hostPermissions": [], + "icons": [ + { + "size": 128, + "url": "chrome-extension://$CHROME_EXT_ID$/images/migrated_app_icons/youtube.png" + } + ], + "id": "blpcfgokakmgnkcojhhkbfbldkacnbeo", + "installType": "normal", + "isApp": true, + "launchType": "OPEN_AS_REGULAR_TAB", + "mayDisable": true, + "name": "YouTube", + "offlineEnabled": false, + "optionsUrl": "", + "permissions": [], + "shortName": "YouTube", + "type": "hosted_app" +} \ No newline at end of file