Merge branch 'master' into Buerklin-provider

This commit is contained in:
Marc 2026-01-04 19:41:45 +01:00 committed by GitHub
commit 1fb2c050db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 2488 additions and 2294 deletions

View file

@ -139,7 +139,7 @@ class FileTypeFilterTools
{
$filter = trim($filter);
return $this->cache->get('filter_exts_'.md5($filter), function (ItemInterface $item) use ($filter) {
return $this->cache->get('filter_exts_'.hash('xxh3', $filter), function (ItemInterface $item) use ($filter) {
$elements = explode(',', $filter);
$extensions = [];

View file

@ -311,6 +311,14 @@ class DigikeyProvider implements InfoProviderInterface
'auth_bearer' => $this->authTokenManager->getAlwaysValidTokenString(self::OAUTH_APP_NAME)
]);
if ($response->getStatusCode() === 404) {
//No media found
return [
'datasheets' => [],
'images' => [],
];
}
$media_array = $response->toArray();
foreach ($media_array['MediaLinks'] as $media_link) {

View file

@ -397,13 +397,13 @@ class OEMSecretsProvider implements InfoProviderInterface
* Generates a cache key for storing part details based on the provided provider ID.
*
* This method creates a unique cache key by prefixing the provider ID with 'part_details_'
* and hashing the provider ID using MD5 to ensure a consistent and compact key format.
* and hashing the provider ID using XXH3 to ensure a consistent and compact key format.
*
* @param string $provider_id The unique identifier of the provider or part.
* @return string The generated cache key.
*/
private function getCacheKey(string $provider_id): string {
return 'oemsecrets_part_' . md5($provider_id);
return 'oemsecrets_part_' . hash('xxh3', $provider_id);
}

View file

@ -31,9 +31,6 @@ enum ProviderCapabilities
/** Basic information about a part, like the name, description, part number, manufacturer etc */
case BASIC;
/** Information about the footprint of a part */
case FOOTPRINT;
/** Provider can provide a picture for a part */
case PICTURE;
@ -43,6 +40,24 @@ enum ProviderCapabilities
/** Provider can provide prices for a part */
case PRICE;
/** Information about the footprint of a part */
case FOOTPRINT;
/**
* Get the order index for displaying capabilities in a stable order.
* @return int
*/
public function getOrderIndex(): int
{
return match($this) {
self::BASIC => 1,
self::PICTURE => 2,
self::DATASHEET => 3,
self::PRICE => 4,
self::FOOTPRINT => 5,
};
}
public function getTranslationKey(): string
{
return 'info_providers.capabilities.' . match($this) {