-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
66 lines (57 loc) · 2.04 KB
/
script.js
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
if (!window.localStorage.getItem('uid')) {
window.location = '/start/'
}
async function run() {
const response = await fetch('https://zymono.com/myschoolapi/getschool', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ uid: window.localStorage.getItem('uid') }),
});
if (response.ok) {
const school = await response.json();
// console.log(school)
document.getElementById('report').addEventListener('submit', function(event) {
event.preventDefault()
document.getElementById('button').disabled = true
document.getElementById('button').textContent = 'Loading...'
const apiKey = 'db2e08783da783967be5eb3f488a1e6a';
const apiUrl = 'https://api.imgbb.com/1/upload';
const formData = new FormData();
const inputFile = document.getElementById('image-input').files[0];
formData.append('image', inputFile);
formData.append('key', apiKey);
fetch(apiUrl, {
method: 'POST',
body: formData
})
.then(response => response.json())
.then(data => {
if (data.success) {
const imageUrl = data.data.url;
fetch('//zymono.com/api/report', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
id: school.school, //Panel Key from https://zymono.com/me/ (Same as API key)
user: document.getElementById('name').value, //User being reported
imgURL: imageUrl, //Url of an image for evidence (You can leave this blank)
reason: document.getElementById('reason').value, //Reason for report
device: window.location.hostname //Platform (E.g. Minecraft, Xbox, Discord, etc)
})
})
.then(function(res) {
window.location = '/reported/'
})
}
})
})
} else {
window.location = '/start/'
}
console.log(response)
}
run()