sharp-chat/SharpChat/Flashii/FlashiiUrls.cs
2023-02-07 16:01:56 +01:00

35 lines
1.1 KiB
C#

using System.IO;
namespace SharpChat.Flashii {
public static class FlashiiUrls {
private const string BASE_URL_FILE = @"msz_url.txt";
private const string BASE_URL_FALLBACK = @"https://flashii.net";
private const string AUTH = @"/_sockchat/verify";
private const string BANS = @"/_sockchat/bans";
private const string BUMP = @"/_sockchat/bump";
public static string AuthURL { get; }
public static string BansURL { get; }
public static string BumpURL { get; }
static FlashiiUrls() {
AuthURL = GetURL(AUTH);
BansURL = GetURL(BANS);
BumpURL = GetURL(BUMP);
}
public static string GetBaseURL() {
if(!File.Exists(BASE_URL_FILE))
return BASE_URL_FALLBACK;
string url = File.ReadAllText(BASE_URL_FILE).Trim().Trim('/');
if(string.IsNullOrEmpty(url))
return BASE_URL_FALLBACK;
return url;
}
public static string GetURL(string path) {
return GetBaseURL() + path;
}
}
}