fix: cdn.hotelsync.ru nginx config + RoomModal key for state reset

- Add cdn.hotelsync.ru server block to nginx config (serves /var/www/uploads)
- Add cdn.hotelsync.ru to HTTP redirect server_name
- RoomModal: add key={editingRoom?.id ?? 'new'} to force state reinit on room change
- RoomModal: remove categories[0] fallback for categoryId (show 'Без категории' instead)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-23 13:14:20 +03:00
parent 95809851fb
commit 31d135563f
3 changed files with 23 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
# ── Редирект HTTP → HTTPS ───────────────────────────────────────────────── # ── Редирект HTTP → HTTPS ─────────────────────────────────────────────────
server { server {
listen 80; listen 80;
server_name hotelsync.ru www.hotelsync.ru app.hotelsync.ru api.hotelsync.ru git.hotelsync.ru guest.hotelsync.ru cp.hotelsync.ru; server_name hotelsync.ru www.hotelsync.ru app.hotelsync.ru api.hotelsync.ru git.hotelsync.ru guest.hotelsync.ru cp.hotelsync.ru cdn.hotelsync.ru;
location /.well-known/acme-challenge/ { location /.well-known/acme-challenge/ {
root /var/www/certbot; root /var/www/certbot;
@@ -115,6 +115,25 @@ server {
} }
} }
# ── cdn.hotelsync.ru — Static file CDN (uploads) ─────────────────────────
server {
listen 443 ssl;
server_name cdn.hotelsync.ru;
ssl_certificate /etc/letsencrypt/live/cdn.hotelsync.ru/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/cdn.hotelsync.ru/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
add_header Access-Control-Allow-Origin '*' always;
add_header Cache-Control 'public, max-age=31536000, immutable' always;
location / {
root /var/www/uploads;
try_files $uri =404;
}
}
# ── git.hotelsync.ru — Gitea ────────────────────────────────────────────── # ── git.hotelsync.ru — Gitea ──────────────────────────────────────────────
server { server {
listen 443 ssl; listen 443 ssl;

View File

@@ -70,7 +70,7 @@ export function RoomModal({ open, room, categories = [], onClose, onSave, onDele
sortOrder: room?.sortOrder ?? 99, sortOrder: room?.sortOrder ?? 99,
allowHourly: room?.allowHourly ?? false, allowHourly: room?.allowHourly ?? false,
hourlyRate: room?.hourlyRate ?? 1000, hourlyRate: room?.hourlyRate ?? 1000,
categoryId: room?.categoryId ?? (categories.find(c => c.name === room?.type)?.id ?? categories[0]?.id ?? ''), categoryId: room?.categoryId ?? (categories.find(c => c.name === room?.type)?.id ?? ''),
description: room?.description ?? '', description: room?.description ?? '',
earlyCheckinFee: room?.earlyCheckinFee ?? '', earlyCheckinFee: room?.earlyCheckinFee ?? '',
lateCheckoutFee: room?.lateCheckoutFee ?? '', lateCheckoutFee: room?.lateCheckoutFee ?? '',

View File

@@ -203,8 +203,9 @@ export function RoomsPage() {
</div> </div>
)} )}
{/* Modal */} {/* Modal — key forces remount so useState reinitializes with the new room */}
<RoomModal <RoomModal
key={editingRoom?.id ?? 'new'}
open={modalOpen} open={modalOpen}
room={editingRoom} room={editingRoom}
onClose={() => { setModalOpen(false); setSaveError(null) }} onClose={() => { setModalOpen(false); setSaveError(null) }}