Skip to content

Instantly share code, notes, and snippets.

@diegoos
Last active May 30, 2022 21:50
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save diegoos/a6414c67e5b0c9525385a556c10aa03d to your computer and use it in GitHub Desktop.
Save diegoos/a6414c67e5b0c9525385a556c10aa03d to your computer and use it in GitHub Desktop.
pages:
stage: deploy
script:
- mkdir .public
- cp -r * .public
- mkdir public
- mv .public public/.public
- cd public
- mv .public HASH_PASSWORD
- wget https://gist.githubusercontent.com/diegoos/a6414c67e5b0c9525385a556c10aa03d/raw/2a96c28318a4419aba0147ff353410b230b4f18e/index.html
artifacts:
paths:
- public
only:
- master
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="noindex, nofollow">
</head>
<style>
body {
color: #333;
}
.box {
border-radius: 3px;
background: rgba(101, 101, 101, 0.7); margin: auto; padding: 12px;
}
.lightbox {
zoom: 1.5;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(10, 10, 10, 0.8);
text-align: center;
margin: auto;
}
div.horizontal {
display: flex;
justify-content: center;
height: 100%;
}
div.vertical {
display: flex;
flex-direction: column;
justify-content: center;
width: 100%;
}
::-webkit-input-placeholder {
color: #955;
text-align: center;
}
::-moz-placeholder {
color: #955;
text-align: center;
}
:-ms-input-placeholder {
color: #955;
text-align: center;
}
</style>
<body>
<div id="loginbox" class="lightbox" >
<div class="horizontal">
<div class="vertical">
<div class="box">
<input style="margin: 16px; text-align: center;" id="password" type="password" placeholder="password" /> <br />
<button id="loginbutton" type="button">Enter</button>
<p id="wrongPassword" style="display: none">wrong password</p>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
<script type="text/javascript" src="https://cdn.rawgit.com/chrisveness/crypto/master/sha1.js"></script>
<script type="text/javascript">
"use strict";
function loadPage(pwd) {
var hash= pwd;
hash= Sha1.hash(pwd);
var url= hash + "/index.html";
$.ajax({
url : url,
dataType : "html",
success : function(data) {
window.location= url;
},
error : function(xhr, ajaxOptions, thrownError) {
parent.location.hash= hash;
//$("#wrongPassword").show();
$("#password").attr("placeholder","wrong password");
$("#password").val("");
}
});
}
$("#loginbutton").on("click", function() {
loadPage($("#password").val());
});
$("#password").keypress(function(e) {
if (e.which == 13) {
loadPage($("#password").val());
}
});
$("#password").focus();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment