Browse Source

refactor: feed api

pull/9323/head
Pranav C 2 months ago
parent
commit
1f1725e91f
  1. 6
      packages/nocodb/src/services/utils.service.ts
  2. 25
      packages/nocodb/src/utils/tele.ts

6
packages/nocodb/src/services/utils.service.ts

@ -6,7 +6,7 @@ import { ViewTypes } from 'nocodb-sdk';
import { ConfigService } from '@nestjs/config';
import { useAgent } from 'request-filtering-agent';
import dayjs from 'dayjs';
import { T } from 'nc-help';
import { T } from '~/utils';
import type { AppConfig, NcRequest } from '~/interface/config';
import { NC_APP_SETTINGS, NC_ATTACHMENT_FIELD_SIZE } from '~/constants';
import SqlMgrv2 from '~/db/sql-mgr/v2/SqlMgrv2';
@ -504,15 +504,15 @@ export class UtilsService {
}
if (dayjs().isAfter(this.lastSyncTime.add(3, 'hours'))) {
T.emit('ph_event', {});
this.lastSyncTime = dayjs();
}
let response;
try {
response = await axios.get(
response = await axios.post(
'https://product-feed.nocodb.com/api/v1/social/feed',
T.payload,
{
params: {
per_page,

25
packages/nocodb/src/utils/tele.ts

@ -248,6 +248,31 @@ class Tele {
static get id() {
return this.machineId || machineIdSync();
}
static get payload() {
const payload: Record<string, any> = {
package_id: packageVersion,
node_version: process.version,
xc_version: process.env.NC_SERVER_UUID,
env: process.env.NODE_ENV || 'production',
oneClick: !!process.env.NC_ONE_CLICK,
count: global.NC_COUNT,
cache,
litestream,
executable,
};
try {
payload.os_type = os.type();
payload.os_platform = os.platform();
payload.os_release = os.release();
payload.docker = isDocker();
payload.machine_id = `${this.id},,`;
payload.upTime = Math.round(process.uptime() / 3600);
} catch {
// ignore
}
return payload;
}
}
async function waitForMachineId(teleData) {

Loading…
Cancel
Save