faustedition / faust-gen-html

Pipelines to generate HTML for the Faust edition's reading texts and prints.
1 stars 4 forks source link

Explicit shortcut API #654

Closed thvitt closed 3 years ago

thvitt commented 3 years ago

Shortcuts (i.e. vers numbers or sigils) are currently implemented in the controller by generating redirects to the target URL, optionally including the URL fragment.

This works fine when the main browser window navigates to /query?q=〈shortcut〉, however, the AJAX solution for the search page implemented in faustedition/faust-web#583 appearently has no way to access the actual target URL including the fragment:

(a) using fetch(…, {redirect: 'auto'}) follows all redirects but the response does no longer include the fragment (b) using fetch(…, {redirect: 'manual'}) (or error) is practically indistinguishable from a network error, header data is available.

A separate function that could be used from the controller could either generate the new URL in a simple non-redirect response or generate an error on a 'no shortcut' case especially for the AJAX search API while the /query endpoint could continue working in the same way as it does now.