<commit_before>function onAuthCallback() {

	var authInfo = getAuthInfoFromUrl()

	if (authInfo && authInfo["access_token"]) {

	    var token = authInfo["access_token"];

	    localStorage.GithubToken = token
	    focalStorage.setItem("githubToken", token).then(function() {
	    	window.opener.githubAuth.onAuthenticated(window.uuid, token);
	    	// window.close()
	    })
	    return 
	}

    var codeInfo = getCodeFromUrl();
    if (!codeInfo) {
    	alert("failed to receive auth code (the token to get the token)");
    	return 
  	}


    var code = codeInfo["code"]

    jQuery.post("https://github.com/login/oauth/access_token",{
    	client_id: "21b67bb82b7af444a7ef",
    	client_secret: "e9ae61b190c5f82a9" + "e3d6d0d2f97e8ad4ba29d18",
    	code: code,
    	redirect_uri: "https://livelykernel.github.io/lively4-core/oauth/github.html",
    	state: ""
    }, 
    function(data, status, xhr) {
    	// we should be redirected.... 
    })

}

function getCodeFromUrl() {
  if (window.location.search) {
    var authResponse = window.location.search.substring(1);
    var authInfo = JSON.parse(
      '{"' + authResponse.replace(/&/g, '","').replace(/=/g, '":"') + '"}',
      function(key, value) { return key === "" ? value : decodeURIComponent(value); });
    return authInfo;
  }
}
<commit_msg>draft ace editor<commit_after>function onAuthCallback() {

	var authInfo = getAuthInfoFromUrl()

	if (authInfo && authInfo["access_token"]) {

	    var token = authInfo["access_token"];

	    localStorage.GithubToken = token
	    focalStorage.setItem("githubToken", token).then(function() {
	    	window.opener.githubAuth.onAuthenticated(window.uuid, token);
	    	// window.close()
	    })
	    return 
	}

    var codeInfo = getCodeFromUrl();
    if (!codeInfo) {
    	alert("failed to receive auth code (the token to get the token)");
    	return 
  	}


    var code = codeInfo["code"]

    jQuery.post("https://github.com/login/oauth/access_token",{
    	client_id: "21b67bb82b7af444a7ef",
    	client_secret: "e9ae61b190c5f82a9" + "e3d6d0d2f97e8ad4ba29d18",
    	code: code,
    	redirect_uri: "https://livelykernel.github.io/lively4-core/oauth/github.html",
    	state: ""
    }, 
    function(data, status, xhr) {
    	// we should be redirected.... 
    },
    "application/json")

}

function getCodeFromUrl() {
  if (window.location.search) {
    var authResponse = window.location.search.substring(1);
    var authInfo = JSON.parse(
      '{"' + authResponse.replace(/&/g, '","').replace(/=/g, '":"') + '"}',
      function(key, value) { return key === "" ? value : decodeURIComponent(value); });
    return authInfo;
  }
}

{'fraction_non_alphanumeric': 0.15727788279773156, 'fraction_numerical': 0.026465028355387523, 'mean_word_length': 3.1800947867298577, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1495812', 'n_tokens_mistral': 966, 'n_tokens_neox': 909, 'n_words': 157}