This commit is contained in:
@@ -804,6 +804,14 @@ angular.module('syncthing.core')
|
||||
});
|
||||
}
|
||||
|
||||
$scope.pendingIsRemoteEncrypted = function(folderID, deviceID) {
|
||||
var pending = $scope.pendingFolders[folderID];
|
||||
if (!pending || !pending.offeredBy || !pending.offeredBy[deviceID]) {
|
||||
return false;
|
||||
}
|
||||
return pending.offeredBy[deviceID].remoteEncrypted;
|
||||
};
|
||||
|
||||
$scope.refreshFailed = function (page, perpage) {
|
||||
if (!$scope.failed || !$scope.failed.folder) {
|
||||
return;
|
||||
@@ -1932,17 +1940,20 @@ angular.module('syncthing.core')
|
||||
$('#globalChanges').modal();
|
||||
};
|
||||
|
||||
function editFolderModal() {
|
||||
function editFolderModal(initialTab) {
|
||||
initVersioningEditing();
|
||||
$scope.currentFolder._recvEnc = $scope.currentFolder.type === 'receiveencrypted';
|
||||
$scope.folderPathErrors = {};
|
||||
$scope.folderEditor.$setPristine();
|
||||
if (!initialTab) {
|
||||
initialTab = "#folder-general";
|
||||
}
|
||||
$('.nav-tabs a[href="' + initialTab + '"]').tab('show');
|
||||
$('#editFolder').modal().one('shown.bs.tab', function (e) {
|
||||
if (e.target.attributes.href.value === "#folder-ignores") {
|
||||
$('#folder-ignores textarea').focus();
|
||||
}
|
||||
}).one('hidden.bs.modal', function () {
|
||||
$('.nav-tabs a[href="#folder-general"]').tab('show');
|
||||
window.location.hash = "";
|
||||
$scope.currentFolder = {};
|
||||
});
|
||||
@@ -1971,7 +1982,7 @@ angular.module('syncthing.core')
|
||||
return 'fas fa-folder';
|
||||
};
|
||||
|
||||
function editFolder() {
|
||||
function editFolder(initialTab) {
|
||||
if ($scope.currentFolder.path.length > 1 && $scope.currentFolder.path.slice(-1) === $scope.system.pathSeparator) {
|
||||
$scope.currentFolder.path = $scope.currentFolder.path.slice(0, -1);
|
||||
} else if (!$scope.currentFolder.path) {
|
||||
@@ -1979,7 +1990,7 @@ angular.module('syncthing.core')
|
||||
$scope.currentFolder.path = '';
|
||||
}
|
||||
initShareEditing('folder');
|
||||
editFolderModal();
|
||||
editFolderModal(initialTab);
|
||||
}
|
||||
|
||||
$scope.internalVersioningEnabled = function(guiVersioning) {
|
||||
@@ -2020,7 +2031,7 @@ angular.module('syncthing.core')
|
||||
}
|
||||
};
|
||||
|
||||
$scope.editFolderExisting = function(folderCfg) {
|
||||
$scope.editFolderExisting = function(folderCfg, initialTab) {
|
||||
$scope.editingExisting = true;
|
||||
$scope.editingDefaults = false;
|
||||
$scope.currentFolder = angular.copy(folderCfg);
|
||||
@@ -2040,7 +2051,7 @@ angular.module('syncthing.core')
|
||||
$scope.emitHTTPError(err);
|
||||
});
|
||||
|
||||
editFolder();
|
||||
editFolder(initialTab);
|
||||
};
|
||||
|
||||
$scope.editFolderDefaults = function() {
|
||||
@@ -2115,11 +2126,18 @@ angular.module('syncthing.core')
|
||||
}
|
||||
|
||||
$scope.shareFolderWithDevice = function (folder, device) {
|
||||
$scope.folders[folder].devices.push({
|
||||
deviceID: device
|
||||
});
|
||||
$scope.config.folders = folderList($scope.folders);
|
||||
$scope.saveConfig();
|
||||
var folderCfg = $scope.folders[folder];
|
||||
if (folderCfg.type == "receiveencrypted" || !$scope.pendingIsRemoteEncrypted(folder, device)) {
|
||||
$scope.folders[folder].devices.push({
|
||||
deviceID: device
|
||||
});
|
||||
$scope.config.folders = folderList($scope.folders);
|
||||
$scope.saveConfig();
|
||||
} else {
|
||||
// Open edit folder dialog to enter encryption password
|
||||
$scope.editFolderExisting(folderCfg, "#folder-sharing");
|
||||
$scope.currentSharing.selected[device] = true;
|
||||
}
|
||||
};
|
||||
|
||||
$scope.saveFolder = function () {
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
<a href="#" ng-click="selectAllSharedDevices(false)" translate>Deselect All</a></small>
|
||||
</p>
|
||||
<div class="form-group" ng-repeat="device in currentSharing.shared">
|
||||
<share-template selected="currentSharing.selected" encryption-passwords="currentSharing.encryptionPasswords" id="{{device.deviceID}}" label="{{deviceName(device)}}" folder-type="{{currentFolder.type}}" untrusted="device.untrusted" />
|
||||
<share-template selected="currentSharing.selected" encryption-passwords="currentSharing.encryptionPasswords" id="{{device.deviceID}}" label="{{deviceName(device)}}" folder-type="{{currentFolder.type}}" untrusted="device.untrusted || pendingIsRemoteEncrypted(currentFolder.id, device.deviceID)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-horizontal" ng-if="currentSharing.unrelated.length || otherDevices().length <= 0">
|
||||
@@ -70,7 +70,7 @@
|
||||
<span translate>There are no devices to share this folder with.</span>
|
||||
</p>
|
||||
<div class="form-group" ng-repeat="device in currentSharing.unrelated" ng-init="id = device.deviceID; folder = currentFolder">
|
||||
<share-template selected="currentSharing.selected" encryption-passwords="currentSharing.encryptionPasswords" id="{{device.deviceID}}" label="{{deviceName(device)}}" folder-type="{{currentFolder.type}}" untrusted="device.untrusted" />
|
||||
<share-template selected="currentSharing.selected" encryption-passwords="currentSharing.encryptionPasswords" id="{{device.deviceID}}" label="{{deviceName(device)}}" folder-type="{{currentFolder.type}}" untrusted="device.untrusted || pendingIsRemoteEncrypted(currentFolder.id, device.deviceID)" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user