@elurjs/universal 0.1.14 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/dev.mjs +2 -1
- package/cli/sdui.mjs +9 -0
- package/package.json +1 -1
package/cli/dev.mjs
CHANGED
|
@@ -201,7 +201,8 @@ const WEB_MIME = {
|
|
|
201
201
|
};
|
|
202
202
|
function withReloadScript(html) {
|
|
203
203
|
const script = `<script>(()=>{const es=new EventSource("/__elur_dev");` +
|
|
204
|
-
`es.onmessage=e=>{if(e.data==="reload")location.reload();}
|
|
204
|
+
`es.onmessage=e=>{if(e.data==="reload")location.reload();};` +
|
|
205
|
+
`addEventListener("beforeunload",()=>es.close());})();</script>`;
|
|
205
206
|
return html.includes("</body>")
|
|
206
207
|
? html.replace("</body>", script + "</body>")
|
|
207
208
|
: html + script;
|
package/cli/sdui.mjs
CHANGED
|
@@ -635,6 +635,15 @@ if (sub === "gateway") {
|
|
|
635
635
|
const urlObj = new URL(req.url ?? "/", "http://127.0.0.1");
|
|
636
636
|
const pathname = urlObj.pathname;
|
|
637
637
|
|
|
638
|
+
if (req.method === "GET" &&
|
|
639
|
+
(pathname === "/" || pathname === "/favicon.ico")) {
|
|
640
|
+
return send(200, {
|
|
641
|
+
ok: true, rev,
|
|
642
|
+
rutas: "POST /serve | POST /publish | GET /poll | " +
|
|
643
|
+
"GET /stream | POST /action | GET /actions",
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
|
|
638
647
|
if (req.method === "GET" && pathname === "/poll") {
|
|
639
648
|
const since = Number(urlObj.searchParams.get("since") ?? "0");
|
|
640
649
|
if (rev > since && liveItem) {
|