feat(plugins): report install beacon after successful installs

This commit is contained in:
t8y2 committed 2026-09-15 20:57:58 +08:00
1 parent f73424c3d3
commit 6a6f7712c1
1 file changed
+17
@@ -349,7 +349,24 @@ async function handleWebPackage(event: Event) {
if (file) await installPlugin(file);
}
// Fire-and-forget install beacon for the marketplace stats worker
// (deploy/plugin-stats-worker, POST dbxio.com/api/plugins/install).
// Decorative counters only: no auth, no PII, failures are never surfaced.
function reportInstallBeacon(result: PluginInstallResult) {
try {
void fetch("https://dbxio.com/api/plugins/install", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ id: result.plugin.manifest.id, version: result.plugin.manifest.version }),
keepalive: true,
}).catch(() => {});
} catch {
// stats only — ignore beacon failures
}
}
async function finishInstall(result: PluginInstallResult) {
reportInstallBeacon(result);
toast(t("pluginPlatform.installSuccess", { name: result.plugin.manifest.name, version: result.plugin.manifest.version }));
clearPluginIconCache();
installedPlugins.value = await api.listPlugins();