]> git.ardis.lu - static-encrypt/commitdiff
Fetch from "/template" instead of "/template.html"
authorArdis Lu <ardisglu@gmail.com>
Fri, 7 Jun 2024 05:01:22 +0000 (22:01 -0700)
committerArdis Lu <ardisglu@gmail.com>
Fri, 7 Jun 2024 05:01:22 +0000 (22:01 -0700)
Otherwise, Cloudflare Pages will waste time with a redirection.

README.md
index.html

index bc2d0f87d56b44ef0cdef5a2ead5577339d15b53..87a79d1041cc206292b3bdab47b785660cca7a4a 100644 (file)
--- a/README.md
+++ b/README.md
@@ -95,3 +95,11 @@ tsc --declaration --emitDeclarationOnly --allowJs .\decrypt.js .\encrypt.js
 ```
 
 These `*.d.ts` files allow `encrypt` and `decrypt` to be imported in `.ts` files with typing.
+
+## Local testing
+
+Host the files on any web host configured to serve static files and add a default file extension of `.html` to plain paths. For example, using [local-web-server](https://github.com/lwsjs/local-web-server/):
+
+```
+ws --static.extensions html 
+```
index bd386740f6909f7d7b6f68bc8487c0de77e8b55b..97acffc13d767c423ce71e5e9d145ddf6791c541 100644 (file)
@@ -13,7 +13,7 @@
   <link rel="icon" href="data:,">
   <link rel="modulepreload" href="/encrypt.js" crossorigin>
   <link rel="modulepreload" href="/decrypt.js" crossorigin>
-  <link rel="preload" as="fetch" href="/template.html" crossorigin>
+  <link rel="preload" as="fetch" href="/template" crossorigin>
   <title>static-encrypt</title>
   <style>
     * {
       downloadHtml(output, `${Date.now()}.html`);
     })
 
-    const template = await fetch('/template.html').then(r => r.text());
+    const template = await fetch('/template').then(r => r.text());
 
     // For debugging and bulk usage in the DevTools console
     globalThis.help = function () {
This page took 0.039326 seconds and 4 git commands to generate.