feat(plugins): count marketplace downloads and installs
This commit is contained in:
6 files changed
+178
-1
No files matched your search
@@ -52,6 +52,22 @@ export function listingRepositoryCanVerify(repository: PluginRepository): boolea
|
||||
return repository.kind === "official" || repository.kind === "enterprise";
|
||||
}
|
||||
|
||||
const INSTALL_BEACON_URL = "https://dbxio.com/api/plugins/install";
|
||||
|
||||
// Fire-and-forget install beacon for marketplace statistics; never blocks or fails the install.
|
||||
export function beaconPluginInstall(pluginId: string, version: string): void {
|
||||
try {
|
||||
void fetch(INSTALL_BEACON_URL, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "text/plain" },
|
||||
body: JSON.stringify({ id: pluginId, version }),
|
||||
keepalive: true,
|
||||
}).catch(() => undefined);
|
||||
} catch {
|
||||
// Statistics are best-effort.
|
||||
}
|
||||
}
|
||||
|
||||
export function filterMarketplacePluginListings(listings: readonly MarketplacePluginListing[], query: string, repositoryId: string): MarketplacePluginListing[] {
|
||||
const normalizedQuery = query.trim().toLocaleLowerCase();
|
||||
return listings.filter((listing) => {
|
||||
|
||||
Reference in new issue
Block a user