diff --git a/dojo.conf b/dojo.conf index 43c14e7..e97f1dd 100644 --- a/dojo.conf +++ b/dojo.conf @@ -2,4 +2,13 @@ perldoc => 1, secrets => ['b8a9e54090ccb580b6203e53a9f9199af38ce538'], path => 'public', + + radio => { + server_name=>"localhost:3000", + radio_server =>"https://radio.vuelodegrulla.com", + channel => "/p", + listen_url =>"http://gruya:8000/p", + } + } + diff --git a/lib/Dojo.pm b/lib/Dojo.pm index 6f8fc1a..2bb3bd0 100644 --- a/lib/Dojo.pm +++ b/lib/Dojo.pm @@ -3,7 +3,6 @@ use Mojo::Base 'Mojolicious'; use Dojo::Conf; use Dojo::Model::Vuelo; use Dojo::Model::Users; -use Dojo::Model::Data; # This method will run once at server start sub startup { @@ -14,11 +13,11 @@ use Dojo::Model::Data; $self->helper(dbv => sub { state $dbv = Dojo::Model::Vuelo->new }); $self->helper(dbg => sub { state $dbg = Dojo::Model::Users->new }); - $self->helper(ddtt => sub { state $ddtt = Dojo::Model::Data->new }); $self->defaults({%Dojo::Conf::def}); my $r = $self->routes; #router # user ======================================================================== + $r->any('/')->to('home#home_'); $r->any('/home')->to('home#home'); $r->any('/cal')->to('home#cal'); $r->any('/event/:id'=> [id => qr/\d+/])->to('home#event'); @@ -40,22 +39,20 @@ use Dojo::Model::Data; $r->any('/candy')->to('home#candy'); # ============================================================================= -# admin ======================================================================= - # $r->any('/admin/home')->to('home#admin_home'); - #$r->any('/admin/radio')->to('home#admin_radio'); - #$r->any('/admin/eventos')->to('home#admin_eventos'); - #$r->any('/admin/eventos/:type'=> [type=>['e','p','c']])->to('home#admin_eventos'); - #$r->any('/admin/mensajes')->to('home#admin_mensajes'); - #$r->any('/admin/json/:dreq/:id')->to('home#admin_json'); -# ============================================================================= - -# login ======================================================================= +# login guest ================================================================= $r->any('/login')->to('users#login'); $r->any('/logout')->to('users#logout'); my $logged_in = $r->under('/')->to('users#is_logged'); $logged_in->get('/radio')->to('home#radio'); +# ============================================================================= +# login user grulla =========================================================== + my $guestp = $r->under('/')->to('users#is_grulla'); + $guestp->any('/bcast')->to('home#bcast'); +# ============================================================================= + +# admin ======================================================================= my $admin = $r->under('/admin')->to('users#is_admin'); $admin->any('')->to('home#admin'); $admin->any('home')->to('home#admin_home'); diff --git a/lib/Dojo/Controller/Data.pm b/lib/Dojo/Controller/Data.pm index 9b58464..e16e329 100644 --- a/lib/Dojo/Controller/Data.pm +++ b/lib/Dojo/Controller/Data.pm @@ -51,25 +51,25 @@ sub candy{ sub isOn{return grep(/\s$server_name/,sendT("host:list()"))? 1:0; } - sub sendT{ +sub sendT{ commandT(shift); my @r = $t->getlines(All=>0); return @r - } - sub connectT{ +} +sub connectT{ $t = new Net::Telnet ( Port=>5582, Timeout=>1, Errmode=>'return' ); # $t = new Net::Telnet ( Port=>5582, Timeout=>1, Errmode=>'die' ); return 1 if $t->open(); return 0; - } - sub commandT{ +} +sub commandT{ $t->getlines(All=>0);#empty buffer $t->print(shift); #run istruction - } - sub disconnectT{ $t->close();} +} +sub disconnectT{ $t->close();} #========================================================= -1 +1; __END__ diff --git a/lib/Dojo/Controller/Home.pm b/lib/Dojo/Controller/Home.pm index 92e9057..99d226a 100644 --- a/lib/Dojo/Controller/Home.pm +++ b/lib/Dojo/Controller/Home.pm @@ -3,7 +3,6 @@ use Mojo::Base 'Mojolicious::Controller'; use Mojo::Template; use Dojo::Support qw{ log dmph merge_hash load_module get_names}; use Dojo::Conf; - sub tst{ my $c=shift; # $c->stash( merge_hash( @@ -11,16 +10,22 @@ sub tst{ # (load_module("home/contact"))[0] #)); # $c->stash(apend => ["home/contact"]); - $c->stash( (load_module("home/tst"))[0] ); - $c->stash(layout=> "defaultContact"); - my $x = [get_names("public/home/cal/img/")]; - log("@$x"); - $c->stash( ilist => $x); - $c->dbv->tst; + #$c->stash( (load_module("home/tst"))[0] ); + #$c->stash(layout=> "defaultContact"); + #my $x = [get_names("public/home/cal/img/")]; + #log("@$x"); + #$c->stash( ilist => $x); + #$c->dbv->tst; + $c->render(text=> $c->config->{radio}{'channel'}); } # User ======================================================================== + sub home_ { + my $c = shift; + $c->redirect_to("/home") ; + } + sub home { my $c = shift; $c->stash((load_module("home/home"))[0]); @@ -92,6 +97,13 @@ sub tst{ $c->stash( t=>$c->dbv->podcast_txt, pod=>$c->dbv->podcast_infoHash); } + sub bcast{ + my $c = shift; + $c->stash((load_module("home/bcast"))[0]); + $c->stash( $c->dbv->conf_bcast); + + } + sub radio{ my $c=shift; $c->stash((load_module("home/radio"))[0]); diff --git a/lib/Dojo/Controller/Users.pm b/lib/Dojo/Controller/Users.pm index 3046ca7..a7ab037 100644 --- a/lib/Dojo/Controller/Users.pm +++ b/lib/Dojo/Controller/Users.pm @@ -6,11 +6,16 @@ use Dojo::Support qw{ merge_hash load_module }; sub login { my $self = shift; #falta si el usuario ya está registrado y llama a login. - if ($self->session('ureq')//1 == 4){ + if (($self->session('ureq')//0) == 4){ $self->stash( css=>["users/login/cssaForm.css"]); $self->stash(template=>'users/logina') ; $self->stash(layout=>"default"); } + elsif (($self->session('ureq')//0) == 2){ + $self->stash( css=>["users/login/cssuForm.css"]); + $self->stash(template=>'users/loginu') ; + $self->stash(layout=>"defaultContact"); + } else{ $self->stash( css=>["users/login/cssForm.css"]); $self->stash(layout=>"defaultContact"); @@ -19,21 +24,27 @@ sub login { my $pass = $self->param('pass') //''; return $self->render unless my $pmid = $self->dbg->check($user, $pass); $self->session(user => $user, pmid=>$pmid, nick=> $self->param('nick')); - $self->redirect_to($self->session('prev')); + $self->redirect_to($self->session('prev')) ; } sub is_logged { my $self = shift; return 1 if $self->session('user'); - $self->session(prev=>$self->url_for); + $self->session(ureq=>1,prev=>$self->url_for); $self->redirect_to('login'); } sub is_admin { my $self = shift; - return 1 if ($self->session('pmid')==4); + return 1 if ( ($self->session('pmid') //0) == 4); $self->session(ureq=>4,prev=>$self->url_for); $self->redirect_to('login'); } +sub is_grulla { + my $self = shift; + return 1 if (($self->session('pmid')//0)==2); + $self->session(ureq=>2,prev=>$self->url_for); + $self->redirect_to('login'); +} sub logout { my $self = shift; diff --git a/lib/Dojo/Model/Data.pm b/lib/Dojo/Model/Data.pm deleted file mode 100644 index a448a14..0000000 --- a/lib/Dojo/Model/Data.pm +++ /dev/null @@ -1,15 +0,0 @@ -package Dojo::Model::Data; -use Dojo::Support qw{ dmph merge_hash load_module }; -use Dojo::Conf; - -sub new { bless {}, shift }; - - -sub tst{ - - return {tst=>"this is my rifle"}; -} - -1; - - diff --git a/lib/Dojo/Model/Vuelo.pm b/lib/Dojo/Model/Vuelo.pm index 2d32a89..5ee693f 100644 --- a/lib/Dojo/Model/Vuelo.pm +++ b/lib/Dojo/Model/Vuelo.pm @@ -58,6 +58,9 @@ sub new { bless {}, shift }; sub conf_chat{ return $Dojo::Conf::chat; } + sub conf_bcast{ + return $Dojo::Conf::rtmp; + } #============================================================================== # Read vdg admin ============================================================== diff --git a/public/home/admin/radio/cssAdmin.css b/public/home/admin/radio/cssAdmin.css index beb953d..97b9bdb 100755 --- a/public/home/admin/radio/cssAdmin.css +++ b/public/home/admin/radio/cssAdmin.css @@ -3,13 +3,35 @@ section.title{ justify-content:center; -webkit-justify-content:center; } +article.title{ + flex:2; +} article.title> p { font-size:3em; color:black;; font-weight:bold; - margin:10px; text-align:center; } +article.bcast{ + flex:1; + border: 1px solid red; + box-sizing: border-box; + border-radius: 6px; + margin:30px; + padding:5px; + background-color:white; +} +article.bcast > form > div >*{ + width:100%; +} +article.bcast > form > div >input{ +min-height: 30px; +margin-top: 6px; +} +#gpass{ + color:white; + font-size:1.5em; +} section.radio{ justify-content:center; -webkit-justify-content:center; @@ -46,8 +68,6 @@ div.cont p{ margin:1px 3px;; } - - article.rmod{ flex:1; margin:30px; diff --git a/public/home/bcast/cssCast.css b/public/home/bcast/cssCast.css new file mode 100755 index 0000000..f5291df --- /dev/null +++ b/public/home/bcast/cssCast.css @@ -0,0 +1,55 @@ +body{ + background-repeat: no-repeat; + background-attachment: fixed; + background-size:cover; + background-image:url("grulla_21.jpg"); + background-position: right top; + +} +section.header{ + background-color: rgba(51,51,51,0); + display: block; + padding: 45px 15px 0px; +} +h2.textHead{ + background-color: #c22a39; + color: white; + text-align: center; + font-weight: bold; + margin: auto; + font-size: 2em; + padding: 2.5vh; +} + +section.content{ + justify-content: center; + -webkit-justify-content: center; + background-color: rgba(51,51,51,0); + padding: 40px 0px 0px 0px; +} + +article.imageHead{ + min-width:270px; + background-repeat: no-repeat; + background-size:contain; + background-position:center; + flex:1 1 270px; + flex-shrink:1; + max-width:500px; + margin:20px; + min-height:300px +} +section.vid{ + display:flex; + justify-content: center; + -webkit-justify-content: center; + background-color: rgba(0,0,0,0.85); + padding: calc(10% + 30px) 0px; + width:100%; + height:90vh; + max-height:800px; +} + +div.flowplayer{ +} + diff --git a/public/home/bcast/grulla_21.jpg b/public/home/bcast/grulla_21.jpg new file mode 100755 index 0000000..ec1c091 Binary files /dev/null and b/public/home/bcast/grulla_21.jpg differ diff --git a/public/home/bcast/jsFlowpl.js b/public/home/bcast/jsFlowpl.js new file mode 100644 index 0000000..58d10fd --- /dev/null +++ b/public/home/bcast/jsFlowpl.js @@ -0,0 +1,6 @@ + flowplayer(function (api) { + api.on("load", function (e, api, video) { + console.log("streaming"); +}); +}); + diff --git a/public/home/bcast/noise.jpg b/public/home/bcast/noise.jpg new file mode 100644 index 0000000..8490308 Binary files /dev/null and b/public/home/bcast/noise.jpg differ diff --git a/public/users/login/cssuForm.css b/public/users/login/cssuForm.css new file mode 100755 index 0000000..c2e9fc9 --- /dev/null +++ b/public/users/login/cssuForm.css @@ -0,0 +1,49 @@ +section.hero{ + height:100vh; + background-repeat: no-repeat; + background-attachment: fixed; + background-size:cover; + background-image:url("puerta.jpg"); + background-position: center center; + +} +article.login{ + background: rgba(33, 33, 33, 0.8); + color:white; + margin: auto 0px auto auto; + padding: 1px 0px; + text-align: center; + min-width: 300px; + width: 36%; + min-height: 100vh; +} + +article.login p{ +margin: 20vh auto 20px; +font-size: 2em; +} + +article.login form{ + font-size:1.2em; + width:80%; + margin:auto; +} + +label{ + display:block; + margin:10px 5px 15px 10px; +} + +form.login > input{ +} + +form.login > input#submit { + display:block; + margin:30px auto; + width:200px; + height:60px; +} + +form.login > .name{ +display:none; +} diff --git a/templates/home/admin/radio.html.ep b/templates/home/admin/radio.html.ep index 9e4995c..fabcf67 100755 --- a/templates/home/admin/radio.html.ep +++ b/templates/home/admin/radio.html.ep @@ -1,5 +1,11 @@ Radio + + Contraseña Video Stream + <<%= %gpass %> + + + diff --git a/templates/home/bcast.html.ep b/templates/home/bcast.html.ep new file mode 100755 index 0000000..5333ecb --- /dev/null +++ b/templates/home/bcast.html.ep @@ -0,0 +1,13 @@ + + + + + + data-ratio="0.4167"> + + + "/live.ogg" type="video/ogg"> + type="video/flash"> + + + diff --git a/templates/users/loginu.html.ep b/templates/users/loginu.html.ep new file mode 100755 index 0000000..454d135 --- /dev/null +++ b/templates/users/loginu.html.ep @@ -0,0 +1,14 @@ + + + Bienvenido + + Nombre: + + Nick chat: + + Contraseña: + + + + +
Radio
Bienvenido