<commit_before>/*
 * Copyright (C) 2012-2019  Online-Go.com
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/// <reference path="../typings_manual/index.d.ts" />
import "whatwg-fetch"; /* polyfills window.fetch */
import * as Sentry from '@sentry/browser';
import { configure_goban } from 'configure-goban';

declare var ogs_current_language;
declare var ogs_version;

let sentry_env = "production";

if (/online-(go|baduk|weiqi|covay|igo).(com|net)$/.test(document.location.host) && !(/dev/.test(document.location.host))) {
    sentry_env = "production";
    if (/beta/.test(document.location.host)) {
        sentry_env = "beta";
    }
}  else {
    sentry_env = "development";
}

try {
    Sentry.init({
        dsn: 'https://91e6858af48a40e7954e5b7548aa2e08@sentry.io/250615',
        release: ogs_version || 'dev',
        whitelistUrls: [
            'online-go.com',
            'online-baduk.com',
            'online-weiqi.com',
            'online-covay.com',
            'online-igo.com',
            'cdn.online-go.com',
            'beta.online-go.com',
            'dev.beta.online-go.com'
        ],
        environment: sentry_env,
        integrations: [
            new Sentry.Integrations.GlobalHandlers({
                onerror: true,
                onunhandledrejection: false
            }),
            new Sentry.Integrations.Breadcrumbs({
                console: false
            })
        ]
    });

    Sentry.setTag("version", ogs_version || 'dev');
    Sentry.setExtra("language", ogs_current_language || 'unknown');
    Sentry.setExtra("version", ogs_version || 'dev');
} catch (e) {
    console.error(e);
}

try {
    window.onunhandledrejection = (e) => {
        console.error(e);
        console.error(e.reason);
        console.error(e.stack);
    };
} catch (e) {
    console.log(e);
}

import * as data from "data";

data.setDefault("theme", "light");
data.setDefault("config", {
    "user": {
        "anonymous": true,
        "id": 0,
        "username": "Guest",
        "ranking": -100,
        "country": "un",
        "pro": 0,
    }
});
data.setDefault("config.user", {
    "anonymous": true,
    "id": 0,
    "username": "Guest",
    "ranking": -100,
    "country": "un",
    "pro": 0,
});

configure_goban();

import * as React from "react";
import * as ReactDOM from "react-dom";
import { browserHistory } from './ogsHistory';
import { routes } from "./routes";

//import {Promise} from "es6-promise";
import {get} from "requests";
import {errorAlerter, uuid} from "misc";
import {close_all_popovers} from "popover";
import * as sockets from "sockets";
import {_} from "translate";
import {init_tabcomplete} from "tabcomplete";
import * as player_cache from "player_cache";
import {toast} from 'toast';
import cached from 'cached';
import * as moment from 'moment';

import "debug";

declare const swal;


/*** Initialize moment in our current language ***/
declare function getPreferredLanguage();<commit_msg>Fix cdn config race condition<commit_after>/*
 * Copyright (C) 2012-2019  Online-Go.com
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/// <reference path="../typings_manual/index.d.ts" />
import "whatwg-fetch"; /* polyfills window.fetch */
import * as Sentry from '@sentry/browser';
import { configure_goban } from 'configure-goban';

declare var ogs_current_language;
declare var ogs_version;

let sentry_env = "production";

if (/online-(go|baduk|weiqi|covay|igo).(com|net)$/.test(document.location.host) && !(/dev/.test(document.location.host))) {
    sentry_env = "production";
    if (/beta/.test(document.location.host)) {
        sentry_env = "beta";
    }
}  else {
    sentry_env = "development";
}

try {
    Sentry.init({
        dsn: 'https://91e6858af48a40e7954e5b7548aa2e08@sentry.io/250615',
        release: ogs_version || 'dev',
        whitelistUrls: [
            'online-go.com',
            'online-baduk.com',
            'online-weiqi.com',
            'online-covay.com',
            'online-igo.com',
            'cdn.online-go.com',
            'beta.online-go.com',
            'dev.beta.online-go.com'
        ],
        environment: sentry_env,
        integrations: [
            new Sentry.Integrations.GlobalHandlers({
                onerror: true,
                onunhandledrejection: false
            }),
            new Sentry.Integrations.Breadcrumbs({
                console: false
            })
        ]
    });

    Sentry.setTag("version", ogs_version || 'dev');
    Sentry.setExtra("language", ogs_current_language || 'unknown');
    Sentry.setExtra("version", ogs_version || 'dev');
} catch (e) {
    console.error(e);
}

try {
    window.onunhandledrejection = (e) => {
        console.error(e);
        console.error(e.reason);
        console.error(e.stack);
    };
} catch (e) {
    console.log(e);
}

import * as data from "data";

data.setDefault("theme", "light");
data.setDefault("config", {
    "user": {
        "anonymous": true,
        "id": 0,
        "username": "Guest",
        "ranking": -100,
        "country": "un",
        "pro": 0,
    }
});
data.setDefault("config.user", {
    "anonymous": true,
    "id": 0,
    "username": "Guest",
    "ranking": -100,
    "country": "un",
    "pro": 0,
});

data.setDefault('config.cdn', window['cdn_service']);
data.setDefault('config.cdn_host', window['cdn_service'].replace('https://', '').replace('http://', '').replace('//', ''));
data.setDefault('config.cdn_release', window['cdn_service'] + '/' + window['ogs_release']);
data.setDefault('config.release', window['ogs_release']);

configure_goban();

import * as React from "react";
import * as ReactDOM from "react-dom";
import { browserHistory } from './ogsHistory';
import { routes } from "./routes";

//import {Promise} from "es6-promise";
import {get} from "requests";
import {errorAlerter, uuid} from "misc";
import {close_all_popovers} from "popover";
import * as sockets from "sockets";
import {_} from "translate";
import {init_tabcomplete} from "tabcomplete";
import * as player_cache from "player_cache";
import {toast} from 'toast';
import cached from 'cached';
import * as moment from 'moment';

import "debug";

declare const swal;


/*** Initialize moment in our current language ***/
declare function getPreferredLanguage();
{'fraction_non_alphanumeric': 0.146843853820598, 'fraction_numerical': 0.012757475083056479, 'mean_word_length': 2.9465128474043, 'pattern_counts': {'":': 26, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 3, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 2, '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': '597752', 'n_tokens_mistral': 2435, 'n_tokens_neox': 2324, 'n_words': 628}