"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SysinfoService = void 0;
const common_1 = require("@nestjs/common");
const info = require("systeminformation");
const node_fetch_1 = require("node-fetch");
let SysinfoService = class SysinfoService {
    async general() {
        return {
            memories: await info.memLayout(),
            cpu: await info.cpu(),
            disks: await info.diskLayout(),
            graphics: await info.graphics(),
            os: await info.osInfo(),
            system: await info.system(),
            networks: await info.networkInterfaces(),
            versions: await info.versions(),
        };
    }
    async ip() {
        return (await node_fetch_1.default('https://ifconfig.me/ip', { method: 'GET' })).text();
    }
    async geoIp() {
        const ip = await this.ip();
        const { city, country, countryCode, isp, lat, lon } = await (await node_fetch_1.default(`http://demo.ip-api.com/json/${ip}`, { method: 'GET' })).json();
        return { city, country, countryCode, isp, lat, lon, ip };
    }
    async docker() {
        return Object.assign(Object.assign({}, await info.dockerInfo()), { containers: await info.dockerContainers() });
    }
};
SysinfoService = __decorate([
    common_1.Injectable()
], SysinfoService);
exports.SysinfoService = SysinfoService;
//# sourceMappingURL=sysinfo.service.js.map