btcpayserver/BTCPayServer/Models/ServerViewModels/DynamicDnsViewModel.cs
Dennis Reimann ad8f347989 Refactoring: Allow ViewsRazor extension to be used by plugins
Moves the `ViewsRazor` extension into Abstractions, so that it can be used by plugins.

Separated out of #2701, prerequisite for the LNbank plugin integration.
2021-07-30 08:27:33 +02:00

41 lines
1.3 KiB
C#

using System;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Services;
namespace BTCPayServer.Models.ServerViewModels
{
public class DynamicDnsViewModel
{
public class WellKnownService
{
public WellKnownService(string name, string url)
{
Name = name;
Url = url;
}
public string Name { get; set; }
public string Url { get; set; }
}
public bool Modify { get; set; }
public DynamicDnsService Settings { get; set; }
public string LastUpdated
{
get
{
if (Settings?.LastUpdated is DateTimeOffset date)
{
return ViewsRazor.ToTimeAgo(date);
}
return null;
}
}
public WellKnownService[] KnownServices { get; set; } = new[]
{
new WellKnownService("noip", "https://dynupdate.no-ip.com/nic/update"),
new WellKnownService("dyndns", "https://members.dyndns.org/v3/update"),
new WellKnownService("duckdns", "https://www.duckdns.org/v3/update"),
new WellKnownService("google", "https://domains.google.com/nic/update"),
};
}
}