mirror of
https://github.com/koush/scrypted.git
synced 2026-07-09 08:30:39 +01:00
google-device-access: publish
This commit is contained in:
4
plugins/google-device-access/package-lock.json
generated
4
plugins/google-device-access/package-lock.json
generated
@@ -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",
|
||||
|
||||
@@ -43,5 +43,5 @@
|
||||
"@types/node": "^14.17.11",
|
||||
"@types/url-parse": "^1.4.3"
|
||||
},
|
||||
"version": "0.0.39"
|
||||
"version": "0.0.41"
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user