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:
@@ -1,7 +1,7 @@
|
||||
# ── Редирект HTTP → HTTPS ─────────────────────────────────────────────────
|
||||
server {
|
||||
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/ {
|
||||
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 ──────────────────────────────────────────────
|
||||
server {
|
||||
listen 443 ssl;
|
||||
|
||||
@@ -70,7 +70,7 @@ export function RoomModal({ open, room, categories = [], onClose, onSave, onDele
|
||||
sortOrder: room?.sortOrder ?? 99,
|
||||
allowHourly: room?.allowHourly ?? false,
|
||||
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 ?? '',
|
||||
earlyCheckinFee: room?.earlyCheckinFee ?? '',
|
||||
lateCheckoutFee: room?.lateCheckoutFee ?? '',
|
||||
|
||||
@@ -203,8 +203,9 @@ export function RoomsPage() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Modal */}
|
||||
{/* Modal — key forces remount so useState reinitializes with the new room */}
|
||||
<RoomModal
|
||||
key={editingRoom?.id ?? 'new'}
|
||||
open={modalOpen}
|
||||
room={editingRoom}
|
||||
onClose={() => { setModalOpen(false); setSaveError(null) }}
|
||||
|
||||
Reference in New Issue
Block a user