From 2fa6ad22a3086c6e4203a9d7c683a6e804469b45 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Wed, 4 Dec 2024 21:42:10 +0000 Subject: [PATCH] Expose access token under developer tools I need this from time to time. For example, debugging an API call or scripting something with the admin API. This is buried under developer settings so hopefully no one starts sharing this willy-nilly. Element Web does something similar, except theirs is hidden under Help & About. --- src/devtools/AccountData.qml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/devtools/AccountData.qml b/src/devtools/AccountData.qml index b07b43399..b2a238644 100644 --- a/src/devtools/AccountData.qml +++ b/src/devtools/AccountData.qml @@ -33,4 +33,28 @@ ColumnLayout { } } } + FormCard.FormCard { + FormCard.FormSwitchDelegate { + id: showAccessTokenCheckbox + text: i18nc("@info", "Show Access Token") + description: i18n("This should not be shared with anyone, even other users. This token gives full access to your account.") + } + FormCard.FormTextDelegate { + text: i18nc("@info", "Access Token") + description: root.connection.accessToken + visible: showAccessTokenCheckbox.checked + + contentItem.children: QQC2.Button { + text: i18nc("@action:button", "Copy access token to clipboard") + icon.name: "edit-copy" + display: QQC2.AbstractButton.IconOnly + + onClicked: Clipboard.saveText(root.connection.accessToken) + + QQC2.ToolTip.text: text + QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay + QQC2.ToolTip.visible: hovered + } + } + } }