[Slides] Let image search use a configurable Custom Search address

Abierto Apto para principiantes
#9,124 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
68/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
typescript
Área
api, backend

Línea de trabajo

Empieza en templates/slides/server/lib/media-search-providers.ts, donde se define GOOGLE_IMAGE_SEARCH_URL y se construye la solicitud de Custom Search, luego revisa server/register-secrets.ts para ver cómo se registra GOOGLE_SEARCH_CX. Añade un secreto opcional GOOGLE_SEARCH_URL, inclúyelo comentado en .env.example y cubre ambos casos en media-search-providers.test.ts. Está terminado cuando la solicitud no cambia sin nada configurado y se envía a la dirección configurada cuando se establece.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Slides image search sends every request to GOOGLE_IMAGE_SEARCH_URL, a constant set to https://www.googleapis.com/customsearch/v1 in templates/slides/server/lib/media-search-providers.ts:3. Only GOOGLE_API_KEY and GOOGLE_SEARCH_CX come from settings.

Google's overview page says "Existing Custom Search JSON API customers have until January 1, 2027 to transition to an alternative solution" (https://developers.google.com/custom-search/v1/overview). After that date image search in Slides stops for everyone who set it up, and there is no setting that changes where the request goes.

I'd like to add one optional setting, GOOGLE_SEARCH_URL, resolved the same way as the other two:

const [apiKey, searchEngineId, searchUrl] = await Promise.all([
  runtime.resolveSecret("GOOGLE_API_KEY"),
  runtime.resolveSecret("GOOGLE_SEARCH_CX"),
  runtime.resolveSecret("GOOGLE_SEARCH_URL"),
]);
// ...
const response = await runtime.fetch(
  `${searchUrl || GOOGLE_IMAGE_SEARCH_URL}?${params}`,
  fetchOptions(),
);

It would be registered in server/register-secrets.ts with required: false like GOOGLE_SEARCH_CX, listed commented out in .env.example, and covered in media-search-providers.test.ts with one case that the request goes to Google when it isn't set and one that it goes to the configured address when it is. With nothing set the request is the same as today.

Since CONTRIBUTING asks for an issue before a new config option, I wanted to check the shape first. I can send it as a PR if this works for you.

Lenguaje dominante
TypeScript
Estrellas
7.7k
Forks
706
Merge medio
1 d 11 h
PR fusionados (30 d)
790

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de BuilderIO/agent-native

Todos los issues de BuilderIO/agent-native

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.