#47 added the filenameTemplate setting and reads it in both download paths, but the options page has no field for it, so it is storage-only and unreachable in practice.
Why it was not in that PR
options.js is loaded as a plain script (<script src="options.js">), so it cannot import validateTemplate from platforms/common.js. Reusing the validator needs the options page converted to type="module".
The alternative — reimplementing validation inline in a non-module script — would recreate exactly the drift #47 removed. The validator in that PR had a bug precisely because it re-derived a rule the renderer already owned, and the fix was to make it call the renderer instead. Writing a third copy in the options page would be the same mistake with a wider gap between the copies.
Scope
- Convert
options.html to load options.js as a module.
- Add a text input beside the existing folder field, with the token list in the description. The folder field already documents
{platform}; both settings now share one vocabulary, so document them together.
- Validate on input with
validateTemplate(value) for the filename and validateTemplate(value, { allowSlash: true }) for the folder, showing reason inline. The reasons are written to be read by a user, including the case-sensitivity hint and the pointer from "no slashes in a filename" to the folder setting.
- Extend the existing live preview to render the filename too, so the effect is visible before saving.
renderTemplate against a sample field bag is what the preview should call — the same reason as above.
- Refuse to save an invalid template rather than storing it and failing quietly at download time.
#47 added the
filenameTemplatesetting and reads it in both download paths, but the options page has no field for it, so it is storage-only and unreachable in practice.Why it was not in that PR
options.jsis loaded as a plain script (<script src="options.js">), so it cannot importvalidateTemplatefromplatforms/common.js. Reusing the validator needs the options page converted totype="module".The alternative — reimplementing validation inline in a non-module script — would recreate exactly the drift #47 removed. The validator in that PR had a bug precisely because it re-derived a rule the renderer already owned, and the fix was to make it call the renderer instead. Writing a third copy in the options page would be the same mistake with a wider gap between the copies.
Scope
options.htmlto loadoptions.jsas a module.{platform}; both settings now share one vocabulary, so document them together.validateTemplate(value)for the filename andvalidateTemplate(value, { allowSlash: true })for the folder, showingreasoninline. The reasons are written to be read by a user, including the case-sensitivity hint and the pointer from "no slashes in a filename" to the folder setting.renderTemplateagainst a sample field bag is what the preview should call — the same reason as above.