mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-30 12:23:39 +01:00
feat: add support for bannedplugin.json to catch failing plugins
This commit is contained in:
parent
67dd9fbf9c
commit
d53bc4b1cb
1 changed files with 19 additions and 0 deletions
|
|
@ -29,6 +29,8 @@ namespace Dalamud.Plugin
|
||||||
|
|
||||||
private readonly Type interfaceType = typeof(IDalamudPlugin);
|
private readonly Type interfaceType = typeof(IDalamudPlugin);
|
||||||
|
|
||||||
|
private readonly List<BannedPlugin> bannedPlugins;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="PluginManager"/> class.
|
/// Initializes a new instance of the <see cref="PluginManager"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -48,6 +50,9 @@ namespace Dalamud.Plugin
|
||||||
|
|
||||||
this.pluginConfigs = new PluginConfigurations(Path.Combine(Path.GetDirectoryName(dalamud.StartInfo.ConfigurationPath), "pluginConfigs"));
|
this.pluginConfigs = new PluginConfigurations(Path.Combine(Path.GetDirectoryName(dalamud.StartInfo.ConfigurationPath), "pluginConfigs"));
|
||||||
|
|
||||||
|
this.bannedPlugins = JsonConvert.DeserializeObject<List<BannedPlugin>>(
|
||||||
|
File.ReadAllText(Path.Combine(this.dalamud.StartInfo.AssetDirectory, "UIRes", "bannedplugin.json")));
|
||||||
|
|
||||||
// Try to load missing assemblies from the local directory of the requesting assembly
|
// Try to load missing assemblies from the local directory of the requesting assembly
|
||||||
// This would usually be implicit when using Assembly.Load(), but Assembly.LoadFile() doesn't do it...
|
// This would usually be implicit when using Assembly.Load(), but Assembly.LoadFile() doesn't do it...
|
||||||
// This handler should only be invoked on things that fail regular lookups, but it *is* global to this appdomain
|
// This handler should only be invoked on things that fail regular lookups, but it *is* global to this appdomain
|
||||||
|
|
@ -317,6 +322,13 @@ namespace Dalamud.Plugin
|
||||||
DalamudApiLevel = DalamudApiLevel,
|
DalamudApiLevel = DalamudApiLevel,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (this.bannedPlugins.Any(x => x.Name == pluginDef.InternalName &&
|
||||||
|
x.AssemblyVersion == pluginDef.AssemblyVersion))
|
||||||
|
{
|
||||||
|
Log.Error($"[PLUGINM] Banned plugin {pluginDef.InternalName} with {pluginDef.AssemblyVersion}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (pluginDef.InternalName == "PingPlugin" && pluginDef.AssemblyVersion == "1.11.0.0")
|
if (pluginDef.InternalName == "PingPlugin" && pluginDef.AssemblyVersion == "1.11.0.0")
|
||||||
{
|
{
|
||||||
Log.Error("Banned PingPlugin");
|
Log.Error("Banned PingPlugin");
|
||||||
|
|
@ -366,5 +378,12 @@ namespace Dalamud.Plugin
|
||||||
this.UnloadPlugins();
|
this.UnloadPlugins();
|
||||||
this.LoadPlugins();
|
this.LoadPlugins();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class BannedPlugin
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
public string AssemblyVersion { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue