can you help me with my Twitch Ban Checker
it worked a few months ago, but something is wrong now
maybe someone can give me a tip why it doesn't work anymore
I wrote this Twitch Ban Checker which, after entering the username, gives an answer whether you were banned on Twitch or not
the app is also on codepen https://codepen.io/olthoffs/pen/zqxbWW
var check_user = function (user) {
$(".description").fadeOut(20)
$.getJSON('https://api.twitch.tv/kraken/users/' + encodeURIComponent(user) + '?callback=?').done(function (data) {
if (/.+is unavailable$/.test(data.message)) { // Ban Check
var message = 'It looks like you were banned from twitch, please open a ticket via the '
message += '<a target="_blank" href="https://help.twitch.tv/customer/portal/emails/new?interaction[name]=' + user + '">official twitch support</a> '
message += 'site in order to see why you were banned.<br />'
message += '<span>TwitchTips cannot and will not help with your appeal</span>'
form_result('fail', message)
} else if (/.+is not available on Twitch$/.test(data.message) || /.+does not exist$/.test(data.message)) { // JTV/Nonexistant Check
var message = 'That account is either not a Twitch account or it does not exist.'
form_result('warn', message)
} else {
var message = 'The account provided does not seem to be banned on Twitch. '
message += 'If you\'re seeing a message telling you that you\'re blocked from Twitch, '
message += 'try disabling any VPN, proxy, or extension which re-routes traffic from your browser.<br/><br/>'
message += 'Got multiple accounts? Try checking those too because Twitch bans can be IP based.<br/><br/>'
message += 'If after doing so you are still getting the same error, '
message += 'your ISP may have provided your modem with a previously banned IP address. '
message += 'You can <a style="color: #fff" href="https://help.twitch.tv/customer/portal/emails/new?interaction[name]=' + user + '" target="_blank"><strong>open a ticket</strong></a> with Twitch to check.'
form_result('success', message)
}
}).fail(function () {
form_result('warn', 'The Twitch API appears to have returned an invalid response. Twitch may be having issues at the moment.')
})
}
var form_result = function (type, message) {
if (type === 'success') {
var title = "All is well!"
} else if (type === 'warn') {
var title = "Hmm, That's not right!"
} else {
var title = "Oh dear!"
}
$('.result').attr('class', 'result')
$('.result').html('<h3>' + title + '</h3>' + message)
$('.result').addClass(type)
$(".result").fadeIn()
}
$(document).ready(function () {
$('#ban-check').submit(function (e) {
e.preventDefault()
})
$('#ban-check').keyup(function (e) {
if (e.keyCode !== 13) {
return
}
e.preventDefault()
var user = $('#ban-check input').val()
window.location.hash = '#' + user
check_user(user)
})
var hash = location.hash
if (hash) {
var user = hash.substr(1)
$('#ban-check input').val(user)
check_user(user)
}
})
GET https://api.twitch.tv/kraken/users
(with client-id in the header)
returns:
{
"error": "Gone",
"status": 410,
"message": "It's time to kick ass and serve v3... and I'm all outta v3. See https://dev.twitch.tv/docs"
}
You might need to switch to helix, and go through OAuth flow.
Related
I was wondering if I could just simply do the following to limit logins, but I seem to run into a problem where the page just reloads constatly once I log in once.
function onSignIn(googleUser) {
var profile = googleUser.getBasicProfile();
console.log('Name: ' + profile.getName());
console.log('Email: ' + profile.getEmail()); // This is null if the 'email' scope is not present.
//list the emails that can login to the website using Gmail OAuth
if (profile.getEmail() == "XXXXXXXX#gmail.com") {
window.location.href = "./index.html"
} else {
let done = confirm("You don't have permission to access this.")
if (done) {
window.location.href = "https://www.HOMEPAGEco.uk/"
} else {
alert("Please try again.")
}
}
}
The line window.location.href = "./index.html" will always reload the page; if you want no action to be taken when they are in the whitelist, just check if they are NOT in the list.
if (profile.getEmail() !== "XXXXXXXX#gmail.com") {
let done = confirm("You don't have permission to access this.")
if (done) {
window.location.href = "https://www.HOMEPAGEco.uk/"
} else {
alert("Please try again.")
}
}
i'm having an issue trying to use the {Linking} package. I'd like to send a text message to an specific number, like in the following code:
import { Linking } from ‘react-native’;
WhatsApp = (text, phone) => {
Linking.openURL(`whatsapp://send?text=${text}&phone=${phone}`);
}
But it happens that the message gets written in the App's text field, but I still need to press the 'send' button in order to really deliver my message. Does anybody know how to fix it? (send the message without having to press the button?)
Try this way:
WhatsApp = () => {
let msg = 'type something';
let phoneWithCountryCode = 'xxxxxxxxxx';
let mobile = Platform.OS == 'ios' ? phoneWithCountryCode : '+' + phoneWithCountryCode;
if (mobile) {
if (msg) {
let url = 'whatsapp://send?text=' + msg + '&phone=' + mobile;
Linking.openURL(url).then((data) => {
console.log('WhatsApp Opened');
}).catch(() => {
alert('Make sure WhatsApp installed on your device');
});
} else {
alert('Please insert message to send');
}
} else {
alert('Please insert mobile no');
}}
Please Note: send + in front of phone with country if opening in android
I'm helping my friend with some code, and I tried to fix the problem in it, but neither of us can figure it out, so here I am, asking people on StackOverflow for help!
var colors = require('colors/safe');
var chalkAnimation = require('chalk-animation');
var nodemailer = require('nodemailer');
var Username = prompt('[ⓘ SET UP INFO ] - Please start the connect process by typing in: "mh!startup" ');
if (Username == 'mh!startup') {
const RainbowMPPHAXX = chalkAnimation.rainbow(`███╗░░░███╗██████╗░██████╗░ ██╗░░██╗░█████╗░██╗░░██╗██╗░░██╗
████╗░████║██╔══██╗██╔══██╗ ██║░░██║██╔══██╗╚██╗██╔╝╚██╗██╔╝
██╔████╔██║██████╔╝██████╔╝ ███████║███████║░╚███╔╝░░╚███╔╝░
██║╚██╔╝██║██╔═══╝░██╔═══╝░ ██╔══██║██╔══██║░██╔██╗░░██╔██╗░
██║░╚═╝░██║██║░░░░░██║░░░░░ ██║░░██║██║░░██║██╔╝╚██╗██╔╝╚██╗
╚═╝░░░░░╚═╝╚═╝░░░░░╚═╝░░░░░ ╚═╝░░╚═╝╚═╝░░╚═╝╚═╝░░╚═╝╚═╝░░╚═╝ `);
}
setTimeout(function() {
RainbowMPPHAXX.start(); // Animation resumes
}, 0);
setTimeout(function(){ console.info(colors.cyan("[ ⓘ CONNECT INFO ] - Connecting to MPP HAXX . . . ")); }, 700);
setTimeout(function(){ console.info(colors.green("[ ⓘ CONNECT INFO ] - Successfully connected to MPP HAXX! ")); }, 1700);
setTimeout(function(){ console.info(colors.cyan("[ ⓘ CONNECT INFO ] - Connecting to MPP HAXX login . .")); }, 1800);
setTimeout(function(){ console.info(colors.green("[ ⓘ CONNECT INFO ] - Successfully connected to MPP HAXX login! start up successful! :D")); }, 2000);
/*Thanks Alex for helping with some wrapping in the code!*/
/*MPP HAXX LOGIN*/
var KnowsUsername = true;
var KnowsEmail = true;
var KnowsPassword = true;
setTimeout(function () {
var Username = prompt('[LOGIN QUESTION] - What is your username?');
if (Username == '') {
KnowsUsername = true;
console.info(colors.green('[ ⓘ LOGIN INFO] - Correct username!'));
var Email = prompt('[LOGIN QUESTION] - What is your E-mail?');
if (Email == '') {
KnowsEmail = true;
console.info(colors.green('[ ⓘ LOGIN INFO] - Correct E-mail!'));
var Password = prompt('[LOGIN QUESTION] - What is your password?');
if (Password == '') {
KnowsPassword = true;
const RainbowLoading = chalkAnimation.rainbow(`Loading...`);
setTimeout(function() {
RainbowLoading.start(); // Animation resumes
}, 0);
console.info(colors.green('[ ⓘ LOGIN INFO] - Correct password!'));
setTimeout(function(){console.info(colors.cyan(`[ ⓘ 2FA INFO ] - This is the final last step of the verification process! since you have gotten all of the login questions correct so far. We will now send you an E-mail to your E-mail: "${Email}" with the 2FA code. If you don't recive it in your main inbox please click on this link: https://mail.google.com/mail/u/0/?tab=rm&ogbl#spam `)); }, 7000);
} else {
KnowsPassword = false;
console.error(colors.red('[LOGIN ERROR] - Aww! it looks like ' + '"' + Password + '"' + " is not your password. Try again!" ));
}
} else {
KnowsEmail = false;
console.error(colors.red('[LOGIN ERROR] - Aww! it looks like ' + '"' + Email + '"' + " is not your E-mail. Try again!" ));
}
} else {
KnowsUsername = false;
console.error(colors.red('[LOGIN ERROR] - Aww! it looks like ' + '"' + Username + '"' + " is not your username. Try again!" ));
}
}, 2100);
He uses VSC (Visual Studio Code) to see what it does, and apparently it doesn't give the "Loading..." thing rainbow text, I'm hoping somebody knows what's going on, because I don't
i created a login.php file where the user can will be navigated to instamojo payment page . After completing the transaction the user is getting the success message from instamojo , but i need to display the successful transaction in my domain or in own php file . so how can i get the transation related information to my webpage or to my login.php file
Ex: Redirecting from our login.php to instamojo(payment gateway)and response back (success message)to our login.php intimating the user that payment is success
var rootURL = "cgshealthcare.com/HealthCareSystem/";;
$(document).ready(function() {
$('#login').click(function() {
if ($('#username').val() == "" || $('#password').val() == "") {
alert("Please enter username or password");
return false;
}
cardloginUser($('#username').val(), $('#password').val());
});
});
function forwardtoRegister() {
window.location = "login.php?page=register";
}
function cardloginUser(userName, password) {
console.log('userName: ' + userName);
console.log('password: ' + password);
if (userName.length < 1) {
$('#errorlist').html("<font color='red'><b> Please enter User ID</b></font>");
return false;
}
if (password.length < 1) {
$('#errorlist').html(" <font color='red'><b> Please enter Password</b></font>");
return false;
}
console.log(rootURL + '/authenticate/' + userName + '/' + password);
$.ajax({
type: 'GET',
url: rootURL + '/authenticate/' + userName + '/' + password,
dataType: "json",
success: function(data) {
console.log("hello" + data.responseMessageDetails);
var list = data == null ? [] : (data.responseMessageDetails instanceof Array ? data.responseMessageDetails : [data.responseMessageDetails]);
console.log("List : " + list);
if ((list).length < 1) {
$('#errorlist').html("<font color='red'><b> Invalid User Name and Password Combination </b></font>");
$('#errorblock').css("visibility") == "visible";
}
$.each(list, function(index, responseMessageDetails) {
console.log("Status " + responseMessageDetails);
var message = responseMessageDetails.message;
if (message.indexOf("]:") > 0) message = message.substring(0, message.indexOf("]:") + 2);
console.log("message" + message);
console.log("USer Data" + responseMessageDetails.status);
console.log("USer Data" + responseMessageDetails.message);
if (responseMessageDetails.status == "Success") {
window.location = "imjo.in/NpKxN";;
} else if (responseMessageDetails.status == "Fail") {
window.location = "www.google.com";
console.log("Fail1");
$('#errorlist').html("<font color='red'><b>" + message + "</b></font>");
} else {
console.log("Fail111");
$('#errorlist').html("<font color='red'><b> We are sorry some intermittent Issue. Please try after some time. </b></font>");
}
});
},
error: function(data) {
console.log("data...." + data);
var list = data == null ? [] : (data.responseMessageDetails instanceof Array ? data.responseMessageDetails : [data.responseMessageDetails]);
console.log("data...." + data);
$.each(list, function(index, responseMessageDetails) {
console.log(responseMessageDetails);
var message = responseMessageDetails.message;
if (message.indexOf("]:") > 0) message = message.substring(0, message.indexOf("]:") + 2);
$('#errorlist').html("<font color='red'><b>" + message + "</b></font>");
});
}
});
}
function showLogin() {
window.location = "login.php";
}
Please look at the integration guide here.
After user enters payment information on instamojo, they are redirected to a redirect-url which you specify (and is a url on your website). Instamojo appends transaction results to this url. You can make it a php url on your website and read the results using GET method. Depending upon the results, you can process your payment and display results to the end-user. More on GET method here...
Instamojo also provides for webhooks, which are like silent POSTs in the background and can be used as backups in case redirect urls in front-end fail for some reason. This way if end-users' redirection failed for any reason, the webhook will still receive information in the background which can be used you to update your database for success/failure of transaction. Of course you webserver has to be up and running to receive webhooks notifications. If that's the point of failure, nothing will work :)
The API link I shared has all those details.
Thanks
I am trying to show the conversation between the two users even after the users logout and login. I mean when user1 logged out and again logged in, he should see the conversations made with the user2. I am using Ejabberd XMPP server and Strophe Js to retrive the messages.
As I found this strophe.mam.js plugin to do this but raising the error and cant get the messages.
Here is my code:
function onConnect(status)
{
// Functions runs while users trys to login to the XMPP server
var iq = null;
switch (status)
{
case Strophe.Status.CONNECTING:
log('Connecting.');
break;
case Strophe.Status.CONNFAIL:
log('Failed to connect.');
$('#connect').get(0).value = 'connect';
break;
case Strophe.Status.DISCONNECTING:
log('Disconnecting.');
break;
case Strophe.Status.DISCONNECTED:
log('Disconnected.');
$('#connect').get(0).value = 'connect';
break;
case Strophe.Status.CONNECTED:
log('Connected.');
connection.addHandler(onMessage, null, 'message', null, null, null);
connection.addHandler(onPresence, null, 'presence', null, null, null);
iq = $iq({type: 'get'}).c('query', {xmlns: 'jabber:iq:roster'});
connection.sendIQ(iq, onRoster);
break;
default:
break;
}
}
function onMessage(msg) {
debugger;
var fromJid = msg.getAttribute("from"),
bareFromJid = Strophe.getBareJidFromJid(fromJid),
type = msg.getAttribute("type"),
elems = msg.getElementsByTagName("body");
if (type == "chat" && elems.length > 0) {
var body = elems[0],
message = Strophe.getText(body);
showMessage(bareFromJid + ": " + message);
connection.mam.query("yashwanth#localhost", {
"with": bareFromJid,
onMessage: function(message) {
console.log("Message from " + bareFromJid,
": " + message);
return true;
},
onComplete: function(response) {
console.log("Got all the messages");
}
});
}
return true;
}
function send() {
// Handles with sending the message
var to = $('#to-jid').get(0).value,
myBareJid = Strophe.getBareJidFromJid(connection.jid);
message = $('#message').get(0).value,
reply = $msg({to: to, type: 'chat'})
.c("body")
.t(message);
connection.send(reply.tree());
showMessage(myBareJid + ": " + message);
}
$(document).ready(function () {
connection = new Strophe.Connection(BOSH_SERVICE);
messagebox = $("#messages");
messagebox.val("");
logbox = $("#log-messages");
logbox.val("");
rosterbox = $("#roster");
rosterbox.val("");
connection.rawInput = function (data) { log('RECV: ' + data); };
connection.rawOutput = function (data) { log('SEND: ' + data); };
Strophe.log = function (level, msg) { log('LOG: ' + msg); };
login();
$('#send').bind('click', send);
});
So whenever the user receives the message there will be something in the console. But it returns me this error in my logs
RECV: <body xmlns='http://jabber.org/protocol/httpbind'><iq xmlns='jabber:client'
from='yashwanth#localhost' to='yashwanth#localhost/22064184271436881211352579'
id='yashwanth#localhost' type='error'><query xmlns='urn:xmpp:mam:0'><x xmlns='jabber:x:data'><field
var='FORM_TYPE'><value>urn:xmpp:mam:0</value></field><field var='with'>
<value>shabda#localhost</value></field></x><set xmlns='http://jabber.org/protocol/rsm'/></query>
<error code='400' type='modify'><bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error>
</iq></body>
Please help me out with this
Your MAM query is not correctly formatted.
You are missing the attribute type="submit" on the x element with xmlns jabber:x:data feature. Type is mandatory in XEP-0004 Data Forms
You IQ should be:
<iq type='set' id='juliet1'>
<query xmlns='urn:xmpp:mam:0'>
<x xmlns='jabber:x:data' type='submit'>
<field var='FORM_TYPE' type='hidden'>
<value>urn:xmpp:mam:0</value>
</field>
<field var='with'>
<value>shabda#localhost</value>
</field>
</x>
<set xmlns='http://jabber.org/protocol/rsm'/>
</query>
</iq>
See Example 6 in XEP-0313 Message Archive Management.
The MAM strophe plugin had a bug. We prepared a fix here: https://github.com/processone/strophejs-plugins/commit/5a7857e2ab625c0521c68719d7e220f00c32c593
And submitted this pull request: https://github.com/strophe/strophejs-plugins/pull/65
I had a problem with MAM. See this link: https://www.ejabberd.im/forum/25028/solved-how-configure-and-test-modmam-message-archive-management
I solved the problem change type 'set' to 'get'