<commit_before>/*
 * @author     <NAME> <<EMAIL>>
 * @copyright  2013-2018 MapCentia ApS
 * @license    http://www.gnu.org/licenses/#AGPL  GNU AFFERO GENERAL PUBLIC LICENSE 3
 */

var express = require('express');
var router = express.Router();

router.get('/locale', function(request, response) {
    var lang = request.acceptsLanguages('en', 'en-US', 'da', 'da-DK');
    if (lang) {
        if (lang === "en") {
            lang = "en-US";
        }
        if (lang === "da") {
            lang = "da-DK";
        }
    } else {
        lang = "en-US";
    }
    lang = lang.replace("-","_");
    response.set('Content-Type', 'application/javascript');
    //response.send("window._vidiLocale='" + lang + "'");
    response.send("var urlVars = (function getUrlVars() {var mapvars = {};var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, key, value) {mapvars[key] = value;});return mapvars;})(); if (urlVars.locale !== undefined){window._vidiLocale=urlVars.locale.split('#')[0]} else {window._vidiLocale='" + lang + "'}");
});
module.exports = router;<commit_msg>Return the clients IP address<commit_after>/*
 * @author     <NAME> <<EMAIL>>
 * @copyright  2013-2018 MapCentia ApS
 * @license    http://www.gnu.org/licenses/#AGPL  GNU AFFERO GENERAL PUBLIC LICENSE 3
 */

var express = require('express');
var router = express.Router();
var ipaddr = require('ipaddr.js');

router.get('/locale', function(request, response) {
    var ip = ipaddr.process(request.ip).toString();
    var lang = request.acceptsLanguages('en', 'en-US', 'da', 'da-DK');
    if (lang) {
        if (lang === "en") {
            lang = "en-US";
        }
        if (lang === "da") {
            lang = "da-DK";
        }
    } else {
        lang = "en-US";
    }
    lang = lang.replace("-","_");
    response.set('Content-Type', 'application/javascript');
    //response.send("window._vidiLocale='" + lang + "'");
    response.send("window._vidiIp = '" + ip + "'; var urlVars = (function getUrlVars() {var mapvars = {};var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, key, value) {mapvars[key] = value;});return mapvars;})(); if (urlVars.locale !== undefined){window._vidiLocale=urlVars.locale.split('#')[0]} else {window._vidiLocale='" + lang + "'}");
});
module.exports = router;
{'fraction_non_alphanumeric': 0.21834625322997417, 'fraction_numerical': 0.008613264427217916, 'mean_word_length': 3.231329690346084, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1317964', 'n_tokens_mistral': 789, 'n_tokens_neox': 767, 'n_words': 163}