<commit_before>package radar;

use Dancer2;
use utf8;
use File::Slurp;
use POSIX q/strftime/;
use Data::Dumper;

use XML::FeedPP;
use HTML::Entities;
use HTML::Parse;
use HTML::FormatText;
use Date::Manip;
use Digest::MD5 qw(md5_hex);
use JSON;

our $VERSION = '0.1';

my %FEEDS         = ();
my %ENTRIES       = ();
my @ids_items_db  = ();
my $hoy           = time();
my $dia           = 60 * 60 * 24;
my $ayer          = $hoy - $dia;

get '/' => sub {
    my $data_file           = read_file config->{radar}{entries_json_file};
    my $desc                = config->{radar}{descripcion};
    my $data                = from_json $data_file;
    @ids_items_db           = sort ( %{ $data } ); #setear este array.
    #@ids_items_db           = @{ $data } ; #setear este array.
    print Dumper($data);
    my $h                   = config->{radar}{pie_de_pag};
    #template 'index',       { data => $data , descripcion => $desc, extras => $h};
    template 'index',       { data => $data , descripcion => $desc, extras => Dumper(@ids_items_db)};
};

get '/update/*' => sub {
    my ( $pass )    = splat;
    my $pass_conf   = config->{radar}{admin_p};
    #print $f1, $f2, $f3;
    if ($pass eq $pass_conf){
        get_feed_stuff();
        template 'sip';<commit_msg>ahora si papote<commit_after>package radar;

use Dancer2;
use utf8;
use File::Slurp;
use POSIX q/strftime/;
use Data::Dumper;

use XML::FeedPP;
use HTML::Entities;
use HTML::Parse;
use HTML::FormatText;
use Date::Manip;
use Digest::MD5 qw(md5_hex);
use JSON;

our $VERSION = '0.1';

my %FEEDS         = ();
my %ENTRIES       = ();
my @ids_items_db  = ();
my $hoy           = time();
my $dia           = 60 * 60 * 24;
my $ayer          = $hoy - $dia;

get '/' => sub {
    my $data_file           = read_file config->{radar}{entries_json_file};
    my $desc                = config->{radar}{descripcion};
    my $data                = from_json $data_file;
    @ids_items_db           = keys(%$data); #setear este array.
    #pa debuggear...
    #my $arrocero = join " ", @ids_items_db;
    #print Dumper($data);
    #template 'index',       { data => $data , descripcion => $desc, extras => $arrocero};
    my $h                   = config->{radar}{pie_de_pag};
    template 'index',       { data => $data , descripcion => $desc, extras => $h};
};

get '/update/*' => sub {
    my ( $pass )    = splat;
    my $pass_conf   = config->{radar}{admin_p};
    #print $f1, $f2, $f3;
    if ($pass eq $pass_conf){
        get_feed_stuff();
        template 'sip';
{'fraction_non_alphanumeric': 0.16904196357878068, 'fraction_numerical': 0.011876484560570071, 'mean_word_length': 2.3075916230366493, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, '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': '4396002', 'n_tokens_mistral': 954, 'n_tokens_neox': 922, 'n_words': 229}