sharp-chat/SharpChat/Flashii/FlashiiUrls.cs

36 lines
1.1 KiB
C#
Raw Normal View History

2022-08-30 15:42:03 +00:00
using System.IO;
namespace SharpChat.Flashii {
2022-08-30 15:00:58 +00:00
public static class FlashiiUrls {
2022-08-30 15:42:03 +00:00
private const string BASE_URL_FILE = @"msz_url.txt";
2022-08-30 15:44:33 +00:00
private const string BASE_URL_FALLBACK = @"https://flashii.net";
2022-08-30 15:42:03 +00:00
2022-08-30 15:44:33 +00:00
private const string AUTH = @"/_sockchat/verify";
private const string BANS = @"/_sockchat/bans";
private const string BUMP = @"/_sockchat/bump";
2022-08-30 15:42:03 +00:00
public static string AuthURL { get; }
public static string BansURL { get; }
public static string BumpURL { get; }
2023-02-07 15:01:56 +00:00
2022-08-30 15:42:03 +00:00
static FlashiiUrls() {
AuthURL = GetURL(AUTH);
BansURL = GetURL(BANS);
BumpURL = GetURL(BUMP);
}
public static string GetBaseURL() {
if(!File.Exists(BASE_URL_FILE))
2022-08-30 15:44:33 +00:00
return BASE_URL_FALLBACK;
2022-08-30 15:42:03 +00:00
string url = File.ReadAllText(BASE_URL_FILE).Trim().Trim('/');
if(string.IsNullOrEmpty(url))
2022-08-30 15:44:33 +00:00
return BASE_URL_FALLBACK;
2022-08-30 15:42:03 +00:00
return url;
}
public static string GetURL(string path) {
return GetBaseURL() + path;
}
2022-08-30 15:00:58 +00:00
}
}