Fallback to default client configuration if `requestConfigFromFrame` configuration is invalid

Abierto
#5,508 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
javascript
Área
frontend

Línea de trabajo

Sigue la ruta de inicio del cliente que lee requestConfigFromFrame e inspecciona cómo se validan los niveles de los ancestros. Reproduce el lanzamiento directo de H-VS con un ancestorLevel fuera de rango y, después, verifica que la configuración no válida se ignore con una advertencia en la consola, mientras que la configuración iniciada mediante LMS siga funcionando.

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

Descripción

scoping

The Hypothesis white-label VitalSource book reader at https://hypothesis.vitalsource.com is configured for use inside the Hypothesis LMS app. To enable the Hypothesis client to talk to our LMS app, the book reader frame that loads the client sets the requestConfigFromFrame key:

// `window.hypothesisConfig` function in the iframe where the client is loaded
function () {return {requestConfigFromFrame: {origin: "https://lms.hypothes.is",ancestorLevel: 3},openSidebar: true};} = $1

If you try to access a book at https://hypothesis.vitalsource.com directly, the client fails to load due to this configuration. It logs this error on startup:

Client config error

The preferred solution here would be that https://hypothesis.vitalsource.com changes the Hypothesis client configuration depending on whether it was launched by our LMS app or not:

  1. When launched by our LMS app, the H-VS book reader should use the above configuration
  2. Otherwise, the H-VS reader should omit the requestConfigFromFrame key

As a fallback we can implement purely on our side, ignore the requestConfigFromFrame configuration with a console warning if it is invalid (eg. specifies that the configuration should be retrieved from the ancestor N levels up the frame tree, and N is greater than the number of ancestors). The console warning is important in case the code path ever ends up getting executed when it shouldn't be.

Lenguaje dominante
Mustache
Estrellas
743
Forks
227
Merge medio
6 min
PR fusionados (30 d)
1

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

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 hypothesis/client

Todos los issues de hypothesis/client

Issues similares

Más issues de Web Dev

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.