From fa5ce220f5f84c541dd5eb15edffd7f611910b71 Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 9 May 2025 15:53:59 +0200 Subject: [PATCH] Allow password change for all OO apps --- src/common/pad-types.js | 2 +- www/common/cryptpad-common.js | 5 +++-- www/common/inner/access.js | 5 +++-- www/common/pad-types.js | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/common/pad-types.js b/src/common/pad-types.js index 8c2f8014b..70756f552 100644 --- a/src/common/pad-types.js +++ b/src/common/pad-types.js @@ -27,7 +27,7 @@ const factory = (AppConfig = {}, ApiConfig = {}, setCustomize({AppConfig,ApiConfig}); } - const Types = { setCustomize }; + const Types = { OO_APPS, setCustomize }; Types.__defineGetter__("availableTypes", function () { if (ApiConfig.appsToDisable) { diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 78bec4f90..d6a52bdbb 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -19,13 +19,14 @@ define([ '/common/common-credential.js', '/customize/login.js', '/common/store-interface.js', + '/common/pad-types.js', '/customize/application_config.js', '/components/nthen/index.js', '/components/tweetnacl/nacl-fast.min.js' ], function (Config, Broadcast, Messages, Util, Hash, Cache, Constants, Feedback, Visible, UserObject, LocalStore, Channel, Block, - Cred, Login, Store, AppConfig, nThen) { + Cred, Login, Store, Types, AppConfig, nThen) { /* This file exposes functionality which is specific to Cryptpad, but not to any particular pad type. This includes functions for committing metadata @@ -1689,7 +1690,7 @@ define([ if (!href) { return void cb({ error: 'EINVAL_HREF' }); } var parsed = Hash.parsePadUrl(href); if (!parsed.hash) { return void cb({ error: 'EINVAL_HREF' }); } - if (parsed.type !== 'sheet') { return void cb({ error: 'EINVAL_TYPE' }); } + if (!Types.OO_APPS.includes(parsed.type)) { return void cb({ error: 'EINVAL_TYPE' }); } var warning = false; var newHash, newRoHref; diff --git a/www/common/inner/access.js b/www/common/inner/access.js index 2c5c03de1..ee260137b 100644 --- a/www/common/inner/access.js +++ b/www/common/inner/access.js @@ -8,11 +8,12 @@ define([ '/common/common-hash.js', '/common/common-interface.js', '/common/common-ui-elements.js', + '/common/pad-types.js', '/common/inner/common-modal.js', '/common/hyperscript.js', '/customize/messages.js', '/components/nthen/index.js', -], function ($, Util, Hash, UI, UIElements, Modal, h, +], function ($, Util, Hash, UI, UIElements, Types, Modal, h, Messages, nThen) { var Access = {}; @@ -908,7 +909,7 @@ define([ // We should know it because the pad is stored, but it's better to check... //if (!data.noEditPassword && !opts.noEditPassword && owned && data.href) { if (!data.noEditPassword && !opts.noEditPassword && owned && data.href && parsed.type !== "form") { // TODO password change in forms block responses (validation & decryption) - var isOO = ['sheet', 'doc', 'presentation'].includes(parsed.type); + var isOO = Types?.OO_APPS?.includes(parsed.type); var isFile = parsed.hashData.type === 'file'; var isSharedFolder = parsed.type === 'drive'; diff --git a/www/common/pad-types.js b/www/common/pad-types.js index 8c2f8014b..70756f552 100644 --- a/www/common/pad-types.js +++ b/www/common/pad-types.js @@ -27,7 +27,7 @@ const factory = (AppConfig = {}, ApiConfig = {}, setCustomize({AppConfig,ApiConfig}); } - const Types = { setCustomize }; + const Types = { OO_APPS, setCustomize }; Types.__defineGetter__("availableTypes", function () { if (ApiConfig.appsToDisable) {