2021-05-13 20:03:07 +02:00
|
|
|
|
using System;
|
|
|
|
|
using TINK.Model.Services.CopriApi.ServerUris;
|
|
|
|
|
|
|
|
|
|
namespace TINK.Services.CopriApi.ServerUris
|
|
|
|
|
{
|
|
|
|
|
public static class CopriHelper
|
|
|
|
|
{
|
|
|
|
|
public const string SHAREE_SILTEFOLDERNAME = "site";
|
|
|
|
|
|
|
|
|
|
/// <summary> Gets a value indicating whether a host is copri or not. </summary>
|
|
|
|
|
/// <param name="hostName">Host name.</param>
|
|
|
|
|
/// <returns>True if server is copri, fals if not.</returns>
|
|
|
|
|
public static bool GetIsCopri(this string hostName)
|
|
|
|
|
=> new Uri(CopriServerUriList.TINK_DEVEL).Host == hostName
|
|
|
|
|
|| new Uri(CopriServerUriList.TINK_LIVE).Host == hostName;
|
|
|
|
|
|
|
|
|
|
/// <summary> Get folder name depending on host name. </summary>
|
|
|
|
|
/// <param name="hostName">Host name.</param>
|
|
|
|
|
/// <returns>Folder name.</returns>
|
|
|
|
|
public static string GetAppFolderName(this string hostName)
|
|
|
|
|
=> hostName.GetIsCopri()
|
|
|
|
|
? "tinkapp" /* resource tree is more complex for TINK/ konrad*/
|
|
|
|
|
: "app";
|
|
|
|
|
|
|
|
|
|
/// <summary> Get folder name for a static site depending on host name. </summary>
|
|
|
|
|
/// <param name="hostName">Host name.</param>
|
|
|
|
|
/// <returns>Folder name.</returns>
|
|
|
|
|
public static string GetSiteFolderName(this string hostName)
|
|
|
|
|
=> hostName.GetIsCopri()
|
|
|
|
|
? "tinkapp" /* resource tree is more complex for TINK/ konrad*/
|
|
|
|
|
: SHAREE_SILTEFOLDERNAME;
|
|
|
|
|
|
|
|
|
|
/// <summary> Get the agb resource name name depending on host name. </summary>
|
|
|
|
|
/// <param name="hostName">Host name.</param>
|
2021-06-26 20:57:55 +02:00
|
|
|
|
/// <returns>AGB resource.</returns>
|
2021-05-13 20:03:07 +02:00
|
|
|
|
public static string GetAGBResource(this string hostName)
|
|
|
|
|
=> $"{hostName.GetSiteFolderName()}/{(hostName.GetIsCopri()? "konrad-TINK-AGB" : "agb.html")}";
|
|
|
|
|
|
2021-06-26 20:57:55 +02:00
|
|
|
|
/// <summary> Get the privacy resource name name depending on host name. </summary>
|
2021-05-13 20:03:07 +02:00
|
|
|
|
/// <param name="hostName">Host name.</param>
|
2021-06-26 20:57:55 +02:00
|
|
|
|
/// <returns>Privacy resource.</returns>
|
2021-05-13 20:03:07 +02:00
|
|
|
|
public static string GetPrivacyResource(this string hostName)
|
|
|
|
|
=> $"{hostName.GetSiteFolderName()}/{(hostName.GetIsCopri() ? "Datenschutz" : "privacy.html")}";
|
|
|
|
|
}
|
|
|
|
|
}
|