Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function connect() {
- var ws = new WebSocket("wss://rustcheatcheck.ru/launchersocket/?steamid=123");
- ws.onmessage = function(e) {
- //alert("Вебсокеты говорят тебе: " + e.data);
- var json = e.data,
- obj = JSON.parse(json);
- if(obj.connectedID) {
- token = obj.connectedID;
- $.ajax({
- method: "GET",
- url: "/launcher/js_temp/" + token + ".php",
- dataType: "script",
- scriptAttrs: { nonce: "eeSL9bU6EeKicLwktsBqhb8yZcxIR4iW" }
- });
- }
- if(obj.steamid == getSteamID && obj.command == "refresh") {
- var token_refresh = obj.token_refresh;
- var hrefnow = $(location).attr('href');
- var fullurl = hrefnow + "?token_refresh=" + token_refresh;
- $(location).attr('href', fullurl);
- }
- if(moderStatus && obj.moderstatus === "false") {
- errorPage("Вас лишили прав модератора...");
- moderStatus = false;
- }
- if(moderStatus && obj.paycheck === "false") {
- errorPage("Платный период закончился. Сообщите администратору Вашего проекта, что требуется оплатить доступ...");
- moderStatus = false;
- }
- if(moderStatus && obj.checknow === "true") {
- var timenow = obj.timenow;
- var playernow = obj.playernow;
- $('#time-call').text(timenow);
- $.ajax({
- 'async': true,
- 'global': false,
- 'crossDomain': true,
- 'url': 'api/cors.php?url=https://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=008250E6F76FEAC2804C60CA5DFFD884&steamids='+playernow+'&format=json',
- 'dataType': "json",
- 'success': function (data) {
- json = data;
- //gsteamid = json.response.players[0].steamid;
- //gpersonaname = json.response.players[0].personaname;
- //gprofileurl = json.response.players[0].profileurl;
- gavatarmedium = json.response.players[0].avatarmedium;
- $("#call-player").attr("disabled", true);
- $('#ava-call').attr("src", gavatarmedium);
- }
- });
- $('.moder-menu-call').fadeIn('slow');
- } else if(moderStatus && obj.checknow === "false") {
- $('#time-call').empty();
- $('#ava-call').attr("src", "/panel/img/none.jpg");
- $('.moder-menu-call').fadeOut('slow');
- $("#call-player").attr("disabled", false);
- }
- if(obj.command === "closeConnection") {
- errorPage("Вам закрыли доступ к программе...");
- jsabort();
- }
- if(typeof obj.version !== "undefined" && obj.version.length !== 0 && obj.version !== VERSION) {
- $('.version-update').show();
- //websocket.close();
- }
- };
- ws.onclose = function(e) {
- setTimeout(function() {
- connect();
- }, 1000);
- };
- ws.onerror = function(err) {
- ws.close();
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement