-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
99 lines (82 loc) · 3.48 KB
/
Copy pathindex.html
File metadata and controls
99 lines (82 loc) · 3.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<!DOCTYPE html>
<html>
<head>
<title>TapeBucket</title>
<link href="/css/paste.css" rel="stylesheet" type="text/css" />
<link href="/css/solarized.css" rel="stylesheet" type="text/css" />
<script src="/js/jquery.min.js"></script>
<script src="/js/crypto-js.min.js"></script>
</head>
<body>
<script>
function uploadPaste() {
var request = new XMLHttpRequest();
request.open("POST", "/submitpaste")
request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
request.timeout = 10000; // timeout in ms, 10 seconds
request.onload = function() { // Call a function when the state changes.
if (this.readyState === XMLHttpRequest.DONE) {
// Request finished. Do processing here.
console.log(this)
if (this.status != 200) {
alert("error: " + this.responseText)
return
}
window.location = this.responseText
}
}
request.send(JSON.stringify({
paste: document.getElementById("paste").value
}))
}
function encrypt(password) {
document.getElementById("paste").value = CryptoJS.AES.encrypt(
document.getElementById("paste").value, password)
}
function decrypt(password) {
document.getElementById("paste").value = CryptoJS.AES.decrypt(
document.getElementById("paste").value, password).toString(CryptoJS.enc.Utf8)
}
function done() {
encrypt(document.getElementById("pass").value);
document.getElementById("popup").style.display = "none";
document.getElementById("pass").value = ""
};
function done2() {
decrypt(document.getElementById("pass2").value);
document.getElementById("popupDecrypt").style.display = "none";
document.getElementById("pass2").value = ""
};
function showPopup() {
document.getElementById("popup").style.display = "block";
}
function showPopupDecrypt() {
document.getElementById("popupDecrypt").style.display = "block";
}
</script>
<button class="btn btn-info" onclick="showPopup()">Encrypt</button>
<button class="btn btn-info" onclick="showPopupDecrypt()">Decrypt</button>
<button class="btn btn-info" onclick=uploadPaste()>Upload!</button>
<div id="popup">
<div id="passwordwarning">
<h1>Warning: Once you press done, no one can decrypt this without the password.
Not even a site admin.</h1>
</div>
<div id="passbox">
<input id="pass" type="password" placeholder="Password" />
</div>
<br>
<button onclick="done()" class="btn">Done</button>
<button onclick="this.parentElement.style.display='none'" class="btn">Cancel</button>
</div>
<div id="popupDecrypt">
<div id="passbox">
<input id="pass2" type="password" placeholder="Password" />
</div>
<button class="btn" onclick="done2()">Done</button>
<button class="btn" onclick="this.parentElement.style.display='none'">Cancel</button>
</div>
<pre class="code">
<code><textarea class="prettyprint" id="paste" placeholder="[ paste text ]" spellcheck="false">{{.Paste}}</textarea></code>
</pre>
</body></html>