<commit_before>const Cookies = require('./lib/js-cookie');

/*
 * Configuration values needed in js codes
 *
 * NOTE:
 * Please use the following command to avoid accidentally committing personal changes
 * git update-index --assume-unchanged src/javascript/config.js
 *
 */

function getAppId() {
    return localStorage.getItem('config.app_id') ? localStorage.getItem('config.app_id') :
               /staging\.binary\.com/i.test(window.location.hostname) ? '1098' : '1';
}

function getSocketURL() {
    let server_url = localStorage.getItem('config.server_url');
    if (!server_url) {
        const loginid = Cookies.get('loginid'),
            isReal  = loginid && !/^VRT/.test(loginid),
            toGreenPercent = { real: 100, virtual: 0, logged_out: 0 }, // default percentage
            categoryMap    = ['real', 'virtual', 'logged_out'],
            randomPercent = Math.random() * 100,
            percentValues = Cookies.get('connection_setup'); // set by GTM

        // override defaults by cookie values
        if (percentValues && percentValues.indexOf(',') > 0) {
            const cookiePercents = percentValues.split(',');
            categoryMap.map(function(cat, idx) {
                if (cookiePercents[idx] && !isNaN(cookiePercents[idx])) {
                    toGreenPercent[cat] = +cookiePercents[idx].trim();
                }
            });
        }

        server_url = (/staging\.binary\.com/i.test(window.location.hostname) ? 'www2' :
                (isReal  ? (randomPercent < toGreenPercent.real       ? 'green' : 'blue') :
                 loginid ? (randomPercent < toGreenPercent.virtual    ? 'green' : 'blue') :
                           (randomPercent < toGreenPercent.logged_out ? 'green' : 'blue'))
            ) + '.binaryws.com';
    }
    return 'wss://' + server_url + '/websockets/v3';
}

module.exports = {
    getAppId    : getAppId,
    getSocketURL: getSocketURL,
};<commit_msg>Change staging server to blue<commit_after>const Cookies = require('./lib/js-cookie');

/*
 * Configuration values needed in js codes
 *
 * NOTE:
 * Please use the following command to avoid accidentally committing personal changes
 * git update-index --assume-unchanged src/javascript/config.js
 *
 */

function getAppId() {
    return localStorage.getItem('config.app_id') ? localStorage.getItem('config.app_id') :
               /staging\.binary\.com/i.test(window.location.hostname) ? '1098' : '1';
}

function getSocketURL() {
    let server_url = localStorage.getItem('config.server_url');
    if (!server_url) {
        const loginid = Cookies.get('loginid'),
            isReal  = loginid && !/^VRT/.test(loginid),
            toGreenPercent = { real: 100, virtual: 0, logged_out: 0 }, // default percentage
            categoryMap    = ['real', 'virtual', 'logged_out'],
            randomPercent = Math.random() * 100,
            percentValues = Cookies.get('connection_setup'); // set by GTM

        // override defaults by cookie values
        if (percentValues && percentValues.indexOf(',') > 0) {
            const cookiePercents = percentValues.split(',');
            categoryMap.map(function(cat, idx) {
                if (cookiePercents[idx] && !isNaN(cookiePercents[idx])) {
                    toGreenPercent[cat] = +cookiePercents[idx].trim();
                }
            });
        }

        server_url = (/staging\.binary\.com/i.test(window.location.hostname) ? 'blue' :
                (isReal  ? (randomPercent < toGreenPercent.real       ? 'green' : 'blue') :
                 loginid ? (randomPercent < toGreenPercent.virtual    ? 'green' : 'blue') :
                           (randomPercent < toGreenPercent.logged_out ? 'green' : 'blue'))
            ) + '.binaryws.com';
    }
    return 'wss://' + server_url + '/websockets/v3';
}

module.exports = {
    getAppId    : getAppId,
    getSocketURL: getSocketURL,
};
{'fraction_non_alphanumeric': 0.14190231362467867, 'fraction_numerical': 0.007969151670951156, 'mean_word_length': 2.363007778738116, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, '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': '3274544', 'n_tokens_mistral': 1165, 'n_tokens_neox': 1119, 'n_words': 230}