the last
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
PORT=3000
|
||||
WEB_SERVER_IMAGE_REPOSITORY=toiiiiday/robot-installer-web-server
|
||||
WEB_SERVER_CONTAINER_NAME=robot-installer-web-server
|
||||
WEB_SERVER_PORT=3000
|
||||
IMAGE_TAG=1.0.1
|
||||
WEB_SERVER_PORT=3005
|
||||
IMAGE_TAG=1.0.0
|
||||
DOCKER_NETWORK=robot-installer-net
|
||||
WEB_SERVER_UPLOADS_DIR=./uploads
|
||||
SQLSERVER_HOST=172.20.235.176
|
||||
@@ -14,11 +14,11 @@ SQLSERVER_ENCRYPT=false
|
||||
SQLSERVER_TRUST_SERVER_CERTIFICATE=true
|
||||
AUTH_SECRET=change_this_to_a_long_random_value
|
||||
SESSION_MAX_AGE_MS=28800000
|
||||
SESSION_COOKIE_SECURE=false
|
||||
SESSION_COOKIE_SECURE=true
|
||||
EMAIL_CONFIRMATION_EXPIRES_MS=86400000
|
||||
APP_BASE_URL=http://localhost:3000
|
||||
APP_BASE_URL=https://package.pnkr.cloud
|
||||
APP_SHOW_ERROR_DETAILS=false
|
||||
WEB_CLIENT_ORIGINS=http://localhost:8080,http://localhost:5173,http://localhost:4173,http://localhost:3000,http://127.0.0.1:3000
|
||||
WEB_CLIENT_ORIGINS=https://app.pnkr.cloud,http://localhost:8080,http://localhost:5173,http://localhost:4173,http://localhost:3000,http://127.0.0.1:3000
|
||||
|
||||
# Mail chính dùng để gửi email xác nhận tới các tài khoản đăng ký
|
||||
SMTP_HOST=smtp.gmail.com
|
||||
|
||||
@@ -22,7 +22,7 @@ const sessionMaxAgeMs = Number(process.env.SESSION_MAX_AGE_MS || 1000 * 60 * 60
|
||||
const authSecret = process.env.AUTH_SECRET || process.env.SESSION_SECRET || 'robot-installer-dev-secret';
|
||||
const secureSessionCookie = getBooleanEnv(process.env.SESSION_COOKIE_SECURE, process.env.NODE_ENV === 'production');
|
||||
const publicApiCorsOrigins = getCsvEnv(process.env.WEB_CLIENT_ORIGINS || process.env.PUBLIC_API_CORS_ORIGINS, [
|
||||
'https://robot.installer',
|
||||
'https://app.pnkr.cloud',
|
||||
'http://localhost:5173',
|
||||
'http://localhost:4173'
|
||||
]);
|
||||
@@ -225,6 +225,10 @@ function getBooleanEnv(value, fallback) {
|
||||
return ['1', 'true', 'yes', 'on'].includes(String(value).toLowerCase());
|
||||
}
|
||||
|
||||
function escapeShellDoubleQuoted(value) {
|
||||
return String(value || '').replace(/(["\\$`])/g, '\\$1');
|
||||
}
|
||||
|
||||
function isPublicApiCorsPath(pathname) {
|
||||
return pathname === '/api/apps'
|
||||
|| pathname.startsWith('/api/apps/')
|
||||
@@ -1377,6 +1381,12 @@ app.get('/api/apps/:appCode/versions/:version/manifest', asyncRoute(async (req,
|
||||
app.get('/install-agent.sh', (req, res) => {
|
||||
const baseUrl = getBaseUrl(req);
|
||||
const agentUrl = `${baseUrl}/packages/agent/latest.deb`;
|
||||
const agentAllowedOrigins = Array.from(new Set([
|
||||
baseUrl,
|
||||
...publicApiCorsOrigins.filter((origin) => origin !== '*'),
|
||||
'http://localhost:3000',
|
||||
'http://127.0.0.1:3000'
|
||||
])).join(',');
|
||||
res.type('text/x-shellscript').send(`#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
@@ -1408,7 +1418,7 @@ echo "Configuring Local Installer Agent..."
|
||||
mkdir -p /etc/local-installer-agent
|
||||
touch "$AGENT_ENV"
|
||||
set_agent_env ROBOT_PACKAGE_BASE_URL "$PACKAGE_BASE_URL"
|
||||
set_agent_env ALLOWED_ORIGINS "$PACKAGE_BASE_URL,http://localhost:3000,http://127.0.0.1:3000"
|
||||
set_agent_env ALLOWED_ORIGINS "${escapeShellDoubleQuoted(agentAllowedOrigins)}"
|
||||
set_agent_env ALLOWED_DOWNLOAD_HOSTS "$PACKAGE_HOST,localhost,127.0.0.1"
|
||||
|
||||
echo "Starting Local Installer Agent..."
|
||||
|
||||
Reference in New Issue
Block a user