diff options
-rw-r--r-- | apps/files_sharing/css/public.scss | 25 | ||||
-rw-r--r-- | apps/files_sharing/js/public.js | 120 | ||||
-rw-r--r-- | core/js/core.json | 1 | ||||
-rw-r--r-- | core/js/public/publicpage.js | 29 |
4 files changed, 0 insertions, 175 deletions
diff --git a/apps/files_sharing/css/public.scss b/apps/files_sharing/css/public.scss index c3451ce0aae..29807e43853 100644 --- a/apps/files_sharing/css/public.scss +++ b/apps/files_sharing/css/public.scss @@ -250,28 +250,3 @@ thead { cursor: pointer; font-weight: bold; } - -// hide the download entry on the menu -// on public share when NOT on mobile -@media only screen and (min-width: variables.$breakpoint-mobile + 1) { - #body-public { - .header-right { - #header-actions-menu { - > ul > li#download { - display: none; - } - } - } - } -} - -// hide the primary on public share on mobile -@media only screen and (max-width: variables.$breakpoint-mobile) { - #body-public { - .header-right { - #header-primary-action { - display: none; - } - } - } -} diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index eca9b8f0df8..7b255c7de1e 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -305,31 +305,6 @@ OCA.Sharing.PublicApp = { } } - $(document).on('click', '#directLink', function () { - $(this).focus(); - $(this).select(); - }); - - $('.save-form').submit(function (event) { - event.preventDefault(); - - var remote = $(this).find('#remote_address').val(); - var token = $('#sharingToken').val(); - var owner = $('#save-external-share').data('owner'); - var ownerDisplayName = $('#save-external-share').data('owner-display-name'); - var name = $('#save-external-share').data('name'); - var isProtected = $('#save-external-share').data('protected') ? 1 : 0; - OCA.Sharing.PublicApp._createFederatedShare(remote, token, owner, ownerDisplayName, name, isProtected); - }); - - $('#remote_address').on("keyup paste", function() { - if ($(this).val() === '' || $('#save-external-share > .icon.icon-loading-small').length > 0) { - $('#save-button-confirm').prop('disabled', true); - } else { - $('#save-button-confirm').prop('disabled', false); - } - }); - self._bindShowTermsAction(); // legacy @@ -393,101 +368,6 @@ OCA.Sharing.PublicApp = { _onUrlChanged: function (params) { this.fileList.changeDirectory(params.path || params.dir, false, true); }, - - - /** - * fall back to old behaviour where we redirect the user to his server to mount - * the public link instead of creating a dedicated federated share - * - * @param {any} remote - - * @param {any} token - - * @param {any} owner - - * @param {any} ownerDisplayName - - * @param {any} name - - * @param {any} isProtected - - * @private - */ - _legacyCreateFederatedShare: function (remote, token, owner, ownerDisplayName, name, isProtected) { - - var self = this; - var location = window.location.protocol + '//' + window.location.host + OC.getRootPath(); - - if(remote.substr(-1) !== '/') { - remote += '/' - } - - var url = remote + 'index.php/apps/files#' + 'remote=' + encodeURIComponent(location) // our location is the remote for the other server - + "&token=" + encodeURIComponent(token) + "&owner=" + encodeURIComponent(owner) +"&ownerDisplayName=" + encodeURIComponent(ownerDisplayName) + "&name=" + encodeURIComponent(name) + "&protected=" + isProtected; - - - if (remote.indexOf('://') > 0) { - OC.redirect(url); - } else { - // if no protocol is specified, we automatically detect it by testing https and http - // this check needs to happen on the server due to the Content Security Policy directive - $.get(OC.generateUrl('apps/files_sharing/testremote'), {remote: remote}).then(function (protocol) { - if (protocol !== 'http' && protocol !== 'https') { - self._toggleLoading(); - OC.dialogs.alert(t('files_sharing', 'No compatible server found at {remote}', {remote: remote}), - t('files_sharing', 'Invalid server URL')); - } else { - OC.redirect(protocol + '://' + url); - } - }); - } - }, - - _toggleLoading: function() { - var loading = $('#save-external-share > .icon.icon-loading-small').length === 0; - if (loading) { - $('#save-external-share > .icon-external') - .removeClass("icon-external") - .addClass("icon-loading-small"); - $('#save-external-share #save-button-confirm').prop("disabled", true); - - } else { - $('#save-external-share > .icon-loading-small') - .addClass("icon-external") - .removeClass("icon-loading-small"); - $('#save-external-share #save-button-confirm').prop("disabled", false); - - } - }, - - _createFederatedShare: function (remote, token, owner, ownerDisplayName, name, isProtected) { - var self = this; - - this._toggleLoading(); - - if (remote.indexOf('@') === -1) { - this._legacyCreateFederatedShare(remote, token, owner, ownerDisplayName, name, isProtected); - return; - } - - $.post( - OC.generateUrl('/apps/federatedfilesharing/createFederatedShare'), - { - 'shareWith': remote, - 'token': token - } - ).done( - function (data) { - var url = data.remoteUrl; - - if (url.indexOf('://') > 0) { - OC.redirect(url); - } else { - OC.redirect('http://' + url); - } - } - ).fail( - function (jqXHR) { - OC.dialogs.alert(JSON.parse(jqXHR.responseText).message, - t('files_sharing', 'Failed to add the public link to your Nextcloud')); - self._toggleLoading(); - } - ); - } }; window.addEventListener('DOMContentLoaded', function () { diff --git a/core/js/core.json b/core/js/core.json index 40bb35dde9f..457656fdd08 100644 --- a/core/js/core.json +++ b/core/js/core.json @@ -3,7 +3,6 @@ "core-common.js" ], "modules": [ - "../core/js/public/publicpage.js", "../core/js/setupchecks.js", "../core/js/mimetype.js", "../core/js/mimetypelist.js" diff --git a/core/js/public/publicpage.js b/core/js/public/publicpage.js deleted file mode 100644 index b17eac181b1..00000000000 --- a/core/js/public/publicpage.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors - * SPDX-License-Identifier: AGPL-3.0-or-later - */ - -window.addEventListener('DOMContentLoaded', function () { - - $('#body-public').find('.header-end .menutoggle').click(function() { - $(this).next('.popovermenu').toggleClass('open'); - }); - - $('#save-external-share').click(function () { - $('#external-share-menu-item').toggleClass('hidden') - $('#remote_address').focus(); - }); - - $(document).mouseup(function(e) { - var toggle = $('#body-public').find('.header-end .menutoggle'); - var container = toggle.next('.popovermenu'); - - // if the target of the click isn't the menu toggle, nor a descendant of the - // menu toggle, nor the container nor a descendant of the container - if (!toggle.is(e.target) && toggle.has(e.target).length === 0 && - !container.is(e.target) && container.has(e.target).length === 0) { - container.removeClass('open'); - } - }); - -}); |