| Index: remoting/webapp/crd/js/legacy_host_list_api.js
|
| diff --git a/remoting/webapp/crd/js/host_list_api_impl.js b/remoting/webapp/crd/js/legacy_host_list_api.js
|
| similarity index 86%
|
| rename from remoting/webapp/crd/js/host_list_api_impl.js
|
| rename to remoting/webapp/crd/js/legacy_host_list_api.js
|
| index edea31893447f7fec57f955d9cbddbd90ec93a37..c99c97758b1575ebfa76d5802694c7b493e4a4ad 100644
|
| --- a/remoting/webapp/crd/js/host_list_api_impl.js
|
| +++ b/remoting/webapp/crd/js/legacy_host_list_api.js
|
| @@ -18,12 +18,13 @@ var remoting = remoting || {};
|
| * @constructor
|
| * @implements {remoting.HostListApi}
|
| */
|
| -remoting.HostListApiImpl = function() {
|
| +remoting.LegacyHostListApi = function() {
|
| };
|
|
|
| /** @override */
|
| -remoting.HostListApiImpl.prototype.register = function(
|
| - newHostId, hostName, publicKey, hostClientId) {
|
| +remoting.LegacyHostListApi.prototype.register = function(
|
| + hostName, publicKey, hostClientId) {
|
| + var newHostId = base.generateUuid();
|
| var newHostDetails = { data: {
|
| hostId: newHostId,
|
| hostName: hostName,
|
| @@ -44,7 +45,12 @@ remoting.HostListApiImpl.prototype.register = function(
|
| var result = /** @type {!Object} */ (response.getJson());
|
| var data = base.getObjectAttr(result, 'data');
|
| var authCode = base.getStringAttr(data, 'authorizationCode');
|
| - return { authCode: authCode, email: '', gcdId: '' };
|
| + return {
|
| + authCode: authCode,
|
| + email: '',
|
| + hostId: newHostId,
|
| + isLegacy: true
|
| + };
|
| } else {
|
| console.log(
|
| 'Failed to register the host. Status: ' + response.status +
|
| @@ -55,7 +61,7 @@ remoting.HostListApiImpl.prototype.register = function(
|
| };
|
|
|
| /** @override */
|
| -remoting.HostListApiImpl.prototype.get = function() {
|
| +remoting.LegacyHostListApi.prototype.get = function() {
|
| var that = this;
|
| return new remoting.Xhr({
|
| method: 'GET',
|
| @@ -67,7 +73,7 @@ remoting.HostListApiImpl.prototype.get = function() {
|
| };
|
|
|
| /** @override */
|
| -remoting.HostListApiImpl.prototype.put =
|
| +remoting.LegacyHostListApi.prototype.put =
|
| function(hostId, hostName, hostPublicKey) {
|
| return new remoting.Xhr({
|
| method: 'PUT',
|
| @@ -80,16 +86,16 @@ remoting.HostListApiImpl.prototype.put =
|
| }
|
| },
|
| useIdentity: true
|
| - }).start().then(remoting.HostListApiImpl.defaultResponse_());
|
| + }).start().then(remoting.LegacyHostListApi.defaultResponse_());
|
| };
|
|
|
| /** @override */
|
| -remoting.HostListApiImpl.prototype.remove = function(hostId) {
|
| +remoting.LegacyHostListApi.prototype.remove = function(hostId) {
|
| return new remoting.Xhr({
|
| method: 'DELETE',
|
| url: remoting.settings.DIRECTORY_API_BASE_URL + '/@me/hosts/' + hostId,
|
| useIdentity: true
|
| - }).start().then(remoting.HostListApiImpl.defaultResponse_(
|
| + }).start().then(remoting.LegacyHostListApi.defaultResponse_(
|
| [remoting.Error.Tag.NOT_FOUND]));
|
| };
|
|
|
| @@ -102,7 +108,8 @@ remoting.HostListApiImpl.prototype.remove = function(hostId) {
|
| * @return {!Array<!remoting.Host>}
|
| * @private
|
| */
|
| -remoting.HostListApiImpl.prototype.parseHostListResponse_ = function(response) {
|
| +remoting.LegacyHostListApi.prototype.parseHostListResponse_ =
|
| + function(response) {
|
| if (response.status == 200) {
|
| var obj = /** @type {{data: {items: Array}}} */
|
| (base.jsonParseSafe(response.getText()));
|
| @@ -140,7 +147,7 @@ remoting.HostListApiImpl.prototype.parseHostListResponse_ = function(response) {
|
| * @return {function(!remoting.Xhr.Response):void}
|
| * @private
|
| */
|
| -remoting.HostListApiImpl.defaultResponse_ = function(opt_ignoreErrors) {
|
| +remoting.LegacyHostListApi.defaultResponse_ = function(opt_ignoreErrors) {
|
| /** @param {!remoting.Xhr.Response} response */
|
| var result = function(response) {
|
| var error = remoting.Error.fromHttpStatus(response.status);
|
| @@ -158,7 +165,7 @@ remoting.HostListApiImpl.defaultResponse_ = function(opt_ignoreErrors) {
|
| };
|
|
|
| /** @override */
|
| -remoting.HostListApiImpl.prototype.getSupportHost = function(supportId) {
|
| +remoting.LegacyHostListApi.prototype.getSupportHost = function(supportId) {
|
| return new remoting.Xhr({
|
| method: 'GET',
|
| url: remoting.settings.DIRECTORY_API_BASE_URL + '/support-hosts/' +
|
|
|