From 4eabe91ceeb4bf5cbf171dc26cb15a9ecd7347d1 Mon Sep 17 00:00:00 2001 From: Kukks Date: Wed, 29 Jun 2022 15:33:24 +0200 Subject: [PATCH] remove lnurl from crowdfund as per requests --- BTCPayServer.Tests/SeleniumTests.cs | 28 --------------- BTCPayServer/Hosting/BTCPayServerServices.cs | 3 +- .../Views/Shared/LNURL/CrowdfundLNURL.cshtml | 36 ------------------- .../Views/UIAppsPublic/ViewCrowdfund.cshtml | 24 ++----------- BTCPayServer/wwwroot/crowdfund/app.js | 4 +-- 5 files changed, 4 insertions(+), 91 deletions(-) delete mode 100644 BTCPayServer/Views/Shared/LNURL/CrowdfundLNURL.cshtml diff --git a/BTCPayServer.Tests/SeleniumTests.cs b/BTCPayServer.Tests/SeleniumTests.cs index 47126348c..519111921 100644 --- a/BTCPayServer.Tests/SeleniumTests.cs +++ b/BTCPayServer.Tests/SeleniumTests.cs @@ -1796,35 +1796,7 @@ namespace BTCPayServer.Tests var payoutsData = await ctx.Payouts.Where(p => p.PullPaymentDataId == pullPaymentId).ToListAsync(); Assert.True(payoutsData.All(p => p.State == PayoutState.Completed)); }); - - //lnurl crowdfund support - s.GoToStore(); - s.Driver.FindElement(By.Id("StoreNav-CreateApp")).Click(); - s.Driver.FindElement(By.Name("AppName")).SendKeys("CF" + Guid.NewGuid()); - s.Driver.FindElement(By.Id("SelectedAppType")).SendKeys("Crowdfund"); - s.Driver.FindElement(By.Id("Create")).Click(); - Assert.Contains("App successfully created", s.FindAlertMessage().Text); - s.Driver.FindElement(By.Id("Title")).SendKeys("Kukkstarter"); - s.Driver.FindElement(By.CssSelector("div.note-editable.card-block")).SendKeys("1BTC = 1BTC"); - s.Driver.FindElement(By.Id("SaveSettings")).Click(); - Assert.Contains("App updated", s.FindAlertMessage().Text); - - s.Driver.FindElement(By.Id("ViewApp")).Click(); - - var windows = s.Driver.WindowHandles; - Assert.Equal(2, windows.Count); - s.Driver.SwitchTo().Window(windows[1]); - - s.Driver.FindElement(By.CssSelector("#crowdfund-body-contribution-container .perk")).Click(); - s.Driver.FindElement(By.PartialLinkText("LNURL")).Click(); - lnurl = s.Driver.FindElement(By.ClassName("lnurl")) - .GetAttribute("href"); - - LNURL.LNURL.Parse(lnurl, out tag); - - s.Driver.Close(); - s.Driver.SwitchTo().Window(windows[0]); } [Fact] diff --git a/BTCPayServer/Hosting/BTCPayServerServices.cs b/BTCPayServer/Hosting/BTCPayServerServices.cs index 42570c87d..227a1cf4b 100644 --- a/BTCPayServer/Hosting/BTCPayServerServices.cs +++ b/BTCPayServer/Hosting/BTCPayServerServices.cs @@ -359,8 +359,7 @@ namespace BTCPayServer.Hosting services.AddSingleton(new UIExtension("LNURL/LightningAddressNav", "store-integrations-nav")); services.AddSingleton(new UIExtension("LNURL/LightningAddressOption", - "store-integrations-list"));services.AddSingleton(new UIExtension("LNURL/CrowdfundLNURL", - "crowdfund-head")); + "store-integrations-list")); services.AddSingleton(); services.AddSingleton(); diff --git a/BTCPayServer/Views/Shared/LNURL/CrowdfundLNURL.cshtml b/BTCPayServer/Views/Shared/LNURL/CrowdfundLNURL.cshtml deleted file mode 100644 index c8e061362..000000000 --- a/BTCPayServer/Views/Shared/LNURL/CrowdfundLNURL.cshtml +++ /dev/null @@ -1,36 +0,0 @@ -@using BTCPayServer.Services.Stores -@using BTCPayServer.Payments.Lightning -@using BTCPayServer.Abstractions.Extensions -@model BTCPayServer.Models.AppViewModels.ViewCrowdfundViewModel -@inject BTCPayNetworkProvider BTCPayNetworkProvider -@inject StoreRepository StoreRepository -@{ - Context.Request.Query.TryGetValue("cryptocode", out var cryptoCodeValues); - var cryptoCode = cryptoCodeValues.FirstOrDefault() ?? "BTC"; - - var store = await StoreRepository.FindStore(Model.StoreId); - var supported = store.GetSupportedPaymentMethods(BTCPayNetworkProvider).OfType().FirstOrDefault(method => method.CryptoCode == cryptoCode); - if (supported != null && !store.GetEnabledPaymentIds(BTCPayNetworkProvider).Contains(supported.PaymentId)) - { - supported = null; - } - - if (supported != null) - { - var lnurls = Model.Perks.Select(item => (item.Id, LNURL.LNURL.EncodeUri(new Uri(Context.Request.GetAbsoluteUri(Url.Action("GetLNURLForApp", "UILNURL", new - { - cryptoCode = supported.CryptoCode, - appid = Model.AppId, - ItemCode = item.Id - }))), "payRequest", supported.UseBech32Scheme))).ToDictionary(tuple => tuple.Id, tuple => tuple.Item2); - lnurls.Add("", LNURL.LNURL.EncodeUri(new Uri(Context.Request.GetAbsoluteUri(Url.Action("GetLNURLForApp", "UILNURL", new - { - cryptoCode = supported.CryptoCode, - appid = Model.AppId, - }))), "payRequest", supported.UseBech32Scheme)); - - } -} diff --git a/BTCPayServer/Views/UIAppsPublic/ViewCrowdfund.cshtml b/BTCPayServer/Views/UIAppsPublic/ViewCrowdfund.cshtml index 2a18f9669..095665f50 100644 --- a/BTCPayServer/Views/UIAppsPublic/ViewCrowdfund.cshtml +++ b/BTCPayServer/Views/UIAppsPublic/ViewCrowdfund.cshtml @@ -345,28 +345,8 @@

- - - -
+ +