Fix storage.getServicesByName() calls - use correct storage methods

Replace non-existent getServicesByName() with:
- discoverServices() for paginated mode
- getRandomService() for random mode

Fixes "storage.getServicesByName is not a function" error.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-14 17:02:11 +01:00
parent 1d9ba69a5f
commit 100a86e3ce

View File

@@ -215,7 +215,7 @@ const handlers: Record<string, RpcHandler> = {
const pageLimit = Math.min(Math.max(1, limit), MAX_PAGE_SIZE);
const pageOffset = Math.max(0, offset || 0);
const allServices = await storage.getServicesByName(parsed.service, parsed.version);
const allServices = await storage.discoverServices(parsed.service, parsed.version, 1000, 0);
const compatibleServices = filterCompatibleServices(allServices);
// Get unique services per username with available offers
@@ -260,14 +260,12 @@ const handlers: Record<string, RpcHandler> = {
}
// Mode 3: Random discovery without username
const allServices = await storage.getServicesByName(parsed.service, parsed.version);
const compatibleServices = filterCompatibleServices(allServices);
const randomService = await storage.getRandomService(parsed.service, parsed.version);
if (compatibleServices.length === 0) {
if (!randomService) {
throw new Error('No services found');
}
const randomService = compatibleServices[Math.floor(Math.random() * compatibleServices.length)];
const availableOffer = await findAvailableOffer(randomService);
if (!availableOffer) {