From 64a68b95b00fa32b64421f06ffcb8db95f40486d Mon Sep 17 00:00:00 2001 From: Andrew Camilleri Date: Thu, 7 Jan 2021 09:56:35 +0100 Subject: [PATCH] Add API Key QR scan + click to reveal api key in List view (#2174) --- BTCPayServer/Views/Manage/APIKeys.cshtml | 127 ++++++++++++------ BTCPayServer/Views/Shared/ShowQR.cshtml | 9 +- .../Views/Wallets/WalletSettings.cshtml | 2 +- 3 files changed, 91 insertions(+), 47 deletions(-) diff --git a/BTCPayServer/Views/Manage/APIKeys.cshtml b/BTCPayServer/Views/Manage/APIKeys.cshtml index 41065055d..6b308322a 100644 --- a/BTCPayServer/Views/Manage/APIKeys.cshtml +++ b/BTCPayServer/Views/Manage/APIKeys.cshtml @@ -4,62 +4,101 @@ ViewData.SetActivePageAndTitle(ManageNavPages.APIKeys, "Manage your API Keys"); } - +

The BTCPay Server Greenfield API offers programmatic access to your instance. You can manage your BTCPay - Server (e.g. stores, invoices, users) as well as automate workflows and integrations (see use case examples). + Server (e.g. stores, invoices, users) as well as automate workflows and integrations (see use case examples). For that you need the API keys, which can be generated here. Find more information in the API authentication docs.

- - - - - - + + + + + + - @foreach (var keyData in Model.ApiKeyDatas) - { - - - - - - - } - @if (!Model.ApiKeyDatas.Any()) - { - - - - } + @{ + var index = 0; + } + @foreach (var keyData in Model.ApiKeyDatas) + { + + + + + + + index++; + } + @if (!Model.ApiKeyDatas.Any()) + { + + + + }
LabelKeyPermissionsActions
LabelKeyPermissionsActions
@keyData.Label@keyData.Id - @{ - var permissions = keyData.GetBlob().Permissions; - } - @if (!permissions.Any()) - { - No permissions - } - else - { -
    - @foreach (var permission in Permission.ToPermissions(permissions).Select(c => c.ToString()).Distinct().ToArray()) - { -
  • @permission
  • - } -
- } -
- Remove -
- No API keys -
@keyData.Label + @keyData.Id + Click to reveal + + @{ + var permissions = keyData.GetBlob().Permissions; + } + @if (!permissions.Any()) + { + No permissions + } + else + { +
    + @foreach (var permission in Permission.ToPermissions(permissions).Select(c => c.ToString()).Distinct().ToArray()) + { +
  • + @permission +
  • + } +
+ } +
+ Remove + - + +
+ No API keys +
Generate new key + + + + + + + + + diff --git a/BTCPayServer/Views/Shared/ShowQR.cshtml b/BTCPayServer/Views/Shared/ShowQR.cshtml index fe25db48e..a56a63405 100644 --- a/BTCPayServer/Views/Shared/ShowQR.cshtml +++ b/BTCPayServer/Views/Shared/ShowQR.cshtml @@ -39,7 +39,8 @@ data: data, fragments: [], active: false, - modalId: modalId + modalId: modalId, + useBCUR: true }, computed: { @@ -78,7 +79,11 @@ this.fragments = []; return; } - this.fragments = window.bcur.encodeUR(this.data.toString(), 200); + if (this.useBCUR){ + this.fragments = window.bcur.encodeUR(this.data.toString(), 200); + }else{ + this.fragments = [this.data.toString()]; + } }, start: function () { diff --git a/BTCPayServer/Views/Wallets/WalletSettings.cshtml b/BTCPayServer/Views/Wallets/WalletSettings.cshtml index cdc16a103..dd5d86c16 100644 --- a/BTCPayServer/Views/Wallets/WalletSettings.cshtml +++ b/BTCPayServer/Views/Wallets/WalletSettings.cshtml @@ -98,7 +98,7 @@