Remove default implementation from interface

Not supported on netf
This commit is contained in:
Archi
2023-04-21 11:32:20 +02:00
parent cb1648b8c3
commit 1d5bf32ec6
2 changed files with 14 additions and 5 deletions

View File

@@ -106,6 +106,7 @@ internal sealed class Startup {
if (PluginsCore.ActivePlugins?.Count > 0) {
foreach (IWebInterface plugin in PluginsCore.ActivePlugins.OfType<IWebInterface>()) {
if (string.IsNullOrEmpty(plugin.PhysicalPath) || string.IsNullOrEmpty(plugin.WebPath)) {
// Invalid path provided
continue;
}
@@ -113,10 +114,18 @@ internal sealed class Startup {
if (!Path.IsPathRooted(physicalPath)) {
// Relative path
physicalPath = Path.Combine(Path.GetDirectoryName(plugin.GetType().Assembly.Location)!, plugin.PhysicalPath);
string? assemblyDirectory = Path.GetDirectoryName(plugin.GetType().Assembly.Location);
if (string.IsNullOrEmpty(assemblyDirectory)) {
// Invalid path provided
continue;
}
physicalPath = Path.Combine(assemblyDirectory, plugin.PhysicalPath);
}
if (!Directory.Exists(physicalPath)) {
// Non-existing path provided
continue;
}

View File

@@ -25,13 +25,13 @@ namespace ArchiSteamFarm.Plugins.Interfaces;
public interface IWebInterface : IPlugin {
/// <summary>
/// Specifies physical path to static WWW files provided by the plugin. Can be either relative to plugin's assembly location, or absolute. Default "www" value assumes that you ship "www" directory together with your plugin's main DLL assembly, similar to ASF.
/// Specifies physical path to static WWW files provided by the plugin. Can be either relative to plugin's assembly location, or absolute. If you don't know better, we recommend value of "www", which assumes that you ship "www" directory together with your plugin's main DLL assembly, similar to ASF.
/// </summary>
string PhysicalPath => "www";
string PhysicalPath { get; }
/// <summary>
/// Specifies web path (address) under which ASF should host your static WWW files in <see cref="PhysicalPath" /> directory. Default "/" value allows you to override default ASF files and gives you full flexibility in your www directory. However, you can instead host your files under some fixed location specified here, such as "/MyPlugin".
/// Specifies web path (address) under which ASF should host your static WWW files in <see cref="PhysicalPath" /> directory. If you don't know better, we recommend value of "/", which allows you to override default ASF files and gives you full flexibility in your <see cref="PhysicalPath" /> directory. However, you can instead host your files under some other fixed location specified here, such as "/MyPlugin".
/// </summary>
[JsonProperty]
string WebPath => "/";
string WebPath { get; }
}