google-device-access: publish

This commit is contained in:
Koushik Dutta
2021-12-22 11:33:15 -08:00
parent 6d5267e617
commit 47be8de815
3 changed files with 4 additions and 16 deletions

View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/google-device-access",
"version": "0.0.39",
"version": "0.0.41",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/google-device-access",
"version": "0.0.39",
"version": "0.0.41",
"dependencies": {
"@googleapis/smartdevicemanagement": "^0.2.0",
"axios": "^0.21.1",

View File

@@ -43,5 +43,5 @@
"@types/node": "^14.17.11",
"@types/url-parse": "^1.4.3"
},
"version": "0.0.39"
"version": "0.0.41"
}

View File

@@ -288,19 +288,7 @@ class GoogleSmartDeviceAccess extends ScryptedDeviceBase implements OauthClient,
refreshThrottled = throttle(async () => {
const response = await this.authGet('/devices');
const userId = response.headers['user-id'];
if (userId && this.storage.getItem('userId') !== userId) {
try {
const endpoint = await endpointManager.getPublicCloudEndpoint();
this.console.log('pubsub endpoint:', endpoint);
await axios.post(`https://scrypted-gda-server.uw.r.appspot.com/register/${userId}`, {
endpoint,
});
this.storage.setItem('userId', userId);
}
catch (e) {
this.console.error('register error', e);
}
}
this.console.log('user-id', userId);
return response.data;
}, refreshFrequency * 1000);