diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-08-28 13:12:20 +0200 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-09-03 16:07:49 +0200 |
commit | 7b6c78c81d4bd5e280f370b95ca2746cd8693882 (patch) | |
tree | ebea977fc109b92ab17003e1fc3058179a1074b6 /apps | |
parent | 04b25ba59d48ea3ab1d34d9f05ede33fc7ad7fbc (diff) | |
download | nextcloud-server-7b6c78c81d4bd5e280f370b95ca2746cd8693882.tar.gz nextcloud-server-7b6c78c81d4bd5e280f370b95ca2746cd8693882.zip |
chore: Remove legacy JS code for public page menu (header actions)
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/css/public.scss | 25 | ||||
-rw-r--r-- | apps/files_sharing/js/public.js | 120 |
2 files changed, 0 insertions, 145 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 () { |