mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-10-29 22:47:47 -04:00
plugins: hide the list under the detail overlay
plugins: block activation when the startup check cannot run ref #3626
This commit is contained in:
1 parent
53b8de2714
commit
765ffe8564
7 files changed
+125
-95
No files matched your search
@@ -893,10 +893,8 @@ Singleton {
|
||||
|
||||
function _makeStartupCheckObject(pluginId, plugin) {
|
||||
const comp = Qt.createComponent(pluginComponentUrl(pluginId, plugin.startupCheckPath), Component.PreferSynchronous);
|
||||
if (comp.status === Component.Error) {
|
||||
log.error("startupCheck component error", pluginId, comp.errorString());
|
||||
return null;
|
||||
}
|
||||
if (comp.status === Component.Error)
|
||||
throw new Error(comp.errorString());
|
||||
return comp.createObject(root);
|
||||
}
|
||||
|
||||
@@ -915,8 +913,12 @@ Singleton {
|
||||
return ok;
|
||||
}
|
||||
|
||||
const probe = _makeStartupCheckObject(pluginId, plugin);
|
||||
let probe = null;
|
||||
let settled = false;
|
||||
const finish = result => {
|
||||
if (settled)
|
||||
return;
|
||||
settled = true;
|
||||
if (probe)
|
||||
probe.destroy();
|
||||
const err = _normalizeStartupError(result);
|
||||
@@ -937,28 +939,20 @@ Singleton {
|
||||
onResult(ok);
|
||||
};
|
||||
|
||||
const check = probe ? probe.check : null;
|
||||
if (typeof check !== "function") {
|
||||
finish(null);
|
||||
return true;
|
||||
}
|
||||
if (check.length >= 1) {
|
||||
try {
|
||||
check(finish);
|
||||
} catch (e) {
|
||||
log.warn("startupCheck threw for", pluginId, e.message);
|
||||
finish(null);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
let r = null;
|
||||
try {
|
||||
r = check();
|
||||
probe = _makeStartupCheckObject(pluginId, plugin);
|
||||
const check = probe?.check;
|
||||
if (typeof check !== "function")
|
||||
throw new Error("startupCheck has no check function");
|
||||
if (check.length >= 1)
|
||||
check(finish);
|
||||
else
|
||||
finish(check());
|
||||
} catch (e) {
|
||||
log.warn("startupCheck threw for", pluginId, e.message);
|
||||
r = null;
|
||||
const message = String(e?.message || e);
|
||||
log.warn("startupCheck failed for", pluginId, message);
|
||||
finish(message);
|
||||
}
|
||||
finish(r);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -973,7 +967,7 @@ Singleton {
|
||||
const plugin = availablePlugins[pluginId];
|
||||
if (plugin)
|
||||
_loadPluginTranslations(pluginId, plugin.pluginDirectory);
|
||||
return loadPlugin(pluginId);
|
||||
return runStartupGate(pluginId);
|
||||
}
|
||||
|
||||
function ensureLauncherInstance(pluginId) {
|
||||
|
||||
Reference in new issue
Block a user