@silexlabs/silex 3.0.0-alpha.67 → 3.0.0-alpha.68
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/dist/client/js/main.js
CHANGED
|
@@ -97,7 +97,7 @@ var silex;(()=>{var t={357:function(t){var e;"undefined"!=typeof globalThis?glob
|
|
|
97
97
|
><span>${e.text}</span></div>
|
|
98
98
|
`))}
|
|
99
99
|
</header>
|
|
100
|
-
`,r),document.body.appendChild(r),t.on("load",(()=>{n.view.el.appendChild(r)}))),t.Commands.add(e.command,{run(){e.link&&window.open(e.link),e.attributes.containerClassName&&(n.set("visible",!0),r.classList.remove("gjs-hidden"),t.Canvas.getFrameEl().classList.add("silex-squeeze-left"))},stop(){e.attributes.containerClassName&&(n.set("visible",!1),r.classList.add("gjs-hidden"),t.Canvas.getFrameEl().classList.remove("silex-squeeze-left"))}})})),t.on("load device:select page",(()=>{!function(){const e=n.view.el,r=t.Canvas.getFrameEl();r.classList.remove("enable-squeeze"),setTimeout((()=>{const t=r.getClientRects()[0]?.left,n=e.getClientRects()[0]?.right;t<n||!n?r.classList.add("enable-squeeze"):r.classList.remove("enable-squeeze")}),400),n.get("visible")?r.classList.add("silex-squeeze-left"):r.classList.remove("silex-squeeze-left")}()}))},Nn=document.createElement("div");let In;const Dn="open-settings";let $n="v3";const Rn=nt.plugins.add("settings-dialog",((t,e)=>{try{$n="3.0.0-alpha.
|
|
100
|
+
`,r),document.body.appendChild(r),t.on("load",(()=>{n.view.el.appendChild(r)}))),t.Commands.add(e.command,{run(){e.link&&window.open(e.link),e.attributes.containerClassName&&(n.set("visible",!0),r.classList.remove("gjs-hidden"),t.Canvas.getFrameEl().classList.add("silex-squeeze-left"))},stop(){e.attributes.containerClassName&&(n.set("visible",!1),r.classList.add("gjs-hidden"),t.Canvas.getFrameEl().classList.remove("silex-squeeze-left"))}})})),t.on("load device:select page",(()=>{!function(){const e=n.view.el,r=t.Canvas.getFrameEl();r.classList.remove("enable-squeeze"),setTimeout((()=>{const t=r.getClientRects()[0]?.left,n=e.getClientRects()[0]?.right;t<n||!n?r.classList.add("enable-squeeze"):r.classList.remove("enable-squeeze")}),400),n.get("visible")?r.classList.add("silex-squeeze-left"):r.classList.remove("silex-squeeze-left")}()}))},Nn=document.createElement("div");let In;const Dn="open-settings";let $n="v3";const Rn=nt.plugins.add("settings-dialog",((t,e)=>{try{$n="3.0.0-alpha.68"}catch(t){}console.info("Silex version:",$n),t.Commands.add(Dn,{run:(e,n,{page:r})=>{In=t.Modal.open({title:r?"Page settings":"Site Settings",content:"",attributes:{class:"settings-dialog"}}).onceClose((()=>{n.set("active",0),t.stopCommand(Dn)})),function(t,e,n=t.getModel()){const r=n.get("settings")||{};n.set("settings",r),we(ne`
|
|
101
101
|
<p>The page settings will override site settings, <a href="https://github.com/silexlabs/Silex/wiki/Settings" target="_blank">more info about settings here</a>.</p>
|
|
102
102
|
<form class="silex-form">
|
|
103
103
|
<h2>General settings</h2>
|
|
@@ -15,12 +15,16 @@ function default_1(config) {
|
|
|
15
15
|
return router;
|
|
16
16
|
}
|
|
17
17
|
exports.default = default_1;
|
|
18
|
-
function validateStatus(status,
|
|
18
|
+
function validateStatus(status, _default = 500) {
|
|
19
|
+
if (!status) {
|
|
20
|
+
console.warn(`Status code is undefined, returning default ${_default}`);
|
|
21
|
+
return _default;
|
|
22
|
+
}
|
|
19
23
|
status = parseInt(status.toString());
|
|
20
24
|
if (status >= 100 && status < 600)
|
|
21
25
|
return status;
|
|
22
|
-
console.warn(`Invalid status code ${status}, returning default ${
|
|
23
|
-
return
|
|
26
|
+
console.warn(`Invalid status code ${status}, returning default ${_default}}`);
|
|
27
|
+
return _default;
|
|
24
28
|
}
|
|
25
29
|
async function routeUser(req, res) {
|
|
26
30
|
try {
|
package/package.json
CHANGED
|
@@ -49,14 +49,18 @@ export default function(config: ServerConfig) {
|
|
|
49
49
|
* Method to validate HTTP status codes
|
|
50
50
|
* Returns a suitable error code if it is not valid
|
|
51
51
|
*/
|
|
52
|
-
function validateStatus(status: number,
|
|
52
|
+
function validateStatus(status: number, _default = 500): number {
|
|
53
|
+
if(!status) {
|
|
54
|
+
console.warn(`Status code is undefined, returning default ${_default}`)
|
|
55
|
+
return _default
|
|
56
|
+
}
|
|
53
57
|
// Make sure it is a string
|
|
54
58
|
status = parseInt(status.toString())
|
|
55
59
|
// Check the status code
|
|
56
60
|
if (status >= 100 && status < 600) return status
|
|
57
61
|
// Invalid status code
|
|
58
|
-
console.warn(`Invalid status code ${status}, returning default ${
|
|
59
|
-
return
|
|
62
|
+
console.warn(`Invalid status code ${status}, returning default ${_default}}`)
|
|
63
|
+
return _default
|
|
60
64
|
}
|
|
61
65
|
|
|
62
66
|
/**
|