mirror of
https://github.com/documenso/documenso.git
synced 2025-11-15 01:01:49 +10:00
feat: use dynamic version instead of hardcodded version
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
import { registerInstance } from '@documenso/lib/server-only/telemetry/register-instance';
|
||||
|
||||
import packageInfo from '../package.json';
|
||||
|
||||
export const register = async () => {
|
||||
if (process.env.NEXT_RUNTIME === 'nodejs') {
|
||||
await registerInstance();
|
||||
await registerInstance({ version: packageInfo.version });
|
||||
}
|
||||
};
|
||||
|
||||
@ -8,7 +8,11 @@ import {
|
||||
import { upsertSiteSetting } from '../site-settings/upsert-site-setting';
|
||||
import { sendInstance } from './send-instance';
|
||||
|
||||
export const registerInstance = async () => {
|
||||
type ResigsterInstanceOptions = {
|
||||
version: string;
|
||||
};
|
||||
|
||||
export const registerInstance = async ({ version }: ResigsterInstanceOptions) => {
|
||||
const instanceResponse = await getSiteSettings().then((settings) =>
|
||||
settings.find((setting) => setting.id === SITE_SETTINGS_TELEMETRY_ID),
|
||||
);
|
||||
@ -30,13 +34,13 @@ export const registerInstance = async () => {
|
||||
return await sendInstance({
|
||||
uniqueId: instance.data?.instanceId,
|
||||
timestamp: new Date(),
|
||||
version: '1.2.3',
|
||||
version,
|
||||
});
|
||||
}
|
||||
|
||||
return await sendInstance({
|
||||
uniqueId: instance.data.instanceId,
|
||||
timestamp: new Date(),
|
||||
version: '1.2.3',
|
||||
version,
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user