From 11c7acf744a48582aac82586057cda30abf7df72 Mon Sep 17 00:00:00 2001 From: Emile Nijssen Date: Wed, 6 Nov 2024 17:10:51 +0100 Subject: [PATCH 1/4] add login to repair --- lib/OAuth2Driver.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/OAuth2Driver.js b/lib/OAuth2Driver.js index 060e606..cf7db69 100644 --- a/lib/OAuth2Driver.js +++ b/lib/OAuth2Driver.js @@ -318,6 +318,19 @@ class OAuth2Driver extends Homey.Driver { } }; + const onLogin = async ({ username, password }) => { + await client.getTokenByCredentials({ username, password }); + + await device.onOAuth2Uninit(); + await device.setStoreValue('OAuth2SessionId', OAuth2SessionId); + await device.setStoreValue('OAuth2ConfigId', OAuth2ConfigId); + await client.save(); + device.oAuth2Client = client; + await device.onOAuth2Init(); + + return true; + }; + const onShowView = async viewId => { if (viewId === 'login_oauth2') { await onShowViewLoginOAuth2(); @@ -330,6 +343,7 @@ class OAuth2Driver extends Homey.Driver { socket .setHandler('showView', onShowView) + .setHandler('login', onLogin) .setHandler('disconnect', onDisconnect); } From 5d90e0ab51e515db5674d1e356c6256046726985 Mon Sep 17 00:00:00 2001 From: Emile Nijssen Date: Wed, 6 Nov 2024 17:11:57 +0100 Subject: [PATCH 2/4] add license --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 6723749..e23a4db 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "dependencies": { "node-fetch": "^2.3.0" }, + "license": "MIT", "devDependencies": { "@athombv/jsdoc-template": "^1.6.1", "@types/jest": "^28.1.1", @@ -47,4 +48,4 @@ ] } } -} +} \ No newline at end of file From 403706b1d33b76b7d1713f9f3d417b8834e7f744 Mon Sep 17 00:00:00 2001 From: Emile Nijssen Date: Wed, 6 Nov 2024 17:15:59 +0100 Subject: [PATCH 3/4] add App.onOAuth2Uninit, Driver.onOAuth2Uninit --- lib/OAuth2App.js | 14 ++++++++++++++ lib/OAuth2Driver.js | 16 ++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/lib/OAuth2App.js b/lib/OAuth2App.js index 7693c29..3a3c7f7 100644 --- a/lib/OAuth2App.js +++ b/lib/OAuth2App.js @@ -54,6 +54,13 @@ class OAuth2App extends Homey.App { await this.onOAuth2Init(); } + /** + * @returns {Promise} + */ + async onUninit() { + await this.onOAuth2Uninit(); + } + /** * @returns {Promise} */ @@ -61,6 +68,13 @@ class OAuth2App extends Homey.App { // Overload Me } + /** + * @returns {Promise} + */ + async onOAuth2Uninit() { + // Overload Me + } + /** */ enableOAuth2Debug() { diff --git a/lib/OAuth2Driver.js b/lib/OAuth2Driver.js index cf7db69..78ef1dd 100644 --- a/lib/OAuth2Driver.js +++ b/lib/OAuth2Driver.js @@ -24,6 +24,13 @@ class OAuth2Driver extends Homey.Driver { await this.onOAuth2Init(); } + /** + * @returns {Promise} + */ + async onUninit() { + await this.onOAuth2Uninit(); + } + /** * @description * > This method can be extended @@ -33,6 +40,15 @@ class OAuth2Driver extends Homey.Driver { // Extend me } + /** + * @description + * > This method can be extended + * @returns {Promise} + */ + async onOAuth2Uninit() { + // Extend me + } + /** * @returns {*} */ From 1cd796bcae97879e2dc3e646cf750f33d60c8cdf Mon Sep 17 00:00:00 2001 From: Homey Github Actions Bot Date: Wed, 6 Nov 2024 16:17:42 +0000 Subject: [PATCH 4/4] 3.6.0 --- package-lock.json | 4 ++-- package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index ad01a9a..1198866 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "homey-oauth2app", - "version": "3.5.7", + "version": "3.6.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "homey-oauth2app", - "version": "3.5.7", + "version": "3.6.0", "dependencies": { "node-fetch": "^2.3.0" }, diff --git a/package.json b/package.json index e23a4db..30719d4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "homey-oauth2app", - "version": "3.5.7", + "version": "3.6.0", "description": "", "main": "index.js", "files": [ @@ -48,4 +48,4 @@ ] } } -} \ No newline at end of file +}