feat(mation): add specific remotes for license, telemetry and notifications
This commit is contained in:
@@ -1,10 +1,18 @@
|
|||||||
import { renderObject } from '../../../../../helpers/renderer.js';
|
import { renderObject } from '../../../../../helpers/renderer.js';
|
||||||
import axios from '../../../../../helpers/axios-with-proxy.js';
|
import axios from '../../../../../helpers/axios-with-proxy.js';
|
||||||
import logger from '../../../../../helpers/logger.js';
|
import logger from '../../../../../helpers/logger.js';
|
||||||
|
import appConfig from '../../../../../config/app.js';
|
||||||
|
|
||||||
const NOTIFICATIONS_URL =
|
const AUTOMATISCH_NOTIFICATIONS_URL =
|
||||||
'https://notifications.automatisch.io/notifications.json';
|
'https://notifications.automatisch.io/notifications.json';
|
||||||
|
|
||||||
|
const MATION_NOTIFICATIONS_URL =
|
||||||
|
'https://notifications.mation.work/notifications.json';
|
||||||
|
|
||||||
|
const NOTIFICATIONS_URL = appConfig.isMation
|
||||||
|
? MATION_NOTIFICATIONS_URL
|
||||||
|
: AUTOMATISCH_NOTIFICATIONS_URL;
|
||||||
|
|
||||||
export default async (request, response) => {
|
export default async (request, response) => {
|
||||||
let notifications = [];
|
let notifications = [];
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,12 @@ import axios from './axios-with-proxy.js';
|
|||||||
|
|
||||||
const CACHE_DURATION = 1000 * 60 * 60 * 24; // 24 hours in milliseconds
|
const CACHE_DURATION = 1000 * 60 * 60 * 24; // 24 hours in milliseconds
|
||||||
|
|
||||||
|
const AUTOMATISCH_LICENSE_VERIFY_URL =
|
||||||
|
'https://license.automatisch.io/api/v1/licenses/verify';
|
||||||
|
|
||||||
|
const MATION_LICENSE_VERIFY_URL =
|
||||||
|
'https://license.mation.work/api/v1/licenses/verify';
|
||||||
|
|
||||||
const hasValidLicense = async () => {
|
const hasValidLicense = async () => {
|
||||||
const license = await getLicense();
|
const license = await getLicense();
|
||||||
|
|
||||||
@@ -17,7 +23,10 @@ const getLicense = async () => {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const url = 'https://license.automatisch.io/api/v1/licenses/verify';
|
const url = appConfig.isMation
|
||||||
|
? MATION_LICENSE_VERIFY_URL
|
||||||
|
: AUTOMATISCH_LICENSE_VERIFY_URL;
|
||||||
|
|
||||||
const cachedResponse = memoryCache.get(url);
|
const cachedResponse = memoryCache.get(url);
|
||||||
|
|
||||||
if (cachedResponse) {
|
if (cachedResponse) {
|
||||||
|
|||||||
@@ -5,9 +5,13 @@ import appConfig from '../../config/app.js';
|
|||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
|
||||||
const WRITE_KEY = '284Py4VgK2MsNYV7xlKzyrALx0v';
|
const WRITE_KEY = '284Py4VgK2MsNYV7xlKzyrALx0v';
|
||||||
const DATA_PLANE_URL = 'https://telemetry.automatisch.io/v1/batch';
|
|
||||||
const CPUS = os.cpus();
|
const CPUS = os.cpus();
|
||||||
const SIX_HOURS_IN_MILLISECONDS = 21600000;
|
const SIX_HOURS_IN_MILLISECONDS = 21600000;
|
||||||
|
const AUTOMATISCH_DATA_PLANE_URL = 'https://telemetry.automatisch.io/v1/batch';
|
||||||
|
const MATION_DATA_PLANE_URL = 'https://telemetry.mation.work/v1/batch';
|
||||||
|
const DATA_PLANE_URL = appConfig.isMation
|
||||||
|
? MATION_DATA_PLANE_URL
|
||||||
|
: AUTOMATISCH_DATA_PLANE_URL;
|
||||||
|
|
||||||
class Telemetry {
|
class Telemetry {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|||||||
Reference in New Issue
Block a user