mirror of
https://github.com/anten-ka/gotelegram_pro.git
synced 2026-05-19 15:56:04 +00:00
fix: download_template - handle StartBootstrap dist/ structure + fallback index.html search
StartBootstrap templates store production files in dist/ subdirectory. Added: dist/ detection, recursive index.html fallback, ls output to stderr.
This commit is contained in:
@@ -238,9 +238,28 @@ download_template() {
|
||||
|
||||
# Для StartBootstrap — каждый шаблон в своём репо
|
||||
elif [ "$source" = "startbootstrap" ]; then
|
||||
git clone --depth 1 "$repo_url" "$clone_dir" 2>/dev/null
|
||||
# Убираем .git
|
||||
rm -rf "$clone_dir/.git"
|
||||
local sb_tmp="/tmp/sb_clone_$$"
|
||||
rm -rf "$sb_tmp"
|
||||
git clone --depth 1 "$repo_url" "$sb_tmp" 2>/dev/null
|
||||
if [ -d "$sb_tmp" ]; then
|
||||
rm -rf "$sb_tmp/.git"
|
||||
# StartBootstrap хранит production-файлы в dist/
|
||||
if [ -f "$sb_tmp/dist/index.html" ]; then
|
||||
cp -r "$sb_tmp/dist/"* "$clone_dir/"
|
||||
elif [ -f "$sb_tmp/index.html" ]; then
|
||||
cp -r "$sb_tmp/"* "$clone_dir/"
|
||||
else
|
||||
# fallback: ищем index.html рекурсивно
|
||||
local found_index
|
||||
found_index=$(find "$sb_tmp" -name "index.html" -type f 2>/dev/null | head -1)
|
||||
if [ -n "$found_index" ]; then
|
||||
local found_dir
|
||||
found_dir=$(dirname "$found_index")
|
||||
cp -r "$found_dir/"* "$clone_dir/"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
rm -rf "$sb_tmp"
|
||||
fi
|
||||
|
||||
# Проверяем результат
|
||||
@@ -249,9 +268,22 @@ download_template() {
|
||||
echo "$clone_dir"
|
||||
return 0
|
||||
else
|
||||
# fallback: ищем index.html в подпапках (нестандартная структура)
|
||||
local fallback_index
|
||||
fallback_index=$(find "$clone_dir" -name "index.html" -type f 2>/dev/null | head -1)
|
||||
if [ -n "$fallback_index" ]; then
|
||||
local fallback_dir
|
||||
fallback_dir=$(dirname "$fallback_index")
|
||||
if [ "$fallback_dir" != "$clone_dir" ]; then
|
||||
cp -r "$fallback_dir/"* "$clone_dir/"
|
||||
log_success "Шаблон \"$name\" скачан (из подпапки)"
|
||||
echo "$clone_dir"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
log_error "Шаблон не содержит index.html"
|
||||
log_dim "Путь: $clone_dir"
|
||||
ls -la "$clone_dir" 2>/dev/null
|
||||
ls -la "$clone_dir" 2>/dev/null >&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user