site
Version:
Site Engine is the world's first all-in-one engine to build a modern web site, game, or blog. No HTML or CSS knowledge required.
1 lines • 6.36 kB
JavaScript
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.sendOAuthCallback=exports.sendBrowsePage=exports.sendPasswordMismatchError=exports.sendNewPasswordOk=exports.send302=exports.send500=void 0;var t,e,n,o,r,s,a=require("./shared.manifest");exports.send500=t=function(t){return(()=>(t.statusCode=500,t.setHeader("Content-Type","text/html"),t.end('\n<html xmlns="http://www.w3.org/1999/xhtml">\n <head>\n <meta http-equiv="content-type" content="text/html; charset=utf-8" />\n <title>Error</title>\n <meta name="viewport" content="width=device-width" />\n </head>\n <body>\n <h1>Error</h1>\n </body>\n</html>')))()},exports.send302=e=function(t,e){return(()=>(e.statusCode=302,e.setHeader("Location",t),e.end()))()},exports.sendNewPasswordOk=n=function(t,e){return(()=>(e.statusCode=200,e.setHeader("Content-Type","text/html"),""===t?(()=>(e.setHeader("Set-Cookie",["serverPassword_705357537593286848=_null_; Path=/; Expires=Wed, 01 Jan 1000 00:00:00 GMT; Secure; SameSite=Strict"]),e.end('\n<html xmlns="http://www.w3.org/1999/xhtml">\n <head>\n <meta http-equiv="content-type" content="text/html; charset=utf-8" />\n <title>Removing Password OK</title>\n <meta name="viewport" content="width=device-width" />\n </head>\n <body>\n <h1>Removing Password OK</h1>\n <p>Successfully removed the password from browser cookie.</p>\n </body>\n</html>')))():(()=>(e.setHeader("Set-Cookie",["serverPassword_705357537593286848="+t+"; Path=/; Expires=Fri, 01 Jan 9999 00:00:00 GMT; Secure; SameSite=Strict"]),e.end('\n<html xmlns="http://www.w3.org/1999/xhtml">\n <head>\n <meta http-equiv="content-type" content="text/html; charset=utf-8" />\n <title>New Password OK</title>\n <meta name="viewport" content="width=device-width" />\n </head>\n <body>\n <h1>New Password OK</h1>\n <p>Successfully set a password in browser cookie.</p>\n </body>\n</html>')))()))()},exports.sendPasswordMismatchError=o=function(t){return(()=>(t.statusCode=500,t.setHeader("Content-Type","text/html"),t.end('\n<html xmlns="http://www.w3.org/1999/xhtml">\n <head>\n <meta http-equiv="content-type" content="text/html; charset=utf-8" />\n <title>Password Mismatch</title>\n <meta name="viewport" content="width=device-width" />\n </head>\n <body>\n <h1>Password Mismatch</h1>\n <p>However, you can go to "set password in browser cookie" page:</p>\n Password:<br />\n <input type="password" id="password" /><br />\n <button type="button" onclick="location.href= \'/.password/\'+document.getElementById(\'password\').value;">Go</button>\n </body>\n</html>')))()},exports.sendBrowsePage=r=function(t){return(()=>(t.statusCode=200,t.setHeader("Content-Type","text/html"),t.end('\n<html xmlns="http://www.w3.org/1999/xhtml">\n <head>\n <meta http-equiv="content-type" content="text/html; charset=utf-8" />\n <title>Browse</title>\n <meta name="viewport" content="width=device-width" />\n <script type="text/javascript">\n document.addEventListener("DOMContentLoaded", function() {\n document.getElementById("browse").addEventListener("click", function() {\n var uri = document.getElementById("uri").value;\n if (uri[0] === "/" && uri[1] !== "/" && uri[1] !== "\\\\") {\n location.href = uri;\n }\n else {\n alert(\n \'Address must be a relative URL that starts with "/" \' +\n \'(and cannot start with "//" or "/\\\\")\'\n );\n }\n });\n });\n <\/script>\n </head>\n <body>\n <h1>Browse</h1>\n <p>\n Go to the address as an "href". It will append a "Referer"\n header to the request so that it won\'t be blocked (unlike the browser\'s address bar).\n </p>\n <input id="uri" /><br />\n <button type="button" id="browse">Browse</button>\n </body>\n</html>')))()},exports.sendOAuthCallback=s=function(t,e,n,o){return void 0===n&&(n=null),(0,a.assert)("string"==typeof t&&1<=(i=t.length)&&i<=1e3),[r,s]=null!=e?(()=>((0,a.assert)("string"==typeof e.name&&1<=(h=e.name.length)&&h<=100),(0,a.assert)("string"==typeof e.accessToken&&1<=(l=e.accessToken.length)&&l<=1e3),[e.name,e.accessToken]))():[null,null],d=JSON.stringify(n),(0,a.assert)("string"==typeof d),o.statusCode=200,o.setHeader("Content-Type","text/html"),o.end('\n<html xmlns="http://www.w3.org/1999/xhtml">\n <head>\n <meta http-equiv="content-type" content="text/html; charset=utf-8" />\n <title>OAuth</title>\n <meta name="viewport" content="width=device-width" />\n <script type="text/javascript">\n document.addEventListener("DOMContentLoaded", function() {\n try {\n var meta = JSON.parse(localStorage.meta);\n if (\n localStorage.metaSchema === "v2" &&\n '+JSON.stringify(t)+" === meta.oAuthState\n ) {\n var toUri = meta.oAuthFinalUri;\n meta.oAuthState = null;\n meta.oAuthFinalUri = null;\n meta.oAuthName = "+JSON.stringify(r)+";\n meta.oAuthAccessToken = "+JSON.stringify(s)+";\n meta.oAuthAttachment = "+d+';\n localStorage.meta = JSON.stringify(meta);\n location.href = toUri;\n }\n else {\n throw new Error();\n }\n }\n catch (ex) {\n document.body.textContent = "OAuth error.";\n }\n });\n <\/script>\n </head>\n <body>\n </body>\n</html>');var r,s,d,i,h,l},exports.send500=t,exports.send302=e,exports.sendNewPasswordOk=n,exports.sendPasswordMismatchError=o,exports.sendBrowsePage=r,exports.sendOAuthCallback=s;