<commit_before>/*
 * Copyright (c) 2015 <NAME> (<EMAIL>)
 *
 * This is free software: you can redistribute it and/or modify
 * it under the terms of the Artistic License 2.0 as published by
 * The Perl Foundation.
 *
 * This source 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
 * Artistic License 2.0 for more details.
 *
 * You should have received a copy of the Artistic License 2.0
 * along the source as a COPYING file. If not, obtain it from
 * http://www.perlfoundation.org/artistic_license_2_0.
 */

var app = angular.module('chimaeraD', ['ngRoute']);

app.config(function($routeProvider, $httpProvider) {
	$routeProvider
		.otherwise({
			redirectTo: '/'
		})
		.when('/', {
			templateUrl: 'main.html',
			controller: 'mainController'
		})
		.when('/device/:device/:uri*', {
			templateUrl: 'device.html',
			controller: 'deviceController'
		});

    $httpProvider.defaults.timeout = 5000;
});

app.controller('mainController', function($scope, $http) {
	$scope.connected = true;
	$scope.interfaces = null;
	$scope.devices = null;

	var success = function(data) {
		console.log(data);
		$scope[data.key] = data.value;
	}

	var error = function(data) {
		console.log('error');
	}

	$scope.keepalive = function() {
		$http.post('/api/v1/keepalive', {})
			.success(function(data) {
				$scope.connected = true;
				success(data);
			})
			.error(function() {
				$scope.connected = false;
				error();
			})
			.finally(function() {
				$scope.keepalive();
			});
	}

	$scope.api = function(path) {
		$http.post(path, {})
			.success(success)
			.error(error);
	}
});
<commit_msg>add timeout of 1 hour to keepalive.<commit_after>/*
 * Copyright (c) 2015 <NAME> (<EMAIL>)
 *
 * This is free software: you can redistribute it and/or modify
 * it under the terms of the Artistic License 2.0 as published by
 * The Perl Foundation.
 *
 * This source 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
 * Artistic License 2.0 for more details.
 *
 * You should have received a copy of the Artistic License 2.0
 * along the source as a COPYING file. If not, obtain it from
 * http://www.perlfoundation.org/artistic_license_2_0.
 */

var app = angular.module('chimaeraD', ['ngRoute']);

app.config(function($routeProvider, $httpProvider) {
	$routeProvider
		.otherwise({
			redirectTo: '/'
		})
		.when('/', {
			templateUrl: 'main.html',
			controller: 'mainController'
		})
		.when('/device/:device/:uri*', {
			templateUrl: 'device.html',
			controller: 'deviceController'
		});

    $httpProvider.defaults.timeout = 5000;
});

app.controller('mainController', function($scope, $http) {
	$scope.connected = true;
	$scope.interfaces = null;
	$scope.devices = null;

	var success = function(data) {
		console.log(data);
		$scope[data.key] = data.value;
	}

	var error = function(data) {
		console.log('error');
	}

	$scope.keepalive = function() {
		$http.post('/api/v1/keepalive', {}, {timeout:3.6e6}) // 1 hour
			.success(function(data) {
				$scope.connected = true;
				success(data);
				$scope.keepalive();
			})
			.error(function(data) {
				$scope.connected = false;
				error(data);
			});
	}

	$scope.api = function(path) {
		$http.post(path, {})
			.success(success)
			.error(error);
	}
});

{'fraction_non_alphanumeric': 0.15005760368663595, 'fraction_numerical': 0.011232718894009217, 'mean_word_length': 3.5878467635402904, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '3898933', 'n_tokens_mistral': 1261, 'n_tokens_neox': 1125, 'n_words': 308}