diff --git a/.gitignore b/.gitignore index 7701503b05..87beaa63c3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .vs node_modules +npm-debug.log diff --git a/src/background.js b/src/background.js index 077ada5ca4..70cc84ddfe 100644 --- a/src/background.js +++ b/src/background.js @@ -1,3 +1,4 @@ var cryptoService = new CryptoService(); var tokenService = new TokenService(); -var userService = new UserService(tokenService); +var apiService = new ApiService(tokenService); +var userService = new UserService(tokenService, apiService); diff --git a/src/manifest.json b/src/manifest.json index 2e50e396c0..737331e265 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -13,11 +13,13 @@ }, "background": { "scripts": [ + "node_modules/jquery/dist/jquery.min.js", "node_modules/sjcl/sjcl.js", "node_modules/sjcl/core/cbc.js", "node_modules/sjcl/core/bitArray.js", "services/cryptoService.js", "services/tokenService.js", + "services/apiService.js", "services/userService.js", "background.js" ] diff --git a/src/package.json b/src/package.json index 861d05266a..a61915e9b0 100644 --- a/src/package.json +++ b/src/package.json @@ -4,6 +4,7 @@ "devDependencies": { "ionic-framework-v1": "1.3.1", "sjcl": "1.0.3", - "angular-jwt": "0.0.9" + "angular-jwt": "0.0.9", + "jquery": "3.1.0" } } diff --git a/src/popup/app/services/apiService.js b/src/popup/app/services/apiService.js index f1a1ef268c..b6eaea7226 100644 --- a/src/popup/app/services/apiService.js +++ b/src/popup/app/services/apiService.js @@ -6,42 +6,21 @@ _apiUri = appSettings.apiUri; _service.sites = $resource(_apiUri + '/sites/:id', {}, { - get: { method: 'GET', params: { id: '@id' } }, - list: { method: 'GET', params: {} }, post: { method: 'POST', params: {} }, put: { method: 'POST', params: { id: '@id' } }, del: { url: _apiUri + '/sites/:id/delete', method: 'POST', params: { id: '@id' } } }); _service.folders = $resource(_apiUri + '/folders/:id', {}, { - get: { method: 'GET', params: { id: '@id' } }, - list: { method: 'GET', params: {} }, post: { method: 'POST', params: {} }, put: { method: 'POST', params: { id: '@id' } }, del: { url: _apiUri + '/folders/:id/delete', method: 'POST', params: { id: '@id' } } }); - _service.ciphers = $resource(_apiUri + '/ciphers/:id', {}, { - get: { method: 'GET', params: { id: '@id' } }, - list: { method: 'GET', params: {} }, - 'import': { url: _apiUri + '/ciphers/import', method: 'POST', params: {} }, - favorite: { url: _apiUri + '/ciphers/:id/favorite', method: 'POST', params: { id: '@id' } }, - del: { url: _apiUri + '/ciphers/:id/delete', method: 'POST', params: { id: '@id' } } - }); - _service.accounts = $resource(_apiUri + '/accounts', {}, { register: { url: _apiUri + '/accounts/register', method: 'POST', params: {} }, - emailToken: { url: _apiUri + '/accounts/email-token', method: 'POST', params: {} }, - email: { url: _apiUri + '/accounts/email', method: 'POST', params: {} }, - putPassword: { url: _apiUri + '/accounts/password', method: 'POST', params: {} }, getProfile: { url: _apiUri + '/accounts/profile', method: 'GET', params: {} }, - putProfile: { url: _apiUri + '/accounts/profile', method: 'POST', params: {} }, - getTwoFactor: { url: _apiUri + '/accounts/two-factor', method: 'GET', params: {} }, - putTwoFactor: { url: _apiUri + '/accounts/two-factor', method: 'POST', params: {} }, - postPasswordHint: { url: _apiUri + '/accounts/password-hint', method: 'POST', params: {} }, - putSecurityStamp: { url: _apiUri + '/accounts/security-stamp', method: 'POST', params: {} }, - 'import': { url: _apiUri + '/accounts/import', method: 'POST', params: {} }, - postDelete: { url: _apiUri + '/accounts/delete', method: 'POST', params: {} } + postPasswordHint: { url: _apiUri + '/accounts/password-hint', method: 'POST', params: {} } }); _service.auth = $resource(_apiUri + '/auth', {}, { diff --git a/src/popup/index.html b/src/popup/index.html index 5903f60491..099cbd59c1 100644 --- a/src/popup/index.html +++ b/src/popup/index.html @@ -5,10 +5,10 @@