NineSec Team Shell
Server IP : 92.205.26.207  /  Your IP : 216.73.216.16
Web Server : Apache
System : Linux 207.26.205.92.host.secureserver.net 4.18.0-553.60.1.el8_10.x86_64 #1 SMP Thu Jul 10 04:01:16 EDT 2025 x86_64
User : zikryat ( 1002)
PHP Version : 8.3.23
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/zikryat/public_html/src/api/../

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/zikryat/public_html/src/api/../main.ts
/**
 * Copyright 2023, the hatemragab project author.
 * All rights reserved. Use of this source code is governed by a
 * MIT license that can be found in the LICENSE file.
 */

import { NestFactory } from "@nestjs/core";
import { AppModule } from "./app.module";

import path, { join } from "path";
import * as admin from "firebase-admin";
import root from "app-root-path";

const xss = require("xss-clean");
const requestIp = require("request-ip");
import bodyParser from "body-parser";
import helmet from "helmet";

import morgan from "morgan";
import { ValidationPipe, VersioningType } from "@nestjs/common";
import { NestExpressApplication } from "@nestjs/platform-express";
import { RedisIoAdapter } from "./chat/socket_io/redis-io.adapter";
async function bootstrap() {
  console.log(process.env.NODE_ENV)
  if (process.env.isFirebaseFcmEnabled == "true") {
    console.log("You use firebase as  push notification provider");
    await admin.initializeApp({ credential: admin.credential.cert(path.join(root.path, "firebase-adminsdk.json")) });
  }
  if (process.env.isOneSignalEnabled == "true") {
    console.log("You use  OneSignal as  push notification provider ");
  }
  const app = await NestFactory.create<NestExpressApplication>(AppModule, {
    cors: {
      origin: "*"
    },
    logger: ["error", "warn"]
  });
  let isDev = process.env.NODE_ENV == "development";
  app.use(morgan("tiny", {
    skip: function(req, res) {
      if (isDev) {
        return false;
      }
      return res.statusCode < 400;
    }
  }));
  app.use(helmet({crossOriginResourcePolicy: false,}));
  app.use(bodyParser.urlencoded({ extended: false }));
  app.useGlobalPipes(
    new ValidationPipe({
      whitelist: true,
      // it case with i18n RangeError: Maximum call stack size exceeded
      validateCustomDecorators: false,
      stopAtFirstError: true,
      transform: true
    })
  );
  app.use(requestIp.mw());
  app.use(xss());
  const redisIoAdapter = new RedisIoAdapter(app);
  app.useWebSocketAdapter(redisIoAdapter);
  const port = process.env.PORT ?? 80;
  app.useStaticAssets(join(root.path, "public"));
  app.useStaticAssets(join(root.path, "public", "v-public"));
  app.useStaticAssets(join(root.path, "public", "media"));
  await app.listen(port);

  console.log("app run on port " + port);
}

bootstrap();

NineSec Team - 2022