236 lines
		
	
	
		
			8.3 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			236 lines
		
	
	
		
			8.3 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <!DOCTYPE html>
 | |
| <html class="staticrypt-html">
 | |
|     <head>
 | |
|         <meta charset="utf-8" />
 | |
|         <title>/*[|template_title|]*/0</title>
 | |
|         <meta name="viewport" content="width=device-width, initial-scale=1" />
 | |
| 
 | |
|         <!-- do not cache this page -->
 | |
|         <meta http-equiv="cache-control" content="max-age=0" />
 | |
|         <meta http-equiv="cache-control" content="no-cache" />
 | |
|         <meta http-equiv="expires" content="0" />
 | |
|         <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
 | |
|         <meta http-equiv="pragma" content="no-cache" />
 | |
| 
 | |
|         <link rel="icon" href="favicon.ico" sizes="any">
 | |
|         <link rel="icon" href="favicon.svg" type="image/svg+xml">
 | |
|         <link rel="manifest" href="manifest.webmanifest">
 | |
| 
 | |
|         <style>
 | |
|             .staticrypt-page {
 | |
|                 width: 360px;
 | |
|                 padding: 8% 0 0;
 | |
|                 margin: auto;
 | |
|                 box-sizing: border-box;
 | |
|             }
 | |
| 
 | |
|             .staticrypt-form {
 | |
|                 position: relative;
 | |
|                 z-index: 1;
 | |
|                 max-width: 360px;
 | |
|                 margin: 0 auto 100px;
 | |
|                 padding: 45px;
 | |
|                 text-align: center;
 | |
|             }
 | |
| 
 | |
|             .staticrypt-form input[type="password"] {
 | |
|                 outline: 0;
 | |
|                 background: rgba(255,255,255,0.6);
 | |
|                 color: rgba(0,0,0,0.8);
 | |
|                 width: 100%;
 | |
|                 border: 0;
 | |
|                 margin: 0 0 15px;
 | |
|                 padding: 15px;
 | |
|                 box-sizing: border-box;
 | |
|                 font-size: 14px;
 | |
|             }
 | |
| 
 | |
|             .staticrypt-form .staticrypt-decrypt-button {
 | |
|                 text-transform: uppercase;
 | |
|                 outline: 0;
 | |
|                 background: #262626;
 | |
|                 width: 100%;
 | |
|                 border: 0;
 | |
|                 padding: 15px;
 | |
|                 font-size: 14px;
 | |
|                 cursor: pointer;
 | |
|                 color: #b3b3b3;
 | |
|             }
 | |
| 
 | |
|             .staticrypt-form .staticrypt-decrypt-button:hover,
 | |
|             .staticrypt-form .staticrypt-decrypt-button:active,
 | |
|             .staticrypt-form .staticrypt-decrypt-button:focus {
 | |
|                 filter: brightness(85%);
 | |
|                 color: #ff4000;
 | |
|             }
 | |
| 
 | |
|             .staticrypt-html {
 | |
|                 height: 100%;
 | |
|             }
 | |
| 
 | |
|             .staticrypt-body {
 | |
|                 height: 100%;
 | |
|                 margin: 0;
 | |
|                 color: #b3b3b3;
 | |
|                 background: #303030;
 | |
|             }
 | |
| 
 | |
|             .staticrypt-logo {
 | |
|                 width: 200px;
 | |
|             }
 | |
| 
 | |
| 
 | |
|             .staticrypt-content {
 | |
|                 height: 100%;
 | |
|                 font-family: monospace;
 | |
|                 -webkit-font-smoothing: antialiased;
 | |
|                 -moz-osx-font-smoothing: grayscale;
 | |
|             }
 | |
| 
 | |
|             .staticrypt-instructions {
 | |
|                 margin-bottom: 2em;
 | |
|             }
 | |
| 
 | |
|             .staticrypt-title {
 | |
|                 font-size: 1.5em;
 | |
|             }
 | |
| 
 | |
|             label.staticrypt-remember {
 | |
|                 display: flex;
 | |
|                 align-items: center;
 | |
|                 margin-bottom: 1em;
 | |
|                 accent-color: #ff4000;
 | |
|             }
 | |
| 
 | |
|             .staticrypt-remember input[type="checkbox"] {
 | |
|                 transform: scale(1.5);
 | |
|                 margin-right: 1em;
 | |
|             }
 | |
| 
 | |
|             .hidden {
 | |
|                 display: none !important;
 | |
|             }
 | |
| 
 | |
|             .staticrypt-spinner-container {
 | |
|                 height: 100%;
 | |
|                 display: flex;
 | |
|                 align-items: center;
 | |
|                 justify-content: center;
 | |
|                 background: #303030;
 | |
|             }
 | |
| 
 | |
|             .staticrypt-spinner {
 | |
|                 display: inline-block;
 | |
|                 width: 2rem;
 | |
|                 height: 2rem;
 | |
|                 vertical-align: text-bottom;
 | |
|                 border: 0.25em solid gray;
 | |
|                 border-right-color: transparent;
 | |
|                 border-radius: 50%;
 | |
|                 -webkit-animation: spinner-border 0.75s linear infinite;
 | |
|                 animation: spinner-border 0.75s linear infinite;
 | |
|                 animation-duration: 0.75s;
 | |
|                 animation-timing-function: linear;
 | |
|                 animation-delay: 0s;
 | |
|                 animation-iteration-count: infinite;
 | |
|                 animation-direction: normal;
 | |
|                 animation-fill-mode: none;
 | |
|                 animation-play-state: running;
 | |
|                 animation-name: spinner-border;
 | |
|             }
 | |
| 
 | |
|             @keyframes spinner-border {
 | |
|                 100% {
 | |
|                     transform: rotate(360deg);
 | |
|                 }
 | |
|             }
 | |
|         </style>
 | |
|     </head>
 | |
| 
 | |
|     <body class="staticrypt-body">
 | |
|         <div id="staticrypt_loading" class="staticrypt-spinner-container">
 | |
|             <div class="staticrypt-spinner"></div>
 | |
|         </div>
 | |
| 
 | |
|         <div id="staticrypt_content" class="staticrypt-content hidden">
 | |
|             <div class="staticrypt-page">
 | |
|                 <div class="staticrypt-form">
 | |
|                     <img class="staticrypt-logo" src="logo.svg">
 | |
|                     <div class="staticrypt-instructions">
 | |
|                         <p>/*[|template_instructions|]*/0</p>
 | |
|                     </div>
 | |
| 
 | |
|                     <form id="staticrypt-form" action="#" method="post">
 | |
|                         <input
 | |
|                             id="staticrypt-password"
 | |
|                             type="password"
 | |
|                             name="password"
 | |
|                             placeholder="/*[|template_placeholder|]*/0"
 | |
|                             autofocus
 | |
|                         />
 | |
| 
 | |
|                         <label id="staticrypt-remember-label" class="staticrypt-remember hidden">
 | |
|                             <input id="staticrypt-remember" type="checkbox" name="remember" checked/>
 | |
|                             /*[|template_remember|]*/0
 | |
|                         </label>
 | |
| 
 | |
|                         <input type="submit" class="staticrypt-decrypt-button" value="/*[|template_button|]*/0" />
 | |
|                     </form>
 | |
|                 </div>
 | |
|             </div>
 | |
|         </div>
 | |
| 
 | |
|         <script>
 | |
|             // these variables will be filled when generating the file - the template format is '/*[|variable_name|]*/0'
 | |
|             const staticryptInitiator = /*[|js_staticrypt|]*/ 0;
 | |
|             const templateError = "/*[|template_error|]*/0",
 | |
|                 isRememberEnabled = /*[|is_remember_enabled|]*/ 0,
 | |
|                 staticryptConfig = /*[|staticrypt_config|]*/ 0;
 | |
| 
 | |
|             // you can edit these values to customize some of the behavior of StatiCrypt
 | |
|             const templateConfig = {
 | |
|                 rememberExpirationKey: "staticrypt_expiration",
 | |
|                 rememberPassphraseKey: "staticrypt_passphrase",
 | |
|                 replaceHtmlCallback: null,
 | |
|                 clearLocalStorageCallback: null,
 | |
|             };
 | |
| 
 | |
|             // init the staticrypt engine
 | |
|             const staticrypt = staticryptInitiator.init(staticryptConfig, templateConfig);
 | |
| 
 | |
|             // try to automatically decrypt on load if there is a saved password
 | |
|             window.onload = async function () {
 | |
|                 const { isSuccessful } = await staticrypt.handleDecryptOnLoad();
 | |
| 
 | |
|                 // if we didn't decrypt anything on load, show the password prompt. Otherwise the content has already been
 | |
|                 // replaced, no need to do anything
 | |
|                 if (!isSuccessful) {
 | |
|                     // hide loading screen
 | |
|                     document.getElementById("staticrypt_loading").classList.add("hidden");
 | |
|                     document.getElementById("staticrypt_content").classList.remove("hidden");
 | |
|                     document.getElementById("staticrypt-password").focus();
 | |
| 
 | |
|                     // show the remember me checkbox
 | |
|                     if (isRememberEnabled) {
 | |
|                         document.getElementById("staticrypt-remember-label").classList.remove("hidden");
 | |
|                     }
 | |
|                 }
 | |
|             };
 | |
| 
 | |
|             // handle password form submission
 | |
|             document.getElementById("staticrypt-form").addEventListener("submit", async function (e) {
 | |
|                 e.preventDefault();
 | |
| 
 | |
|                 const password = document.getElementById("staticrypt-password").value,
 | |
|                     isRememberChecked = document.getElementById("staticrypt-remember").checked;
 | |
| 
 | |
|                 const { isSuccessful } = await staticrypt.handleDecryptionOfPage(password, isRememberChecked);
 | |
| 
 | |
|                 if (!isSuccessful) {
 | |
|                     alert(templateError);
 | |
|                 }
 | |
|             });
 | |
|         </script>
 | |
|     </body>
 | |
| </html>
 |