diff --git a/README.md b/README.md index 331c261a..0704e2b8 100644 --- a/README.md +++ b/README.md @@ -106,4 +106,4 @@ This project includes a desktop notification hack that can be enable by running ## License -[GPLv3](LICENSE.md) +[GPLv3](LICENSE.md) \ No newline at end of file diff --git a/app/browser/README.md b/app/browser/README.md index eb7ffb24..c4fd5fd8 100644 --- a/app/browser/README.md +++ b/app/browser/README.md @@ -4,6 +4,8 @@ The files in here handle the code that talks with the browser page. The [index.js](index.js) is the entry point it load the [zoom.js](zoom.js) and the [pageTitleNotifications.js](pageTitleNotifications.js) files. +The [onlineOfflineListener.js](onlineOfflineListener.js) adds listeners to the online/offline events and emit an 'online-status-changed' to the ipc when it receives a online/offline event. + The [zoom.js](zoom.js) inject the keyboard shortcuts for zoom in the browser. The [rightClickMenuWithSpellcheck.js](rightClickMenuWithSpellcheck.js) handles the spellchecker and right menu click funcionality. We are leveraging the spellchecker capabilitites to [electron-spell-check-provider](https://www.npmjs.com/package/electron-spell-check-provider) and the right click menu to the [electron-editor-context-menu](https://github.com/mixmaxhq/electron-editor-context-menu) modules. diff --git a/app/browser/index.js b/app/browser/index.js index a8aefb89..d99dc02b 100644 --- a/app/browser/index.js +++ b/app/browser/index.js @@ -2,6 +2,7 @@ const path = require('path'); const { ipcRenderer, remote } = require('electron'); const pageTitleNotifications = require('./pageTitleNotifications'); + require('./onlineOfflineListener')(); require('./rightClickMenuWithSpellcheck'); require('./zoom')(); diff --git a/app/browser/onlineOfflineListener.js b/app/browser/onlineOfflineListener.js new file mode 100644 index 00000000..6fdf4f6b --- /dev/null +++ b/app/browser/onlineOfflineListener.js @@ -0,0 +1,16 @@ + +const { ipcRenderer } = require('electron') + +exports = module.exports = () => { + + console.log('onlineOfflineListener'); + + const updateOnlineStatus = () => { + ipcRenderer.send('online-status-changed', navigator.onLine ? 'online' : 'offline') + } + + window.addEventListener('online', updateOnlineStatus) + window.addEventListener('offline', updateOnlineStatus) + + updateOnlineStatus() +}; \ No newline at end of file diff --git a/app/config/README.md b/app/config/README.md index e928f333..aec8a616 100644 --- a/app/config/README.md +++ b/app/config/README.md @@ -1,3 +1,5 @@ +# Config + This folder contains the configuration options available for the app. ## Available starting arguments diff --git a/app/index.js b/app/index.js index f8f6a70b..2a9fb62c 100644 --- a/app/index.js +++ b/app/index.js @@ -6,6 +6,7 @@ const config = require('./config')(app.getPath('userData')); const login = require('./login'); const Menus = require('./menus'); const notifications = require('./notifications'); +const onlineOffline = require('./onlineOffline'); global.edgeUserAgent = config.edgeUserAgent; @@ -32,6 +33,7 @@ app.on('ready', () => { }); login.handleLoginDialogTry(window); + onlineOffline.reloadPageWhenOfflineToOnline(window, config.url); window.webContents.setUserAgent(config.chromeUserAgent); diff --git a/app/login/README.md b/app/login/README.md index 7fe897fc..e9d7f45b 100644 --- a/app/login/README.md +++ b/app/login/README.md @@ -1,7 +1,9 @@ +# Login + This code handles the login dialog that appears when the app can login using ntlm. [index.js](index.js) is the entry point that creates an electron browser window with the [login.html](login.html) content. -The (formSender.js)[formSender.js] is the minimum js code that is needed to send the code username/password to the electron app in order to callback with the values. +The [formSender.js](formSender.js) is the minimum js code that is needed to send the code username/password to the electron app in order to callback with the values. The username/password aren't cached and the browserWindow gets remove once the form is submit. \ No newline at end of file diff --git a/app/menus/README.md b/app/menus/README.md index 22e6fdea..0fe0dae2 100644 --- a/app/menus/README.md +++ b/app/menus/README.md @@ -1,3 +1,5 @@ +# Menus + This folder handles the menus (tray and main menu). To access the main menu, press the 'Alt' key while the application is selected. @@ -8,6 +10,6 @@ To access the main menu, press the 'Alt' key while the application is selected. * Help: The help menu is defined in the [help.js](help.js) file. -* Preferences: The preferences submenu gets defined in the [preferences.js](preferences.js) file. +* Preferences: The preferences submenu gets defined in the [preferences.js](preferences.js) file. * Tray: [tray.js](tray.js) contains the tray menu and its implementation. \ No newline at end of file diff --git a/app/notifications/README.md b/app/notifications/README.md index fefb651a..d108f920 100644 --- a/app/notifications/README.md +++ b/app/notifications/README.md @@ -1,7 +1,9 @@ +# Notifications + This folder has the code that handles the desktop notifications hack implementation. -There only the [index.js](index.js) file. The desktop notification is a temporary solution that will be hopefully face out as linux clients start implementing its support. +There only the [index.js](index.js) file. The desktop notification is a temporary solution that will be hopefully face out as linux clients start implementing its support. -At the time of writing, Ubuntu 18 does support the notications so it has been deem necessary to disable this hack. +At the time of writing, Ubuntu 18 does support the notications so it has been deem necessary to disable this hack. -It is possible to enable it by using the configuration options. Check the [config README.md](../config/README.md) for more info on how to enableDesktopNotificationsHack \ No newline at end of file +It is possible to enable it by using the configuration options. Check the [config README.md](../config/README.md) for more info on how to enableDesktopNotificationsHack. \ No newline at end of file diff --git a/app/onlineOffline/README.md b/app/onlineOffline/README.md new file mode 100644 index 00000000..c1c9baf3 --- /dev/null +++ b/app/onlineOffline/README.md @@ -0,0 +1,7 @@ +# Online Offline + +This folder contains the code that handles the managing of the online/offline status. + +This is to improve the case when the application when there is still no network connectivity. + +We only try to reload the page once when going from offline to online. \ No newline at end of file diff --git a/app/onlineOffline/index.js b/app/onlineOffline/index.js new file mode 100644 index 00000000..aa74b423 --- /dev/null +++ b/app/onlineOffline/index.js @@ -0,0 +1,15 @@ +const {ipcMain} = require('electron'); +let oldStatus = 'online'; +let reloaded = false; + +exports.reloadPageWhenOfflineToOnline = function reloadPageWhenOfflineToOnline(window, url) { + + ipcMain.on('online-status-changed', (event, status) => { + if ((!reloaded) && (oldStatus === 'offline') && (oldStatus !== status)) { + reloaded = true; + console.log('reloading!!!'); + setTimeout(() => window.loadURL(url), 10000); + } + oldStatus = status; + }); +}; \ No newline at end of file diff --git a/package.json b/package.json index 112eaa0d..70be3eae 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "teams-for-linux", - "version": "0.1.12", + "version": "0.1.13", "main": "app/index.js", "description": "Unofficial client for Microsoft Teams for Linux", "homepage": "https://github.com/IsmaelMartinez/teams-for-linux", @@ -27,16 +27,16 @@ }, "dependencies": { "electron-native-notification": "^1.2.1", - "electron-window-state": "^4.1.1", - "yargs": "^12.0.1", - "electron-spell-check-provider": "*", - "electron-editor-context-menu": "*" + "electron-window-state": "^5.0.3", + "yargs": "^12.0.5", + "electron-spell-check-provider": "^1.1.1", + "electron-editor-context-menu": "^1.1.1" }, "devDependencies": { - "electron": "^3.0.0", + "electron": "^4.0.1", "electron-builder": "^20.28.4", - "eslint": "^5.10.0", - "yarn": "^1.12.3" + "eslint": "^5.12.0", + "yarn": "^1.13.0" }, "build": { "appId": "teams-for-linux", diff --git a/yarn.lock b/yarn.lock index b75e6136..ac7e5e70 100644 --- a/yarn.lock +++ b/yarn.lock @@ -23,10 +23,10 @@ esutils "^2.0.2" js-tokens "^4.0.0" -"@types/node@^8.0.24": - version "8.10.38" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.38.tgz#e05c201a668492e534b48102aca0294898f449f6" - integrity sha512-EibsnbJerd0hBFaDjJStFrVbVBAtOy4dgL8zZFw0uOvPqzBAX59Ci8cgjg3+RgJIWhsB5A4c+pi+D4P9tQQh/A== +"@types/node@^10.12.18": + version "10.12.18" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.18.tgz#1d3ca764718915584fcd9f6344621b7672665c67" + integrity sha512-fh+pAqt4xRzPfqA6eh3Z2y6fyZavRIumvjhaCL753+TVkGKGhpPeyrJG2JftD0T9q4GF00KjefsQ+PQNDdWQaQ== acorn-jsx@^5.0.0: version "5.0.1" @@ -282,17 +282,10 @@ builtin-modules@^1.0.0: resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" integrity sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8= -caller-path@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" - integrity sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8= - dependencies: - callsites "^0.2.0" - -callsites@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" - integrity sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo= +callsites@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.0.0.tgz#fb7eb569b72ad7a45812f93fd9430a3e410b3dd3" + integrity sha512-tWnkwu9YEq2uzlBDI4RcLn8jrFvF9AOi8PxDNU3hZZjJcjkcRAq3vCI+vZcg1SuxISDYe86k9VZFwAxDiJGoAw== camelcase-keys@^2.0.0: version "2.1.0" @@ -520,11 +513,6 @@ decamelize@^1.1.2, decamelize@^1.2.0: resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= -deep-equal@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.0.1.tgz#f5d260292b660e084eff4cdbc9f08ad3247448b5" - integrity sha1-9dJgKStmDghO/0zbyfCK0yR0SLU= - deep-extend@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" @@ -630,7 +618,7 @@ electron-download@^4.1.0: semver "^5.4.1" sumchecker "^2.0.2" -electron-editor-context-menu@*: +electron-editor-context-menu@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/electron-editor-context-menu/-/electron-editor-context-menu-1.1.1.tgz#dc30098e0dfb37f62628e43303124c7f3379572d" integrity sha1-3DAJjg37N/YmKOQzAxJMfzN5Vy0= @@ -671,7 +659,7 @@ electron-publish@20.38.2: lazy-val "^1.0.3" mime "^2.4.0" -electron-spell-check-provider@*: +electron-spell-check-provider@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/electron-spell-check-provider/-/electron-spell-check-provider-1.1.1.tgz#bbb521dcb314f9da020b4afca53f4e7a8e08955e" integrity sha512-MXetFfJ9AkVgPehpL11mJwdDRX7N07ev1ZbUHAEYO2YOMYHNJ0gMI7AHEAw8KKN4vjaAut7Tlli9QgU8MGgtNA== @@ -679,21 +667,20 @@ electron-spell-check-provider@*: spellchecker "^3.4.4" underscore "^1.8.3" -electron-window-state@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/electron-window-state/-/electron-window-state-4.1.1.tgz#6b34fdc31b38514dfec8b7c8f7b5d4addb67632d" - integrity sha1-azT9wxs4UU3+yLfI97XUrdtnYy0= +electron-window-state@^5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/electron-window-state/-/electron-window-state-5.0.3.tgz#4f36d09e3f953d87aff103bf010f460056050aa8" + integrity sha512-1mNTwCfkolXl3kMf50yW3vE2lZj0y92P/HYWFBrb+v2S/pCka5mdwN3cagKm458A7NjndSwijynXgcLWRodsVg== dependencies: - deep-equal "^1.0.1" - jsonfile "^2.2.3" + jsonfile "^4.0.0" mkdirp "^0.5.1" -electron@^3.0.0: - version "3.0.11" - resolved "https://registry.yarnpkg.com/electron/-/electron-3.0.11.tgz#81e350db741fc0f2997ecb2fef5ed085ca42a723" - integrity sha512-galllxAMT3HLbHNR6i5WXrUXzsxzz0D1X6vu3uFMhofU9Wdbxv2w7BAD/BcYTT4c1bu4nZEgXO6AvHXjq0Sksw== +electron@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/electron/-/electron-4.0.1.tgz#c41eaee9e081c2e5e4a4a4a761b7577a77d2eb18" + integrity sha512-kBWDLn1Vq8Tm6+/HpQc8gkjX7wJyQI8v/lf2kAirfi0Q4cXh6vBjozFvV1U/9gGCbyKnIDM+m8/wpyJIjg4w7g== dependencies: - "@types/node" "^8.0.24" + "@types/node" "^10.12.18" electron-download "^4.1.0" extract-zip "^1.0.3" @@ -732,10 +719,10 @@ eslint-visitor-keys@^1.0.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" integrity sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ== -eslint@^5.10.0: - version "5.10.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.10.0.tgz#24adcbe92bf5eb1fc2d2f2b1eebe0c5e0713903a" - integrity sha512-HpqzC+BHULKlnPwWae9MaVZ5AXJKpkxCVXQHrFaRw3hbDj26V/9ArYM4Rr/SQ8pi6qUPLXSSXC4RBJlyq2Z2OQ== +eslint@^5.12.0: + version "5.12.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.12.0.tgz#fab3b908f60c52671fb14e996a450b96c743c859" + integrity sha512-LntwyPxtOHrsJdcSwyQKVtHofPHdv+4+mFwEe91r2V13vqpM8yLr7b1sW+Oo/yheOPkWYsYlYJCkzlFAt8KV7g== dependencies: "@babel/code-frame" "^7.0.0" ajv "^6.5.3" @@ -754,6 +741,7 @@ eslint@^5.10.0: glob "^7.1.2" globals "^11.7.0" ignore "^4.0.6" + import-fresh "^3.0.0" imurmurhash "^0.1.4" inquirer "^6.1.0" js-yaml "^3.12.0" @@ -768,7 +756,6 @@ eslint@^5.10.0: pluralize "^7.0.0" progress "^2.0.0" regexpp "^2.0.1" - require-uncached "^1.0.3" semver "^5.5.1" strip-ansi "^4.0.0" strip-json-comments "^2.0.1" @@ -1097,6 +1084,14 @@ ignore@^4.0.6: resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== +import-fresh@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.0.0.tgz#a3d897f420cab0e671236897f75bc14b4885c390" + integrity sha512-pOnA9tfM3Uwics+SaBLCNyZZZbK+4PTu0OPZtLlMIrv17EdBoC15S9Kn8ckJ9TZTyKb3ywNE5y1yeDxxGA7nTQ== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + import-lazy@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-2.1.0.tgz#05698e3d45c88e8d7e9d92cb0584e77f096f3e43" @@ -1321,13 +1316,6 @@ json5@^2.1.0: dependencies: minimist "^1.2.0" -jsonfile@^2.2.3: - version "2.4.0" - resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-2.4.0.tgz#3736a2b428b87bbda0cc83b53fa3d633a35c2ae8" - integrity sha1-NzaitCi4e72gzIO1P6PWM6NcKug= - optionalDependencies: - graceful-fs "^4.1.6" - jsonfile@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" @@ -1696,6 +1684,13 @@ package-json@^4.0.0: registry-url "^3.0.3" semver "^5.1.0" +parent-module@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.0.tgz#df250bdc5391f4a085fb589dad761f5ad6b865b5" + integrity sha512-8Mf5juOMmiE4FcmzYc4IaiS9L3+9paz2KOiXzkRviCP6aDmN49Hz6EMWz0lGNp9pX80GvvAuLADtyGfW/Em3TA== + dependencies: + callsites "^3.0.0" + parse-color@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/parse-color/-/parse-color-1.0.0.tgz#7b748b95a83f03f16a94f535e52d7f3d94658619" @@ -1989,18 +1984,10 @@ require-main-filename@^1.0.1: resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" integrity sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE= -require-uncached@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" - integrity sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM= - dependencies: - caller-path "^0.1.0" - resolve-from "^1.0.0" - -resolve-from@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" - integrity sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY= +resolve-from@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== restore-cursor@^2.0.0: version "2.0.0" @@ -2555,7 +2542,7 @@ yargs-parser@^11.1.1: camelcase "^5.0.0" decamelize "^1.2.0" -yargs@^12.0.1, yargs@^12.0.5: +yargs@^12.0.5: version "12.0.5" resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.5.tgz#05f5997b609647b64f66b81e3b4b10a368e7ad13" integrity sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw== @@ -2573,10 +2560,10 @@ yargs@^12.0.1, yargs@^12.0.5: y18n "^3.2.1 || ^4.0.0" yargs-parser "^11.1.1" -yarn@^1.12.3: - version "1.12.3" - resolved "https://registry.yarnpkg.com/yarn/-/yarn-1.12.3.tgz#fb4599bf1f8da01552bcc7e1571dfd4e53788203" - integrity sha512-8f5rWNDvkhAmCxmn8C0LsNWMxTYVk4VGKiq0sIB6HGZjaZTHsGIH87SUmVDUEd2Wk54bqKoUlbVWgQFCQhRkVw== +yarn@^1.13.0: + version "1.13.0" + resolved "https://registry.yarnpkg.com/yarn/-/yarn-1.13.0.tgz#affa9c956739548024068532a902cf18c9cb523f" + integrity sha512-Unfw2eefv8imt4ZMPhvFVP44WCz38huDxkHs+Yqrx4wBTK75Tr0mh3V4rh+2Nw5iQq0rcM/VafotCZo9qTb5DA== yauzl@2.4.1: version "2.4.1"