-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
275 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,92 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width"> | ||
<title>Zymono mySchool</title> | ||
<link href="style.css" rel="stylesheet" type="text/css" /> | ||
<link rel="manifest" href="/manifest.json"> | ||
<script> | ||
if ('serviceWorker' in navigator) { | ||
navigator.serviceWorker.register('/service-worker.js') | ||
.then(function (registration) { | ||
console.log('Service Worker registered with scope:', registration.scope); | ||
// if (window.localStorage.getItem('buid')) { | ||
// window.location = '/report/' | ||
// } else { | ||
// window.location = '/flows/signup/' | ||
// } | ||
}) | ||
.catch(function (error) { | ||
console.log('Service Worker registration failed:', error); | ||
}); | ||
} | ||
|
||
if ('serviceWorker' in navigator) { | ||
navigator.serviceWorker.register('/service-worker.js') | ||
.then(function(registration) { | ||
registration.addEventListener('updatefound', function() { | ||
const newWorker = registration.installing; | ||
newWorker.addEventListener('statechange', function() { | ||
if (newWorker.state === 'installed') { | ||
// Prompt the user to update the page | ||
} | ||
}); | ||
}); | ||
}) | ||
.catch(function(error) { | ||
console.log('Service Worker registration failed:', error); | ||
}); | ||
} | ||
|
||
</script> | ||
</head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Report With Zymono</title> | ||
<style> | ||
body { | ||
font-family: Arial, sans-serif; | ||
margin: 0; | ||
padding: 0; | ||
background-color: #333; | ||
color: #fff; | ||
} | ||
|
||
.container { | ||
max-width: 100%; | ||
height: 100vh; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
padding: 20px; | ||
} | ||
|
||
h2 { | ||
text-align: center; | ||
} | ||
|
||
label { | ||
display: block; | ||
margin-bottom: 10px; | ||
font-weight: bold; | ||
} | ||
|
||
input[type="text"], input[type="file"], | ||
textarea { | ||
width: 100%; | ||
padding: 10px; | ||
margin-bottom: 15px; | ||
border: 1px solid #555; | ||
border-radius: 5px; | ||
background-color: #444; | ||
color: #fff; | ||
} | ||
|
||
textarea { | ||
height: 150px; | ||
} | ||
|
||
button { | ||
background-color: #007BFF; | ||
color: #fff; | ||
padding: 10px 20px; | ||
border: none; | ||
width: 107%; | ||
border-radius: 5px; | ||
cursor: pointer; | ||
} | ||
|
||
button:hover { | ||
background-color: #0056b3; | ||
} | ||
|
||
.emergency { | ||
color: #932a2a; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<script> | ||
if (window.localStorage.getItem('buid')) { | ||
window.location = '/report/' | ||
} else { | ||
window.location = '/flows/signup/' | ||
} | ||
</script> | ||
</body> | ||
<div class="container"> | ||
<img height="180px" src="//zymono.com/images/zymono-light.png"> | ||
<h2>Report</h2> | ||
<p class="emergency">If There Is An Immediate Threat To Your Life, Call <u>911</u></p> | ||
<form action="#" id="report"> | ||
<!-- <label for="reporter-name">Your Name:</label> | ||
<input type="text" id="reporter-name" name="reporter-name" required> --> | ||
<label for="file">Evidence:</label> | ||
<input type="file" id="image-input" accept=".jpg, .jpeg, .png .svg" max-size="32MB" name="file"> | ||
|
||
<label for="reported-name">Name of Person Being Reported:</label> | ||
<input type="text" id="name" name="reported-name" required> | ||
|
||
<label for="report-reason">Reason for Reporting:</label> | ||
<textarea id="reason" name="report-reason" required></textarea> | ||
|
||
</html> | ||
<button type="submit" id="button">Submit Report</button> | ||
</form> | ||
</div> | ||
<script src="script.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<script> | ||
window.localStorage.setItem('tempSchool', new URLSearchParams(location.search).get('school')) | ||
window.location = 'https://zymono.com/auth/?b=https://' + window.location.hostname + '/auth' | ||
</script> |
Oops, something went wrong.