From 56533f1fbf3b7a59e3d5b50d7be8d7db6c58d61b Mon Sep 17 00:00:00 2001 From: Akamaru Date: Fri, 21 Nov 2025 15:15:48 +0100 Subject: [PATCH] Neu: Funstock Evercade Bridge --- FunstockEvercadeBridge.php | 115 +++++++++++++++++++++++++++++++++++++ README.md | 5 ++ 2 files changed, 120 insertions(+) create mode 100644 FunstockEvercadeBridge.php diff --git a/FunstockEvercadeBridge.php b/FunstockEvercadeBridge.php new file mode 100644 index 0000000..6463c8f --- /dev/null +++ b/FunstockEvercadeBridge.php @@ -0,0 +1,115 @@ + [ + 'name' => 'Number of products', + 'type' => 'number', + 'defaultValue' => 20, + 'required' => false, + ], + ], + ]; + + public function getIcon() + { + return 'https://www.google.com/s2/favicons?domain=funstock.eu&sz=32'; + } + + public function collectData() + { + $limit = $this->getInput('limit') ?: 20; + $apiUrl = 'https://funstock.eu/collections/evercade/products.json?sort_by=created-descending&limit=' . $limit; + + $json = getContents($apiUrl); + if (!$json) { + returnServerError('Could not fetch data from Funstock'); + } + + $data = json_decode($json, true); + if (!$data || !isset($data['products'])) { + returnServerError('Invalid JSON response from Funstock'); + } + + foreach ($data['products'] as $product) { + $item = []; + + $item['title'] = $product['title']; + $item['uri'] = 'https://funstock.eu/products/' . $product['handle']; + $item['uid'] = (string) $product['id']; + + // Timestamp (creation date) + if (isset($product['created_at'])) { + $item['timestamp'] = strtotime($product['created_at']); + } + + // Author/Vendor + if (isset($product['vendor']) && !empty($product['vendor'])) { + $item['author'] = $product['vendor']; + } + + // Categories/Tags + if (isset($product['tags']) && is_array($product['tags'])) { + $item['categories'] = $product['tags']; + } + + // Price from first variant + $price = ''; + if (isset($product['variants'][0]['price'])) { + $price = $product['variants'][0]['price'] . ' EUR'; + } + + // Product type + $productType = $product['product_type'] ?? ''; + + // Build content + $content = ''; + + // Product image + if (isset($product['images'][0]['src'])) { + $imageUrl = $product['images'][0]['src']; + $content .= '
' . htmlspecialchars($product['title']) . '

'; + $item['enclosures'][] = $imageUrl; + } + + // Price and type + if ($price || $productType) { + $content .= '

'; + if ($price) { + $content .= 'Price: ' . htmlspecialchars($price); + } + if ($price && $productType) { + $content .= ' | '; + } + if ($productType) { + $content .= 'Type: ' . htmlspecialchars($productType); + } + $content .= '

'; + } + + // Description (clean HTML) + if (isset($product['body_html']) && !empty($product['body_html'])) { + $description = $product['body_html']; + + // Remove empty paragraphs + $description = preg_replace('/

\s*( |\s)*<\/p>/', '', $description); + + $content .= '


' . $description; + } + + $item['content'] = $content; + + $this->items[] = $item; + } + } +} diff --git a/README.md b/README.md index e3cd4ef..040d33b 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,11 @@ Diese Sammlung enthält verschiedene Bridge-Implementierungen für RSS-Bridge, u ### [Florida TV Bridge](https://bridge.ponywave.de/#bridge-FloridaTVBridge) (Von Akamaru) - **Beschreibung**: Neueste News von FloridaTV Entertainment. +### [Funstock Evercade Bridge](https://bridge.ponywave.de/#bridge-FunstockEvercadeBridge) (Von Akamaru) +- **Beschreibung**: Zeigt neue Evercade-Produkte von Funstock (Konsolen, Cartridges, Zubehör) +- **Parameter**: + - **Number of products**: Anzahl der Produkte (Standard: 20) + ### [Foodwatch Bridge](https://bridge.ponywave.de/#bridge-FoodwatchBridge) (Von Akamaru) - **Beschreibung**: Zeigt die neuesten Nachrichten von Foodwatch.org