diff --git a/app/mothership/sockets/mothership.ts b/app/mothership/sockets/mothership.ts index 941bfd4b1..dbe826c0b 100644 --- a/app/mothership/sockets/mothership.ts +++ b/app/mothership/sockets/mothership.ts @@ -6,6 +6,7 @@ import { subscribeToServers } from '../subscribe-to-servers'; import { AppError } from '../../core/errors'; import { readFileIfExists } from '../utils'; import { CustomSocket, WebSocketWithHeartBeat } from '../custom-socket'; +import packageJson from '../../../package.json'; export class MothershipSocket extends CustomSocket { private mothershipServersEndpoint?: { @@ -127,15 +128,13 @@ export class MothershipSocket extends CustomSocket { const keyFile = varState.data?.regFile ? readFileIfExists(varState.data?.regFile).toString('base64') : ''; const serverName = `${varState.data?.name as string}`; const lanIp: string = networkState.data.find(network => network.ipaddr[0]).ipaddr[0] || ''; - const machineId = `${await getMachineId()}`; return { 'x-api-key': apiKey, 'x-flash-guid': varState.data?.flashGuid ?? '', 'x-key-file': keyFile ?? '', 'x-server-name': serverName, - 'x-lan-ip': lanIp, - 'x-machine-id': machineId + 'x-unraid-api-version': packageJson.version }; } diff --git a/app/types/index.d.ts b/app/types/index.d.ts new file mode 100644 index 000000000..8cb293272 --- /dev/null +++ b/app/types/index.d.ts @@ -0,0 +1 @@ +declare module '*.json'; diff --git a/app/utils.ts b/app/utils.ts index 043ceb582..805577170 100644 --- a/app/utils.ts +++ b/app/utils.ts @@ -2,12 +2,14 @@ import fetch from 'cross-fetch'; import * as Sentry from '@sentry/node'; import { MOTHERSHIP_GRAPHQL_LINK } from './consts'; import { CachedServer } from './cache'; +import packageJson from '../package.json'; export const getServers = async (apiKey: string) => fetch(MOTHERSHIP_GRAPHQL_LINK, { method: 'POST', headers: { 'Content-Type': 'application/json', - Accept: 'application/json' + Accept: 'application/json', + 'x-unraid-api-version': packageJson.version }, body: JSON.stringify({ query: 'query($apiKey: String!) { servers @auth(apiKey: $apiKey) { owner { username url avatar } guid apikey name status wanip lanip localurl remoteurl } }', diff --git a/tsconfig.json b/tsconfig.json index f3af3b37b..4e951d541 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -50,7 +50,10 @@ // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ + "typeRoots": [ + "node_modules/@types/", + "./app/types/" + ], /* List of folders to include type definitions from. */ // "types": [], /* Type declaration files to be included in compilation. */ // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ @@ -68,6 +71,7 @@ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ /* Advanced Options */ - "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ + "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */, + "resolveJsonModule": false } } \ No newline at end of file