diff --git a/.gitignore b/.gitignore index 489f13a..b1379bb 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ history.json /.idea/jsLibraryMappings.xml db/users.json +db/users.json diff --git a/public/msgsw.js b/public/msgsw.js index 328465d..7356235 100644 --- a/public/msgsw.js +++ b/public/msgsw.js @@ -1,33 +1,73 @@ -// import { initializeApp} from "https://www.gstatic.com/firebasejs/10.8.0/firebase-app.js"; -// import { getDatabase, ref, onValue, set } from "https://www.gstatic.com/firebasejs/10.8.0/firebase-database.js"; -// const firebaseConfig = { apiKey: "AIzaSyAQ89agVS02dwVK9-yWwpZOvMkQWLiKcEM", authDomain: "fixcraft-vpn.firebaseapp.com", databaseURL: "https://fixcraft-vpn-default-rtdb.firebaseio.com", projectId: "fixcraft-vpn", storageBucket: "fixcraft-vpn.appspot.com", messagingSenderId: "811886239981", appId: "1:811886239981:web:9e43da7b31be5f7fb1ace4", measurementId: "G-CTR9TEET9E" }; -// const app = initializeApp(firebaseConfig); -// const db = getDatabase(); -// const infodat = ref(db, 'data'); -// onValue(infodat, (snapshot) => { -// var data1 = snapshot.val(); -// const data = {"title":"FixCraftV2 - Chat"} -// var snd="" -// var msg="" -// const options = { -// tag: "Chat", -// body: snd+" - "+msg, -// icon: "FixCraft.png", -// image: "FixCraft.png", -// vibrate: 500, -// } -// -// event.waitUntil( -// self.registration.showNotification(data.title, options) -// );}) +import { initializeApp} from "https://www.gstatic.com/firebasejs/10.8.0/firebase-app.js"; +import { getDatabase, ref, onValue, set } from "https://www.gstatic.com/firebasejs/10.8.0/firebase-database.js"; +self.addEventListener('install', (event) => { + event.waitUntil((async () => { -self.addEventListener('message', (event) => { - let notification = event.data; - self.registration.showNotification( - notification.title, - notification.options - ).catch((error) => { + +const firebaseConfig = { apiKey: "AIzaSyAQ89agVS02dwVK9-yWwpZOvMkQWLiKcEM", authDomain: "fixcraft-vpn.firebaseapp.com", databaseURL: "https://fixcraft-vpn-default-rtdb.firebaseio.com", projectId: "fixcraft-vpn", storageBucket: "fixcraft-vpn.appspot.com", messagingSenderId: "811886239981", appId: "1:811886239981:web:9e43da7b31be5f7fb1ace4", measurementId: "G-CTR9TEET9E" }; +const app = initializeApp(firebaseConfig); +const db = getDatabase(); +const infodat = ref(db, 'data'); +onValue(infodat, (snapshot) => { + var data1 = snapshot.val(); + +var now = new Date +var tmp = new Date(data1.chat[data1.chat.length-1].timestamp) + +if(((now-tmp)/1000)<6){ + const data = {"title":"FixCraftV2 - Chat"} + var snd=data1.chat[data1.chat.length-1].sender + var msg=data1.chat[data1.chat.length-1].content + const options = { + tag: "Chat", + body: snd+" - "+msg, + icon: "FixCraft.png", + image: "FixCraft.png", + vibrate: 500, +} +self.registration.showNotification( + data.title, + options +).catch((error) => { +console.log(error); +});} + +}) +const infodat2 = ref(db, 'server'); +onValue(infodat2, (snapshot) => { + var dats = snapshot.val(); + var nowf = new Date + if(dats.anounce!=undefined){ + var tmpf = new Date(dats.anounce[dats.anounce.length-1].timestamp) }else{ + var tmp = 0 + } + + if(((nowf-tmpf)/1000)<6){ + const data = {"title":"FixCraftV2 - Anouncement"} + var msg=dats.anounce[dats.anounce.length-1].content + const options = { + tag: "Anouncement", + body: msg, + icon: "FixCraft.png", + image: "FixCraft.png", + vibrate: 500, + } + self.registration.showNotification( + data.title, + options + ).catch((error) => { console.log(error); - }); + });}}) +})()); }); +// self.addEventListener('message', (event) => { +// let notification = event.data; +// self.registration.showNotification( +// notification.title, +// notification.options +// ).catch((error) => { +// console.log(error); +// }); +// }); + diff --git a/public/password.js b/public/password.js index 7ea9a0a..d4d0eee 100644 --- a/public/password.js +++ b/public/password.js @@ -9,8 +9,11 @@ import "/platform.js"; var visitorId = "000"; var hwid="000x000" var hwidban= {} +console.clear=function(){} if ("serviceWorker" in navigator) { - navigator.serviceWorker.register("https://remote.fixcraft.org/msgsw.js").then( + navigator.serviceWorker.register("./msgsw.js",{ + type: 'module', + }).then( (registration) => { console.log("Service worker registration succeeded:", registration); }, diff --git a/serve.mjs b/serve.mjs index f7bfcb6..b9a8f52 100644 --- a/serve.mjs +++ b/serve.mjs @@ -131,16 +131,17 @@ export function Serve(path, config, cors) { return list; } - if(parseCookies(req).usernamecred==undefined&&parseCookies(req).passwordcred==undefined&&parseCookies(req).canlogintosite!="truesigma"){ - if((path+req.url.split('?')[0].split('#')[0]).includes("cf-icon")==true||path+req.url.split('?')[0].split('#')[0]=="./public/fixcraft.png"){ + if(parseCookies(req).usernamecred==undefined&&parseCookies(req).passwordcred==undefined&&parseCookies(req).canlogintosite!="truesigma"||true){ + if((path+req.url.split('?')[0].split('#')[0]).includes("cf-icon")==true||path+req.url.split('?')[0].split('#')[0]=="./public/fixcraft.png"||true){ try{ readFileSync(path+req.url.split('?')[0].split('#')[0]) + console.log(date.gray+ipAddress+" GRANTED VIEW ACCESS!".green+" ("+userpath.gray+")") return res.writeHead(200, {'content-type':type, 'access-control-allow-origin':cors?'*':request.headers['host']}).end(readFileSync(path+req.url.split('?')[0].split('#')[0])) }catch{} } - console.log(date.gray+ipAddress+" SHOWING INACCESSIBLE PAGE, NEW".red+" ("+userpath.gray+")") - return res.writeHead(200, {'content-type':'text/html', 'access-control-allow-origin':cors?'*':request.headers['host']}).end(readFileSync("./private/block/block.html")) + // console.log(date.gray+ipAddress+" SHOWING INACCESSIBLE PAGE, NEW".red+" ("+userpath.gray+")") + // return res.writeHead(200, {'content-type':'text/html', 'access-control-allow-origin':cors?'*':request.headers['host']}).end(readFileSync("./private/block/block.html")) }else if(parseCookies(req).usernamecred==undefined&&parseCookies(req).passwordcred==undefined){ var whitelist=["./public/api/ip","./public/copyright/hardwareidjs.js","./public/rehost/fingerprintjs/v4.js","./public/password.css","./public/snackbar.css","./public/snackbar.js","./public/host.js","./public/jquery.js","./public/setup.js","./public/password.js","./public/copyright/hardwareidjs.js","./public/platform.js","./public/lock.png"] for(var oioi = 0; oioi