mirror of
https://github.com/g3rv4/GetMoarFediverse.git
synced 2024-11-21 23:23:09 +01:00
Deprecate Sites in favor of Instances (#7)
This commit is contained in:
parent
4ccfaad15f
commit
875b2fe26e
12
README.md
12
README.md
@ -18,17 +18,7 @@ You can download an executable for your environment [on the releases page](https
|
|||||||
"dotnet",
|
"dotnet",
|
||||||
"csharp"
|
"csharp"
|
||||||
],
|
],
|
||||||
"Sites": [
|
"Instances": [ "hachyderm.io", "mastodon.social" ]
|
||||||
{
|
|
||||||
"Host": "hachyderm.io",
|
|
||||||
"SiteSpecificTags": [
|
|
||||||
"hachyderm"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Host": "mastodon.social"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -44,9 +44,14 @@ public class Config
|
|||||||
{
|
{
|
||||||
throw new Exception("The api key is missing");
|
throw new Exception("The api key is missing");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data.Sites is { Length: > 0 })
|
||||||
|
{
|
||||||
|
Console.WriteLine("Warning: Sites is deprecated, please use Instances instead");
|
||||||
|
}
|
||||||
|
|
||||||
Instance = new Config(importedPath, data.FakeRelayUrl, apiKey, data.MastodonPostgresConnectionString,
|
Instance = new Config(importedPath, data.FakeRelayUrl, apiKey, data.MastodonPostgresConnectionString,
|
||||||
data.Tags.ToImmutableArray(), data.ImmutableSites);
|
data.Tags.ToImmutableArray(), data.GetImmutableSites());
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ConfigData
|
public class ConfigData
|
||||||
@ -54,14 +59,26 @@ public class Config
|
|||||||
public string FakeRelayUrl { get; set; }
|
public string FakeRelayUrl { get; set; }
|
||||||
public string? FakeRelayApiKey { get; set; }
|
public string? FakeRelayApiKey { get; set; }
|
||||||
public string? MastodonPostgresConnectionString { get; set; }
|
public string? MastodonPostgresConnectionString { get; set; }
|
||||||
|
public string[]? Instances { get; set; }
|
||||||
public string[] Tags { get; set; }
|
public string[] Tags { get; set; }
|
||||||
public InternalSiteData[]? Sites { get; set; }
|
public InternalSiteData[]? Sites { get; set; }
|
||||||
|
|
||||||
public ImmutableArray<SiteData> ImmutableSites =>
|
public ImmutableArray<SiteData> GetImmutableSites()
|
||||||
Sites == null
|
{
|
||||||
|
// the plan is to stop supporting Sites in favor of Instances. SiteSpecificTags add complexity and
|
||||||
|
// don't make sense when pulling tags from Mastodon. Also, pulling is fast and multithreaded!
|
||||||
|
if (Instances != null)
|
||||||
|
{
|
||||||
|
return Instances
|
||||||
|
.Select(i => new SiteData { Host = i, SiteSpecificTags = ImmutableArray<string>.Empty })
|
||||||
|
.ToImmutableArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Sites == null
|
||||||
? ImmutableArray<SiteData>.Empty
|
? ImmutableArray<SiteData>.Empty
|
||||||
: Sites.Select(s => s.ToSiteData())
|
: Sites.Select(s => s.ToSiteData())
|
||||||
.ToImmutableArray();
|
.ToImmutableArray();
|
||||||
|
}
|
||||||
|
|
||||||
public class InternalSiteData
|
public class InternalSiteData
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user