mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-28 13:48:13 +02:00
add oss check
This commit is contained in:
parent
79ce93d578
commit
48963f24df
1 changed files with 11 additions and 2 deletions
|
@ -8,6 +8,7 @@ import { eq, count, notInArray } from "drizzle-orm";
|
||||||
import { APP_VERSION } from "./consts";
|
import { APP_VERSION } from "./consts";
|
||||||
import crypto from "crypto";
|
import crypto from "crypto";
|
||||||
import { UserType } from "@server/types/UserTypes";
|
import { UserType } from "@server/types/UserTypes";
|
||||||
|
import { build } from "@server/build";
|
||||||
|
|
||||||
class TelemetryClient {
|
class TelemetryClient {
|
||||||
private client: PostHog | null = null;
|
private client: PostHog | null = null;
|
||||||
|
@ -19,7 +20,15 @@ class TelemetryClient {
|
||||||
this.enabled = enabled;
|
this.enabled = enabled;
|
||||||
const dev = process.env.ENVIRONMENT !== "prod";
|
const dev = process.env.ENVIRONMENT !== "prod";
|
||||||
|
|
||||||
if (this.enabled && !dev) {
|
if (dev) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (build !== "oss") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.enabled) {
|
||||||
this.client = new PostHog(
|
this.client = new PostHog(
|
||||||
"phc_QYuATSSZt6onzssWcYJbXLzQwnunIpdGGDTYhzK3VjX",
|
"phc_QYuATSSZt6onzssWcYJbXLzQwnunIpdGGDTYhzK3VjX",
|
||||||
{
|
{
|
||||||
|
@ -40,7 +49,7 @@ class TelemetryClient {
|
||||||
logger.info(
|
logger.info(
|
||||||
"Pangolin now gathers anonymous usage data to help us better understand how the software is used and guide future improvements and feature development. You can find more details, including instructions for opting out of this anonymous data collection, at: https://docs.digpangolin.com/telemetry"
|
"Pangolin now gathers anonymous usage data to help us better understand how the software is used and guide future improvements and feature development. You can find more details, including instructions for opting out of this anonymous data collection, at: https://docs.digpangolin.com/telemetry"
|
||||||
);
|
);
|
||||||
} else if (!this.enabled && !dev) {
|
} else if (!this.enabled) {
|
||||||
logger.info(
|
logger.info(
|
||||||
"Analytics usage statistics collection is disabled. If you enable this, you can help us make Pangolin better for everyone. Learn more at: https://docs.digpangolin.com/telemetry"
|
"Analytics usage statistics collection is disabled. If you enable this, you can help us make Pangolin better for everyone. Learn more at: https://docs.digpangolin.com/telemetry"
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue