-
Notifications
You must be signed in to change notification settings - Fork 1
/
api.html
44 lines (44 loc) · 1.72 KB
/
api.html
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
<html>
<head>
<title>CTRL+ALT+TEC KIWI API (v.1.3)</title>
<script src="https://www.gstatic.com/firebasejs/5.4.2/firebase.js"></script>
</head>
<body>
<h1>KIWI</h1>
<h2>REST API</h2>
<div id="return"></div>
<script>
// Initialize Firebase
var config = {
apiKey: "AIzaSyDlqcRMOR7P4PeKnnY3-6OEjMHZ2xnG3bc",
authDomain: "ctrl-alt-tec-api.firebaseapp.com",
databaseURL: "https://ctrl-alt-tec-api.firebaseio.com",
projectId: "ctrl-alt-tec-api",
storageBucket: "ctrl-alt-tec-api.appspot.com",
messagingSenderId: "613390401674"
};
firebase.initializeApp(config);
var urlParams = new Map();
window.location.search.substring(1).split("&").forEach(function(item){
urlParams.set(item.split("=")[0], item.split("=")[1])
})
if(urlParams.get("KEY")=="iruKHi4qAih4kg0fvDHbMNfvPBa2" && Math.floor(Date.now() / 1000) - parseInt(urlParams.get('TIMESTAMP')) < 20){
firebase.firestore().collection("bankTransfers").doc().set({
TARGET: '[email protected]',
CONCEPT: 'kiwi print',
QUANTITY: parseInt(urlParams.get('PAGES'))*1.5,
DATE: new Date(),
FINISHED: false,
USER: urlParams.get('USER')+'@itesm.mx',
TYPE: 'PAYMENT'
}).then(function(){
document.querySelector("#return").innerText = "Succesfully charged $"+parseInt(urlParams.get('PAGES'))*1.5+" to "+ urlParams.get('USER')+'@itesm.mx' + " for using kiwi."
})
}else{
alert('SECURITY WARNING!\n The key provided is not valid or the link has expired')
}
console.log(urlParams)
console.log(urlParams.get('USER'))
</script>
</body>
</html>