Commit 08ef768a authored by Sascha Pfeiffer's avatar Sascha Pfeiffer

some more progress to files

Signed-off-by: default avatarSascha Pfeiffer <sascha.pfeiffer@psono.com>
parent 58612cae
......@@ -115,6 +115,7 @@ var build = function(build_path, type) {
"src/common/data/js/lib/chart.min.js",
"src/common/data/js/lib/jquery.min.js",
"src/common/data/js/lib/client.min.js",
"src/common/data/js/lib/FileSaver.min.js",
"src/common/data/js/lib/datatables.min.js",
"src/common/data/js/lib/snap.min.js",
"src/common/data/js/lib/jquery-ui.min.js",
......
......@@ -106,6 +106,7 @@
<script src="js/lib/uuid.js" type="text/javascript"></script>
<script src="js/lib/chart.min.js" type="text/javascript"></script>
<script src="js/lib/client.min.js" type="text/javascript"></script>
<script src="js/lib/FileSaver.min.js" type="text/javascript"></script>
<script src="js/lib/jquery.min.js" type="text/javascript"></script>
<script src="js/lib/datatables.min.js" type="text/javascript"></script>
<script src="js/lib/snap.min.js" type="text/javascript"></script>
......
......@@ -33,6 +33,7 @@
<script src="js/lib/uuid.js" type="text/javascript"></script>
<script src="js/lib/chart.min.js" type="text/javascript"></script>
<script src="js/lib/client.min.js" type="text/javascript"></script>
<script src="js/lib/FileSaver.min.js" type="text/javascript"></script>
<script src="js/lib/jquery.min.js" type="text/javascript"></script>
<script src="js/lib/datatables.min.js" type="text/javascript"></script>
<script src="js/lib/snap.min.js" type="text/javascript"></script>
......
......@@ -339,6 +339,7 @@
<script src="js/lib/uuid.js" type="text/javascript"></script>
<script src="js/lib/chart.min.js" type="text/javascript"></script>
<script src="js/lib/client.min.js" type="text/javascript"></script>
<script src="js/lib/FileSaver.min.js" type="text/javascript"></script>
<script src="js/lib/jquery.min.js" type="text/javascript"></script>
<script src="js/lib/datatables.min.js" type="text/javascript"></script>
<script src="js/lib/snap.min.js" type="text/javascript"></script>
......
<!DOCTYPE html>
<html ng-app="psonocli" class="datastore" ng-csp ng-strict-di>
<head>
<title>Download File</title>
<meta charset="utf-8">
<link rel="apple-touch-icon" sizes="180x180" href="img/apple-touch-icon.png">
<link rel="icon" type="image/png" href="img/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="img/favicon-16x16.png" sizes="16x16">
<link rel="shortcut icon" href="img/favicon.ico">
<meta charset="utf-8"/>
<meta name="description" content="Psono Web Client to login or register">
<meta name="msapplication-config" content="img/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<meta name="viewport" content="width=device-width, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<!-- build:build_min_css -->
<link href="css/lib/cssreset-context-min.css" rel="stylesheet" />
<link href="css/lib/opensans.css" rel="stylesheet" />
<link href="css/lib/angular-csp.css" rel="stylesheet">
<link href="css/lib/bootstrap.css" rel="stylesheet">
<link href="css/lib/ui-bootstrap-csp.css" rel="stylesheet">
<link href="css/lib/datatables.min.css" rel="stylesheet">
<link href="css/lib/angular-snap.css" rel="stylesheet">
<link href="css/lib/font-awesome.min.css" rel="stylesheet">
<link href="css/lib/angular-datatables.css" rel="stylesheet">
<link href="css/lib/datatables.bootstrap.css" rel="stylesheet">
<link href="css/lib/angular-ui-select.css" rel="stylesheet">
<link href="css/lib/loading-bar.min.css" rel="stylesheet">
<link href="css/angular-tree-view.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<!-- endbuild -->
<link href="css/open-secret.css" rel="stylesheet">
</head>
<body>
<div ng-controller="OpenSecretCtrl" class="ng-cloak">
<div class="loading-lock">
<img src="img/logo.png" alt="Psono Web Client" id="logo">
<div class="loading-lock-logo">
<div class="loading-lock-logo-unloaded">
<i class="fa fa-lock" ></i>
</div>
<div class="loading-lock-logo-loaded">
<i id="loading-lock-logo-loaded-fa" class="fa fa-lock" ></i>
</div>
</div>
<div class="loading-lock-text">
{{'DECRYPTING_FILE' | translate}}
</div>
</div>
</div>
<div ng-show="::false" style="position: fixed; height: 100%; width: 100%; background-color: #0f1118; top: 0; left: 0; z-index: 10000;">
<div style="position: absolute; font-size: 26px; color: #2dbb93; background-color: #151f2b; top: 50%; left: 50%; transform: translate(-50%, -50%); padding: 60px 60px 60px 60px; text-align: center">
<i style="
display: inline-block;
font: normal normal normal 14px/1 FontAwesome;
text-rendering: auto;
font-size: 3em;
text-align: center;
animation: fa-spin 2s infinite linear;
vertical-align: middle;">&#xf110;</i> Loading<noscript><br>JavaScript is disabled</noscript>
</div>
</div>
<!-- build:build_min_js -->
<!-- Start of scripts -->
<script src="js/lib/ecma-nacl.min.js" type="text/javascript"></script>
<script src="js/lib/blake2b.js" type="text/javascript"></script>
<script src="js/lib/openpgp.min.js" type="text/javascript"></script>
<script src="js/lib/sha512.min.js" type="text/javascript"></script>
<script src="js/lib/sha256.min.js" type="text/javascript"></script>
<script src="js/lib/sha1.min.js" type="text/javascript"></script>
<script src="js/lib/uuid.js" type="text/javascript"></script>
<script src="js/lib/chart.min.js" type="text/javascript"></script>
<script src="js/lib/client.min.js" type="text/javascript"></script>
<script src="js/lib/FileSaver.min.js" type="text/javascript"></script>
<script src="js/lib/jquery.min.js" type="text/javascript"></script>
<script src="js/lib/datatables.min.js" type="text/javascript"></script>
<script src="js/lib/snap.min.js" type="text/javascript"></script>
<script src="js/lib/jquery-ui.min.js"></script>
<script src="js/lib/lokijs.min.js" type="application/javascript"></script>
<script src="js/lib/qrcode.min.js" type="application/javascript"></script>
<script src="js/lib/fastclick.js" type="application/javascript"></script>
<script src="js/lib/password-generator.js" type="application/javascript"></script>
<script src="js/lib/papaparse.min.js" type="application/javascript"></script>
<script src="js/lib/fast-xml-parser.js" type="application/javascript"></script>
<!-- Angular Juju -->
<script src="js/lib/angular.min.js" type="application/javascript"></script>
<script src="js/lib/raven.min.js" type="application/javascript"></script>
<script src="js/raven.js" type="application/javascript"></script>
<script src="js/lib/angular-cookies.min.js" type="application/javascript"></script>
<script src="js/lib/angular-animate.min.js" type="application/javascript"></script>
<script src="js/lib/angular-touch.min.js" type="application/javascript"></script>
<script src="js/lib/angular-complexify.min.js" type="application/javascript"></script>
<script src="js/lib/loading-bar.min.js" type="application/javascript"></script>
<script src="js/lib/angular-chart.min.js" type="application/javascript"></script>
<script src="js/lib/angular-route.min.js" type="application/javascript"></script>
<script src="js/lib/angular-sanitize.min.js" type="application/javascript"></script>
<script src="js/lib/angular-local-storage.min.js" type="application/javascript"></script>
<script src="js/lib/angular-snap.min.js" type="application/javascript"></script>
<script src="js/lib/angular-translate.min.js" type="application/javascript"></script>
<script src="js/lib/angular-translate-storage-cookie.min.js" type="application/javascript"></script>
<script src="js/lib/angular-translate-loader-url.min.js" type="application/javascript"></script>
<script src="js/lib/angular-translate-loader-static-files.min.js" type="application/javascript"></script>
<script src="js/lib/ui-bootstrap-tpls.min.js" type="application/javascript"></script>
<script src="js/lib/angular-datatables.js" type="application/javascript"></script>
<script src="js/lib/angular-ui-select.js" type="application/javascript"></script>
<script src="js/lib/ng-context-menu.js" type="application/javascript"></script>
<script src="js/module/ng-tree.js" type="application/javascript"></script>
<script src="js/main.js" type="application/javascript"></script>
<script src="js/service-worker-load.js" type="application/javascript"></script>
<script src="js/directive/fileReader.js" type="application/javascript"></script>
<script src="js/directive/treeView.js" type="application/javascript"></script>
<script src="js/directive/treeViewNode.js" type="application/javascript"></script>
<script src="js/controller/AcceptShareCtrl.js"></script>
<script src="js/controller/ChooseFolderCtrl.js"></script>
<script src="js/controller/ChooseSecretsCtrl.js"></script>
<script src="js/controller/AccountCtrl.js" type="application/javascript"></script>
<script src="js/controller/ActivationCtrl.js" type="application/javascript"></script>
<script src="js/controller/DatastoreCtrl.js"></script>
<script src="js/controller/SecurityReportCtrl.js" type="application/javascript"></script>
<script src="js/controller/LoginCtrl.js" type="application/javascript"></script>
<script src="js/controller/GPGDecryptMessageCtrl.js" type="application/javascript"></script>
<script src="js/controller/GPGEncryptMessageCtrl.js" type="application/javascript"></script>
<script src="js/controller/LostPasswordCtrl.js" type="application/javascript"></script>
<script src="js/controller/ActivateEmergencyCodeCtrl.js" type="application/javascript"></script>
<script src="js/controller/MainCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/AcceptShareCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/ChooseFolderCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/ChooseSecretsCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/ConfigureGoogleAuthenticatorCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/DeleteOtherSessionsCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/AddGPGReceiverCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/ConfigureDuoCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/ConfigureYubiKeyOTPCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/CreateDatastoreCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/CreateAPIKeyCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/EditAPIKeyCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/EditDatastoreCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/DeleteDatastoreCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/DatastoreNewEntryCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/DisplayShareRightsCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/EditEntryCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/EditFolderCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/GoOfflineCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/HistoryCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/NewFolderCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/VerifyCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/NewGroupCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/PickUserCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/EditGroupCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/EncryptMessageGPGCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/DecryptMessageGPGCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/EditGPGUserCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/GenerateNewMailGPGKeyCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/ImportMailGPGKeyAsTextCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/ShareEditEntryCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/ShareEntryCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/ShareNewEntryCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/ShowEmergencyCodesCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/ShowRecoverycodeCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/UnlockOfflineCacheCtrl.js" type="application/javascript"></script>
<script src="js/controller/modal/DeleteAccountCtrl.js" type="application/javascript"></script>
<script src="js/controller/EditEntryBigCtrl.js" type="application/javascript"></script>
<script src="js/controller/OpenSecretCtrl.js" type="application/javascript"></script>
<script src="js/controller/OtherCtrl.js" type="application/javascript"></script>
<script src="js/controller/SessionsCtrl.js" type="application/javascript"></script>
<script src="js/controller/KnownHostsCtrl.js" type="application/javascript"></script>
<script src="js/controller/OtherDatastoreCtrl.js" type="application/javascript"></script>
<script src="js/controller/OtherAPIKeyCtrl.js" type="application/javascript"></script>
<script src="js/controller/ExportCtrl.js" type="application/javascript"></script>
<script src="js/controller/ImportCtrl.js" type="application/javascript"></script>
<script src="js/controller/PanelCtrl.js" type="application/javascript"></script>
<script src="js/controller/RegisterCtrl.js" type="application/javascript"></script>
<script src="js/controller/SettingsCtrl.js" type="application/javascript"></script>
<script src="js/controller/ShareCtrl.js" type="application/javascript"></script>
<script src="js/controller/ShareusersCtrl.js" type="application/javascript"></script>
<script src="js/controller/GroupsCtrl.js" type="application/javascript"></script>
<script src="js/controller/WrapperCtrl.js" type="application/javascript"></script>
<script src="js/controller/Enforce2FaCtrl.js" type="application/javascript"></script>
<script src="js/service/api-client.js" type="application/javascript"></script>
<script src="js/service/api-fileserver.js" type="application/javascript"></script>
<script src="js/service/api-pwnedpasswords.js" type="application/javascript"></script>
<script src="js/service/helper.js" type="application/javascript"></script>
<script src="js/service/device.js" type="application/javascript"></script>
<script src="js/service/message.js" type="application/javascript"></script>
<script src="js/service/item-blueprint.js" type="application/javascript"></script>
<script src="js/service/share-blueprint.js" type="application/javascript"></script>
<script src="js/service/crypto-library.js" type="application/javascript"></script>
<script src="js/service/converter.js" type="application/javascript"></script>
<script src="js/service/openpgp.js" type="application/javascript"></script>
<script src="js/service/storage.js" type="application/javascript"></script>
<script src="js/service/offline-cache.js" type="application/javascript"></script>
<script src="js/service/account.js" type="application/javascript"></script>
<script src="js/service/settings.js" type="application/javascript"></script>
<script src="js/service/manager-base.js" type="application/javascript"></script>
<script src="js/service/language-picker.js" type="application/javascript"></script>
<script src="js/service/manager.js" type="application/javascript"></script>
<script src="js/service/manager-widget.js" type="application/javascript"></script>
<script src="js/service/manager-datastore.js" type="application/javascript"></script>
<script src="js/service/manager-api-keys.js" type="application/javascript"></script>
<script src="js/service/manager-secret-link.js" type="application/javascript"></script>
<script src="js/service/manager-share-link.js" type="application/javascript"></script>
<script src="js/service/manager-export.js" type="application/javascript"></script>
<script src="js/service/manager-file-transfer.js" type="application/javascript"></script>
<script src="js/service/manager-hosts.js" type="application/javascript"></script>
<script src="js/service/manager-import.js" type="application/javascript"></script>
<script src="js/service/manager-security-report.js" type="application/javascript"></script>
<script src="js/service/import-chrome-csv.js" type="application/javascript"></script>
<script src="js/service/import-psono-pw-json.js" type="application/javascript"></script>
<script src="js/service/import-lastpass-com-csv.js" type="application/javascript"></script>
<script src="js/service/import-keepassx-org-csv.js" type="application/javascript"></script>
<script src="js/service/import-keepass-info-csv.js" type="application/javascript"></script>
<script src="js/service/import-keepass-info-xml.js" type="application/javascript"></script>
<script src="js/service/manager-status.js" type="application/javascript"></script>
<script src="js/service/manager-secret.js" type="application/javascript"></script>
<script src="js/service/manager-share.js" type="application/javascript"></script>
<script src="js/service/manager-datastore-password.js" type="application/javascript"></script>
<script src="js/service/manager-datastore-user.js" type="application/javascript"></script>
<script src="js/service/manager-datastore-gpg-user.js" type="application/javascript"></script>
<script src="js/service/manager-groups.js" type="application/javascript"></script>
<script src="js/service/manager-history.js" type="application/javascript"></script>
<script src="js/service/manager-datastore-setting.js" type="application/javascript"></script>
<script src="js/service/browser-client.js" type="application/javascript"></script>
<script src="js/service/drop-down-menu-watcher.js" type="application/javascript"></script>
<script src="view/templates.js" type="application/javascript"></script>
<!-- End Angular Juju -->
<!-- endbuild -->
</body>
</html>
\ No newline at end of file
......@@ -212,6 +212,7 @@
<script src="js/lib/uuid.js" type="text/javascript"></script>
<script src="js/lib/chart.min.js" type="text/javascript"></script>
<script src="js/lib/client.min.js" type="text/javascript"></script>
<script src="js/lib/FileSaver.min.js" type="text/javascript"></script>
<script src="js/lib/jquery.min.js" type="text/javascript"></script>
<script src="js/lib/datatables.min.js" type="text/javascript"></script>
<script src="js/lib/snap.min.js" type="text/javascript"></script>
......
......@@ -106,6 +106,7 @@
<script src="js/lib/uuid.js" type="text/javascript"></script>
<script src="js/lib/chart.min.js" type="text/javascript"></script>
<script src="js/lib/client.min.js" type="text/javascript"></script>
<script src="js/lib/FileSaver.min.js" type="text/javascript"></script>
<script src="js/lib/jquery.min.js" type="text/javascript"></script>
<script src="js/lib/datatables.min.js" type="text/javascript"></script>
<script src="js/lib/snap.min.js" type="text/javascript"></script>
......
......@@ -423,6 +423,7 @@
<script src="js/lib/uuid.js" type="text/javascript"></script>
<script src="js/lib/chart.min.js" type="text/javascript"></script>
<script src="js/lib/client.min.js" type="text/javascript"></script>
<script src="js/lib/FileSaver.min.js" type="text/javascript"></script>
<script src="js/lib/jquery.min.js" type="text/javascript"></script>
<script src="js/lib/datatables.min.js" type="text/javascript"></script>
<script src="js/lib/snap.min.js" type="text/javascript"></script>
......
......@@ -21,12 +21,12 @@
* @description
* Main Controller for the datastore widget
*/
angular.module('psonocli').controller('DatastoreCtrl', ["$q", "$rootScope", "$scope", "$uibModal", "$routeParams", "$timeout",
"manager", "managerDatastorePassword", 'managerDatastore', 'offlineCache',
"itemBlueprint", "managerWidget", "managerSecret", "dropDownMenuWatcher",
function($q, $rootScope, $scope, $uibModal, $routeParams, $timeout,
manager, managerDatastorePassword, managerDatastore, offlineCache,
itemBlueprint, managerWidget, managerSecret, dropDownMenuWatcher){
angular.module('psonocli').controller('DatastoreCtrl', ["$q", "$rootScope", "$scope", "$uibModal", "$routeParams",
"$timeout", "manager", "managerDatastorePassword", 'managerDatastore', 'offlineCache', "itemBlueprint",
"managerWidget", "managerSecret", "dropDownMenuWatcher", "managerFileTransfer",
function($q, $rootScope, $scope, $uibModal, $routeParams,
$timeout, manager, managerDatastorePassword, managerDatastore, offlineCache, itemBlueprint,
managerWidget, managerSecret, dropDownMenuWatcher, managerFileTransfer){
$scope.contextMenuOnShow = contextMenuOnShow;
$scope.contextMenuOnClose = contextMenuOnClose;
......@@ -83,14 +83,17 @@
/**
* Triggered once someone clicks on a node entry
* Forwards to the opener of the "open-secret.html" page
* Forwards to the opener of the "open-secret.html" page or the file download
*
* @param item The item in question
* @param path The path to the item
*/
on_item_click: function (item, path) {
return managerSecret.on_item_click(item, path);
if (item.type === 'file') {
return managerFileTransfer.on_item_click(item, path);
} else {
return managerSecret.on_item_click(item, path);
}
},
/**
......
......@@ -14,7 +14,6 @@
*/
angular.module('psonocli').controller('ModalEditEntryBigCtrl', ['$scope', '$rootScope', '$uibModal', 'itemBlueprint',
function ($scope, $rootScope, $uibModal, itemBlueprint) {
$scope.show_history = show_history;
$scope.reset = reset;
$scope.save = save;
......
......@@ -38,7 +38,7 @@
$scope.logout = managerDatastoreUser.logout;
$scope.go_offline = go_offline;
$scope.go_online = go_online;
$scope.on_item_click = managerSecret.on_item_click;
$scope.on_item_click = on_item_click;
$scope.on_datastore_switch_click = on_datastore_switch_click;
$scope.user_username = account.get_account_detail('user_username');
......@@ -214,6 +214,20 @@
return '';
}
}
/**
* @ngdoc
* @name psonocli.controller:MainCtrl#on_item_click
* @methodOf psonocli.controller:MainCtrl
*
* @description
* Triggered once someone clicks an item
*
* @param {object} item The item to open
*/
function on_item_click(item) {
managerSecret.on_item_click(item)
}
}]
);
}(angular, Raven));
\ No newline at end of file
......@@ -36,7 +36,7 @@
$scope.open_tab = browserClient.open_tab;
$scope.logout = managerDatastoreUser.logout;
$scope.filterBySearch = filterBySearch;
$scope.on_item_click = managerSecret.on_item_click;
$scope.on_item_click = on_item_click;
$scope.edit_item = edit_item;
$scope.generate_password = generate_password;
$scope.bookmark = bookmark;
......@@ -61,6 +61,11 @@
//console.log(ele);
});
manager.storage_on('datastore-file-leafs', 'update', function (ele) {
//console.log("main.js update");
//console.log(ele);
});
manager.storage_on('datastore-password-leafs', 'insert', function (ele) {
//console.log("main.js insert");
......@@ -68,6 +73,12 @@
});
manager.storage_on('datastore-file-leafs', 'insert', function (ele) {
//console.log("main.js insert");
$scope.searchArray.push(ele);
});
manager.storage_on('datastore-password-leafs', 'delete', function (ele) {
//console.log("main.js update");
//console.log(ele);
......@@ -78,6 +89,17 @@
}
});
manager.storage_on('datastore-file-leafs', 'delete', function (ele) {
//console.log("main.js update");
//console.log(ele);
for (var i = $scope.searchArray.length - 1; i >= 0; i--) {
if ($scope.searchArray[i].key === ele.key) {
$scope.searchArray.splice(i, 1);
}
}
});
if (offlineCache.is_active() && offlineCache.is_locked()) {
var modalInstance = $uibModal.open({
......@@ -186,6 +208,21 @@
return password_filter(datastore_entry);
}
/**
* @ngdoc
* @name psonocli.controller:PanelCtrl#on_item_click
* @methodOf psonocli.controller:MainCtrl
*
* @description
* Triggered once someone clicks an item
*
* @param {object} item The item to open
*/
function on_item_click(item) {
console.log(item);
managerSecret.on_item_click(item)
}
}]
);
}(angular));
\ No newline at end of file
......@@ -14,14 +14,17 @@
* @requires psonocli.shareBlueprint
* @requires psonocli.managerWidget
* @requires psonocli.cryptoLibrary
* @requires psonocli.managerFileTransfer
*
* @description
* Main Controller for the shareusers widget
*/
angular.module('psonocli').controller('ShareusersCtrl', ["$scope", "$interval", "managerSecret", "managerDatastoreUser",
"$uibModal", "shareBlueprint", "managerWidget", "$timeout", "dropDownMenuWatcher", 'cryptoLibrary', 'managerDatastorePassword',
function ($scope, $interval, managerSecret, managerDatastoreUser, $uibModal, shareBlueprint,
managerWidget, $timeout, dropDownMenuWatcher, cryptoLibrary, managerDatastorePassword) {
"$uibModal", "shareBlueprint", "managerWidget", "$timeout", "dropDownMenuWatcher", 'cryptoLibrary',
'managerDatastorePassword', 'managerFileTransfer',
function ($scope, $interval, managerSecret, managerDatastoreUser,
$uibModal, shareBlueprint, managerWidget, $timeout, dropDownMenuWatcher, cryptoLibrary,
managerDatastorePassword, managerFileTransfer) {
$scope.contextMenuOnShow = contextMenuOnShow;
$scope.contextMenuOnClose = contextMenuOnClose;
......@@ -88,7 +91,11 @@
* @param path The path to the item
*/
on_item_click: function (item, path) {
managerSecret.on_item_click(item, path);
if (item.type === 'file') {
return managerFileTransfer.on_item_click(item, path);
} else {
return managerSecret.on_item_click(item, path);
}
},
/**
......
......@@ -95,17 +95,17 @@
return;
}
if ($scope.bp.selected.hasOwnProperty('alternativeSave')) {
if ($scope.bp.selected.hasOwnProperty('preSave')) {
var onSuccess = function(){
// pass
$uibModalInstance.close($scope.bp.selected);
};
var onError = function(error) {
$scope.errors.push(error);
var onError = function(errors) {
for (var i = 0; i < errors.length; i++) {
$scope.errors.push(errors[i]);
}
};
$scope.bp.selected.alternativeSave($scope.bp.selected, parent, path, $uibModalInstance.close)
$scope.bp.selected.preSave($scope.bp.selected, parent, path)
.then(onSuccess, onError);
} else {
$scope.bp.selected['callback_data'] = $scope.data;
......
......@@ -15,7 +15,6 @@
*/
angular.module('psonocli').controller('ModalEditEntryCtrl', ['$rootScope', '$scope', '$uibModal', '$uibModalInstance', 'itemBlueprint', 'offlineCache', 'node', 'path', 'data',
function ($rootScope, $scope, $uibModal, $uibModalInstance, itemBlueprint, offlineCache, node, path, data) {
$scope.show_history = show_history;
$scope.reset = reset;
$scope.save = save;
......@@ -47,7 +46,9 @@
selected: itemBlueprint.get_blueprint($scope.node.type)
};
console.log($scope.data);
for (var i = $scope.bp.selected.fields.length - 1; i >= 0; i--) {
console.log($scope.bp.selected.fields[i].name);
if ($scope.data.hasOwnProperty($scope.bp.selected.fields[i].name)) {
$scope.bp.selected.fields[i].value = $scope.data[$scope.bp.selected.fields[i].name];
}
......
......@@ -585,6 +585,11 @@
' <i class="fa fa-external-link"></i>' +
'</a>' +
'</span>' +
'<span class="node-open-link" ng-if="item.type === \'file\'">' +
'<a href="#" class="btn btn-default" ng-click="$event.preventDefault(); $event.stopPropagation(); clickItem(item, $event)">' +
' <i class="fa fa-download"></i>' +
'</a>' +
'</span>' +
'<span class="node-dropdown" uib-dropdown on-toggle="toggled(open, \'drop_item_\' + item.id)">' +
'<a class="btn btn-default editbutton" href="#" role="button" id="drop_item_{{ ::item.id }}" uib-dropdown-toggle ng-click="$event.stopPropagation()">' +
' <i class="fa fa-cogs"></i>' +
......
(function(a,b){if("function"==typeof define&&define.amd)define([],b);else if("undefined"!=typeof exports)b();else{b(),a.FileSaver={exports:{}}.exports}})(this,function(){"use strict";function b(a,b){return"undefined"==typeof b?b={autoBom:!1}:"object"!=typeof b&&(console.warn("Depricated: Expected third argument to be a object"),b={autoBom:!b}),b.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\uFEFF",a],{type:a.type}):a}function c(b,c,d){var e=new XMLHttpRequest;e.open("GET",b),e.responseType="blob",e.onload=function(){a(e.response,c,d)},e.onerror=function(){console.error("could not download file")},e.send()}function d(a){var b=new XMLHttpRequest;return b.open("HEAD",a,!1),b.send(),200<=b.status&&299>=b.status}function e(a){try{a.dispatchEvent(new MouseEvent("click"))}catch(c){var b=document.createEvent("MouseEvents");b.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),a.dispatchEvent(b)}}var f="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof global&&global.global===global?global:void 0,a=f.saveAs||("object"!=typeof window||window!==f?function(){}:"download"in HTMLAnchorElement.prototype?function(b,g,h){var i=f.URL||f.webkitURL,j=document.createElement("a");g=g||b.name||"download",j.download=g,j.rel="noopener","string"==typeof b?(j.href=b,j.origin===location.origin?e(j):d(j.href)?c(b,g,h):e(j,j.target="_blank")):(j.href=i.createObjectURL(b),setTimeout(function(){i.revokeObjectURL(j.href)},4E4),setTimeout(function(){e(j)},0))}:"msSaveOrOpenBlob"in navigator?function(f,g,h){if(g=g||f.name||"download","string"!=typeof f)navigator.msSaveOrOpenBlob(b(f,h),g);else if(d(f))c(f,g,h);else{var i=document.createElement("a");i.href=f,i.target="_blank",setTimeout(function(){e(i)})}}:function(a,b,d,e){if(e=e||open("","_blank"),e&&(e.document.title=e.document.body.innerText="downloading..."),"string"==typeof a)return c(a,b,d);var g="application/octet-stream"===a.type,h=/constructor/i.test(f.HTMLElement)||f.safari,i=/CriOS\/[\d]+/.test(navigator.userAgent);if((i||g&&h)&&"object"==typeof FileReader){var j=new FileReader;j.onloadend=function(){var a=j.result;a=i?a:a.replace(/^data:[^;]*;/,"data:attachment/file;"),e?e.location.href=a:location=a,e=null},j.readAsDataURL(a)}else{var k=f.URL||f.webkitURL,l=k.createObjectURL(a);e?e.location=l:location.href=l,e=null,setTimeout(function(){k.revokeObjectURL(l)},4E4)}});f.saveAs=a.saveAs=a,"undefined"!=typeof module&&(module.exports=a)});
//# sourceMappingURL=FileSaver.min.js.map
\ No newline at end of file
......@@ -126,6 +126,7 @@
templateUrl: 'view/index-gpg-encrypt.html'
})
.when('/secret/:type/:secret_id', {})
.when('/file/download/:file_id', {})
.when('/activation-code/:activation_code', {})
.when('/datastore/search/:default_search', {
templateUrl: 'view/datastore.html',
......@@ -211,8 +212,8 @@
return parts.join(' ');
};
}])
.run(['$rootScope', '$location', '$routeParams', '$http', '$templateCache', 'managerSecret', 'offlineCache', 'managerStatus',
function ($rootScope, $location, $routeParams, $http, $templateCache, managerSecret, offlineCache, managerStatus) {
.run(['$rootScope', '$location', '$routeParams', '$http', '$templateCache', 'managerSecret', 'managerFileTransfer', 'offlineCache', 'managerStatus',
function ($rootScope, $location, $routeParams, $http, $templateCache, managerSecret, managerFileTransfer, offlineCache, managerStatus) {
$rootScope.$on( "$routeChangeStart", function(event, next, current) {
var offline_redirect_urls = [
......@@ -233,6 +234,12 @@
var redirect = '/secret/';
if ($location.path().substring(0, redirect.length) === redirect && $routeParams.hasOwnProperty('secret_id')) {
managerSecret.redirect_secret($routeParams.type, $routeParams.secret_id);
return;
}
redirect = '/file/download/';
if ($location.path().substring(0, redirect.length) === redirect && $routeParams.hasOwnProperty('file_id')) {
managerFileTransfer.download_file($routeParams.file_id);
return;
}
});
}]);
......
......@@ -6,29 +6,14 @@
* @name psonocli.apiFileserver
* @requires $http
* @requires $q
* @requires $rootScope
* @requires psonocli.storage
* @requires psonocli.cryptoLibrary
* @requires psonocli.device
* @requires psonocli.offlineCache
*
* @description
* Service to talk to the psono REST api
*/
var apiFileserver = function($http, $q, $rootScope, storage, cryptoLibrary, device, offlineCache) {
var apiFileserver = function($http, $q) {
var decrypt_data = function(session_secret_key, data, req) {
if (session_secret_key && data !== null
&& data.hasOwnProperty('data')
&& data.data.hasOwnProperty('text')
&& data.data.hasOwnProperty('nonce')) {
data.data = JSON.parse(cryptoLibrary.decrypt_data(data.data.text, data.data.nonce, session_secret_key));
}
return data;
};
var call = function(fileserver_url, connection_type, endpoint, data, headers, session_secret_key, transformRequest) {
var call = function(fileserver_url, connection_type, endpoint, data, headers, transformRequest, responseType) {
if (!transformRequest) {
transformRequest = $http.defaults.transformRequest;
......@@ -38,7 +23,8 @@
method: connection_type,
url: fileserver_url + endpoint,
data: data,
transformRequest: transformRequest
transformRequest: transformRequest,
responseType: responseType
};
req.headers = headers;
......@@ -46,11 +32,11 @@
return $q(function(resolve, reject) {
var onSuccess = function(data) {
return resolve(decrypt_data(session_secret_key, data, req));
return resolve(data);
};
var onError = function(data) {
return reject(decrypt_data(session_secret_key, data, req));
return resolve(data);
};
$http(req)
......@@ -88,7 +74,38 @@
'Content-Type': undefined
};
return call(fileserver_url, connection_type, endpoint, data, headers, '', angular.identity);
return call(fileserver_url, connection_type, endpoint, data, headers, angular.identity);
};
/**
* @ngdoc
* @name psonocli.apiFileserver#download
* @methodOf psonocli.apiFileserver
*