Compare commits

...

2 Commits

Author SHA1 Message Date
skymike03
ce39722351 ## v2.6.1.7 (2026.01.02)
- correct version heading check to changelog extraction logic
2026-04-02 22:56:16 +02:00
skymike03
a7dad84108 ## v2.6.1.6.1 (2026.01.02)
- fix update 1fichier error message with free download bacause sometimes the host block download on free mode (only way to bypass is to get an api key / premium account)
2026-04-02 22:47:29 +02:00
4 changed files with 47 additions and 15 deletions

View File

@@ -27,7 +27,7 @@ except Exception:
pygame = None # type: ignore
# Version actuelle de l'application
app_version = "2.6.1.6"
app_version = "2.6.1.7"
# Nombre de jours avant de proposer la mise à jour de la liste des jeux
GAMELIST_UPDATE_DAYS = 1

View File

@@ -1766,6 +1766,9 @@ def handle_controls(event, sources, joystick, screen):
is_zip_non_supported = pending_download[3] if len(pending_download) > 3 else False
if is_1fichier_url(url):
ensure_download_provider_keys(False)
if missing_all_provider_keys():
logger.warning("Aucune clé API - Mode gratuit 1fichier sera utilisé (attente requise)")
task = asyncio.create_task(download_from_1fichier(url, platform, game_name, is_zip_non_supported, task_id))
else:
task = asyncio.create_task(download_rom(url, platform, game_name, is_zip_non_supported, task_id))

View File

@@ -620,19 +620,40 @@ def download_1fichier_free_mode(url, dest_dir, session, log_callback=None, progr
]
direct_link = None
# Examine each pattern and validate the candidate link via HEAD/GET to avoid landing pages (/register, /login)
for idx, pattern in enumerate(patterns):
match = re.search(pattern, html, re.IGNORECASE)
if not match:
continue
try:
captured_link = match.group(1)
except IndexError:
logger.warning(f"1fichier: Pattern {idx} matched but no capture group(1)")
continue
candidate_entries: list[tuple[int, str]] = []
seen_candidates: set[str] = set()
# Resolve relative links
candidate = captured_link if captured_link.startswith(('http://', 'https://')) else urljoin(page_url, captured_link)
for anchor_match in re.finditer(r'<a[^>]+href=[\"\']([^\"\']+)[\"\'][^>]*>(.*?)</a>', html, re.IGNORECASE | re.DOTALL):
href = html_module.unescape(anchor_match.group(1).strip())
anchor_text = re.sub(r'<[^>]+>', ' ', anchor_match.group(2))
normalized_anchor_text = _normalize_1fichier_text(anchor_text)
if not href or not normalized_anchor_text:
continue
if not any(token in normalized_anchor_text for token in ('download', 'telecharg', 'tlcharg', 'click', 'cliquer')):
continue
candidate = href if href.startswith(('http://', 'https://')) else urljoin(page_url, href)
if candidate in seen_candidates:
continue
seen_candidates.add(candidate)
candidate_entries.append((0, candidate))
for idx, pattern in enumerate(patterns):
for match in re.finditer(pattern, html, re.IGNORECASE):
try:
captured_link = html_module.unescape(match.group(1).strip())
except (IndexError, AttributeError):
logger.warning(f"1fichier: Pattern {idx} matched but no usable capture group(1)")
continue
if not captured_link:
continue
candidate = captured_link if captured_link.startswith(('http://', 'https://')) else urljoin(page_url, captured_link)
if candidate in seen_candidates:
continue
seen_candidates.add(candidate)
candidate_entries.append((idx, candidate))
# Examine each pattern and validate the candidate link via HEAD/GET to avoid landing pages (/register, /login)
for idx, candidate in candidate_entries:
logger.debug(f"1fichier: Pattern {idx} matched, candidate link: {candidate}")
# Quick heuristic: skip known non-download endpoints
@@ -847,6 +868,14 @@ def _extract_changelog_section(raw_text):
if not text:
return ""
def _is_version_heading(heading_text):
normalized = str(heading_text or "").strip()
return re.match(
r"^(?:release\s+)?(?:v(?:ersion)?\s*)?\d+(?:\.\d+)+(?:\s*[(:-].*)?$",
normalized,
re.IGNORECASE,
) is not None
lines = text.split("\n")
heading_re = re.compile(r"^(#{1,6})\s+(.+?)\s*$")
changelog_start = None
@@ -870,7 +899,7 @@ def _extract_changelog_section(raw_text):
if stripped == "---":
break
match = heading_re.match(stripped)
if match and len(match.group(1)) <= changelog_level:
if match and len(match.group(1)) <= changelog_level and not _is_version_heading(match.group(2)):
break
extracted.append(line)

View File

@@ -1,3 +1,3 @@
{
"version": "2.6.1.6"
"version": "2.6.1.7"
}