Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/sonarqube.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: SonarQube

on:
pull_request:
push:
branches:
- master

jobs:
sonarqube:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: SonarQube Scan
uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
# If you wish to fail your job when the Quality Gate is red, uncomment the
# following lines. This would typically be used to fail a deployment.
- name: SonarQube Quality Gate check
uses: sonarsource/sonarqube-quality-gate-action@master
timeout-minutes: 5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
16 changes: 13 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
node_modules
# IDE stuff
.idea
.vscode

# dependencies
node_modules
vendor

# artifacts
.sass-cache
npm-debug.log
dist

# Don't mess with other dev's config
# don't mess with other dev's config
launch_phpunit.sh
dist

# since we are using only dev dependencies atm, we can exclude it from polluting the repo
composer.lock
11 changes: 5 additions & 6 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,26 +338,25 @@ module.exports = function (grunt) {
replacement: function (matchedString) {
jsResources = [];

var jsArray = matchedString.match(/script\([A-z']+,\s?'([\/A-z.-]+)'\);/g);
const jsArray = matchedString.match(/script\([A-z]+::[A-z_]+,\s?'([\/A-z.-]+)'\);/g);
jsArray.forEach(function (file) {
var regex = /script\([A-z']+,\s?'([\/A-z.-]+)'\);/g;
var matches = regex.exec(file);
const regex = /script\([A-z]+::[A-z_]+,\s?'([\/A-z.-]+)'\);/g;
const matches = regex.exec(file);
if (matches) {
jsResources.push("'js/" + matches[1] + ".js'");

}
});
//Replace the entire build-js-start to build-js-end block with this <script> tag

return "script('passman', 'passman.min');";
return "script(MyAppTemplateConfig::APP_ID, 'passman.min');";
}
},
{
//Grab the /*build-css-start*/ and /*build-css-end*/ comments and everything in-between
match: /\/\s?\*build\-css\-start[\s\S]*build\-css\-end+\*\//,
replacement: function (matchedString) {
//Replace the entire build-css-start to build-css-end block with this <link> tag
return "style('passman', 'passman.min');"
return "style(MyAppTemplateConfig::APP_ID, 'passman.min');";
}
}
]
Expand Down
8 changes: 0 additions & 8 deletions css/app.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion css/app.css.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion css/public-page.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion css/public-page.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions js/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
(function() {
'use strict';

const APP_ID = 'passman';

/**
* @ngdoc overview
* @name passmanApp
Expand Down Expand Up @@ -84,13 +86,14 @@
localStorageServiceProvider.setNotify(true, true);
}).config(function($translateProvider) {
$translateProvider.useSanitizeValueStrategy('sanitizeParameters');
$translateProvider.useUrlLoader(OC.generateUrl('/apps/passman/api/v2/language'));
$translateProvider.useUrlLoader(OC.generateUrl('/apps/' + APP_ID + '/api/v2/language'));
$translateProvider.preferredLanguage('en');
}).run([
'$rootScope', function($rootScope) {
$rootScope.$on('$routeChangeSuccess', function(e, curr, prev) {
$('.ui-dialog-content').dialog('close');
});
$rootScope.APP_ID = APP_ID;
}]);

/**
Expand Down Expand Up @@ -120,4 +123,4 @@
angular.element('#app-content-wrapper').scope().$apply();
});
});
}());
}());
11 changes: 8 additions & 3 deletions js/app/app_public.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
(function () {
'use strict';

const APP_ID = 'passman';

angular
.module('passmanApp', [
'ngAnimate',
Expand All @@ -38,7 +40,10 @@
/** global: oc_requesttoken */
$httpProvider.defaults.headers.common.requesttoken = oc_requesttoken;
}]).config(function ($translateProvider) {
$translateProvider.useUrlLoader(OC.generateUrl('/apps/passman/api/v2/language'));
$translateProvider.useUrlLoader(OC.generateUrl('/apps/' + APP_ID + '/api/v2/language'));
$translateProvider.preferredLanguage('en');
});
}());
}).run([
'$rootScope', function($rootScope) {
$rootScope.APP_ID = APP_ID;
}]);
}());
6 changes: 3 additions & 3 deletions js/app/controllers/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
* Controller of the passmanApp
*/
angular.module('passmanApp')
.controller('SettingsCtrl', ['$scope', '$rootScope', 'SettingsService', 'VaultService', 'CredentialService', '$location', '$routeParams', '$http', 'EncryptService', 'NotificationService', '$sce', '$translate',
function ($scope, $rootScope, SettingsService, VaultService, CredentialService, $location, $routeParams, $http, EncryptService, NotificationService, $sce, $translate) {
.controller('SettingsCtrl', ['$scope', '$rootScope', 'SettingsService', 'VaultService', 'CredentialService', 'UrlService', '$location', '$routeParams', '$http', 'EncryptService', 'NotificationService', '$sce', '$translate',
function ($scope, $rootScope, SettingsService, VaultService, CredentialService, UrlService, $location, $routeParams, $http, EncryptService, NotificationService, $sce, $translate) {
$scope.vault_settings = {};
$scope.new_vault_name = '';
$scope.showGenericImport = false;
Expand Down Expand Up @@ -147,7 +147,7 @@
};

var getPassmanVersion = function () {
var url = OC.generateUrl('apps/passman/api/internal/version');
var url = UrlService.generateUrl('/api/internal/version');
$http.get(url).then(function (result) {
$scope.passman_version = result.data.version;
});
Expand Down
6 changes: 3 additions & 3 deletions js/app/controllers/share.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
* This file is part of passman, licensed under AGPLv3
*/
angular.module('passmanApp')
.controller('ShareCtrl', ['$scope', 'VaultService', 'CredentialService', 'SettingsService', '$location', '$routeParams', 'ShareService', 'NotificationService', 'SharingACL', 'EncryptService', '$translate', '$rootScope',
function ($scope, VaultService, CredentialService, SettingsService, $location, $routeParams, ShareService, NotificationService, SharingACL, EncryptService, $translate, $rootScope) {
.controller('ShareCtrl', ['$scope', 'VaultService', 'CredentialService', 'SettingsService', '$location', '$routeParams', 'ShareService', 'NotificationService', 'SharingACL', 'EncryptService', 'UrlService', '$translate', '$rootScope',
function ($scope, VaultService, CredentialService, SettingsService, $location, $routeParams, ShareService, NotificationService, SharingACL, EncryptService, UrlService, $translate, $rootScope) {
$scope.active_vault = VaultService.getActiveVault();


Expand Down Expand Up @@ -305,7 +305,7 @@
var port;
var defaultPort = ($location.$$protocol === 'http') ? 80 : 443;
port = (defaultPort !== $location.$$port) ? ':'+ $location.$$port : '';
return $location.$$protocol + '://' + $location.$$host + port + OC.generateUrl('apps/passman/share/public#') + hash;
return $location.$$protocol + '://' + $location.$$host + port + UrlService.generateUrl('/share/public#') + hash;
};

$scope.sharing_complete = true;
Expand Down
10 changes: 5 additions & 5 deletions js/app/controllers/vaultreqdeletion.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@
* Controller of the passmanApp
*/
angular.module('passmanApp')
.controller('RequestDeleteCtrl', ['$scope', '$location', '$http', '$routeParams', 'VaultService', 'NotificationService', '$translate',
function ($scope, $location, $http, $routeParams, VaultService, NotificationService, $translate) {
.controller('RequestDeleteCtrl', ['$scope', '$location', '$http', '$routeParams', 'VaultService', 'NotificationService', 'UrlService', '$translate',
function ($scope, $location, $http, $routeParams, VaultService, NotificationService, UrlService, $translate) {
$scope.reason = '';
VaultService.getVault({guid: $routeParams.vault_id}).then(function(vault){
$scope.pending_deletion = vault.delete_request_pending;
});

$scope.requestDeletion = function () {
var queryUrl = OC.generateUrl('apps/passman/admin/request-deletion/'+ $routeParams.vault_id);
var queryUrl = UrlService.generateUrl('/admin/request-deletion/'+ $routeParams.vault_id);
var params = {
reason: $scope.reason
};
Expand All @@ -51,11 +51,11 @@
};

$scope.removeRequestDeletion = function () {
var queryUrl = OC.generateUrl('apps/passman/admin/request-deletion/' + $routeParams.vault_id);
var queryUrl = UrlService.generateUrl('/admin/request-deletion/' + $routeParams.vault_id);
$http.delete(queryUrl).then(function () {
NotificationService.showNotification($translate.instant('deletion.removed'), 5000);
$location.path('#/');
});
};
}]);
}());
}());
4 changes: 2 additions & 2 deletions js/app/directives/icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* # passwordGen
*/
angular.module('passmanApp').directive('credentialIcon', [
'$window', function($window) {
'$window', 'UrlService', function($window, UrlService) {
return {
template: '<img ng-src="{{ iconUrl }}" class="icon-image-size">',
restrict: 'E',
Expand All @@ -47,7 +47,7 @@
} else {
if(scope.credential.url) {
var url = window.btoa(angular.copy(scope.credential.url)).replace('/', '_');
scope.iconUrl = OC.generateUrl('apps/passman/api/v2/icon/') + url + '/' +
scope.iconUrl = UrlService.generateUrl('/api/v2/icon/') + url + '/' +
scope.credential.credential_id;
}
}
Expand Down
4 changes: 2 additions & 2 deletions js/app/directives/iconpicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* # passwordGen
*/
angular.module('passmanApp').directive('iconPicker', [
'$window', 'IconService', '$http', 'NotificationService','$translate', function($window, IconService, $http, NotificationService, $translate) {
'$window', 'IconService', '$http', 'NotificationService', 'UrlService', '$translate', function($window, IconService, $http, NotificationService, UrlService, $translate) {
return {
templateUrl: 'views/partials/icon-picker.html',
restrict: 'A',
Expand Down Expand Up @@ -117,7 +117,7 @@

scope.refreshUrlIcon = function(){
NotificationService.showNotification($translate.instant('use.icon.refresh.trying'), 5000);
var queryUrl = OC.generateUrl('apps/passman/api/v2/geticon/'+btoa(scope.credential.url));
var queryUrl = UrlService.generateUrl('/api/v2/geticon/'+btoa(scope.credential.url));
$http.get(queryUrl).then(function (response) {
if(typeof response.data.content !== 'undefined'){
scope.customIcon = {};
Expand Down
16 changes: 8 additions & 8 deletions js/app/services/credentialservice.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* Service in the passmanApp.
*/
angular.module('passmanApp')
.service('CredentialService', ['$http', 'EncryptService', 'VaultService', 'FileService', function ($http, EncryptService, VaultService, FileService) {
.service('CredentialService', ['$http', 'EncryptService', 'VaultService', 'FileService', 'UrlService', function ($http, EncryptService, VaultService, FileService, UrlService) {
var credential = {
'credential_id': null,
'guid': null,
Expand Down Expand Up @@ -72,7 +72,7 @@

_credential.expire_time = new Date(angular.copy(credential.expire_time)).getTime() / 1000;

var queryUrl = OC.generateUrl('apps/passman/api/v2/credentials');
var queryUrl = UrlService.generateUrl('/api/v2/credentials');
return $http.post(queryUrl, _credential).then(function (response) {
if (response.data) {
return response.data;
Expand All @@ -91,7 +91,7 @@
}
_credential.expire_time = new Date(angular.copy(credential.expire_time)).getTime() / 1000;

const queryUrl = OC.generateUrl('apps/passman/api/v2/credentials/' + credential.guid);
const queryUrl = UrlService.generateUrl('/api/v2/credentials/' + credential.guid);
return $http.patch(queryUrl, _credential).then(function (response) {
if (response.data) {
return response.data;
Expand All @@ -101,7 +101,7 @@
});
},
getCredential: function (guid) {
var queryUrl = OC.generateUrl('apps/passman/api/v2/credentials/' + guid);
var queryUrl = UrlService.generateUrl('/api/v2/credentials/' + guid);
return $http.get(queryUrl).then(function (response) {
if (response.data) {
return response.data;
Expand All @@ -111,7 +111,7 @@
});
},
destroyCredential: function (guid) {
var queryUrl = OC.generateUrl('apps/passman/api/v2/credentials/' + guid);
var queryUrl = UrlService.generateUrl('/api/v2/credentials/' + guid);
return $http.delete(queryUrl).then(function (response) {
if (response.data) {
return response.data;
Expand Down Expand Up @@ -171,7 +171,7 @@
return key;
},
getRevisions: function (guid) {
var queryUrl = OC.generateUrl('apps/passman/api/v2/credentials/' + guid + '/revision');
var queryUrl = UrlService.generateUrl('/api/v2/credentials/' + guid + '/revision');
return $http.get(queryUrl).then(function (response) {
if (response.data) {
return response.data;
Expand All @@ -183,7 +183,7 @@
updateRevision: function (revision) {
var _revision = angular.copy(revision);
_revision.credential_data = window.btoa(JSON.stringify(_revision.credential_data));
var queryUrl = OC.generateUrl('apps/passman/api/v2/credentials/' + revision.credential_data.guid + '/revision/' + revision.revision_id);
var queryUrl = UrlService.generateUrl('/api/v2/credentials/' + revision.credential_data.guid + '/revision/' + revision.revision_id);
return $http.patch(queryUrl, _revision).then(function (response) {
if (response.data) {
return response.data;
Expand All @@ -193,7 +193,7 @@
});
},
deleteRevision: function (credential_guid, revision_id) {
var queryUrl = OC.generateUrl('apps/passman/api/v2/credentials/' + credential_guid + '/revision/' + revision_id);
var queryUrl = UrlService.generateUrl('/api/v2/credentials/' + credential_guid + '/revision/' + revision_id);
return $http.delete(queryUrl).then(function (response) {
if (response.data) {
return response.data;
Expand Down
Loading
Loading