From 3940b9c4be40402d50ed7de0fce49a2cea75a2cd Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 15 May 2024 11:17:25 +0200 Subject: [PATCH 001/129] Fix checkpoint issues with integrated OO apps --- www/common/onlyoffice/inner.js | 14 +++++++++----- www/common/outer/async-store.js | 32 ++++++++++++++++++++++++++------ www/cryptpad-api.js | 2 ++ 3 files changed, 37 insertions(+), 11 deletions(-) diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index 9faa7afc2..5184833c7 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -392,6 +392,10 @@ define([ }; var onUploaded = function (ev, data, err) { + if (!ev && err) { + console.error(err); + return void UI.warn(Messages.error); + } if (ev.newTemplate) { if (err) { console.error(err); @@ -549,7 +553,7 @@ define([ var saveToServer = function (blob, title) { if (APP.cantCheckpoint) { return; } // TOO_LARGE - var text = getContent(); + var text = !blob && getContent(); if (!text && !blob) { setEditable(false, true); sframeChan.query('Q_CLEAR_CACHE_CHANNELS', [ @@ -3154,9 +3158,9 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null return void UI.errorLoadingScreen(Messages.error); } var blob = new Blob([bin], {type: 'text/plain'}); - var file = getFileType(); - resetData(blob, file); - //saveToServer(blob, title); + //var file = getFileType(); + //resetData(blob, file); + saveToServer(blob, title); Title.updateTitle(title); UI.removeLoadingScreen(); }); @@ -3205,7 +3209,7 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null cb(); }); }); - if (privateData.initialState) { + if (privateData.initialState && (!content || !content.hashes)) { var blob = privateData.initialState; let title = `document.${cfg.fileType}`; console.error(blob, title); diff --git a/www/common/outer/async-store.js b/www/common/outer/async-store.js index cd93675fe..9ba3853e0 100644 --- a/www/common/outer/async-store.js +++ b/www/common/outer/async-store.js @@ -467,6 +467,19 @@ define([ }); }; + var initTempRpc = (clientId, cb) => { + if (store.rpc) { return void cb(store.rpc); } + var kp = Crypto.Nacl.sign.keyPair(); + var keys = { + edPublic: Crypto.Nacl.util.encodeBase64(kp.publicKey), + edPrivate: Crypto.Nacl.util.encodeBase64(kp.secretKey) + }; + Pinpad.create(store.network, keys, function (e, call) { + if (e) { return void cb({error: e}); } + store.rpc = call; + cb(call); + }); + }; var initRpc = function (clientId, data, cb) { if (!store.loggedIn) { return cb(); } if (store.rpc) { return void cb(account); } @@ -3149,7 +3162,7 @@ define([ // If we load CryptPad for the first time from an existing pad, don't create a // drive automatically. - var onNoDrive = function (clientId, cb) { + var onNoDrive = function (clientId, cb, initRpc) { var andThen = function () { // To be able to use all the features inside the pad, we need to // initialize the chat (messenger) and the cursor modules. @@ -3160,9 +3173,16 @@ define([ store.messenger = store.modules['messenger']; // And now we're ready - initAnonRpc(null, null, function () { - cb({}); - }); + let getAnon = () => { + initAnonRpc(null, null, function () { + cb({}); + }); + }; + + if (initRpc) { + return initTempRpc(clientId, getAnon); + } + getAnon(); }; // We need an anonymous RPC to be able to check if the pad exists and to get @@ -3245,7 +3265,7 @@ define([ // First tab, no user hash, no anon hash and this app doesn't need a drive // ==> don't create a drive // Or "neverDrive" (integration into another platform?) - // ==> don't create a drive + // ==> don't create a drive BUT create temp RPC (we may need to upload) if (data.neverDrive || (data.noDrive && !data.userHash && !data.anonHash)) { return void onNoDrive(clientId, function (obj) { if (obj && obj.error) { @@ -3259,7 +3279,7 @@ define([ } Feedback.send("NO_DRIVE", true); callback(obj); - }); + }, !!data.neverDrive); } initialized = true; diff --git a/www/cryptpad-api.js b/www/cryptpad-api.js index e73ef40bd..cdbf7f8dd 100644 --- a/www/cryptpad-api.js +++ b/www/cryptpad-api.js @@ -188,6 +188,7 @@ chan.on('ON_DOWNLOADAS', blob => { let url = URL.createObjectURL(blob); + if (!config.events.onDownloadAs) { return; } config.events.onDownloadAs({ data: { fileType: config.document && config.document.fileType, @@ -198,6 +199,7 @@ chan.on('SAVE', function (data, cb) { blob = data; + if (!config.events.onSave) { return void cb(); } config.events.onSave(data, cb); }); chan.on('RELOAD', function () { From 154b3e66c84d3611e628e3925928282b4d2bd693 Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 15 May 2024 11:37:03 +0200 Subject: [PATCH 002/129] Get username and lang from API config --- customize.dist/messages.js | 7 +++---- www/common/onlyoffice/inner.js | 8 ++++++-- www/common/sframe-app-outer.js | 4 +++- www/cryptpad-api.js | 3 ++- www/integration/main.js | 10 ++++++++-- 5 files changed, 22 insertions(+), 10 deletions(-) diff --git a/customize.dist/messages.js b/customize.dist/messages.js index 579dcd31e..0fb495bb2 100755 --- a/customize.dist/messages.js +++ b/customize.dist/messages.js @@ -35,11 +35,10 @@ var getStoredLanguage = function () { return localStorage && localStorage.getIte var getBrowserLanguage = function () { return navigator.language || navigator.userLanguage || ''; }; var getLanguage = Messages._getLanguage = function () { if (window.cryptpadLanguage) { return window.cryptpadLanguage; } - try { - if (getStoredLanguage()) { return getStoredLanguage(); } - } catch (e) { console.log(e); } var l = getBrowserLanguage(); - // Edge returns 'fr-FR' --> transform it to 'fr' and check again + try { + l = getStoredLanguage() || getBrowserLanguage(); + } catch (e) { console.log(e); } return map[l] ? l : (map[l.split('-')[0]] ? l.split('-')[0] : (map[l.split('_')[0]] ? l.split('_')[0] : 'en')); diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index 5184833c7..dfa949eb6 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -1671,6 +1671,10 @@ define([ var lang = (window.cryptpadLanguage || navigator.language || navigator.userLanguage || '').slice(0,2); + let username = Util.find(privateData, ['integrationConfig', 'user', 'name']) + || metadataMgr.getUserData().name + || Messages.anonymous; + // Config APP.ooconfig = { "document": { @@ -1694,8 +1698,8 @@ define([ }, "user": { "id": String(myOOId), //"c0c3bf82-20d7-4663-bf6d-7fa39c598b1d", - "firstname": metadataMgr.getUserData().name || Messages.anonymous, - "name": metadataMgr.getUserData().name || Messages.anonymous, + "firstname": username, + "name": username }, "mode": "edit", "lang": lang diff --git a/www/common/sframe-app-outer.js b/www/common/sframe-app-outer.js index b1210796f..b634f51b4 100644 --- a/www/common/sframe-app-outer.js +++ b/www/common/sframe-app-outer.js @@ -17,7 +17,9 @@ define([ nThen(function (waitFor) { DomReady.onReady(waitFor()); }).nThen(function (waitFor) { - var obj = SFCommonO.initIframe(waitFor, true, integration.pathname); + let lang = integration && integration.config && integration.config.editorConfig + && integration.config.editorConfig.lang; + var obj = SFCommonO.initIframe(waitFor, true, integration.pathname, lang); href = obj.href; hash = obj.hash; if (isIntegration) { diff --git a/www/cryptpad-api.js b/www/cryptpad-api.js index cdbf7f8dd..d7d2ac7e2 100644 --- a/www/cryptpad-api.js +++ b/www/cryptpad-api.js @@ -116,7 +116,8 @@ application: config.documentType, document: blob, ext: config.document.fileType, - autosave: config.autosave || 10 + autosave: config.autosave || 10, + editorConfig: config.editorConfig || {} }, function (obj) { if (obj && obj.error) { reject(obj.error); return console.error(obj.error); } resolve({}); diff --git a/www/integration/main.js b/www/integration/main.js index fe3ffd010..a09592d3b 100644 --- a/www/integration/main.js +++ b/www/integration/main.js @@ -155,7 +155,12 @@ define([ chan.on('START', function (data) { console.warn('INNER START', data); var href = Hash.hashToHref(data.key, data.application); - console.error(Hash.hrefToHexChannelId(href)); + + if (data.editorConfig.lang) { + var LS_LANG = "CRYPTPAD_LANG"; + localStorage.setItem(LS_LANG, data.editorConfig.lang); + } + window.CP_integration_outer = { pathname: `/${data.application}/`, hash: data.key, @@ -163,7 +168,8 @@ define([ initialState: data.document, config: { fileType: data.ext, - autosave: data.autosave + autosave: data.autosave, + user: data.editorConfig.user }, utils: { onReady: onReady, From 112a222f79f7bf82db96404b1ce73844789494cc Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 21 May 2024 18:05:03 +0200 Subject: [PATCH 003/129] Fix initial OO content issue with API --- www/common/onlyoffice/inner.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index dfa949eb6..9ffbfd47b 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -3213,10 +3213,9 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null cb(); }); }); - if (privateData.initialState && (!content || !content.hashes)) { + if (privateData.initialState && (!content || !content.hashes || !Object.keys(content.hashes).length)) { var blob = privateData.initialState; let title = `document.${cfg.fileType}`; - console.error(blob, title); return convertImportBlob(blob, title); } } From 97a806353e911efb3e1c3bc1ce8dca3c33c5d0aa Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 24 Jun 2024 16:18:27 +0200 Subject: [PATCH 004/129] Fix issue with application names --- www/cryptpad-api.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/www/cryptpad-api.js b/www/cryptpad-api.js index d7d2ac7e2..c72f41f65 100644 --- a/www/cryptpad-api.js +++ b/www/cryptpad-api.js @@ -251,16 +251,22 @@ cryptpadURL = getInstanceURL(); } + config.events = config.events || {}; + // OnlyOffice shim let url = config.document.url; if (/^http:\/\/localhost\/cache\/files\//.test(url)) { url = url.replace(/(http:\/\/localhost\/cache\/files\/)/, getInstanceURL() + 'ooapi/'); } config.document.url = url; - if (config.documentType === "spreadsheet") { + if (config.documentType === "spreadsheet" || config.documentType === "cell") { config.documentType = "sheet"; } - if (config.documentType === "text") { + + if (config.documentType === "slide") { + config.documentType = "presentation"; + } + if (config.documentType === "word" || config.documentType === "text") { config.documentType = "doc"; } @@ -311,8 +317,8 @@ iframe.setAttribute('name', 'frameEditor'); iframe.setAttribute('align', 'top'); iframe.setAttribute("src", url); - iframe.setAttribute("width", config.width); - iframe.setAttribute("height", config.height); + iframe.setAttribute("width", config.width || '100%'); + iframe.setAttribute("height", config.height || '100%'); if (config.editorConfig) { // OnlyOffice container.replaceWith(iframe); container = iframe; From 5383f9ef1c681e1874aeeaac602019d93b2d302c Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 4 Jul 2024 11:33:43 +0200 Subject: [PATCH 005/129] Fix potential memory leak --- lib/api.js | 3 +++ lib/hk-util.js | 1 + lib/storage/file.js | 13 +++++++++++++ 3 files changed, 17 insertions(+) diff --git a/lib/api.js b/lib/api.js index c0e570095..bccf917f8 100644 --- a/lib/api.js +++ b/lib/api.js @@ -190,6 +190,9 @@ nThen(function (w) { removed++; } }); + if (Env.store) { + Env.store.closeInactiveChannels(active); + } if (removed) { Env.Log.info("CLEANED_ACTIVE_CHANNELS_MAP", {removed}); } diff --git a/lib/hk-util.js b/lib/hk-util.js index 7080d3d4a..1bc7f2022 100644 --- a/lib/hk-util.js +++ b/lib/hk-util.js @@ -146,6 +146,7 @@ const dropChannel = HK.dropChannel = function (Env, chanName) { expireChannel(Env, chanName); }, TEMPORARY_CHANNEL_LIFETIME); } + store.closeChannel(chanName, function () {}); }; /* checkExpired diff --git a/lib/storage/file.js b/lib/storage/file.js index 2c2888f7a..98cbfd7db 100644 --- a/lib/storage/file.js +++ b/lib/storage/file.js @@ -286,6 +286,16 @@ var closeChannel = function (env, channelName, cb) { } }; +var closeInactiveChannels = function (env, schedule, active) { + Object.keys(env.channels).forEach(channelName => { + if (!active.includes(channelName)) { + schedule.ordered(channelName, function (next) { + closeChannel(env, channelName, next); + }); + } + }); +}; + var clearOffset = function (env, channelId, cb) { var path = mkOffsetPath(env, channelId); // we should always be able to recover from invalid offsets, so failure to delete them @@ -1445,6 +1455,9 @@ module.exports.create = function (conf, _cb) { closeChannel(env, channelName, Util.both(cb, next)); }); }, + closeInactiveChannels: function (active) { + closeInactiveChannels(env, schedule, active); + }, // write to a log file log: function (channelName, content, cb) { // you probably want the events in your log to be in the correct order. From a7e622dddcf945f3bbcaf11ee1baac982d108846 Mon Sep 17 00:00:00 2001 From: Corentin ARNOULD Date: Sat, 6 Jul 2024 10:23:49 +0200 Subject: [PATCH 006/129] Fix bash indentation and trailing whitespaces Some shell scripts had tabs indentation. Made it all four spaces. Hope it's ok with spaces. Some files had a trailing space in it. It was not useful and takes few bytes for nothing. I didn't delete everything. You can find all tab indented lines with: grep -rP '^\t' 2>/dev/null And more trailing space with: grep -rP ' $' 2>/dev/null --- CHANGELOG.md | 4 ++-- Dockerfile | 2 +- LICENSES/BSD-3-Clause.txt | 2 +- LICENSES/MPL-2.0.txt | 2 +- docker-entrypoint.sh | 6 +++--- readme.md | 2 +- scripts/convert-favicons-to-ico.sh | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index be2161b23..5b4da42a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ This release introduces a new onboarding flow to guide administrators through th - Onboarding screens & app configuration [#1513](https://github.com/cryptpad/cryptpad/pull/1513) - Bahasa Indonesia is a new available language [fe78b6a](https://github.com/cryptpad/cryptpad/commit/fe78b6ab1dc76ce9eb8d5361c309db8e92117fa8) - - Thanks to our [Weblate](https://weblate.cryptpad.org) contributors who made that happen! + - Thanks to our [Weblate](https://weblate.cryptpad.org) contributors who made that happen! ## Improvements @@ -46,7 +46,7 @@ This release introduces a new onboarding flow to guide administrators through th - Switch to new `http2` Nginx option [#1516](https://github.com/cryptpad/cryptpad/pull/1516) - Server fixes and aggregated stats [#1509](https://github.com/cryptpad/cryptpad/pull/1509) - Create the block folder at boot [#911](https://github.com/cryptpad/cryptpad/pull/911) - - Remove obsolete `version` from `docker-compose.yml` [2e716eb](https://github.com/cryptpad/cryptpad/commit/2e716eb4e39fb835f95a1fa1a340e01142d11b1c) + - Remove obsolete `version` from `docker-compose.yml` [2e716eb](https://github.com/cryptpad/cryptpad/commit/2e716eb4e39fb835f95a1fa1a340e01142d11b1c) - Other - Unsharp the corners when hovering the dismiss button on notification drop-down menu [#1466](https://github.com/cryptpad/cryptpad/pull/1466) - Fix contextual menu `Open` on anonymous drive [#1464](https://github.com/cryptpad/cryptpad/pull/1464) diff --git a/Dockerfile b/Dockerfile index e2be11805..c6d343942 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ COPY . /cryptpad RUN sed -i "s@//httpAddress: 'localhost'@httpAddress: '0.0.0.0'@" /cryptpad/config/config.example.js RUN sed -i "s@installMethod: 'unspecified'@installMethod: 'docker'@" /cryptpad/config/config.example.js - + # Install dependencies RUN npm install --production \ && npm run install:components diff --git a/LICENSES/BSD-3-Clause.txt b/LICENSES/BSD-3-Clause.txt index ea890afbc..086d3992c 100644 --- a/LICENSES/BSD-3-Clause.txt +++ b/LICENSES/BSD-3-Clause.txt @@ -1,4 +1,4 @@ -Copyright (c) . +Copyright (c) . Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/LICENSES/MPL-2.0.txt b/LICENSES/MPL-2.0.txt index ee6256cdb..d0a1fa148 100644 --- a/LICENSES/MPL-2.0.txt +++ b/LICENSES/MPL-2.0.txt @@ -35,7 +35,7 @@ Mozilla Public License Version 2.0 means any form of the work other than Source Code Form. 1.7. "Larger Work" - means a work that combines Covered Software with other material, in + means a work that combines Covered Software with other material, in a separate file or files, that is not Covered Software. 1.8. "License" diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 3429b90f6..59972bac6 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -22,16 +22,16 @@ if [ ! -f "$CPAD_CONF" ]; then eg: docker run -v /path/to/config.js:/cryptpad/config/config.js \n\ #################################################################### \n" - cp "$CPAD_HOME"/config/config.example.js "$CPAD_CONF" + cp "$CPAD_HOME"/config/config.example.js "$CPAD_CONF" - sed -i -e "s@\(httpUnsafeOrigin:\).*[^,]@\1 '$CPAD_MAIN_DOMAIN'@" \ + sed -i -e "s@\(httpUnsafeOrigin:\).*[^,]@\1 '$CPAD_MAIN_DOMAIN'@" \ -e "s@\(^ *\).*\(httpSafeOrigin:\).*[^,]@\1\2 '$CPAD_SANDBOX_DOMAIN'@" "$CPAD_CONF" fi cd $CPAD_HOME if [ "$CPAD_INSTALL_ONLYOFFICE" == "yes" ]; then - ./install-onlyoffice.sh --accept-license + ./install-onlyoffice.sh --accept-license fi npm run build diff --git a/readme.md b/readme.md index d5766eed6..f24355c3d 100644 --- a/readme.md +++ b/readme.md @@ -28,7 +28,7 @@ The most recent version and all past release notes can be found on the [releases ## Setup using Docker -You can find `Dockerfile`, `docker-compose.yml` and `docker-entrypoint.sh` files at the root of this repository. We also publish every release on [Docker Hub](https://hub.docker.com/r/cryptpad/cryptpad) as AMD64 & ARM64 official images. +You can find `Dockerfile`, `docker-compose.yml` and `docker-entrypoint.sh` files at the root of this repository. We also publish every release on [Docker Hub](https://hub.docker.com/r/cryptpad/cryptpad) as AMD64 & ARM64 official images. Previously, Docker images were community maintained, had their own repository and weren't official supported. We changed that with v5.4.0 during July 2023. Thanks to @promasu for all the work on the community images. diff --git a/scripts/convert-favicons-to-ico.sh b/scripts/convert-favicons-to-ico.sh index 6f6980876..972b93df7 100755 --- a/scripts/convert-favicons-to-ico.sh +++ b/scripts/convert-favicons-to-ico.sh @@ -5,6 +5,6 @@ # SPDX-License-Identifier: AGPL-3.0-or-later for f in ../customize.dist/favicon/*.png; do - base="$(basename $f ".png")" - magick convert $f -define icon:auto-resize=16,24,32,48,64,72,96,128,256 "$base.ico" + base="$(basename $f ".png")" + magick convert $f -define icon:auto-resize=16,24,32,48,64,72,96,128,256 "$base.ico" done From 7c57db6420b40b9daa27ed3b45cdd5a9df262f4f Mon Sep 17 00:00:00 2001 From: daria Date: Wed, 10 Jul 2024 16:27:41 +0300 Subject: [PATCH 007/129] change focus style for inputs on calendar modals #1506 --- customize.dist/src/less2/include/forms.less | 3 + www/calendar/app-calendar.less | 740 -------------------- 2 files changed, 3 insertions(+), 740 deletions(-) delete mode 100644 www/calendar/app-calendar.less diff --git a/customize.dist/src/less2/include/forms.less b/customize.dist/src/less2/include/forms.less index 065b9db1d..5d8b242f1 100644 --- a/customize.dist/src/less2/include/forms.less +++ b/customize.dist/src/less2/include/forms.less @@ -28,6 +28,9 @@ } &.tui-full-calendar-content { font-size: @colortheme_app-font-size; + &:focus { + outline: @cryptpad_color_brand solid 2px; + } } &[readonly] { //margin-top:1rem; diff --git a/www/calendar/app-calendar.less b/www/calendar/app-calendar.less deleted file mode 100644 index bdf59fb6d..000000000 --- a/www/calendar/app-calendar.less +++ /dev/null @@ -1,740 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 XWiki CryptPad Team and contributors - * - * SPDX-License-Identifier: AGPL-3.0-or-later - */ - -@import (reference) '../../customize/src/less2/include/framework.less'; -@import (reference) '../../customize/src/less2/include/sidebar-layout.less'; -@import (reference) '../../customize/src/less2/include/tools.less'; -@import (reference) '../../customize/src/less2/include/avatar.less'; -@import (reference) '../../customize/src/less2/include/variables.less'; - -&.cp-app-calendar { - - .framework_min_main(); - .sidebar-layout_main(); - - display: flex; - flex-flow: column; - - .cp-toolbar-bottom-mid > div { - color: @cryptpad_text_col; - .cp-small { display: none; } - } - - .flatpickr-calendar { - z-index: 100001 !important; // Alertify is 100000 - } - #cp-sidebarlayout-container #cp-sidebarlayout-rightside { - padding: 0; - & > div { - margin: 0; - } - - .cp-forcehide { - display: none !important; - } - - - .tui-full-calendar-confirm { - span, i { - padding: 0.5rem; - } - span { - padding-left: 0; - } - width: unset; - } - - .tui-full-calendar-layout { - background-color: @cp_sidebar-right-bg !important; - color: @cryptpad_text_col; - display: flex; - flex-flow: column; - .tui-full-calendar-week-container { - min-height: 0; - display: flex; - flex-flow: column; - .tui-full-calendar-vlayout-area { - display: flex; - flex-flow: column; - flex: 1; - min-height: 0; - & > div:last-child { - flex: 1; - min-height: 0; - } - } - } - .tui-full-calendar-weekday-filled { - background-color: @cp_dropdown-bg-hover !important; - } - - .tui-full-calendar-timegrid-hourmarker-time { - color: @cp_calendar-now !important; - } - .tui-full-calendar-timegrid-hourmarker-line-left, .tui-full-calendar-timegrid-hourmarker-line-today { - border-color: @cp_calendar-now !important; - } - .tui-full-calendar-timegrid-todaymarker { - background-color: @cp_calendar-now !important; - } - - .tui-full-calendar-month { - display: flex; - flex-flow: column; - & > div:last-child { - display: flex; - flex-flow: column; - flex: 1; - min-height: 0; - overflow: hidden; - } - .tui-full-calendar-today .tui-full-calendar-weekday-grid-date-decorator { - background-color: @cp_calendar-now !important; - color: @cp_calendar-now-fg !important; - } - .tui-full-calendar-weekday-schedule-time .tui-full-calendar-weekday-schedule-title { - color: @cryptpad_text_col !important; - } - .tui-full-calendar-extra-date { - .tui-full-calendar-weekday-grid-date { - color: @cp_sidebar-hint !important; - opacity: 0.5; - } - } - .tui-full-calendar-weekday-grid-date { - color: @cryptpad_text_col !important; - } - .tui-full-calendar-month-dayname-item span { - color: @cryptpad_text_col !important; - } - } - .tui-full-calendar-dayname * { - color: @cryptpad_text_col !important; - } - .tui-full-calendar-month-more { - background-color: @cp_sidebar-right-bg !important; - color: @cryptpad_text_col; - span { - color: @cryptpad_text_col !important; - } - } - - .tui-full-calendar-floating-layer.cp-calendar-popup-flex { - top: 0 !important; - left: 0 !important; - right: 0 !important; - bottom: 0 !important; - justify-content: center !important; - align-items: center !important; - .tui-full-calendar-popup { - width: 540px; - max-width: 100%; - max-height: 100%; - } - } - #tui-full-calendar-popup-arrow { - display: none !important; - } - } - .tui-full-calendar-timegrid-timezone { - background-color: @cp_sidebar-right-bg !important; - .tui-full-calendar-timegrid-hour { - color: @cryptpad_text_col !important; - } - color: @cryptpad_text_col; - } - .tui-full-calendar-timegrid-gridline, .tui-full-calendar-time-date { - border-color: @cp_calendar-border !important; - } - .tui-full-calendar-splitter, .tui-full-calendar-left, .tui-full-calendar-dayname-container, .tui-full-calendar-weekday-grid-line { - border-color: @cp_calendar-border !important; - - } - .tui-full-calendar-popup { - border-radius: @variables_radius_L; - } - .tui-full-calendar-popup-container { - min-width: 100%; - background: @cp_flatpickr-bg; - color: @cryptpad_text_col; - border-radius: @variables_radius_L; - font-weight: normal; - .tui-full-calendar-icon:not(.tui-full-calendar-calendar-dot):not(.tui-full-calendar-dropdown-arrow):not(.tui-full-calendar-ic-checkbox):not(.fa-map-marker) { - display: none; - } - .tui-full-calendar-icon { - text-align:center; - } - .tui-full-calendar-popup-detail-item { - a { - color: @cryptpad_color_link; - text-decoration: underline; - } - } - .tui-full-calendar-section-button-save { - height: 40px; - .btn-primary { // Update button - margin-right: 0px; - } - } - - } - li.tui-full-calendar-popup-section-item { - padding: 0 6px; - height: 32px; - } - .tui-full-calendar-popup-section-item { - height: auto; - margin: 0; - &:not(li):not(button) { - padding: 0; - margin-top: 5px; - } - #tui-full-calendar-schedule-calendar { - width: 179px; - top: 0; - } - &:not(button) { - border: none; - display: inline-flex; - align-items: center; - &:hover { - background-color: @cp_dropdown-bg-hover; - } - .tui-full-calendar-content { - text-overflow: ellipsis; - font: @colortheme_app-font; - padding: 0 10px; - } - input { flex: 1; } - } - } - .tui-full-calendar-section-date-dash { - height: auto; - } - .tui-full-calendar-section-title, .tui-full-calendar-section-location, .tui-full-calendar-section-body { - width: 100%; - } - .tui-full-calendar-dropdown-menu { - top: 38px; - width: 221px; // same as button - background-color: @cp_dropdown-bg; - color: @cp_dropdown-fg; - } - .tui-full-calendar-section-state, #tui-full-calendar-schedule-private { - display: none !important; - } - - .tui-full-calendar-popup:not(.tui-full-calendar-popup-detail) { - .tui-full-calendar-section-calendar { - width: 221px; // 50% - } - .tui-full-calendar-popup-section { - display: flex; - align-items: center; - flex-wrap: wrap; - .tui-full-calendar-section-start-date, .tui-full-calendar-section-end-date { - flex: 1; - } - .tui-full-calendar-section-allday { - width: 100%; - height: 32px; - border-radius: @variables_radius; - input[type="checkbox"].tui-full-calendar-checkbox-square:checked + span { - background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAABbmlDQ1BpY2MAACiRdZHNK0RRGMZ/Zoh8NIqFNItZDFmMEiVLxsJmkgZlsLn3zpe6c93uvZNkq2wspizExtfCf8BW2VJKkZKs/AG+Npqu97hqJM7t3PfXc87zds5zIJQyjZJbPwAly3PSE8nYXGY+1vhEMy20EyaqGa49NjWV4t/xfkOdqtf9qtf/+/4cLdmca0Bdk/CwYTue8KhwasWzFW8KdxpFLSu8L5xw5IDCF0rXA35UXAj4VbEzkx6HkOoZK/xg/QcbRack3CccL5ll4/s86iatOWt2Wmq3zCguaSZIEkOnzBImHv1SLcnsb9/Al2+SZfEY8rdZxRFHgaJ4E6KWpWtOal70nHwmqyr333m6+aHBoHtrEhoefP+lBxq3oFrx/Y8D368eQvgezqyaf1lyGnkTvVLT4nsQWYeT85qmb8PpBnTd2ZqjfUlhmaF8Hp6PoS0DHVfQvBBk9b3O0S3MrMkTXcLOLvTK/sjiJ6CLZ94KREMsAAAACXBIWXMAAAsSAAALEgHS3X78AAABHUlEQVQoFWNkaP//n4EMwESGHrAW6mtkZvz3G2g03BsBagz/nRUQ7sNp49//TJ+Byv6BlMbrMjCsC2Jg3BbKwOAgB9GMolGAg4GBESIOIrmA+A9I03xvFHGwCrhGkDOe5TAw9LvAFbEn6jEwwTT9BtodvJ7h/4FHYH0MLBCKgaHTgYGBE8jLN2FgYAJae+4FA8NcLwZWkAtAmoLWMTBsuYNwECMsHrVEGBj2RzEwiIEciATANgE1bb6DJAgMNLhTr71hYHBcxsDw+htCAQ5NIAU/4RpBPKjmf2++MfwHaQpZD7cJyEMB3+BORRL+rybE8FOEk4Hj2FO4KMgdrFAMitun2DTCVSMxYAkBFFYg9j94qCIpwsZEil5wyDIDAAXIUsnSKmq7AAAAAElFTkSuQmCC); - } - .tui-full-calendar-ic-checkbox { - margin-left: 5px; - border-radius: 2px; - } - } - .CodeMirror { - margin-top: 5px; - background: @cp_forms-bg !important; - color: @cryptpad_text_col; - border: 1px solid @cp_forms-border; - border-radius: @variables_radius; - width: 100%; - height: 80px; - font: @colortheme_app-font; - font-size: 16px; - line-height: initial; - padding-left: 0.3rem; - pre { - margin: 0; - font-family: inherit; - font-size: inherit; - line-height: inherit; - } - } - .CodeMirror-placeholder { - color: @cp_forms-placeholder; - } - } - } - .tui-full-calendar-popup-detail { - font: @colortheme_app-font; - color: @cryptpad_text_col; - box-shadow: @cryptpad_ui_shadow; - .tui-full-calendar-popup-container { - padding-bottom: 17px; - } - .tui-full-calendar-popup-detail-date { - font-size: 14px; - } - .tui-full-calendar-section-button { - margin-top: 10px; - border: 0; - display: flex; - align-items: start; - button { - flex: 1; - margin: 0; - } - } - .tui-full-calendar-popup-top-line { - border-radius: 10px 10px 0px 0px; - height: 10px; - } - .tui-full-calendar-popup-vertical-line { - visibility: hidden; - width: 10px; - } - } - - .cp-recurrence-label, .cp-notif-label { - color: @cryptpad_text_col; - margin-right: 1rem; - i { - margin-right: 0.5rem; - } - } - - .cp-calendar-recurrence-container { - margin-top: 1rem; - .cp-calendar-rec-translated-str { - margin-top: 0.5rem; - } - } - - .cp-calendar-add-notif { - flex-flow: column; - align-items: baseline !important; - margin: 1rem 0; - * { - font-size: @colortheme_app-font-size; - font-weight: normal; - } - & > div { - display: flex; - } - .cp-calendar-notif-list-container { - width: 100%; - margin-bottom: 10px; - .cp-notif-label { - margin-top: 0.5em; - } - } - .cp-calendar-notif-list { - display: flex; - flex-flow: column; - flex: 1; - min-width: 150px; - &:empty { - display: none; - } - .cp-notif-entry { - display: flex; - margin-bottom: 2px; - border-radius: @variables_radius; - background-color: fade(@cryptpad_text_col, 10%); - padding: 0.25rem; - .cp-notif-value { - width: 75%; - display: inline-flex; - line-height: 30px; - vertical-align: middle; - flex-grow: 1; - .cp-before { - flex: 1; - min-width: 0; - } - } - span:not(:last-child) { - margin: 0; - margin-right: 0.3rem; - } - span:first-child { - margin-left: 0.3rem; - } - .btn-danger-outline { - display: block; - margin-right: 0px !important; - background-color: transparent; - color: @cryptpad_text_col; - border-color: @cryptpad_text_col; - &:hover { - color: @cp_buttons-red-color; - background-color: @cp_buttons-red; - border-color: @cp_buttons-red; - } - } - } - } - .cp-notif-empty { - display: none; - margin-bottom: 2px; - border-radius: @variables_radius; - background-color: fade(@cryptpad_text_col, 10%); - padding: 0.25rem 0.5rem; - line-height: 30px; - } - .cp-calendar-notif-list:empty ~ .cp-notif-empty { - display: block; - } - .cp-calendar-notif-form { - align-items: center; - .cp-calendar-notif-form-buttons { - display: inline-flex; - align-items: center; - & > input { - height: 40px; - } - } - // margin-bottom: 20px; - input { - width: 80px; - margin-right: 0.3rem; - } - .fa-plus{ - margin-left:0.3rem; - } - } - } - - .cp-calendar-close { - top: 17px; - right: 17px; - height: auto; - margin-right: 0px; - line-height: initial; - border: 1px solid; - &:not(:hover) { - background: transparent; - } - } - - } - - .cp-calendar-rec-inline, .cp-calendar-rec-block { - &:not(:last-child) { - margin-bottom: 10px; - } - } - .cp-calendar-rec-inline { - display: flex; - flex-flow: row; - align-items: center; - & > *:not(:first-child) { margin-left: 5px; } - .cp-dropdown-container { - position: unset; - } - input[type="number"] { - width: 80px !important; - margin-bottom: 0 !important; - } - .cp-checkmark { - margin-right: 0.5rem; - } - } - .cp-calendar-rec-block { - .cp-calendar-rec-block-title { - margin-bottom: 0.5rem !important; - } - .cp-radio { - margin-bottom: 0.5rem; - } - input[type="radio"]:not(:checked) ~ .cp-checkmark-label { - input { - filter: grayscale(1); - } - } - .cp-checkmark-label { - & > *:not(:first-child) { margin-left: 5px; } - width: 100%; - //height: 26px; - display: flex; - align-items: center; - & > input { - margin-bottom: 0 !important; - } - input { - display: inline; - height: 24px !important; - padding: 0 5px !important; - } - input[type="text"] { - width: 200px !important; - } - input[type="number"] { - width: 80px !important; - margin-bottom: 0 !important; - } - } - } - #cp-calendar-rec-monthly-pick ~ .cp-checkmark-label { - display: flex; - align-items: center; - & > span { - margin-right: 20px; - } - } - button.cp-calendar-pick-el { - display: flex; - align-items: center; - justify-content: center; - &:not(:last-child) { - margin-right: 5px; - } - } - div.cp-calendar-weekly-pick { - button { - width: 50px; - } - } - div.cp-calendar-monthly-pick { - display: flex; - flex-flow: column; - & > div { - display: flex; - &:not(:last-child) { - margin-bottom: 5px; - } - button { - height: 25px; - width: 25px; - &.lastday { - width: 115px; - } - } - } - } - - .tui-full-calendar-ic-repeat-b { - display: none; - & ~ * { - display: none; - } - } - - #cp-toolbar .cp-calendar-browse { - display: flex; - align-items: center; - button { - color: @cp_toolbar-fg; - border-color: @cp_toolbar-fg; - &:hover { - background-color: fade(@cp_toolbar-fg, 50%); - cursor: pointer; - } - } - } - - .cp-calendar-newevent { - &:hover { - cursor: pointer; - } - } - - .cp-toolbar-bottom-right button, .cp-toolbar-user button { - &:hover { - cursor: pointer; - } - } - - #cp-sidebarlayout-leftside { - & > div { - padding: 10px - } - .cp-calendar-new { - display: flex; - align-items: center; - justify-content: space-between; - } - .cp-calendar-list { - overflow-y: auto; - .cp-calendar-team { - height: 30px; - .avatar_main(30px); - .cp-avatar { - margin-right: 10px; - } - .cp-name { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - } - display: flex; - align-items: center; - justify-content: center; - margin: 5px 0 10px 0; - &:not(:first-child) { - margin-top: 30px; - } - } - .cp-calendar-entry { - display: flex; - align-items: center; - justify-content: space-between; - padding: 5px; - border-radius: @variables_radius; - background-color: @cp_sidebar-left-bg; - &:not(.cp-unclickable) { - cursor: pointer; - } - .cp-dropdown-container { - position: initial; - - .cp-dropdown-content{ - @media screen and (max-width: 600px) - { - left: 50%; - min-width: 45%; - } - } - } - button.cp-calendar-actions { - background-color: transparent; - &:hover { - background-color: @cp_sidebar-left-bg; - } - } - &.cp-ghost { - padding: 0; - button { - .tools_unselectable(); - cursor: pointer; - width: 100%; - display: flex; - justify-content: space-between; - background: transparent; - border: 1px solid @cryptpad_text_col; - border-radius: @variables_radius; - padding: 5px; - height: 36px; - font: @colortheme_app-font; - align-items: center; - color: @cryptpad_text_col; - &:hover { - background-color: @cp_sidebar-left-active; - color: @cp_sidebar-left-active-fg; - border: 0px; - } - i { - margin-left: 5px; - } - } - } - &:not(:last-child) { - margin-bottom: 10px; - } - &:hover { - background: @cp_sidebar-left-item-bg; - } - &.cp-restricted { - color: @cp_drive-header-fg; - } - .cp-calendar-icon { - width: 30px; - display: inline-flex; - height: 30px; - align-items: center; - justify-content: center; - border-radius: @variables_radius; - flex-shrink: 0; - } - &.cp-active { - background-color: @cp_sidebar-left-item-bg; - .cp-calendar-inactive { - display: none; - } - } - &:not(.cp-active) { - .cp-calendar-icon { - background: transparent !important; - } - .cp-calendar-active { - display: none; - } - } - .tools_unselectable(); - .cp-calendar-color { - display: inline-block; - border-radius: 50%; - width: 15px; - height: 15px; - flex-shrink: 0; - } - .cp-calendar-title { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - padding: 0 5px; - } - } - } - } - .cp-calendar-colorpicker { - width: 100px; - height: 25px; - cursor: pointer; - border: 1px solid @cp_forms-border; - } - - @media (max-width: @browser_media-medium-screen) { - .cp-calendar-notif-list-container, .cp-calendar-notif-form { - flex-direction: column; - align-items: unset !important; - } - .cp-calendar-newevent { - i { - margin: 0 !important; - } - span { - display: none; - } - } - .tui-full-calendar-dayname-leftmargin, .tui-full-calendar-timegrid-right { - margin-left: 40px !important; - } - .tui-full-calendar-allday-left, .tui-full-calendar-timegrid-left { - width: 40px !important; - } - .tui-full-calendar-dayname > span { - display: flex; - flex-flow: column; - line-height: 0; - justify-content: center; - align-items: center; - height: 100%; - } - .tui-full-calendar-dayname * { - font-size: 11px; - line-height: initial; - height: auto; - } - .cp-toolbar-bottom-mid > div { - :not(:first-child) { - display: none; - } - :first-child { - display: inline-block; - } - } - } - -} - From 546ccd63f7eaf5f16c974868bb25aa076088a602 Mon Sep 17 00:00:00 2001 From: daria Date: Wed, 10 Jul 2024 16:58:27 +0300 Subject: [PATCH 008/129] Revert "change focus style for inputs on calendar modals #1506" This reverts commit 7c57db6420b40b9daa27ed3b45cdd5a9df262f4f. --- customize.dist/src/less2/include/forms.less | 3 - www/calendar/app-calendar.less | 740 ++++++++++++++++++++ 2 files changed, 740 insertions(+), 3 deletions(-) create mode 100644 www/calendar/app-calendar.less diff --git a/customize.dist/src/less2/include/forms.less b/customize.dist/src/less2/include/forms.less index 5d8b242f1..065b9db1d 100644 --- a/customize.dist/src/less2/include/forms.less +++ b/customize.dist/src/less2/include/forms.less @@ -28,9 +28,6 @@ } &.tui-full-calendar-content { font-size: @colortheme_app-font-size; - &:focus { - outline: @cryptpad_color_brand solid 2px; - } } &[readonly] { //margin-top:1rem; diff --git a/www/calendar/app-calendar.less b/www/calendar/app-calendar.less new file mode 100644 index 000000000..bdf59fb6d --- /dev/null +++ b/www/calendar/app-calendar.less @@ -0,0 +1,740 @@ +/* + * SPDX-FileCopyrightText: 2023 XWiki CryptPad Team and contributors + * + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +@import (reference) '../../customize/src/less2/include/framework.less'; +@import (reference) '../../customize/src/less2/include/sidebar-layout.less'; +@import (reference) '../../customize/src/less2/include/tools.less'; +@import (reference) '../../customize/src/less2/include/avatar.less'; +@import (reference) '../../customize/src/less2/include/variables.less'; + +&.cp-app-calendar { + + .framework_min_main(); + .sidebar-layout_main(); + + display: flex; + flex-flow: column; + + .cp-toolbar-bottom-mid > div { + color: @cryptpad_text_col; + .cp-small { display: none; } + } + + .flatpickr-calendar { + z-index: 100001 !important; // Alertify is 100000 + } + #cp-sidebarlayout-container #cp-sidebarlayout-rightside { + padding: 0; + & > div { + margin: 0; + } + + .cp-forcehide { + display: none !important; + } + + + .tui-full-calendar-confirm { + span, i { + padding: 0.5rem; + } + span { + padding-left: 0; + } + width: unset; + } + + .tui-full-calendar-layout { + background-color: @cp_sidebar-right-bg !important; + color: @cryptpad_text_col; + display: flex; + flex-flow: column; + .tui-full-calendar-week-container { + min-height: 0; + display: flex; + flex-flow: column; + .tui-full-calendar-vlayout-area { + display: flex; + flex-flow: column; + flex: 1; + min-height: 0; + & > div:last-child { + flex: 1; + min-height: 0; + } + } + } + .tui-full-calendar-weekday-filled { + background-color: @cp_dropdown-bg-hover !important; + } + + .tui-full-calendar-timegrid-hourmarker-time { + color: @cp_calendar-now !important; + } + .tui-full-calendar-timegrid-hourmarker-line-left, .tui-full-calendar-timegrid-hourmarker-line-today { + border-color: @cp_calendar-now !important; + } + .tui-full-calendar-timegrid-todaymarker { + background-color: @cp_calendar-now !important; + } + + .tui-full-calendar-month { + display: flex; + flex-flow: column; + & > div:last-child { + display: flex; + flex-flow: column; + flex: 1; + min-height: 0; + overflow: hidden; + } + .tui-full-calendar-today .tui-full-calendar-weekday-grid-date-decorator { + background-color: @cp_calendar-now !important; + color: @cp_calendar-now-fg !important; + } + .tui-full-calendar-weekday-schedule-time .tui-full-calendar-weekday-schedule-title { + color: @cryptpad_text_col !important; + } + .tui-full-calendar-extra-date { + .tui-full-calendar-weekday-grid-date { + color: @cp_sidebar-hint !important; + opacity: 0.5; + } + } + .tui-full-calendar-weekday-grid-date { + color: @cryptpad_text_col !important; + } + .tui-full-calendar-month-dayname-item span { + color: @cryptpad_text_col !important; + } + } + .tui-full-calendar-dayname * { + color: @cryptpad_text_col !important; + } + .tui-full-calendar-month-more { + background-color: @cp_sidebar-right-bg !important; + color: @cryptpad_text_col; + span { + color: @cryptpad_text_col !important; + } + } + + .tui-full-calendar-floating-layer.cp-calendar-popup-flex { + top: 0 !important; + left: 0 !important; + right: 0 !important; + bottom: 0 !important; + justify-content: center !important; + align-items: center !important; + .tui-full-calendar-popup { + width: 540px; + max-width: 100%; + max-height: 100%; + } + } + #tui-full-calendar-popup-arrow { + display: none !important; + } + } + .tui-full-calendar-timegrid-timezone { + background-color: @cp_sidebar-right-bg !important; + .tui-full-calendar-timegrid-hour { + color: @cryptpad_text_col !important; + } + color: @cryptpad_text_col; + } + .tui-full-calendar-timegrid-gridline, .tui-full-calendar-time-date { + border-color: @cp_calendar-border !important; + } + .tui-full-calendar-splitter, .tui-full-calendar-left, .tui-full-calendar-dayname-container, .tui-full-calendar-weekday-grid-line { + border-color: @cp_calendar-border !important; + + } + .tui-full-calendar-popup { + border-radius: @variables_radius_L; + } + .tui-full-calendar-popup-container { + min-width: 100%; + background: @cp_flatpickr-bg; + color: @cryptpad_text_col; + border-radius: @variables_radius_L; + font-weight: normal; + .tui-full-calendar-icon:not(.tui-full-calendar-calendar-dot):not(.tui-full-calendar-dropdown-arrow):not(.tui-full-calendar-ic-checkbox):not(.fa-map-marker) { + display: none; + } + .tui-full-calendar-icon { + text-align:center; + } + .tui-full-calendar-popup-detail-item { + a { + color: @cryptpad_color_link; + text-decoration: underline; + } + } + .tui-full-calendar-section-button-save { + height: 40px; + .btn-primary { // Update button + margin-right: 0px; + } + } + + } + li.tui-full-calendar-popup-section-item { + padding: 0 6px; + height: 32px; + } + .tui-full-calendar-popup-section-item { + height: auto; + margin: 0; + &:not(li):not(button) { + padding: 0; + margin-top: 5px; + } + #tui-full-calendar-schedule-calendar { + width: 179px; + top: 0; + } + &:not(button) { + border: none; + display: inline-flex; + align-items: center; + &:hover { + background-color: @cp_dropdown-bg-hover; + } + .tui-full-calendar-content { + text-overflow: ellipsis; + font: @colortheme_app-font; + padding: 0 10px; + } + input { flex: 1; } + } + } + .tui-full-calendar-section-date-dash { + height: auto; + } + .tui-full-calendar-section-title, .tui-full-calendar-section-location, .tui-full-calendar-section-body { + width: 100%; + } + .tui-full-calendar-dropdown-menu { + top: 38px; + width: 221px; // same as button + background-color: @cp_dropdown-bg; + color: @cp_dropdown-fg; + } + .tui-full-calendar-section-state, #tui-full-calendar-schedule-private { + display: none !important; + } + + .tui-full-calendar-popup:not(.tui-full-calendar-popup-detail) { + .tui-full-calendar-section-calendar { + width: 221px; // 50% + } + .tui-full-calendar-popup-section { + display: flex; + align-items: center; + flex-wrap: wrap; + .tui-full-calendar-section-start-date, .tui-full-calendar-section-end-date { + flex: 1; + } + .tui-full-calendar-section-allday { + width: 100%; + height: 32px; + border-radius: @variables_radius; + input[type="checkbox"].tui-full-calendar-checkbox-square:checked + span { + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAABbmlDQ1BpY2MAACiRdZHNK0RRGMZ/Zoh8NIqFNItZDFmMEiVLxsJmkgZlsLn3zpe6c93uvZNkq2wspizExtfCf8BW2VJKkZKs/AG+Npqu97hqJM7t3PfXc87zds5zIJQyjZJbPwAly3PSE8nYXGY+1vhEMy20EyaqGa49NjWV4t/xfkOdqtf9qtf/+/4cLdmca0Bdk/CwYTue8KhwasWzFW8KdxpFLSu8L5xw5IDCF0rXA35UXAj4VbEzkx6HkOoZK/xg/QcbRack3CccL5ll4/s86iatOWt2Wmq3zCguaSZIEkOnzBImHv1SLcnsb9/Al2+SZfEY8rdZxRFHgaJ4E6KWpWtOal70nHwmqyr333m6+aHBoHtrEhoefP+lBxq3oFrx/Y8D368eQvgezqyaf1lyGnkTvVLT4nsQWYeT85qmb8PpBnTd2ZqjfUlhmaF8Hp6PoS0DHVfQvBBk9b3O0S3MrMkTXcLOLvTK/sjiJ6CLZ94KREMsAAAACXBIWXMAAAsSAAALEgHS3X78AAABHUlEQVQoFWNkaP//n4EMwESGHrAW6mtkZvz3G2g03BsBagz/nRUQ7sNp49//TJ+Byv6BlMbrMjCsC2Jg3BbKwOAgB9GMolGAg4GBESIOIrmA+A9I03xvFHGwCrhGkDOe5TAw9LvAFbEn6jEwwTT9BtodvJ7h/4FHYH0MLBCKgaHTgYGBE8jLN2FgYAJae+4FA8NcLwZWkAtAmoLWMTBsuYNwECMsHrVEGBj2RzEwiIEciATANgE1bb6DJAgMNLhTr71hYHBcxsDw+htCAQ5NIAU/4RpBPKjmf2++MfwHaQpZD7cJyEMB3+BORRL+rybE8FOEk4Hj2FO4KMgdrFAMitun2DTCVSMxYAkBFFYg9j94qCIpwsZEil5wyDIDAAXIUsnSKmq7AAAAAElFTkSuQmCC); + } + .tui-full-calendar-ic-checkbox { + margin-left: 5px; + border-radius: 2px; + } + } + .CodeMirror { + margin-top: 5px; + background: @cp_forms-bg !important; + color: @cryptpad_text_col; + border: 1px solid @cp_forms-border; + border-radius: @variables_radius; + width: 100%; + height: 80px; + font: @colortheme_app-font; + font-size: 16px; + line-height: initial; + padding-left: 0.3rem; + pre { + margin: 0; + font-family: inherit; + font-size: inherit; + line-height: inherit; + } + } + .CodeMirror-placeholder { + color: @cp_forms-placeholder; + } + } + } + .tui-full-calendar-popup-detail { + font: @colortheme_app-font; + color: @cryptpad_text_col; + box-shadow: @cryptpad_ui_shadow; + .tui-full-calendar-popup-container { + padding-bottom: 17px; + } + .tui-full-calendar-popup-detail-date { + font-size: 14px; + } + .tui-full-calendar-section-button { + margin-top: 10px; + border: 0; + display: flex; + align-items: start; + button { + flex: 1; + margin: 0; + } + } + .tui-full-calendar-popup-top-line { + border-radius: 10px 10px 0px 0px; + height: 10px; + } + .tui-full-calendar-popup-vertical-line { + visibility: hidden; + width: 10px; + } + } + + .cp-recurrence-label, .cp-notif-label { + color: @cryptpad_text_col; + margin-right: 1rem; + i { + margin-right: 0.5rem; + } + } + + .cp-calendar-recurrence-container { + margin-top: 1rem; + .cp-calendar-rec-translated-str { + margin-top: 0.5rem; + } + } + + .cp-calendar-add-notif { + flex-flow: column; + align-items: baseline !important; + margin: 1rem 0; + * { + font-size: @colortheme_app-font-size; + font-weight: normal; + } + & > div { + display: flex; + } + .cp-calendar-notif-list-container { + width: 100%; + margin-bottom: 10px; + .cp-notif-label { + margin-top: 0.5em; + } + } + .cp-calendar-notif-list { + display: flex; + flex-flow: column; + flex: 1; + min-width: 150px; + &:empty { + display: none; + } + .cp-notif-entry { + display: flex; + margin-bottom: 2px; + border-radius: @variables_radius; + background-color: fade(@cryptpad_text_col, 10%); + padding: 0.25rem; + .cp-notif-value { + width: 75%; + display: inline-flex; + line-height: 30px; + vertical-align: middle; + flex-grow: 1; + .cp-before { + flex: 1; + min-width: 0; + } + } + span:not(:last-child) { + margin: 0; + margin-right: 0.3rem; + } + span:first-child { + margin-left: 0.3rem; + } + .btn-danger-outline { + display: block; + margin-right: 0px !important; + background-color: transparent; + color: @cryptpad_text_col; + border-color: @cryptpad_text_col; + &:hover { + color: @cp_buttons-red-color; + background-color: @cp_buttons-red; + border-color: @cp_buttons-red; + } + } + } + } + .cp-notif-empty { + display: none; + margin-bottom: 2px; + border-radius: @variables_radius; + background-color: fade(@cryptpad_text_col, 10%); + padding: 0.25rem 0.5rem; + line-height: 30px; + } + .cp-calendar-notif-list:empty ~ .cp-notif-empty { + display: block; + } + .cp-calendar-notif-form { + align-items: center; + .cp-calendar-notif-form-buttons { + display: inline-flex; + align-items: center; + & > input { + height: 40px; + } + } + // margin-bottom: 20px; + input { + width: 80px; + margin-right: 0.3rem; + } + .fa-plus{ + margin-left:0.3rem; + } + } + } + + .cp-calendar-close { + top: 17px; + right: 17px; + height: auto; + margin-right: 0px; + line-height: initial; + border: 1px solid; + &:not(:hover) { + background: transparent; + } + } + + } + + .cp-calendar-rec-inline, .cp-calendar-rec-block { + &:not(:last-child) { + margin-bottom: 10px; + } + } + .cp-calendar-rec-inline { + display: flex; + flex-flow: row; + align-items: center; + & > *:not(:first-child) { margin-left: 5px; } + .cp-dropdown-container { + position: unset; + } + input[type="number"] { + width: 80px !important; + margin-bottom: 0 !important; + } + .cp-checkmark { + margin-right: 0.5rem; + } + } + .cp-calendar-rec-block { + .cp-calendar-rec-block-title { + margin-bottom: 0.5rem !important; + } + .cp-radio { + margin-bottom: 0.5rem; + } + input[type="radio"]:not(:checked) ~ .cp-checkmark-label { + input { + filter: grayscale(1); + } + } + .cp-checkmark-label { + & > *:not(:first-child) { margin-left: 5px; } + width: 100%; + //height: 26px; + display: flex; + align-items: center; + & > input { + margin-bottom: 0 !important; + } + input { + display: inline; + height: 24px !important; + padding: 0 5px !important; + } + input[type="text"] { + width: 200px !important; + } + input[type="number"] { + width: 80px !important; + margin-bottom: 0 !important; + } + } + } + #cp-calendar-rec-monthly-pick ~ .cp-checkmark-label { + display: flex; + align-items: center; + & > span { + margin-right: 20px; + } + } + button.cp-calendar-pick-el { + display: flex; + align-items: center; + justify-content: center; + &:not(:last-child) { + margin-right: 5px; + } + } + div.cp-calendar-weekly-pick { + button { + width: 50px; + } + } + div.cp-calendar-monthly-pick { + display: flex; + flex-flow: column; + & > div { + display: flex; + &:not(:last-child) { + margin-bottom: 5px; + } + button { + height: 25px; + width: 25px; + &.lastday { + width: 115px; + } + } + } + } + + .tui-full-calendar-ic-repeat-b { + display: none; + & ~ * { + display: none; + } + } + + #cp-toolbar .cp-calendar-browse { + display: flex; + align-items: center; + button { + color: @cp_toolbar-fg; + border-color: @cp_toolbar-fg; + &:hover { + background-color: fade(@cp_toolbar-fg, 50%); + cursor: pointer; + } + } + } + + .cp-calendar-newevent { + &:hover { + cursor: pointer; + } + } + + .cp-toolbar-bottom-right button, .cp-toolbar-user button { + &:hover { + cursor: pointer; + } + } + + #cp-sidebarlayout-leftside { + & > div { + padding: 10px + } + .cp-calendar-new { + display: flex; + align-items: center; + justify-content: space-between; + } + .cp-calendar-list { + overflow-y: auto; + .cp-calendar-team { + height: 30px; + .avatar_main(30px); + .cp-avatar { + margin-right: 10px; + } + .cp-name { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + display: flex; + align-items: center; + justify-content: center; + margin: 5px 0 10px 0; + &:not(:first-child) { + margin-top: 30px; + } + } + .cp-calendar-entry { + display: flex; + align-items: center; + justify-content: space-between; + padding: 5px; + border-radius: @variables_radius; + background-color: @cp_sidebar-left-bg; + &:not(.cp-unclickable) { + cursor: pointer; + } + .cp-dropdown-container { + position: initial; + + .cp-dropdown-content{ + @media screen and (max-width: 600px) + { + left: 50%; + min-width: 45%; + } + } + } + button.cp-calendar-actions { + background-color: transparent; + &:hover { + background-color: @cp_sidebar-left-bg; + } + } + &.cp-ghost { + padding: 0; + button { + .tools_unselectable(); + cursor: pointer; + width: 100%; + display: flex; + justify-content: space-between; + background: transparent; + border: 1px solid @cryptpad_text_col; + border-radius: @variables_radius; + padding: 5px; + height: 36px; + font: @colortheme_app-font; + align-items: center; + color: @cryptpad_text_col; + &:hover { + background-color: @cp_sidebar-left-active; + color: @cp_sidebar-left-active-fg; + border: 0px; + } + i { + margin-left: 5px; + } + } + } + &:not(:last-child) { + margin-bottom: 10px; + } + &:hover { + background: @cp_sidebar-left-item-bg; + } + &.cp-restricted { + color: @cp_drive-header-fg; + } + .cp-calendar-icon { + width: 30px; + display: inline-flex; + height: 30px; + align-items: center; + justify-content: center; + border-radius: @variables_radius; + flex-shrink: 0; + } + &.cp-active { + background-color: @cp_sidebar-left-item-bg; + .cp-calendar-inactive { + display: none; + } + } + &:not(.cp-active) { + .cp-calendar-icon { + background: transparent !important; + } + .cp-calendar-active { + display: none; + } + } + .tools_unselectable(); + .cp-calendar-color { + display: inline-block; + border-radius: 50%; + width: 15px; + height: 15px; + flex-shrink: 0; + } + .cp-calendar-title { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + padding: 0 5px; + } + } + } + } + .cp-calendar-colorpicker { + width: 100px; + height: 25px; + cursor: pointer; + border: 1px solid @cp_forms-border; + } + + @media (max-width: @browser_media-medium-screen) { + .cp-calendar-notif-list-container, .cp-calendar-notif-form { + flex-direction: column; + align-items: unset !important; + } + .cp-calendar-newevent { + i { + margin: 0 !important; + } + span { + display: none; + } + } + .tui-full-calendar-dayname-leftmargin, .tui-full-calendar-timegrid-right { + margin-left: 40px !important; + } + .tui-full-calendar-allday-left, .tui-full-calendar-timegrid-left { + width: 40px !important; + } + .tui-full-calendar-dayname > span { + display: flex; + flex-flow: column; + line-height: 0; + justify-content: center; + align-items: center; + height: 100%; + } + .tui-full-calendar-dayname * { + font-size: 11px; + line-height: initial; + height: auto; + } + .cp-toolbar-bottom-mid > div { + :not(:first-child) { + display: none; + } + :first-child { + display: inline-block; + } + } + } + +} + From 471e3954eb0f1da5ee2aebb70f75088687449624 Mon Sep 17 00:00:00 2001 From: daria Date: Wed, 10 Jul 2024 17:01:18 +0300 Subject: [PATCH 009/129] fix error --- customize.dist/src/less2/include/forms.less | 3 +++ 1 file changed, 3 insertions(+) diff --git a/customize.dist/src/less2/include/forms.less b/customize.dist/src/less2/include/forms.less index 065b9db1d..5d8b242f1 100644 --- a/customize.dist/src/less2/include/forms.less +++ b/customize.dist/src/less2/include/forms.less @@ -28,6 +28,9 @@ } &.tui-full-calendar-content { font-size: @colortheme_app-font-size; + &:focus { + outline: @cryptpad_color_brand solid 2px; + } } &[readonly] { //margin-top:1rem; From a4171d19ebda7716bf6449d448356e9e66dea5c4 Mon Sep 17 00:00:00 2001 From: daria Date: Thu, 11 Jul 2024 14:28:55 +0300 Subject: [PATCH 010/129] fix focus style on `new calendar` button #1506 --- www/calendar/app-calendar.less | 3 +++ 1 file changed, 3 insertions(+) diff --git a/www/calendar/app-calendar.less b/www/calendar/app-calendar.less index bdf59fb6d..d219cfd3f 100644 --- a/www/calendar/app-calendar.less +++ b/www/calendar/app-calendar.less @@ -633,6 +633,9 @@ color: @cp_sidebar-left-active-fg; border: 0px; } + &:focus { + outline: @cryptpad_color_brand solid 2px; + } i { margin-left: 5px; } From 4a289d003d9ceaab50d58a949bdd1954e2359949 Mon Sep 17 00:00:00 2001 From: daria Date: Thu, 11 Jul 2024 14:56:01 +0300 Subject: [PATCH 011/129] fix focus style on drive sidebar #1506 --- customize.dist/src/less2/include/drive.less | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/customize.dist/src/less2/include/drive.less b/customize.dist/src/less2/include/drive.less index 239f73287..3672a540e 100644 --- a/customize.dist/src/less2/include/drive.less +++ b/customize.dist/src/less2/include/drive.less @@ -30,6 +30,11 @@ .cp-unselectable { .tools_unselectable(); } + .btn-primary{ + &:focus { + outline: @cryptpad_color_brand solid 2px; + } + } /* local mixins */ @drive_icon-margin: 10px; @@ -348,6 +353,9 @@ overflow: hidden; text-overflow: ellipsis; } + &:focus { + outline: @cryptpad_color_brand solid 2px; + } } } } @@ -373,6 +381,9 @@ padding-left: 20px; .leftside-menu-category_main(); margin: 0; + &:focus { + outline: @cryptpad_color_brand solid 2px; + } } } } @@ -399,6 +410,9 @@ position: relative; top: -1px; } + &:focus { + outline: @cryptpad_color_brand solid 2px; + } } .cp-app-drive-tree-docs { box-shadow: @cryptpad_ui_shadow; From be807d884a1a027ee2b6decd0e31c8fb73b5d057 Mon Sep 17 00:00:00 2001 From: daria Date: Thu, 11 Jul 2024 15:26:43 +0300 Subject: [PATCH 012/129] fix overlapping focus on drive sidebar --- customize.dist/src/less2/include/drive.less | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/customize.dist/src/less2/include/drive.less b/customize.dist/src/less2/include/drive.less index 3672a540e..a4dca3826 100644 --- a/customize.dist/src/less2/include/drive.less +++ b/customize.dist/src/less2/include/drive.less @@ -334,11 +334,10 @@ overflow: hidden; text-overflow: ellipsis; .leftside-menu-category_main(); - margin: 0; display: flex; align-items: center; cursor: pointer; - margin-left: -5px; + margin: 0 0 2px -5px; padding-left: 5px; .fa, .cptools { display: inline-block; From 44aee13a56135063f5ef1ea6448254e18ae8400c Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 15 Jul 2024 12:02:07 +0200 Subject: [PATCH 013/129] Compute new metadata first and fallback to old system if needed --- lib/storage/file.js | 29 +++++++-- .../00000000000000000000000000000000.ndjson | 7 +++ ...00000000000000000000000001.metadata.ndjson | 5 ++ .../00000000000000000000000000000001.ndjson | 7 +++ ...00000000000000000000000002.metadata.ndjson | 1 + .../00000000000000000000000000000002.ndjson | 6 ++ ...00000000000000000000000003.metadata.ndjson | 6 ++ .../00000000000000000000000000000003.ndjson | 6 ++ .../00000000000000000000000000000004.ndjson | 6 ++ scripts/tests/test-metadata.js | 60 +++++++++++++++++++ 10 files changed, 127 insertions(+), 6 deletions(-) create mode 100644 scripts/tests/test-data/00/00000000000000000000000000000000.ndjson create mode 100644 scripts/tests/test-data/00/00000000000000000000000000000001.metadata.ndjson create mode 100644 scripts/tests/test-data/00/00000000000000000000000000000001.ndjson create mode 100644 scripts/tests/test-data/00/00000000000000000000000000000002.metadata.ndjson create mode 100644 scripts/tests/test-data/00/00000000000000000000000000000002.ndjson create mode 100644 scripts/tests/test-data/00/00000000000000000000000000000003.metadata.ndjson create mode 100644 scripts/tests/test-data/00/00000000000000000000000000000003.ndjson create mode 100644 scripts/tests/test-data/00/00000000000000000000000000000004.ndjson create mode 100644 scripts/tests/test-metadata.js diff --git a/lib/storage/file.js b/lib/storage/file.js index 2c2888f7a..d33c42f5f 100644 --- a/lib/storage/file.js +++ b/lib/storage/file.js @@ -429,7 +429,27 @@ How to proceed */ + let requiresChannel = true; + let all = []; nThen(function (w) { + let first = true; + getDedicatedMetadata(env, channelId, (err, line) => { + if (first && !err) { + if (!Array.isArray(line)) { + requiresChannel = false; + } + first = false; + } + all.push({err, line}); + }, w(function (err) { + if (err) { + // stream errors? + w.abort(); + return void cb(err); + } + })); + }).nThen(function (w) { + if (!requiresChannel) { return; } // returns the first line of a channel, parsed... getChannelMetadata(env, channelId, w(function (err, data) { if (err) { @@ -445,13 +465,10 @@ How to proceed handler(null, data); })); }).nThen(function () { - getDedicatedMetadata(env, channelId, handler, function (err) { - if (err) { - // stream errors? - return void cb(err); - } - cb(); + all.forEach(({err, line}) => { + handler(err, line); }); + cb(); }); }; diff --git a/scripts/tests/test-data/00/00000000000000000000000000000000.ndjson b/scripts/tests/test-data/00/00000000000000000000000000000000.ndjson new file mode 100644 index 000000000..cdbaaefa2 --- /dev/null +++ b/scripts/tests/test-data/00/00000000000000000000000000000000.ndjson @@ -0,0 +1,7 @@ +{"owners":["TestOwner"],"validateKey":"TestKey","channel":"0","created":1721035117462} +[0,"test","MSG","test",1721035117969] +[0,"test","MSG","test2",1721035117969] +[0,"test","MSG","test3",1721035117969] +[0,"test","MSG","test4",1721035117969] +[0,"test","MSG","test5",1721035117969] +[0,"test","MSG","test6",1721035117969] diff --git a/scripts/tests/test-data/00/00000000000000000000000000000001.metadata.ndjson b/scripts/tests/test-data/00/00000000000000000000000000000001.metadata.ndjson new file mode 100644 index 000000000..1cafb44c2 --- /dev/null +++ b/scripts/tests/test-data/00/00000000000000000000000000000001.metadata.ndjson @@ -0,0 +1,5 @@ +["RESTRICT_ACCESS",[true],1721035145090] +["ADD_ALLOWED",["NewAllowedKeyNewAllowedKeyNewAllowedKeyNewAl"],1721035148115] +["ADD_PENDING_OWNERS",["PendingOwner"],1721035151295] +["RESTRICT_ACCESS",[false],1721035155836] +["RESTRICT_ACCESS",[true],1721035156728] diff --git a/scripts/tests/test-data/00/00000000000000000000000000000001.ndjson b/scripts/tests/test-data/00/00000000000000000000000000000001.ndjson new file mode 100644 index 000000000..cdbaaefa2 --- /dev/null +++ b/scripts/tests/test-data/00/00000000000000000000000000000001.ndjson @@ -0,0 +1,7 @@ +{"owners":["TestOwner"],"validateKey":"TestKey","channel":"0","created":1721035117462} +[0,"test","MSG","test",1721035117969] +[0,"test","MSG","test2",1721035117969] +[0,"test","MSG","test3",1721035117969] +[0,"test","MSG","test4",1721035117969] +[0,"test","MSG","test5",1721035117969] +[0,"test","MSG","test6",1721035117969] diff --git a/scripts/tests/test-data/00/00000000000000000000000000000002.metadata.ndjson b/scripts/tests/test-data/00/00000000000000000000000000000002.metadata.ndjson new file mode 100644 index 000000000..7c47d09d3 --- /dev/null +++ b/scripts/tests/test-data/00/00000000000000000000000000000002.metadata.ndjson @@ -0,0 +1 @@ +{"owners":["TestOwner"],"validateKey":"TestKey","channel":"0","created":1721035117462} diff --git a/scripts/tests/test-data/00/00000000000000000000000000000002.ndjson b/scripts/tests/test-data/00/00000000000000000000000000000002.ndjson new file mode 100644 index 000000000..99973c454 --- /dev/null +++ b/scripts/tests/test-data/00/00000000000000000000000000000002.ndjson @@ -0,0 +1,6 @@ +[0,"test","MSG","test",1721035117969] +[0,"test","MSG","test2",1721035117969] +[0,"test","MSG","test3",1721035117969] +[0,"test","MSG","test4",1721035117969] +[0,"test","MSG","test5",1721035117969] +[0,"test","MSG","test6",1721035117969] diff --git a/scripts/tests/test-data/00/00000000000000000000000000000003.metadata.ndjson b/scripts/tests/test-data/00/00000000000000000000000000000003.metadata.ndjson new file mode 100644 index 000000000..ffcb25082 --- /dev/null +++ b/scripts/tests/test-data/00/00000000000000000000000000000003.metadata.ndjson @@ -0,0 +1,6 @@ +{"owners":["TestOwner"],"validateKey":"TestKey","channel":"0","created":1721035117462} +["RESTRICT_ACCESS",[true],1721035145090] +["ADD_ALLOWED",["NewAllowedKeyNewAllowedKeyNewAllowedKeyNewAl"],1721035148115] +["ADD_PENDING_OWNERS",["PendingOwner"],1721035151295] +["RESTRICT_ACCESS",[false],1721035155836] +["RESTRICT_ACCESS",[true],1721035156728] diff --git a/scripts/tests/test-data/00/00000000000000000000000000000003.ndjson b/scripts/tests/test-data/00/00000000000000000000000000000003.ndjson new file mode 100644 index 000000000..99973c454 --- /dev/null +++ b/scripts/tests/test-data/00/00000000000000000000000000000003.ndjson @@ -0,0 +1,6 @@ +[0,"test","MSG","test",1721035117969] +[0,"test","MSG","test2",1721035117969] +[0,"test","MSG","test3",1721035117969] +[0,"test","MSG","test4",1721035117969] +[0,"test","MSG","test5",1721035117969] +[0,"test","MSG","test6",1721035117969] diff --git a/scripts/tests/test-data/00/00000000000000000000000000000004.ndjson b/scripts/tests/test-data/00/00000000000000000000000000000004.ndjson new file mode 100644 index 000000000..99973c454 --- /dev/null +++ b/scripts/tests/test-data/00/00000000000000000000000000000004.ndjson @@ -0,0 +1,6 @@ +[0,"test","MSG","test",1721035117969] +[0,"test","MSG","test2",1721035117969] +[0,"test","MSG","test3",1721035117969] +[0,"test","MSG","test4",1721035117969] +[0,"test","MSG","test5",1721035117969] +[0,"test","MSG","test6",1721035117969] diff --git a/scripts/tests/test-metadata.js b/scripts/tests/test-metadata.js new file mode 100644 index 000000000..30d5ddc8c --- /dev/null +++ b/scripts/tests/test-metadata.js @@ -0,0 +1,60 @@ +const Store = require("../../lib/storage/file"); +const Meta = require("../../lib/metadata"); +const nThen = require('nthen'); + +let chanOld = '00000000000000000000000000000000'; +let chanOldUpdated = '00000000000000000000000000000001'; +let chanNew = '00000000000000000000000000000002'; +let chanNewUpdated = '00000000000000000000000000000003'; +let chanNoMeta = '00000000000000000000000000000004'; + +Store.create({ + filePath: './test-data/' +}, (err, store) => { + if (err) { return void console.error(err); } + + const readMetadata = (channel, cb) => { + const ref = {}; + const h = Meta.createLineHandler(ref, console.error); + store.readChannelMetadata(channel, h, () => { + cb(ref && ref.meta); + }); + }; + + nThen(w => { + readMetadata(chanOld, w(meta => { + if (!meta || meta.validateKey !== "TestKey") { + console.log('OldChanNoUpdate', meta); + throw new Error("Error with old channel without metadata update"); + } + })); + readMetadata(chanOldUpdated, w(meta => { + if (!meta || meta.validateKey !== "TestKey" || !meta.restricted || !meta.allowed.includes('NewAllowedKeyNewAllowedKeyNewAllowedKeyNewAl')) { + console.log('OldChanUpdate', meta); + throw new Error("Error with old channel with metadata updates"); + } + })); + readMetadata(chanNew, w(meta => { + if (!meta || meta.validateKey !== "TestKey") { + console.log('NewChanNoUpdate', meta); + throw new Error("Error with new channel without metadata update"); + } + })); + readMetadata(chanNewUpdated, w(meta => { + if (!meta || meta.validateKey !== "TestKey" || !meta.restricted || !meta.allowed.includes('NewAllowedKeyNewAllowedKeyNewAllowedKeyNewAl')) { + console.log('NewChanUpdate', meta); + throw new Error("Error with new channel with metadata updates"); + } + })); + readMetadata(chanNoMeta, w(meta => { + if (meta && Object.keys(meta).length) { + console.log('NoMetadataChan', meta); + throw new Error("Error with channel without metadata"); + } + })); + }).nThen(() => { + console.log('Success'); + process.exit(1); + }); +}) + From 35109ae44698e5ebc35c8ed52e77c0bfd446b694 Mon Sep 17 00:00:00 2001 From: DianaXWiki <139217939+DianaXWiki@users.noreply.github.com> Date: Wed, 17 Jul 2024 17:46:59 +0300 Subject: [PATCH 014/129] Make confirm button responsive #1406 --- customize.dist/src/less2/include/alertify.less | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less index 0890d8010..c225708aa 100644 --- a/customize.dist/src/less2/include/alertify.less +++ b/customize.dist/src/less2/include/alertify.less @@ -327,6 +327,8 @@ nav { padding: @alertify_padding-base; text-align: right; + display: flex; + align-items: center; button, div.cp-button-confirm { margin: 0px !important; &:not(:first-child):not(.left) { @@ -339,6 +341,17 @@ div.cp-button-confirm { vertical-align: middle; } + .btn.btn-danger { + overflow-wrap: break-word; + white-space: normal; + } + @media screen and (max-width: @browser_media-medium-screen){ + justify-content: flex-end; + .btn.btn-danger { + width: 100%; + line-height: inherit; + } + } } } } From bba8bc84a1028b2de352eea45060757a164c94a9 Mon Sep 17 00:00:00 2001 From: DianaXWiki <139217939+DianaXWiki@users.noreply.github.com> Date: Thu, 25 Jul 2024 22:25:26 +0300 Subject: [PATCH 015/129] Make password confirmation button responsive #1406 --- .../src/less2/include/alertify.less | 13 ------------ www/settings/app-settings.less | 21 +++++++++++++++++++ 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less index c225708aa..0890d8010 100644 --- a/customize.dist/src/less2/include/alertify.less +++ b/customize.dist/src/less2/include/alertify.less @@ -327,8 +327,6 @@ nav { padding: @alertify_padding-base; text-align: right; - display: flex; - align-items: center; button, div.cp-button-confirm { margin: 0px !important; &:not(:first-child):not(.left) { @@ -341,17 +339,6 @@ div.cp-button-confirm { vertical-align: middle; } - .btn.btn-danger { - overflow-wrap: break-word; - white-space: normal; - } - @media screen and (max-width: @browser_media-medium-screen){ - justify-content: flex-end; - .btn.btn-danger { - width: 100%; - line-height: inherit; - } - } } } } diff --git a/www/settings/app-settings.less b/www/settings/app-settings.less index ee5c1afc9..a3e47ab39 100644 --- a/www/settings/app-settings.less +++ b/www/settings/app-settings.less @@ -38,6 +38,22 @@ margin-left: 0.5rem; } + .alertify { + nav { + display: flex; + justify-content: center; + align-items: flex-end; + @media screen and (max-width: @browser_media-medium-screen) { + .btn-danger { + line-height: inherit; + overflow-wrap: break-word; + white-space: normal; + width: 100%; + } + } + } + } + #cp-sidebarlayout-container { #cp-sidebarlayout-rightside { input[type="checkbox"] { @@ -113,6 +129,11 @@ margin-left: 10px; } } + nav { + display: flex; + justify-content: center; + align-items: flex-end; + } @media (max-width: 840px) { .cp-password-container { From 3eece44804a1b0f97a26fdfff887cbeb435b855d Mon Sep 17 00:00:00 2001 From: DianaXWiki <139217939+DianaXWiki@users.noreply.github.com> Date: Thu, 25 Jul 2024 23:19:26 +0300 Subject: [PATCH 016/129] Generalize solution to install and register confirmation buttons #1406 --- customize.dist/src/less2/pages/page-install.less | 11 +++++++---- customize.dist/src/less2/pages/page-register.less | 11 +++++++---- www/common/common-interface.js | 8 ++++++-- www/install/main.js | 2 +- www/register/main.js | 2 +- www/settings/app-settings.less | 2 +- www/settings/inner.js | 4 ++-- 7 files changed, 25 insertions(+), 15 deletions(-) diff --git a/customize.dist/src/less2/pages/page-install.less b/customize.dist/src/less2/pages/page-install.less index 47579bd12..d2c773adf 100644 --- a/customize.dist/src/less2/pages/page-install.less +++ b/customize.dist/src/less2/pages/page-install.less @@ -45,11 +45,14 @@ display: flex; align-items: center; justify-content: flex-end; - } - @media screen and (max-width: 600px) { - nav .btn-danger { - line-height: inherit; + @media screen and (max-width: @browser_media-medium-screen) { + .btn-confirm { + line-height: inherit; + overflow-wrap: break-word; + white-space: normal; + width: 100%; + } } } diff --git a/customize.dist/src/less2/pages/page-register.less b/customize.dist/src/less2/pages/page-register.less index 9e5d5caee..24216b49e 100644 --- a/customize.dist/src/less2/pages/page-register.less +++ b/customize.dist/src/less2/pages/page-register.less @@ -70,11 +70,14 @@ display: flex; align-items: center; justify-content: flex-end; - } - @media screen and (max-width: 600px) { - nav .btn-danger { - line-height: inherit; + @media screen and (max-width: @browser_media-medium-screen) { + .btn-confirm { + line-height: inherit; + overflow-wrap: break-word; + white-space: normal; + width: 100%; + } } } diff --git a/www/common/common-interface.js b/www/common/common-interface.js index 2c4d57799..e58f04a67 100644 --- a/www/common/common-interface.js +++ b/www/common/common-interface.js @@ -775,10 +775,10 @@ define([ }); }; - UI.confirm = function (msg, cb, opt, force) { + UI.confirm = function (msg, cb, opt, force, className) { cb = cb || function () {}; opt = opt || {}; - + console.log('Parameters:', { msg, cb, opt, force, className }); var message; if (typeof(msg) === 'string') { if (!force) { msg = Util.fixHTML(msg); } @@ -791,6 +791,10 @@ define([ var ok = dialog.okButton(opt.ok, opt.okClass); var cancel = dialog.cancelButton(opt.cancel, opt.cancelClass); + if (className) { + ok.classList.add(className); + } + var frame = dialog.frame([ message, dialog.nav(opt.reverseOrder? diff --git a/www/install/main.js b/www/install/main.js index 92d6ddcbc..3eb97bf79 100644 --- a/www/install/main.js +++ b/www/install/main.js @@ -194,7 +194,7 @@ define([ done: function ($dialog) { $dialog.find('> div').addClass('half'); }, - }); + }, false, 'btn-confirm'); }, 150); }; diff --git a/www/register/main.js b/www/register/main.js index b9c7e6565..48e4a6e24 100644 --- a/www/register/main.js +++ b/www/register/main.js @@ -180,7 +180,7 @@ define([ done: function ($dialog) { $dialog.find('> div').addClass('half'); }, - }); + }, false, 'btn-confirm'); }, 150); }; diff --git a/www/settings/app-settings.less b/www/settings/app-settings.less index a3e47ab39..6c52d14ca 100644 --- a/www/settings/app-settings.less +++ b/www/settings/app-settings.less @@ -44,7 +44,7 @@ justify-content: center; align-items: flex-end; @media screen and (max-width: @browser_media-medium-screen) { - .btn-danger { + .btn-confirm{ line-height: inherit; overflow-wrap: break-word; white-space: normal; diff --git a/www/settings/inner.js b/www/settings/inner.js index e23459d9d..51cb76efb 100644 --- a/www/settings/inner.js +++ b/www/settings/inner.js @@ -812,7 +812,7 @@ define([ done: function($dialog) { $dialog.find('> div').addClass('half'); }, - }); + }, false, 'btn-confirm'); }; $(form).find('button').click(function() { @@ -866,7 +866,7 @@ define([ if (err || obj.error) { return UI.alert(Messages.settings_changePasswordError); } spinner.done(); }); - }); + }, null, null, 'cp-button-confirm'); }; $form.find('button').click(function() { From 72a6c3b5cdfc3aee841694a7c8b11fc43941d09a Mon Sep 17 00:00:00 2001 From: DianaXWiki <139217939+DianaXWiki@users.noreply.github.com> Date: Sun, 28 Jul 2024 19:36:47 +0300 Subject: [PATCH 017/129] Refactor code + fix i and a tags classes mismatch #1567 --- www/common/common-ui-elements.js | 115 ++++++++++++------------------- 1 file changed, 43 insertions(+), 72 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 5405bf319..980076528 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -623,13 +623,19 @@ define([ var appType = (common.getMetadataMgr().getMetadata().type || 'pad').toUpperCase(); data = data || {}; if (!callback && data.callback) { callback = data.callback; } + + function createIconButton(iconClasses, buttonClasses, title, text, ariaLabel) { + return $('