ваше сообщение коммита
This commit is contained in:
27
backend/Dockerfile.prod
Normal file
27
backend/Dockerfile.prod
Normal file
@@ -0,0 +1,27 @@
|
||||
# Copyright (c) 2024-2025 Тарабанов Александр Викторович
|
||||
# All rights reserved.
|
||||
# This software is proprietary and confidential.
|
||||
# For licensing inquiries: info@hb3-accelerator.com
|
||||
|
||||
FROM node:20-alpine
|
||||
|
||||
# Добавляем метки для авторских прав
|
||||
LABEL maintainer="Тарабанов Александр Викторович <info@hb3-accelerator.com>"
|
||||
LABEL copyright="Copyright (c) 2024-2025 Тарабанов Александр Викторович"
|
||||
LABEL license="Proprietary"
|
||||
LABEL website="https://hb3-accelerator.com"
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Устанавливаем только docker-cli (без демона) для Alpine Linux
|
||||
RUN apk add --no-cache docker-cli curl
|
||||
|
||||
COPY package.json yarn.lock ./
|
||||
RUN yarn install --frozen-lockfile --production
|
||||
|
||||
COPY . .
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
# Production команда
|
||||
CMD ["yarn", "run", "start"]
|
||||
@@ -215,6 +215,7 @@ app.use('/api/uploads', uploadsRoutes); // Загрузка файлов (лог
|
||||
app.use('/api/ens', ensRoutes); // ENS utilities
|
||||
app.use('/api', sshRoutes); // SSH роуты
|
||||
app.use('/api', encryptionRoutes); // Encryption роуты
|
||||
// API ключи удалены
|
||||
// app.use('/api/factory', factoryRoutes); // Factory routes removed - no longer needed
|
||||
app.use('/api/compile-contracts', compileRoutes); // Компиляция контрактов
|
||||
|
||||
|
||||
@@ -30,12 +30,12 @@ function createSessionMiddleware() {
|
||||
}),
|
||||
secret: process.env.SESSION_SECRET || 'hb3atoken',
|
||||
name: 'sessionId',
|
||||
resave: false,
|
||||
saveUninitialized: true,
|
||||
resave: true,
|
||||
saveUninitialized: false,
|
||||
cookie: {
|
||||
maxAge: 30 * 24 * 60 * 60 * 1000,
|
||||
httpOnly: true,
|
||||
secure: process.env.NODE_ENV === 'production',
|
||||
secure: false,
|
||||
sameSite: 'lax',
|
||||
path: '/',
|
||||
},
|
||||
|
||||
@@ -2,6 +2,11 @@ const express = require('express');
|
||||
const router = express.Router();
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const https = require('https');
|
||||
const { promisify } = require('util');
|
||||
const dns = require('dns');
|
||||
|
||||
const resolve4 = promisify(dns.resolve4);
|
||||
|
||||
const SSH_DIR = path.join(process.env.HOME || process.env.USERPROFILE, '.ssh');
|
||||
const DEFAULT_KEY_PATH = path.join(SSH_DIR, 'id_rsa');
|
||||
@@ -39,4 +44,49 @@ router.get('/ssh-key/public', (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
// GET /api/dns-check/:domain - Check DNS and get IP address
|
||||
router.get('/dns-check/:domain', async (req, res) => {
|
||||
try {
|
||||
const domain = req.params.domain;
|
||||
|
||||
if (!domain) {
|
||||
return res.status(400).json({
|
||||
success: false,
|
||||
message: 'Domain parameter is required'
|
||||
});
|
||||
}
|
||||
|
||||
console.log(`Checking DNS for domain: ${domain}`);
|
||||
|
||||
// Используем встроенный DNS resolver Node.js
|
||||
const addresses = await resolve4(domain);
|
||||
|
||||
if (addresses && addresses.length > 0) {
|
||||
const ip = addresses[0];
|
||||
console.log(`DNS resolved: ${domain} → ${ip}`);
|
||||
|
||||
res.json({
|
||||
success: true,
|
||||
domain: domain,
|
||||
ip: ip,
|
||||
message: `Домен ${domain} разрешен в IP: ${ip}`
|
||||
});
|
||||
} else {
|
||||
res.status(404).json({
|
||||
success: false,
|
||||
domain: domain,
|
||||
message: `DNS запись для домена ${domain} не найдена`
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`DNS check error for ${req.params.domain}:`, error.message);
|
||||
|
||||
res.status(500).json({
|
||||
success: false,
|
||||
domain: req.params.domain,
|
||||
message: `Ошибка проверки DNS: ${error.message}`
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
||||
Reference in New Issue
Block a user