Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmixcom authored Sep 29, 2023
1 parent 869719e commit b1fa821
Show file tree
Hide file tree
Showing 6 changed files with 275 additions and 126 deletions.
2 changes: 1 addition & 1 deletion auth/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
window.localStorage.setItem('buid', new URLSearchParams(location.search).get('uid'))
window.localStorage.setItem('photoURL', new URLSearchParams(location.search).get('pfp'))

window.location = '/manage'
window.location = '/start/school.html?school=' + window.localStorage.getItem('tempSchool')
</script>
138 changes: 87 additions & 51 deletions index.html
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>
76 changes: 2 additions & 74 deletions reported/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,86 +21,14 @@ <h1 class="site-header__title" data-lead-id="site-header-title">THANK YOU!</h1>
<div class="main-content">
<i class="fa fa-check main-content__checkmark" id="checkmark"></i>
<p class="main-content__body" data-lead-id="main-content-body">Thanks for filing that report and helping to keep your school a safer place! You're time is greatly appreciated!
<!-- <br><br>
<p><b id="attr"></b> will be notified shortly. You can check the status of your report <a href="/ur/">here</a>. -->
<br><br>

<br><br>
You may now close this page.</p>
</div>
<script type="text/javascript" id="zsiqchat">var $zoho=$zoho || {};$zoho.salesiq = $zoho.salesiq || {widgetcode: "e053bff667460fb859f95c245f87047d3340a171da85957cb979ec2b856e28fa", values:{},ready:function(){}};var d=document;s=d.createElement("script");s.type="text/javascript";s.id="zsiqscript";s.defer=true;s.src="https://salesiq.zoho.com/widget";t=d.getElementsByTagName("script")[0];t.parentNode.insertBefore(s,t);</script>
<footer class="site-footer" id="footer">
<p class="site-footer__fineprint" id="fineprint">Copyright ©2023 Zymono | All Rights Reserved</p>
</footer>
<script type="module">
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.14.0/firebase-app.js";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries

// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
apiKey: "AIzaSyDelFI3VdZG_0G_SEMWrmB_WKRcw3ZNWFw",
authDomain: "auth-e7b21.firebaseapp.com",
projectId: "auth-e7b21",
storageBucket: "auth-e7b21.appspot.com",
messagingSenderId: "877231972674",
appId: "1:877231972674:web:7a629ac207bfca644168db",
measurementId: "G-3CMXJWW5B6"
};
export default firebaseConfig;
// Initialize Firebase
const app = initializeApp(firebaseConfig);

import { getStorage, ref, uploadString } from "https://www.gstatic.com/firebasejs/9.14.0/firebase-storage.js";
import { getDownloadURL, listAll } from "https://www.gstatic.com/firebasejs/9.14.0/firebase-storage.js";
const storage = getStorage()

document.querySelector('#attr').innerText = new URLSearchParams(location.search).get('platform')

function sendNotif(who, fn, u, r, p) {

const get1 = `zymono/${who}/dsc.txt`

getDownloadURL(ref(storage, get1))
.then((url) => {
// // `url` is the download URL for your variable

const xhr = new XMLHttpRequest();

xhr.open('GET', url);
xhr.onload = function() {
if (xhr.status === 200) {

fetch("https://zymono-discord-notifications.cosmixcom.repl.co/dm", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer myToken"
},
body: JSON.stringify({
username: xhr.responseText,
message: {
user: u,
reason: r,
platform: p,
to: fn
},
id: xhr.responseText
})
});
return 'working'

} else {

}
};
xhr.onerror = function(error) {

};
xhr.send();
})
}

// sendNotif(new URLSearchParams(location.search).get('who'), new URLSearchParams(location.search).get('fn'), new URLSearchParams(location.search).get('u'), new URLSearchParams(location.search).get('r'), new URLSearchParams(location.search).get('p'))
</script>
</body>
</html>
66 changes: 66 additions & 0 deletions script.js
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()
4 changes: 4 additions & 0 deletions start/index.html
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>
Loading

0 comments on commit b1fa821

Please sign in to comment.