chore: drop pagination and wine ge
Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
This commit is contained in:
@@ -19,40 +19,12 @@ fetch_github_releases() {
|
||||
|
||||
log "Получение релизов из $repo..."
|
||||
|
||||
local page=1
|
||||
local temp_file="$TEMP_DIR/$(basename "$output_file" .json)_page"
|
||||
local url="https://api.github.com/repos/$repo/releases"
|
||||
|
||||
> "$output_file"
|
||||
|
||||
local all_releases="$TEMP_DIR/all_$(basename "$output_file")"
|
||||
echo "[]" > "$all_releases"
|
||||
|
||||
while true; do
|
||||
local url="https://api.github.com/repos/$repo/releases?page=$page&per_page=100"
|
||||
local response="$temp_file$page"
|
||||
|
||||
if ! curl -s -H "Accept: application/vnd.github.v3+json" "$url" > "$response"; then
|
||||
log "Ошибка при получении страницы $page для $repo"
|
||||
break
|
||||
fi
|
||||
|
||||
if ! jq -e '. | length > 0' "$response" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
|
||||
jq -s '.[0] + .[1]' "$all_releases" "$response" > "$all_releases.tmp" && mv "$all_releases.tmp" "$all_releases"
|
||||
|
||||
((page++))
|
||||
|
||||
if [[ $page -gt 50 ]]; then
|
||||
log "Предупреждение: достигнут лимит страниц (50) для $repo"
|
||||
break
|
||||
fi
|
||||
|
||||
sleep 0.5
|
||||
done
|
||||
|
||||
cp "$all_releases" "$output_file"
|
||||
if ! curl -s -H "Accept: application/vnd.github.v3+json" "$url" > "$output_file"; then
|
||||
log "Ошибка при получении релизов для $repo"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local count=$(jq '. | length' "$output_file" 2>/dev/null || echo "0")
|
||||
log "Получено данных для $repo: $count релизов"
|
||||
@@ -87,15 +59,11 @@ log "Начало генерации метаданных..."
|
||||
|
||||
# PROTON_GE
|
||||
fetch_github_releases "GloriousEggroll/proton-ge-custom" "$TEMP_DIR/proton_ge_releases.json"
|
||||
create_wine_entries "$TEMP_DIR/proton_ge_releases.json" "\\.tar\\.gz$" "Proton-6\\.5-GE-2|github-action" > "$TEMP_DIR/proton_ge.json"
|
||||
create_wine_entries "$TEMP_DIR/proton_ge_releases.json" "\\.tar\\.gz$" "github-action" > "$TEMP_DIR/proton_ge.json"
|
||||
|
||||
# WINE_KRON4EK
|
||||
fetch_github_releases "Kron4ek/Wine-Builds" "$TEMP_DIR/wine_kron4ek_releases.json"
|
||||
create_wine_entries "$TEMP_DIR/wine_kron4ek_releases.json" "\\.tar\\.xz$" "6\\.3|-x86|-wow64" > "$TEMP_DIR/wine_kron4ek.json"
|
||||
|
||||
# WINE_GE_CUSTOM
|
||||
fetch_github_releases "GloriousEggroll/wine-ge-custom" "$TEMP_DIR/wine_ge_custom_releases.json"
|
||||
create_wine_entries "$TEMP_DIR/wine_ge_custom_releases.json" "\\.tar\\.xz$" "6\\.23" > "$TEMP_DIR/wine_ge_custom.json"
|
||||
create_wine_entries "$TEMP_DIR/wine_kron4ek_releases.json" "\\.tar\\.xz$" "-x86|-wow64" > "$TEMP_DIR/wine_kron4ek.json"
|
||||
|
||||
# PROTON_LG
|
||||
fetch_github_releases "Castro-Fidel/wine_builds" "$TEMP_DIR/proton_lg_releases.json"
|
||||
@@ -141,17 +109,8 @@ JSON_CONTINUE
|
||||
|
||||
cat << 'JSON_CONTINUE2'
|
||||
],
|
||||
"wine_ge_custom": [
|
||||
JSON_CONTINUE2
|
||||
|
||||
if [[ -s "$TEMP_DIR/wine_ge_custom.json" ]]; then
|
||||
sed '$!s/$/,/' "$TEMP_DIR/wine_ge_custom.json" | sed 's/^/ /'
|
||||
fi
|
||||
|
||||
cat << 'JSON_CONTINUE3'
|
||||
],
|
||||
"proton_lg": [
|
||||
JSON_CONTINUE3
|
||||
JSON_CONTINUE2
|
||||
|
||||
if [[ -s "$TEMP_DIR/proton_lg.json" ]]; then
|
||||
sed '$!s/$/,/' "$TEMP_DIR/proton_lg.json" | sed 's/^/ /'
|
||||
@@ -202,7 +161,7 @@ fi
|
||||
|
||||
echo
|
||||
log "Статистика созданного файла:"
|
||||
for category in proton_ge wine_kron4ek wine_ge_custom proton_lg proton_cachyos proton_sarek proton_em; do
|
||||
for category in proton_ge wine_kron4ek proton_lg proton_cachyos proton_sarek proton_em; do
|
||||
count=$(jq -r ".${category} | length" "$OUTPUT_FILE" 2>/dev/null || echo "0")
|
||||
log " $category: $count версий"
|
||||
done
|
||||
|
Reference in New Issue
Block a user