Compare commits

...

4 Commits

Author SHA1 Message Date
Your Name a89d6e1a63 feat(ui): add new sponsor and quote image
Add a new sponsor link to index and o-nas pages with corresponding logo, and include a new quote image.
2026-06-01 15:56:16 +02:00
Your Name 60a4b82931 feat(ui): add new sponsor and update text content
Add a new sponsor logo and link for NSA to the index and o-nas pages.
Update the header text in o-nas.html to reflect winner status.
2026-05-30 09:33:58 +02:00
Your Name efa35518ab feat(ui): update sponsor logos and links
Replace the alpacar.pl sponsor with kovosteel.cz and gracla.cz in index.html and o-nas.html, and add new sponsor image assets.
2026-05-25 17:41:17 +02:00
Tomas Dvorak cc6841e723 feat(backend): implement fallback API for club data retrieval
Add a fallback mechanism to use an alternative base URL and club ID
when the primary API request fails. This ensures data resilience by
attempting to fetch club details and standings from a secondary source
using a slug-based lookup.

The implementation also updates the logic to use the active club ID
(either primary or fallback) when overriding logo URLs in match
details and table standings.
2026-05-13 12:05:20 +02:00
9 changed files with 87 additions and 28 deletions
+24 -7
View File
@@ -30,6 +30,9 @@ const (
clubID = "441d3783-06aa-436a-b438-359300ee0371"
clubType = "futsal"
baseURL = "https://facr.tdvorak.dev"
fallbackBaseURL = "https://flashscore.tdvorak.dev"
fallbackClubID = "xzS3gX3T"
fallbackSlug = "uherske-hradiste"
)
// Paths
@@ -1652,13 +1655,27 @@ func refresh(ctx context.Context) error {
urlTable := fmt.Sprintf("%s/club/%s/%s/table", baseURL, clubType, clubID)
var detail ClubDetail
if err := getJSON(ctx, client, urlDetail, &detail); err != nil {
return fmt.Errorf("detail: %w", err)
}
var table ClubTable
var activeClubID string
// Try primary API first
if err := getJSON(ctx, client, urlDetail, &detail); err != nil {
log.Printf("primary api detail failed (%v), trying fallback", err)
urlDetail = fmt.Sprintf("%s/club/%s/%s?slug=%s", fallbackBaseURL, clubType, fallbackClubID, fallbackSlug)
urlTable = fmt.Sprintf("%s/club/%s/%s/table?slug=%s", fallbackBaseURL, clubType, fallbackClubID, fallbackSlug)
if err := getJSON(ctx, client, urlDetail, &detail); err != nil {
return fmt.Errorf("fallback detail: %w", err)
}
if err := getJSON(ctx, client, urlTable, &table); err != nil {
return fmt.Errorf("fallback table: %w", err)
}
activeClubID = fallbackClubID
} else {
if err := getJSON(ctx, client, urlTable, &table); err != nil {
return fmt.Errorf("table: %w", err)
}
activeClubID = clubID
}
// Override or inject facr_link based on match_id
for i := range detail.Competitions {
@@ -1668,10 +1685,10 @@ func refresh(ctx context.Context) error {
detail.Competitions[i].Matches[j].FacrLink = fmt.Sprintf("https://www.fotbal.cz/futsal/zapasy/futsal/%s", mid)
}
// Override logo URLs for our club in match details
if detail.Competitions[i].Matches[j].HomeID == clubID {
if detail.Competitions[i].Matches[j].HomeID == activeClubID {
detail.Competitions[i].Matches[j].HomeLogoURL = "/img/logo.png"
}
if detail.Competitions[i].Matches[j].AwayID == clubID {
if detail.Competitions[i].Matches[j].AwayID == activeClubID {
detail.Competitions[i].Matches[j].AwayLogoURL = "/img/logo.png"
}
}
@@ -1680,7 +1697,7 @@ func refresh(ctx context.Context) error {
// Override logo URLs for our club in the table standings
for i := range table.Competitions {
for j := range table.Competitions[i].Table.Overall {
if table.Competitions[i].Table.Overall[j].TeamID == clubID {
if table.Competitions[i].Table.Overall[j].TeamID == activeClubID {
table.Competitions[i].Table.Overall[j].TeamLogo = "/img/logo.png"
}
}
@@ -1698,7 +1715,7 @@ func refresh(ctx context.Context) error {
if err := writeDiskJSON(c.data); err != nil {
log.Printf("warn: write disk json: %v", err)
}
log.Printf("refreshed data: comps=%d", len(detail.Competitions))
log.Printf("refreshed data: comps=%d source=%s", len(detail.Competitions), map[bool]string{true: "fallback", false: "primary"}[activeClubID == fallbackClubID])
return nil
}
+1 -1
View File
File diff suppressed because one or more lines are too long
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 MiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

+28 -7
View File
@@ -1774,13 +1774,6 @@
</a>
</div>
</div>
<div class="col-xl-3 col-lg-3 col-md-6 col-sm-6 col-ms-6 col-xs-12 partners-wrap center-flex">
<div class="partners-item item center-flex">
<a href="https://alpacar.pl/" target="_blank">
<img decoding="async" src="img/sponzor17.png" class="image">
</a>
</div>
</div>
<div class="col-xl-3 col-lg-3 col-md-6 col-sm-6 col-ms-6 col-xs-12 partners-wrap center-flex">
<div class="partners-item item center-flex">
<a href="https://vechra.cz/" target="_blank">
@@ -1865,6 +1858,34 @@
</a>
</div>
</div>
<div class="col-sxl-3 col-lg-3 col-md-6 col-sm-6 col-ms-6 col-xs-12 partners-wrap center-flex">
<div class="partners-item item center-flex">
<a href="https://www.kovosteel.cz/" target="_blank">
<img decoding="async" src="img/sponzor30.png" class="image">
</a>
</div>
</div>
<div class="col-sxl-3 col-lg-3 col-md-6 col-sm-6 col-ms-6 col-xs-12 partners-wrap center-flex">
<div class="partners-item item center-flex">
<a href="http://gracla.cz/" target="_blank">
<img decoding="async" src="img/sponzor31.png" class="image">
</a>
</div>
</div>
<div class="col-sxl-3 col-lg-3 col-md-6 col-sm-6 col-ms-6 col-xs-12 partners-wrap center-flex">
<div class="partners-item item center-flex">
<a href="https://nsa.gov.cz/" target="_blank">
<img decoding="async" src="img/sponzor32.png" class="image">
</a>
</div>
</div>
<div class="col-sxl-3 col-lg-3 col-md-6 col-sm-6 col-ms-6 col-xs-12 partners-wrap center-flex">
<div class="partners-item item center-flex">
<a href="https://zlinskykraj.cz/" target="_blank">
<img decoding="async" src="img/sponzor33.png" class="image">
</a>
</div>
</div>
</div>
</div>
</div>
+29 -8
View File
@@ -191,7 +191,7 @@
<div class="lte-heading lte-style-header-subheader lte-uppercase lte-subcolor-main has-subheader heading-tag-h6 heading-subtag-h6">
<div class="lte-heading-content">
<h6 class="lte-subheader">2025 / 2026</h6>
<h6 class="lte-header">Účastník 2. FUTSAL LIGY</h6>
<h6 class="lte-header">Výherce 2. FUTSAL LIGY</h6>
</div>
</div>
</div>
@@ -464,13 +464,6 @@
</a>
</div>
</div>
<div class="col-xl-3 col-lg-3 col-md-6 col-sm-6 col-ms-6 col-xs-12 partners-wrap center-flex">
<div class="partners-item item center-flex">
<a href="https://alpacar.pl/" target="_blank">
<img decoding="async" src="img/sponzor17.png" class="image">
</a>
</div>
</div>
<div class="col-xl-3 col-lg-3 col-md-6 col-sm-6 col-ms-6 col-xs-12 partners-wrap center-flex">
<div class="partners-item item center-flex">
<a href="https://vechra.cz/" target="_blank">
@@ -555,6 +548,34 @@
</a>
</div>
</div>
<div class="col-xl-3 col-lg-3 col-md-6 col-sm-6 col-ms-6 col-xs-12 partners-wrap center-flex">
<div class="partners-item item center-flex">
<a href="https://www.kovosteel.cz/" target="_blank">
<img decoding="async" src="img/sponzor30.png" class="image">
</a>
</div>
</div>
<div class="col-xl-3 col-lg-3 col-md-6 col-sm-6 col-ms-6 col-xs-12 partners-wrap center-flex">
<div class="partners-item item center-flex">
<a href="http://gracla.cz/" target="_blank">
<img decoding="async" src="img/sponzor31.png" class="image">
</a>
</div>
</div>
<div class="col-xl-3 col-lg-3 col-md-6 col-sm-6 col-ms-6 col-xs-12 partners-wrap center-flex">
<div class="partners-item item center-flex">
<a href="https://nsa.gov.cz/" target="_blank">
<img decoding="async" src="img/sponzor32.png" class="image">
</a>
</div>
</div>
<div class="col-xl-3 col-lg-3 col-md-6 col-sm-6 col-ms-6 col-xs-12 partners-wrap center-flex">
<div class="partners-item item center-flex">
<a href="https://zlinskykraj.cz/" target="_blank">
<img decoding="async" src="img/sponzor33.png" class="image">
</a>
</div>
</div>
</div>
</div>
</div>