Spaces:
Sleeping
Sleeping
Update app.py
Browse files273 unmodified lines2742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083092 unmodified lines3123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413424 unmodified lines34734834935035135235335435535635735835936036136236360 unmodified lines42442542642742842943086 unmodified lines517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546349 unmodified lines89689789889990090190219 unmodified lines92292392492592692792816 unmodified lines94594694794894995095195295395495595695795895996096116 unmodified lines97897998098198298398498598698798898999099114 unmodified lines100610071008100910101011101210131014101514 unmodified lines1030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107025 unmodified lines1096109710981099110011011102390 unmodified lines149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519179 unmodified lines16991700170117021703170417051706170717089 unmodified lines171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517467 unmodified lines1754175517561757175817591760176117621763273 unmodified lines<style>* { margin: 0; padding: 0; box-sizing: border-box; }body { font-family: 'Poppins', sans-serif; background: #f0f4f9; color: #222; line-height: 1.6; transition: background 0.3s, color 0.3s; }body.dark-mode { background: #1a114f; color: #c8d0e0; }.container { max-width: 1300px; margin: 0 auto; padding: 20px; }.header { display: flex; justify-content: space-between; align-items: center; padding: 15px 0; border-bottom: 1px solid #d4d9e3; }body.dark-mode .header { border-bottom-color: #102a50; }.header h1 { font-size: 1.8rem; font-weight: 600; color: #041f70; }.auth-links { display: flex; gap: 15px; align-items: center; }.auth-links a { color: #041f70; text-decoration: none; font-weight: 500; }.auth-links a:hover { text-decoration: underline; }body.dark-mode .auth-links a { color: #7a8cd1; }.auth-links span { font-weight: 500; color: #444c5a; }body.dark-mode .auth-links span { color: #b0b8c8;}.theme-toggle { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #7a8592; transition: color 0.3s ease; }.theme-toggle:hover { color: #041f70; }body.dark-mode .theme-toggle { color: #8aa9b5; }body.dark-mode .theme-toggle:hover { color: #7a8cd1; }.store-address { padding: 15px; text-align: center; background-color: #ffffff; margin: 20px 0; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); font-size: 1rem; color: #444c5a; }body.dark-mode .store-address { background-color: #102a50; color: #b0b8c8; }.filters-container { margin: 20px 0; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }.search-container { margin: 20px 0; text-align: center; }#search-input { width: 90%; max-width: 600px; padding: 12px 18px; font-size: 1rem; border: 1px solid #d4d9e3; border-radius: 25px; outline: none; box-shadow: 0 2px 5px rgba(0,0,0,0.05); transition: all 0.3s ease; }body.dark-mode #search-input { background-color: #102a50; border-color: #102a50; color: #c8d0e0; }#search-input:focus { border-color: #041f70; box-shadow: 0 0 0 3px rgba(4, 31, 112, 0.2); }body.dark-mode #search-input:focus { border-color: #041f70; box-shadow: 0 0 0 3px rgba(4, 31, 112, 0.3); }.category-filter { padding: 8px 16px; border: 1px solid #d4d9e3; border-radius: 20px; background-color: #fff; cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); font-size: 0.9rem; font-weight: 400; color: #041f70; }body.dark-mode .category-filter { background-color: #102a50; border-color: #102a50; color: #7a8cd1; }.category-filter.active, .category-filter:hover { background-color: #041f70; color: white; border-color: #041f70; box-shadow: 0 2px 10px rgba(4, 31, 112, 0.3); }body.dark-mode .category-filter.active, body.dark-mode .category-filter:hover { background-color: #041f70; border-color: #041f70; color: white; box-shadow: 0 2px 10px rgba(4, 31, 112, 0.4); }.products-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; padding: 10px; }.product { background: #fff; border-radius: 15px; padding: 0; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; height: 100%; border: 1px solid #e1e5eb;}body.dark-mode .product { background: #102a50; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); border-color: #102a50; }.product:hover { transform: translateY(-5px) scale(1.02); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12); }body.dark-mode .product:hover { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3); }.product-image { width: 100%; aspect-ratio: 1 / 1; background-color: #fff; border-radius: 10px 10px 0 0; overflow: hidden; display: flex; justify-content: center; align-items: center; margin-bottom: 0; }2 unmodified lines.product-info { padding: 15px; flex-grow: 1; display: flex; flex-direction: column; justify-content: center; }.product h2 { font-size: 1.1rem; font-weight: 600; margin: 0 0 8px 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #222; }body.dark-mode .product h2 { color: #c8d0e0; }.product-price { font-size: 1.2rem; color: #041f70; font-weight: 700; text-align: center; margin: 5px 0; }body.dark-mode .product-price { color: #7a8cd1; }.product-description { font-size: 0.85rem; color: #7a8592; text-align: center; margin-bottom: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }body.dark-mode .product-description { color: #8aa9b5; }.product-actions { padding: 0 15px 15px 15px; display: flex; flex-direction: column; gap: 8px; }.product-button { display: block; width: 100%; padding: 10px; border: none; border-radius: 8px; background-color: #041f70; color: white; font-size: 0.9rem; font-weight: 500; cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); text-align: center; text-decoration: none; }.product-button:hover { background-color: #031750; box-shadow: 0 4px 15px rgba(3, 23, 80, 0.4); transform: translateY(-2px); }.product-button i { margin-right: 5px; }.add-to-cart { background-color: #041f70; }.add-to-cart:hover { background-color: #031750; box-shadow: 0 4strap 15px rgba(3, 23, 80, 0.4); }#cart-button { position: fixed; bottom: 25px; right: 25px; background-color: #041f70; color: white; border: none; border-radius: 50%; width: 55px; height: 55px; font-size: 1.5rem; cursor: pointer; display: none; align-items: center; justify-content: center; box-shadow: 0 4px 15px rgba(4, 31, 112, 0.4); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); z-index: 1000; }#cart-button .fa-shopping-cart { margin-right: 0; }#cart-button span { position: absolute; top: -5px; right: -5px; background-color: #041f70; color: white; border-radius: 50%; padding: 2px 6px; font-size: 0.7rem; font-weight: bold; }.modal { display: none; position: fixed; z-index: 1001; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.6); backdrop-filter: blur(5px); overflow-y: auto; }.modal-content { background: #f9f8fc; margin: 5% auto; padding: 25px; border-radius: 15px; width: 90%; max-width: 700px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); animation: slideIn 0.3s ease-out; position: relative; }body.dark-mode .modal-content { background: #102a50; color: #c8d0e0; }@keyframes slideIn { from { transform: translateY(-30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }.close { position: absolute; top: 15px; right: 15px; font-size: 1.8rem; color: #aaa; cursor: pointer; transition: color 0.3s; line-height: 1; }.close:hover { color: #333; }body.dark-mode .close { color: #7a8592; }body.dark-mode .close:hover { color: #b0b8c8; }.modal-content h2 { margin-top: 0; margin-bottom: 20px; color: #041f70; display: flex; align-items: center; gap: 10px;}body.dark-mode .modal-content h2 { color: #7a8cd1; }.cart-item { display: grid; grid-template-columns: auto 1fr auto auto; gap: 15px; align-items: center; padding: 15px 0; border-bottom: 1px solid #d4d9e3; }body.dark-mode .cart-item { border-bottom-color: #102a50; }.cart-item:last-child { border-bottom: none; }.cart-item img { width: 60px; height: 60px; object-fit: contain; border-radius: 8px; background-color: #fff; padding: 5px; grid-column: 1; }.cart-item-details { grid-column: 2; }4 unmodified lines.cart-item-remove { grid-column: 4; background:none; border:none; color:#f56565; cursor:pointer; font-size: 1.3em; padding: 5px; line-height: 1; }.cart-item-remove:hover { color: #c53030; }.quantity-input, .color-select { width: 100%; max-width: 180px; padding: 10px; border: 1px solid #d4d9e3; border-radius: 8px; font-size: 1rem; margin: 10px 0; box-sizing: border-box; }body.dark-mode .quantity-input, body.dark-mode .color-select { background-color: #1a114f; border-color: #102a50; color: #c8d0e0; }.cart-summary { margin-top: 20px; text-align: right; border-top: 1px solid #d4d9e3; padding-top: 15px; }body.dark-mode .cart-summary { border-top-color: #102a50; }.cart-summary strong { font-size: 1.2rem; }.cart-actions { margin-top: 25px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }.cart-actions .product-button { width: auto; flex-grow: 1; }.clear-cart { background-color: #7a8592; }.clear-cart:hover { background-color: #5e6e75; box-shadow: 0 4px 15px rgba(94, 110, 117, 0.4); }.formulate-order-button { background-color: #041f70; }.formulate-order-button:hover { background-color: #031750; box-shadow: 0 4px 15px rgba(3, 23, 80, 0.4); }.notification { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); background-color: #041f70; color: white; padding: 10px 20px; border-radius: 20px; box-shadow: 0 4px 10px rgba(0,0,0,0.2); z-index: 1002; opacity: 0; transition: opacity 0.5s ease, bottom 0.5s ease; font-size: 0.9rem;}.notification.show { opacity: 1; bottom: 90px; }#notification-placeholder { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); z-index: 1002; width: auto; max-width: 90%; display: flex; flex-direction: column-reverse; align-items: center; gap: 10px; pointer-events: none; }.no-results-message { grid-column: 1 / -1; text-align: center; padding: 40px; font-size: 1.1rem; color: #5e6e75; }60 unmodified lines{% if is_authenticated %}<div class="product-price">{{ "%.2f"|format(product['price']) }} {{ currency_code }}</div>{% else %}<div class="product-price"><a href="{{ url_for('login') }}" style="color: #041f70; text-decoration: underline;">Войдите, чтобы увидеть цену</a></div>{% endif %}<p class="product-description">{{ product.get('description', '')[:50] }}{% if product.get('description', '')|length > 50 %}...{% endif %}</p></div>86 unmodified lines}}function attemptAutoLogin() {const storedToken = localStorage.getItem('kglobalUserToken');if (storedToken && !isAuthenticated) {console.log('Attempting auto-login with token...');fetch('/auto_login', {method: 'POST',headers: { 'Content-Type': 'application/json' },body: JSON.stringify({ token: storedToken })}).then(response => {if (response.ok) {console.log('Auto-login successful, reloading...');window.location.reload();} else {response.text().then(text => console.warn(`Auto-login failed: ${response.status} ${text}. Removing stored token.`));localStorage.removeItem('kglobalUserToken');}}).catch(error => {console.error('Auto-login fetch error:', error);localStorage.removeItem('kglobalUserToken');});}}function openModal(productIndex) {const modal = document.getElementById('productModal');349 unmodified linesdocument.addEventListener('DOMContentLoaded', () => {applyInitialTheme();attemptAutoLogin();updateCartButton();setupFilters();19 unmodified linesPRODUCT_DETAIL_TEMPLATE = '''<div style="padding: 10px;"><h2 style="font-size: 1.6rem; font-weight: 600; margin-bottom: 15px; text-align: center; color: #041f70;">{{ product['name'] }}</h2><div class="swiper-container" style="max-width: 450px; margin: 0 auto 20px; border-radius: 10px; overflow: hidden; background-color: #fff;"><div class="swiper-wrapper">{% if product.get('photos') and product['photos']|length > 0 %}16 unmodified lines</div>{% if product.get('photos') and product['photos']|length > 1 %}<div class="swiper-pagination" style="position: relative; bottom: 5px;"></div><div class="swiper-button-next" style="color: #041f70;"></div><div class="swiper-button-prev" style="color: #041f70;"></div>{% endif %}</div><div style="margin-top: 20px; font-size: 1rem; line-height: 1.7;"><p><strong>Категория:</strong> {{ product.get('category', 'Без категории') }}</p>{% if is_authenticated %}<p style="font-size: 1.2rem; font-weight: bold; color: #041f70;"><strong>Цена:</strong> {{ "%.2f"|format(product['price']) }} {{ currency_code }}</p>{% else %}<p><strong>Цена:</strong> <a href="{{ url_for('login') }}" style="color: #041f70; text-decoration: underline;">Доступна после входа</a></p>{% endif %}<p><strong>Описание:</strong><br> {{ product.get('description', 'Описание отсутствует.')|replace('\\n', '<br>')|safe }}</p>{% set colors = product.get('colors', []) %}16 unmodified lines<style>body { font-family: 'Poppins', sans-serif; background: linear-gradient(135deg, #d4d9e3, #e9edf2); display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 20px; }.container { max-width: 400px; width: 100%; background: #fff; padding: 30px 40px; border-radius: 15px; box-shadow: 0 5px 20px rgba(0,0,0,0.1); text-align: center; }h2 { color: #041f70; margin-bottom: 25px; font-weight: 600; }label { display: block; text-align: left; margin: 15px 0 5px; font-weight: 500; color: #444c5a; }input[type="text"] { width: 100%; padding: 12px; margin-bottom: 15px; border: 1px solid #c4cbd4; border-radius: 8px; box-sizing: border-box; font-size: 1rem; }input:focus { border-color: #041f70; outline: none; box-shadow: 0 0 0 2px rgba(4, 31, 112, 0.2); }button { width: 100%; padding: 12px; background-color: #041f70; color: white; border: none; border-radius: 8px; cursor: pointer; font-size: 1rem; font-weight: 600; transition: background-color 0.3s ease; margin-top: 10px; }button:hover { background-color: #031750; }.error { color: #721c24; background-color: #f8d7da; border: 1px solid #f5c6cb; padding: 10px; border-radius: 8px; margin-bottom: 15px; font-size: 0.9rem; text-align: left;}.back-link { display: inline-block; margin-top: 20px; color: #041f70; text-decoration: none; font-size: 0.9rem; }.back-link:hover { text-decoration: underline; }</style></head>14 unmodified linesconst form = document.getElementById('loginForm');if (form) {form.addEventListener('submit', function(event) {const tokenInput = document.getElementById('token');if (tokenInput && tokenInput.value) {}});}</script>14 unmodified linesbody { font-family: 'Poppins', sans-serif; background-color: #e9edf2; color: #222; padding: 20px; line-height: 1.6; }.container { max-width: 1200px; margin: 0 auto; background-color: #fff; padding: 25px; border-radius: 10px; box-shadow: 0 3px 10px rgba(0,0,0,0.05); }.header { padding-bottom: 15px; margin-bottom: 25px; border-bottom: 1px solid #d4d9e3; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;}h1, h2, h3 { font-weight: 600; color: #041f70; margin-bottom: 15px; }h1 { font-size: 1.8rem; }h2 { font-size: 1.5rem; margin-top: 30px; display: flex; align-items: center; gap: 8px; }h3 { font-size: 1.2rem; color: #031750; margin-top: 20px; }.section { margin-bottom: 30px; padding: 20px; background-color: #f9f8fc; border: 1px solid #d4d9e3; border-radius: 8px; }form { margin-bottom: 20px; }label { font-weight: 500; margin-top: 10px; display: block; color: #444c5a; font-size: 0.9rem;}input[type="text"], input[type="number"], input[type="password"], input[type="tel"], textarea, select { width: 100%; padding: 10px 12px; margin-top: 5px; border: 1px solid #c4cbd4; border-radius: 6px; font-size: 0.95rem; box-sizing: border-box; transition: border-color 0.3s ease; }input:focus, textarea:focus, select:focus { border-color: #041f70; outline: none; box-shadow: 0 0 0 2px rgba(4, 31, 112, 0.1); }textarea { min-height: 80px; resize: vertical; }input[type="file"] { padding: 8px; background-color: #f0f4f9; cursor: pointer; border: 1px solid #c4cbd4;}input[type="file"]::file-selector-button { padding: 5px 10px; border-radius: 4px; background-color: #e0e5ed; border: 1px solid #c4cbd4; cursor: pointer; margin-right: 10px;}input[type="checkbox"] { margin-right: 5px; vertical-align: middle; }label.inline-label { display: inline-block; margin-top: 10px; font-weight: normal; }button, .button { padding: 10px 18px; border: none; border-radius: 6px; background-color: #041f70; color: white; font-weight: 500; cursor: pointer; transition: background-color 0.3s ease, transform 0.1s ease; margin-top: 15px; font-size: 0.95rem; display: inline-flex; align-items: center; gap: 5px; text-decoration: none; line-height: 1.2;}button:hover, .button:hover { background-color: #031750; }button:active, .button:active { transform: scale(0.98); }button[type="submit"] { min-width: 120px; justify-content: center; }.delete-button { background-color: #f56565; }.delete-button:hover { background-color: #e53e3e; }.add-button { background-color: #041f70; }.add-button:hover { background-color: #031750; }.item-list { display: grid; gap: 20px; }.item { background: #fff; padding: 15px 20px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.07); border: 1px solid #e1e5eb; }.item p { margin: 5px 0; font-size: 0.9rem; color: #444c5a; }.item strong { color: #222; }.item .description { font-size: 0.85rem; color: #5e6e75; max-height: 60px; overflow: hidden; text-overflow: ellipsis; }.item-actions { margin-top: 15px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }.item-actions button:not(.delete-button) { background-color: #041f70; }.item-actions button:not(.delete-button):hover { background-color: #031750; }.edit-form-container { margin-top: 15px; padding: 20px; background: #f0f4f9; border: 1px dashed #c4cbd4; border-radius: 6px; display: none; }details { background-color: #f9f8fc; border: 1px solid #d4d9e3; border-radius: 8px; margin-bottom: 20px; }details > summary { cursor: pointer; font-weight: 600; color: #031750; display: block; padding: 15px; border-bottom: 1px solid #d4d9e3; list-style: none; position: relative; }details > summary::-webkit-details-marker { display: none; }details > summary::after { content: '\\f078'; font-family: 'Font Awesome 6 Free'; font-weight: 900; position: absolute; right: 20px; top: 50%; transform: translateY(-50%); transition: transform 0.2s ease; color: #041f70; }details[open] > summary::after { transform: translateY(-50%) rotate(180deg); }details[open] > summary { border-bottom: 1px solid #d4d9e3; }details .details-content { padding: 20px; }25 unmodified lines<div class="container"><div class="header"><h1><i class="fas fa-tools"></i> Админ-панель Korea Global</h1><a href="{{ url_for('catalog') }}" class="button" style="background-color: #041f70;"><i class="fas fa-store"></i> Перейти в каталог</a></div>{% with messages = get_flashed_messages(with_categories=true) %}390 unmodified lines<style>body { font-family: 'Poppins', sans-serif; background: #f0f4f9; color: #222; line-height: 1.6; padding: 20px; }.container { max-width: 800px; margin: 20px auto; padding: 30px; background: #fff; border-radius: 15px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); border: 1px solid #d4d9e3; }h1 { text-align: center; color: #041f70; margin-bottom: 25px; font-size: 1.8rem; font-weight: 600; }h2 { color: #031750; margin-top: 30px; margin-bottom: 15px; font-size: 1.4rem; border-bottom: 1px solid #d4d9e3; padding-bottom: 8px;}.order-meta { font-size: 0.9rem; color: #5e6e75; margin-bottom: 20px; text-align: center; }.order-item { display: grid; grid-template-columns: 60px 1fr auto; gap: 15px; align-items: center; padding: 15px 0; border-bottom: 1px solid #e1e5eb; }.order-item:last-child { border-bottom: none; }.order-item img { width: 60px; height: 60px; object-fit: contain; border-radius: 8px; background-color: #fff; padding: 5px; border: 1px solid #e1e5eb;}.item-details strong { display: block; margin-bottom: 5px; font-size: 1.05rem; color: #222;}.item-details span { font-size: 0.9rem; color: #444c5a; display: block;}.item-total { font-weight: bold; text-align: right; font-size: 1rem; color: #041f70;}.order-summary { margin-top: 30px; padding-top: 20px; border-top: 2px solid #041f70; text-align: right; }.order-summary p { margin-bottom: 10px; font-size: 1.1rem; }.order-summary strong { font-size: 1.3rem; color: #041f70; }.customer-info { margin-top: 30px; background-color: #f9f8fc; padding: 20px; border-radius: 8px; border: 1px solid #e1e5eb;}.customer-info p { margin-bottom: 8px; font-size: 0.95rem; }.customer-info strong { color: #031750; }.actions { margin-top: 30px; text-align: center; }.button { padding: 12px 25px; border: none; border-radius: 8px; background-color: #25D366; color: white; font-weight: 600; cursor: pointer; transition: background-color 0.3s ease, transform 0.1s ease; font-size: 1rem; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }.button:hover { background-color: #128C7E; }.button:active { transform: scale(0.98); }.button i { font-size: 1.2rem; }.catalog-link { display: block; text-align: center; margin-top: 25px; color: #041f70; text-decoration: none; font-size: 0.9rem; }.catalog-link:hover { text-decoration: underline; }.not-found { text-align: center; color: #c53030; font-size: 1.2rem; padding: 40px 0;}</style>179 unmodified lineslogin_response_html = f'''<!DOCTYPE html><html><head><title>Перенаправление...</title></head><body><script>try {{localStorage.setItem('kglobalUserToken', '{token_attempt}');console.log('Stored token in localStorage.');}} catch (e) {{ console.error("Error saving token to localStorage:", e); }}window.location.href = "{url_for('catalog')}";</script><p>Вход выполнен успешно. Перенаправление в <a href="{url_for('catalog')}">каталог</a>...</p>9 unmodified lines@app.route('/auto_login', methods=['POST'])def auto_login():data = request.get_json()if not data or 'token' not in data:logging.warning("Auto_login request missing data or token.")return jsonify({"error": "Invalid request"}), 400token_attempt = data.get('token', '').strip()if not token_attempt:logging.warning("Attempted auto_login with empty token.")return jsonify({"error": "Token not provided"}), 400current_users = get_users()user_data = current_users.get(token_attempt)if user_data:session['user_token'] = token_attemptsession['user'] = user_data.get('login', token_attempt)session['user_info'] = user_datasession.modified = Truelogging.info(f"Auto-login successful with token.")return jsonify({"message": "OK"}), 200else:logging.warning(f"Failed auto-login attempt with invalid or non-existent token.")return jsonify({"error": "Auto-login failed"}), 401@app.route('/logout')def logout():7 unmodified lineslogout_response_html = f'''<!DOCTYPE html><html><head><title>Выход...</title></head><body><script>try {{localStorage.removeItem('kglobalUserToken');console.log('Removed stored token from localStorage.');}} catch (e) {{ console.error("Error removing from localStorage:", e); }}window.location.href = "{url_for('catalog')}";</script><p>Выход выполнен. Перенаправление на <a href="{url_for('catalog')}">главную страницу</a>...</p>273 unmodified lines2742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083092 unmodified lines3123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413424 unmodified lines34734834935035135235335435535635735835936036136236360 unmodified lines42442542642742842943086 unmodified lines517518519520521522349 unmodified lines87287387487587687787819 unmodified lines89889990090190290390416 unmodified lines92192292392492592692792892993093193293393493593693716 unmodified lines95495595695795895996096196296396496596696714 unmodified lines98298398498598698798814 unmodified lines1003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104325 unmodified lines1069107010711072107310741075390 unmodified lines146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492179 unmodified lines1672167316741675167616779 unmodified lines16871688168916901691169216937 unmodified lines170117021703170417051706273 unmodified lines<style>* { margin: 0; padding: 0; box-sizing: border-box; }body { font-family: 'Poppins', sans-serif; background: #f0f4f9; color: #222; line-height: 1.6; transition: background 0.3s, color 0.3s; }body.dark-mode { background: #011028; color: #c8d0e0; }.container { max-width: 1300px; margin: 0 auto; padding: 20px; }.header { display: flex; justify-content: space-between; align-items: center; padding: 15px 0; border-bottom: 1px solid #d4d9e3; }body.dark-mode .header { border-bottom-color: #021a40; }.header h1 { font-size: 1.8rem; font-weight: 600; color: #021a40; }.auth-links { display: flex; gap: 15px; align-items: center; }.auth-links a { color: #032a60; text-decoration: none; font-weight: 500; }.auth-links a:hover { text-decoration: underline; }body.dark-mode .auth-links a { color: #506a92; }.auth-links span { font-weight: 500; color: #444c5a; }body.dark-mode .auth-links span { color: #b0b8c8;}.theme-toggle { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #7a8592; transition: color 0.3s ease; }.theme-toggle:hover { color: #021a40; }body.dark-mode .theme-toggle { color: #8aa9b5; }body.dark-mode .theme-toggle:hover { color: #506a92; }.store-address { padding: 15px; text-align: center; background-color: #ffffff; margin: 20px 0; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); font-size: 1rem; color: #444c5a; }body.dark-mode .store-address { background-color: #021a40; color: #b0b8c8; }.filters-container { margin: 20px 0; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }.search-container { margin: 20px 0; text-align: center; }#search-input { width: 90%; max-width: 600px; padding: 12px 18px; font-size: 1rem; border: 1px solid #d4d9e3; border-radius: 25px; outline: none; box-shadow: 0 2px 5px rgba(0,0,0,0.05); transition: all 0.3s ease; }body.dark-mode #search-input { background-color: #021a40; border-color: #021a40; color: #c8d0e0; }#search-input:focus { border-color: #021a40; box-shadow: 0 0 0 3px rgba(2, 26, 64, 0.2); }body.dark-mode #search-input:focus { border-color: #021a40; box-shadow: 0 0 0 3px rgba(2, 26, 64, 0.3); }.category-filter { padding: 8px 16px; border: 1px solid #d4d9e3; border-radius: 20px; background-color: #fff; cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); font-size: 0.9rem; font-weight: 400; color: #021a40; }body.dark-mode .category-filter { background-color: #021a40; border-color: #021a40; color: #506a92; }.category-filter.active, .category-filter:hover { background-color: #021a40; color: white; border-color: #021a40; box-shadow: 0 2px 10px rgba(2, 26, 64, 0.3); }body.dark-mode .category-filter.active, body.dark-mode .category-filter:hover { background-color: #021a40; border-color: #021a40; color: white; box-shadow: 0 2px 10px rgba(2, 26, 64, 0.4); }.products-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; padding: 10px; }.product { background: #fff; border-radius: 15px; padding: 0; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; height: 100%; border: 1px solid #e1e5eb;}body.dark-mode .product { background: #021a40; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); border-color: #021a40; }.product:hover { transform: translateY(-5px) scale(1.02); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12); }body.dark-mode .product:hover { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3); }.product-image { width: 100%; aspect-ratio: 1 / 1; background-color: #fff; border-radius: 10px 10px 0 0; overflow: hidden; display: flex; justify-content: center; align-items: center; margin-bottom: 0; }2 unmodified lines.product-info { padding: 15px; flex-grow: 1; display: flex; flex-direction: column; justify-content: center; }.product h2 { font-size: 1.1rem; font-weight: 600; margin: 0 0 8px 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #222; }body.dark-mode .product h2 { color: #c8d0e0; }.product-price { font-size: 1.2rem; color: #021a40; font-weight: 700; text-align: center; margin: 5px 0; }body.dark-mode .product-price { color: #506a92; }.product-description { font-size: 0.85rem; color: #7a8592; text-align: center; margin-bottom: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }body.dark-mode .product-description { color: #8aa9b5; }.product-actions { padding: 0 15px 15px 15px; display: flex; flex-direction: column; gap: 8px; }.product-button { display: block; width: 100%; padding: 10px; border: none; border-radius: 8px; background-color: #021a40; color: white; font-size: 0.9rem; font-weight: 500; cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); text-align: center; text-decoration: none; }.product-button:hover { background-color: #011028; box-shadow: 0 4px 15px rgba(1, 16, 40, 0.4); transform: translateY(-2px); }.product-button i { margin-right: 5px; }.add-to-cart { background-color: #032a60; }.add-to-cart:hover { background-color: #021a40; box-shadow: 0 4px 15px rgba(2, 26, 64, 0.4); }#cart-button { position: fixed; bottom: 25px; right: 25px; background-color: #021a40; color: white; border: none; border-radius: 50%; width: 55px; height: 55px; font-size: 1.5rem; cursor: pointer; display: none; align-items: center; justify-content: center; box-shadow: 0 4px 15px rgba(2, 26, 64, 0.4); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); z-index: 1000; }#cart-button .fa-shopping-cart { margin-right: 0; }#cart-button span { position: absolute; top: -5px; right: -5px; background-color: #032a60; color: white; border-radius: 50%; padding: 2px 6px; font-size: 0.7rem; font-weight: bold; }.modal { display: none; position: fixed; z-index: 1001; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.6); backdrop-filter: blur(5px); overflow-y: auto; }.modal-content { background: #f9f8fc; margin: 5% auto; padding: 25px; border-radius: 15px; width: 90%; max-width: 700px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); animation: slideIn 0.3s ease-out; position: relative; }body.dark-mode .modal-content { background: #021a40; color: #c8d0e0; }@keyframes slideIn { from { transform: translateY(-30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }.close { position: absolute; top: 15px; right: 15px; font-size: 1.8rem; color: #aaa; cursor: pointer; transition: color 0.3s; line-height: 1; }.close:hover { color: #333; }body.dark-mode .close { color: #7a8592; }body.dark-mode .close:hover { color: #b0b8c8; }.modal-content h2 { margin-top: 0; margin-bottom: 20px; color: #021a40; display: flex; align-items: center; gap: 10px;}body.dark-mode .modal-content h2 { color: #506a92; }.cart-item { display: grid; grid-template-columns: auto 1fr auto auto; gap: 15px; align-items: center; padding: 15px 0; border-bottom: 1px solid #d4d9e3; }body.dark-mode .cart-item { border-bottom-color: #021a40; }.cart-item:last-child { border-bottom: none; }.cart-item img { width: 60px; height: 60px; object-fit: contain; border-radius: 8px; background-color: #fff; padding: 5px; grid-column: 1; }.cart-item-details { grid-column: 2; }4 unmodified lines.cart-item-remove { grid-column: 4; background:none; border:none; color:#f56565; cursor:pointer; font-size: 1.3em; padding: 5px; line-height: 1; }.cart-item-remove:hover { color: #c53030; }.quantity-input, .color-select { width: 100%; max-width: 180px; padding: 10px; border: 1px solid #d4d9e3; border-radius: 8px; font-size: 1rem; margin: 10px 0; box-sizing: border-box; }body.dark-mode .quantity-input, body.dark-mode .color-select { background-color: #011028; border-color: #021a40; color: #c8d0e0; }.cart-summary { margin-top: 20px; text-align: right; border-top: 1px solid #d4d9e3; padding-top: 15px; }body.dark-mode .cart-summary { border-top-color: #021a40; }.cart-summary strong { font-size: 1.2rem; }.cart-actions { margin-top: 25px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }.cart-actions .product-button { width: auto; flex-grow: 1; }.clear-cart { background-color: #7a8592; }.clear-cart:hover { background-color: #5e6e75; box-shadow: 0 4px 15px rgba(94, 110, 117, 0.4); }.formulate-order-button { background-color: #021a40; }.formulate-order-button:hover { background-color: #011028; box-shadow: 0 4px 15px rgba(1, 16, 40, 0.4); }.notification { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); background-color: #032a60; color: white; padding: 10px 20px; border-radius: 20px; box-shadow: 0 4px 10px rgba(0,0,0,0.2); z-index: 1002; opacity: 0; transition: opacity 0.5s ease, bottom 0.5s ease; font-size: 0.9rem;}.notification.show { opacity: 1; bottom: 90px; }#notification-placeholder { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); z-index: 1002; width: auto; max-width: 90%; display: flex; flex-direction: column-reverse; align-items: center; gap: 10px; pointer-events: none; }.no-results-message { grid-column: 1 / -1; text-align: center; padding: 40px; font-size: 1.1rem; color: #5e6e75; }60 unmodified lines{% if is_authenticated %}<div class="product-price">{{ "%.2f"|format(product['price']) }} {{ currency_code }}</div>{% else %}<div class="product-price"><a href="{{ url_for('login') }}" style="color: #032a60; text-decoration: underline;">Войдите, чтобы увидеть цену</a></div>{% endif %}<p class="product-description">{{ product.get('description', '')[:50] }}{% if product.get('description', '')|length > 50 %}...{% endif %}</p></div>86 unmodified lines}}function openModal(productIndex) {const modal = document.getElementById('productModal');349 unmodified linesdocument.addEventListener('DOMContentLoaded', () => {applyInitialTheme();updateCartButton();setupFilters();19 unmodified linesPRODUCT_DETAIL_TEMPLATE = '''<div style="padding: 10px;"><h2 style="font-size: 1.6rem; font-weight: 600; margin-bottom: 15px; text-align: center; color: #021a40;">{{ product['name'] }}</h2><div class="swiper-container" style="max-width: 450px; margin: 0 auto 20px; border-radius: 10px; overflow: hidden; background-color: #fff;"><div class="swiper-wrapper">{% if product.get('photos') and product['photos']|length > 0 %}16 unmodified lines</div>{% if product.get('photos') and product['photos']|length > 1 %}<div class="swiper-pagination" style="position: relative; bottom: 5px;"></div><div class="swiper-button-next" style="color: #021a40;"></div><div class="swiper-button-prev" style="color: #021a40;"></div>{% endif %}</div><div style="margin-top: 20px; font-size: 1rem; line-height: 1.7;"><p><strong>Категория:</strong> {{ product.get('category', 'Без категории') }}</p>{% if is_authenticated %}<p style="font-size: 1.2rem; font-weight: bold; color: #021a40;"><strong>Цена:</strong> {{ "%.2f"|format(product['price']) }} {{ currency_code }}</p>{% else %}<p><strong>Цена:</strong> <a href="{{ url_for('login') }}" style="color: #032a60; text-decoration: underline;">Доступна после входа</a></p>{% endif %}<p><strong>Описание:</strong><br> {{ product.get('description', 'Описание отсутствует.')|replace('\\n', '<br>')|safe }}</p>{% set colors = product.get('colors', []) %}16 unmodified lines<style>body { font-family: 'Poppins', sans-serif; background: linear-gradient(135deg, #d4d9e3, #e9edf2); display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 20px; }.container { max-width: 400px; width: 100%; background: #fff; padding: 30px 40px; border-radius: 15px; box-shadow: 0 5px 20px rgba(0,0,0,0.1); text-align: center; }h2 { color: #021a40; margin-bottom: 25px; font-weight: 600; }label { display: block; text-align: left; margin: 15px 0 5px; font-weight: 500; color: #444c5a; }input[type="text"] { width: 100%; padding: 12px; margin-bottom: 15px; border: 1px solid #c4cbd4; border-radius: 8px; box-sizing: border-box; font-size: 1rem; }input:focus { border-color: #021a40; outline: none; box-shadow: 0 0 0 2px rgba(2, 26, 64, 0.2); }button { width: 100%; padding: 12px; background-color: #021a40; color: white; border: none; border-radius: 8px; cursor: pointer; font-size: 1rem; font-weight: 600; transition: background-color 0.3s ease; margin-top: 10px; }button:hover { background-color: #011028; }.error { color: #721c24; background-color: #f8d7da; border: 1px solid #f5c6cb; padding: 10px; border-radius: 8px; margin-bottom: 15px; font-size: 0.9rem; text-align: left;}.back-link { display: inline-block; margin-top: 20px; color: #032a60; text-decoration: none; font-size: 0.9rem; }.back-link:hover { text-decoration: underline; }</style></head>14 unmodified linesconst form = document.getElementById('loginForm');if (form) {form.addEventListener('submit', function(event) {});}</script>14 unmodified linesbody { font-family: 'Poppins', sans-serif; background-color: #e9edf2; color: #222; padding: 20px; line-height: 1.6; }.container { max-width: 1200px; margin: 0 auto; background-color: #fff; padding: 25px; border-radius: 10px; box-shadow: 0 3px 10px rgba(0,0,0,0.05); }.header { padding-bottom: 15px; margin-bottom: 25px; border-bottom: 1px solid #d4d9e3; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;}h1, h2, h3 { font-weight: 600; color: #021a40; margin-bottom: 15px; }h1 { font-size: 1.8rem; }h2 { font-size: 1.5rem; margin-top: 30px; display: flex; align-items: center; gap: 8px; }h3 { font-size: 1.2rem; color: #011028; margin-top: 20px; }.section { margin-bottom: 30px; padding: 20px; background-color: #f9f8fc; border: 1px solid #d4d9e3; border-radius: 8px; }form { margin-bottom: 20px; }label { font-weight: 500; margin-top: 10px; display: block; color: #444c5a; font-size: 0.9rem;}input[type="text"], input[type="number"], input[type="password"], input[type="tel"], textarea, select { width: 100%; padding: 10px 12px; margin-top: 5px; border: 1px solid #c4cbd4; border-radius: 6px; font-size: 0.95rem; box-sizing: border-box; transition: border-color 0.3s ease; }input:focus, textarea:focus, select:focus { border-color: #021a40; outline: none; box-shadow: 0 0 0 2px rgba(2, 26, 64, 0.1); }textarea { min-height: 80px; resize: vertical; }input[type="file"] { padding: 8px; background-color: #f0f4f9; cursor: pointer; border: 1px solid #c4cbd4;}input[type="file"]::file-selector-button { padding: 5px 10px; border-radius: 4px; background-color: #e0e5ed; border: 1px solid #c4cbd4; cursor: pointer; margin-right: 10px;}input[type="checkbox"] { margin-right: 5px; vertical-align: middle; }label.inline-label { display: inline-block; margin-top: 10px; font-weight: normal; }button, .button { padding: 10px 18px; border: none; border-radius: 6px; background-color: #021a40; color: white; font-weight: 500; cursor: pointer; transition: background-color 0.3s ease, transform 0.1s ease; margin-top: 15px; font-size: 0.95rem; display: inline-flex; align-items: center; gap: 5px; text-decoration: none; line-height: 1.2;}button:hover, .button:hover { background-color: #011028; }button:active, .button:active { transform: scale(0.98); }button[type="submit"] { min-width: 120px; justify-content: center; }.delete-button { background-color: #f56565; }.delete-button:hover { background-color: #e53e3e; }.add-button { background-color: #032a60; }.add-button:hover { background-color: #021a40; }.item-list { display: grid; gap: 20px; }.item { background: #fff; padding: 15px 20px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.07); border: 1px solid #e1e5eb; }.item p { margin: 5px 0; font-size: 0.9rem; color: #444c5a; }.item strong { color: #222; }.item .description { font-size: 0.85rem; color: #5e6e75; max-height: 60px; overflow: hidden; text-overflow: ellipsis; }.item-actions { margin-top: 15px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }.item-actions button:not(.delete-button) { background-color: #021a40; }.item-actions button:not(.delete-button):hover { background-color: #011028; }.edit-form-container { margin-top: 15px; padding: 20px; background: #f0f4f9; border: 1px dashed #c4cbd4; border-radius: 6px; display: none; }details { background-color: #f9f8fc; border: 1px solid #d4d9e3; border-radius: 8px; margin-bottom: 20px; }details > summary { cursor: pointer; font-weight: 600; color: #011028; display: block; padding: 15px; border-bottom: 1px solid #d4d9e3; list-style: none; position: relative; }details > summary::-webkit-details-marker { display: none; }details > summary::after { content: '\\f078'; font-family: 'Font Awesome 6 Free'; font-weight: 900; position: absolute; right: 20px; top: 50%; transform: translateY(-50%); transition: transform 0.2s ease; color: #021a40; }details[open] > summary::after { transform: translateY(-50%) rotate(180deg); }details[open] > summary { border-bottom: 1px solid #d4d9e3; }details .details-content { padding: 20px; }25 unmodified lines<div class="container"><div class="header"><h1><i class="fas fa-tools"></i> Админ-панель Korea Global</h1><a href="{{ url_for('catalog') }}" class="button" style="background-color: #032a60;"><i class="fas fa-store"></i> Перейти в каталог</a></div>{% with messages = get_flashed_messages(with_categories=true) %}390 unmodified lines<style>body { font-family: 'Poppins', sans-serif; background: #f0f4f9; color: #222; line-height: 1.6; padding: 20px; }.container { max-width: 800px; margin: 20px auto; padding: 30px; background: #fff; border-radius: 15px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); border: 1px solid #d4d9e3; }h1 { text-align: center; color: #021a40; margin-bottom: 25px; font-size: 1.8rem; font-weight: 600; }h2 { color: #011028; margin-top: 30px; margin-bottom: 15px; font-size: 1.4rem; border-bottom: 1px solid #d4d9e3; padding-bottom: 8px;}.order-meta { font-size: 0.9rem; color: #5e6e75; margin-bottom: 20px; text-align: center; }.order-item { display: grid; grid-template-columns: 60px 1fr auto; gap: 15px; align-items: center; padding: 15px 0; border-bottom: 1px solid #e1e5eb; }.order-item:last-child { border-bottom: none; }.order-item img { width: 60px; height: 60px; object-fit: contain; border-radius: 8px; background-color: #fff; padding: 5px; border: 1px solid #e1e5eb;}.item-details strong { display: block; margin-bottom: 5px; font-size: 1.05rem; color: #222;}.item-details span { font-size: 0.9rem; color: #444c5a; display: block;}.item-total { font-weight: bold; text-align: right; font-size: 1rem; color: #021a40;}.order-summary { margin-top: 30px; padding-top: 20px; border-top: 2px solid #021a40; text-align: right; }.order-summary p { margin-bottom: 10px; font-size: 1.1rem; }.order-summary strong { font-size: 1.3rem; color: #021a40; }.customer-info { margin-top: 30px; background-color: #f9f8fc; padding: 20px; border-radius: 8px; border: 1px solid #e1e5eb;}.customer-info p { margin-bottom: 8px; font-size: 0.95rem; }.customer-info strong { color: #011028; }.actions { margin-top: 30px; text-align: center; }.button { padding: 12px 25px; border: none; border-radius: 8px; background-color: #25D366; color: white; font-weight: 600; cursor: pointer; transition: background-color 0.3s ease, transform 0.1s ease; font-size: 1rem; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }.button:hover { background-color: #128C7E; }.button:active { transform: scale(0.98); }.button i { font-size: 1.2rem; }.catalog-link { display: block; text-align: center; margin-top: 25px; color: #032a60; text-decoration: none; font-size: 0.9rem; }.catalog-link:hover { text-decoration: underline; }.not-found { text-align: center; color: #c53030; font-size: 1.2rem; padding: 40px 0;}</style>179 unmodified lineslogin_response_html = f'''<!DOCTYPE html><html><head><title>Перенаправление...</title></head><body><script>window.location.href = "{url_for('catalog')}";</script><p>Вход выполнен успешно. Перенаправление в <a href="{url_for('catalog')}">каталог</a>...</p>9 unmodified lines@app.route('/auto_login', methods=['POST'])def auto_login():return jsonify({"error": "Auto-login via client-side storage is disabled."}), 400@app.route('/logout')def logout():7 unmodified lineslogout_response_html = f'''<!DOCTYPE html><html><head><title>Выход...</title></head><body><script>window.location.href = "{url_for('catalog')}";</script><p>Выход выполнен. Перенаправление на <a href="{url_for('catalog')}">главную страницу</a>...</p>
app.py+65-122