mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-28 19:39:19 +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 List<BannedPlugin> bannedPlugins;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PluginManager"/> class.
|
||||
/// </summary>
|
||||
|
|
@ -48,6 +50,9 @@ namespace Dalamud.Plugin
|
|||
|
||||
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
|
||||
// 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
|
||||
|
|
@ -317,6 +322,13 @@ namespace Dalamud.Plugin
|
|||
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")
|
||||
{
|
||||
Log.Error("Banned PingPlugin");
|
||||
|
|
@ -366,5 +378,12 @@ namespace Dalamud.Plugin
|
|||
this.UnloadPlugins();
|
||||
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