sharp-chat/SharpChat/Flashii/FlashiiUrls.cs

47 lines
1.7 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 {
private const string BASE_URL_FILE = "msz_url.txt";
private const string BASE_URL_FALLBACK = "https://flashii.net";
2022-08-30 15:42:03 +00:00
private const string VERIFY = "/_sockchat/verify";
private const string BUMP = "/_sockchat/bump";
private const string BANS_CHECK = "/_sockchat/bans/check?u={0}&a={1}&x={2}&n={3}";
private const string BANS_CREATE = "/_sockchat/bans/create";
private const string BANS_REVOKE = "/_sockchat/bans/revoke?t={0}&s={1}&x={2}";
private const string BANS_LIST = "/_sockchat/bans/list?x={0}";
2022-08-30 15:42:03 +00:00
public static string BumpURL { get; }
public static string VerifyURL { get; }
public static string BansCheckURL { get; }
public static string BansCreateURL { get; }
public static string BansRevokeURL { get; }
public static string BansListURL { get; }
2023-02-07 15:01:56 +00:00
2022-08-30 15:42:03 +00:00
static FlashiiUrls() {
BumpURL = GetURL(BUMP);
VerifyURL = GetURL(VERIFY);
BansCheckURL = GetURL(BANS_CHECK);
BansCreateURL = GetURL(BANS_CREATE);
BansRevokeURL = GetURL(BANS_REVOKE);
BansListURL = GetURL(BANS_LIST);
2022-08-30 15:42:03 +00:00
}
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
}
}