<commit_before>angular.module('voda')

.config([
  '$feathersProvider',
  function($feathersProvider) {
    $feathersProvider.setAuthStorage(window.localStorage);
    $feathersProvider.setEndpoint('');
    $feathersProvider.useSocket(true);
  }
])

.config([
  '$stateProvider',
  '$urlRouterProvider',
  '$locationProvider',
  '$httpProvider',
  function($stateProvider, $urlRouterProvider, $locationProvider, $httpProvider) {

    var auth = [
      '$q',
      'Voda',
      '$feathers',
      function($q, Voda, $feathers) {
        var deferred = $q.defer();
        $feathers.authenticate().then(function(res) {
          Voda.set('accessToken', res.accessToken);
          return $feathers.passport.verifyJWT(res.accessToken);
          deferred.resolve(res);
        }).then(function(payload) {
          Voda.set('payload', payload);
          return $feathers.service('users').get(payload.userId);
        }).then(function(user) {
          $feathers.set('user', user);
          deferred.resolve(user);
        }).catch(function(err) {
          deferred.resolve(false);
        })
        return deferred.promise;
      }
    ];

    var isAuth = [
      '$q',
      'Auth',
      function($q, Auth) {
        if(Auth) {
          return true;
        } else {
          return $q.reject('Not logged in');
        }
      }
    ];

    $locationProvider.html5Mode({
      enabled: false,
      requireBase: false
    });
    $locationProvider.hashPrefix('!');

    $stateProvider
    .state('main', {
      abstract: true,
      templateUrl: '/views/main.html',
      controller: 'AppCtrl',
      resolve: {
        App: [
          '$http',
          function($http) {
            return $http.get('/app');
          }
        ],
        Auth: auth
      }
    })
    .state('main.home', {
      url: '/',
      templateUrl: '/views/home.html',
      controller: 'HomeCtrl',
      resolve: {
        Videos: [
          '$feathers',
          'Auth',
          function($feathers) {
            return $feathers.service('videos').find({
              query: {
                $sort: { createdAt: -1 }
              }<commit_msg>set video sort to recordedAt<commit_after>angular.module('voda')

.config([
  '$feathersProvider',
  function($feathersProvider) {
    $feathersProvider.setAuthStorage(window.localStorage);
    $feathersProvider.setEndpoint('');
    $feathersProvider.useSocket(true);
  }
])

.config([
  '$stateProvider',
  '$urlRouterProvider',
  '$locationProvider',
  '$httpProvider',
  function($stateProvider, $urlRouterProvider, $locationProvider, $httpProvider) {

    var auth = [
      '$q',
      'Voda',
      '$feathers',
      function($q, Voda, $feathers) {
        var deferred = $q.defer();
        $feathers.authenticate().then(function(res) {
          Voda.set('accessToken', res.accessToken);
          return $feathers.passport.verifyJWT(res.accessToken);
          deferred.resolve(res);
        }).then(function(payload) {
          Voda.set('payload', payload);
          return $feathers.service('users').get(payload.userId);
        }).then(function(user) {
          $feathers.set('user', user);
          deferred.resolve(user);
        }).catch(function(err) {
          deferred.resolve(false);
        })
        return deferred.promise;
      }
    ];

    var isAuth = [
      '$q',
      'Auth',
      function($q, Auth) {
        if(Auth) {
          return true;
        } else {
          return $q.reject('Not logged in');
        }
      }
    ];

    $locationProvider.html5Mode({
      enabled: false,
      requireBase: false
    });
    $locationProvider.hashPrefix('!');

    $stateProvider
    .state('main', {
      abstract: true,
      templateUrl: '/views/main.html',
      controller: 'AppCtrl',
      resolve: {
        App: [
          '$http',
          function($http) {
            return $http.get('/app');
          }
        ],
        Auth: auth
      }
    })
    .state('main.home', {
      url: '/',
      templateUrl: '/views/home.html',
      controller: 'HomeCtrl',
      resolve: {
        Videos: [
          '$feathers',
          'Auth',
          function($feathers) {
            return $feathers.service('videos').find({
              query: {
                $sort: { recordedAt: -1 }
              }
{'fraction_non_alphanumeric': 0.15681712424383434, 'fraction_numerical': 0.0009306654257794323, 'mean_word_length': 1.9627842866988283, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '6772220', 'n_tokens_mistral': 1286, 'n_tokens_neox': 1294, 'n_words': 202}