diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..a284678 --- /dev/null +++ b/build.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env python3 +"""Склеивает CSS/JS в единый index.html для деплоя (ConfigMap — один файл).""" +import os + +BASE = os.path.dirname(os.path.abspath(__file__)) +html = open(os.path.join(BASE, 'index.html')).read() + +css = open(os.path.join(BASE, 'css/style.css')).read() +html = html.replace('', + f'') + +for jsf in ['storage.js', 'syllables.js', 'transcribe.js', 'audio.js', 'compare.js', 'main.js']: + js = open(os.path.join(BASE, 'js', jsf)).read() + html = html.replace(f'', + f'') + +os.makedirs(os.path.join(BASE, 'dist'), exist_ok=True) +with open(os.path.join(BASE, 'dist/index.html'), 'w') as f: + f.write(html) + +print(f'dist/index.html ready ({len(html)} bytes)') diff --git a/css/style.css b/css/style.css new file mode 100644 index 0000000..fd1a01f --- /dev/null +++ b/css/style.css @@ -0,0 +1,16 @@ +/* Lyngvo — Итальянский тренажёр произношения */ +body { background: #f8f8fa; font-family: sans-serif; } +#app { max-width:900px; margin:20px auto; background:#fff; border-radius:12px; box-shadow:0 2px 12px #0001; padding:24px 32px; } +textarea { width:100%; font-size:1.2em; border-radius:6px; border:1px solid #ccc; padding:8px; } +button { font-size:1em; padding:8px 18px; border-radius:6px; border:none; background:#2a7cff; color:#fff; cursor:pointer; } +button:disabled { background:#ccc; cursor:not-allowed; } +#score { font-size:1.5em; margin:12px 0; } +#diff { font-size:1.2em; line-height:1.8; } +#history { display:flex; flex-wrap:wrap; gap:4px; margin-top:6px; } +#history span { font-size:0.85em; background:#e8e8f0; padding:3px 10px; border-radius:12px; cursor:pointer; } +#history span:hover { background:#d0d0e0; } +.phonetics { font-size:0.85em; color:#666; margin-top:6px; display:flex; gap:16px; flex-wrap:wrap; } +.recItem { display:flex; align-items:center; gap:8px; padding:4px 8px; background:#f0f0f5; border-radius:8px; margin:4px 0; } +.recItem button { font-size:0.8em; padding:4px 10px; } +.syl-chip { cursor:pointer; padding:2px 4px; border-radius:4px; transition:0.15s; } +.syl-chip:hover { background:#e0e0ff; } diff --git a/deploy_lang.sh b/deploy_lang.sh index 28efabc..d7330f7 100755 --- a/deploy_lang.sh +++ b/deploy_lang.sh @@ -1,9 +1,12 @@ #!/bin/bash set -e -# Вклеиваем Groq API ключ в index.html +# Собираем dist/index.html (CSS + JS встроены) +~/lang/.venv/bin/python3 ~/lang/build.sh + +# Вклеиваем Groq API ключ в dist/index.html KEY=$(cat ~/lang/token.txt) -cp ~/lang/index.html /tmp/lyngvo_index.html +cp ~/lang/dist/index.html /tmp/lyngvo_index.html sed -i "s|const GROQ_API_KEY = '';|const GROQ_API_KEY = '${KEY}';|" /tmp/lyngvo_index.html # Синхронизация всей папки lang на ВМ diff --git a/dist/index.html b/dist/index.html new file mode 100644 index 0000000..6f16cc5 --- /dev/null +++ b/dist/index.html @@ -0,0 +1,770 @@ + + +
+ + + + +