mirror of
https://github.com/docmost/docmost
synced 2025-03-28 21:13:28 +00:00
complete
This commit is contained in:
parent
af4a5d46f3
commit
3ebcd02409
@ -10,6 +10,8 @@ const packageJson = require('./../../../package.json');
|
||||
|
||||
@Injectable()
|
||||
export class TelemetryService {
|
||||
private readonly ENDPOINT_URL = 'https://tel.docmost.com/api/event';
|
||||
|
||||
constructor(
|
||||
private readonly environmentService: EnvironmentService,
|
||||
@InjectKysely() private readonly db: KyselyDB,
|
||||
@ -21,6 +23,7 @@ export class TelemetryService {
|
||||
name: 'telemetry',
|
||||
})
|
||||
async sendTelemetry() {
|
||||
try {
|
||||
if (
|
||||
this.environmentService.isDisableTelemetry() ||
|
||||
this.environmentService.isCloud() ||
|
||||
@ -30,7 +33,6 @@ export class TelemetryService {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const workspace = await this.workspaceRepo.findFirst();
|
||||
if (!workspace) {
|
||||
return;
|
||||
@ -72,9 +74,7 @@ export class TelemetryService {
|
||||
workspaceCount,
|
||||
};
|
||||
|
||||
const telemetryUrl = 'https://event.docmost.com/api/event';
|
||||
|
||||
const response = await fetch(telemetryUrl, {
|
||||
await fetch(this.ENDPOINT_URL, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'User-Agent': 'docmost:' + data.version,
|
||||
@ -82,7 +82,6 @@ export class TelemetryService {
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
console.log(response.json());
|
||||
} catch (err) {
|
||||
/* empty */
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user