un poco turbio
This commit is contained in:
@@ -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",
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
21
lib/Dojo.pm
21
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');
|
||||
|
||||
@@ -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__
|
||||
|
||||
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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 ==============================================================
|
||||
|
||||
@@ -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;
|
||||
|
||||
55
public/home/bcast/cssCast.css
Executable file
55
public/home/bcast/cssCast.css
Executable file
@@ -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{
|
||||
}
|
||||
|
||||
BIN
public/home/bcast/grulla_21.jpg
Executable file
BIN
public/home/bcast/grulla_21.jpg
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 589 KiB |
6
public/home/bcast/jsFlowpl.js
Normal file
6
public/home/bcast/jsFlowpl.js
Normal file
@@ -0,0 +1,6 @@
|
||||
flowplayer(function (api) {
|
||||
api.on("load", function (e, api, video) {
|
||||
console.log("streaming");
|
||||
});
|
||||
});
|
||||
|
||||
BIN
public/home/bcast/noise.jpg
Normal file
BIN
public/home/bcast/noise.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 80 KiB |
49
public/users/login/cssuForm.css
Executable file
49
public/users/login/cssuForm.css
Executable file
@@ -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;
|
||||
}
|
||||
@@ -1,5 +1,11 @@
|
||||
<section class="title flex">
|
||||
<article class="title"> <p>Radio</p> </article>
|
||||
<article class="bcast"> <form action="/admin/radio" method"POST">
|
||||
<div><label>Contraseña Video Stream</label></div>
|
||||
<div><textarea name="link" id="gpass" class="gpass"><<%= %gpass %></textarea></div>
|
||||
<input type="hidden" name="update" value="gpass">
|
||||
<div><input type="submit" name="pup" value="Cambiar"></div>
|
||||
|
||||
</section>
|
||||
|
||||
<section class="radio flex">
|
||||
|
||||
13
templates/home/bcast.html.ep
Executable file
13
templates/home/bcast.html.ep
Executable file
@@ -0,0 +1,13 @@
|
||||
<link rel="stylesheet" href="//releases.flowplayer.org/7.2.1/skin/skin.css">
|
||||
<script src="//code.jquery.com/jquery-1.12.4.min.js"></script>
|
||||
<script src="//releases.flowplayer.org/7.2.1/flowplayer.min.js"></script>
|
||||
|
||||
<section class="vid">
|
||||
<div class="flowplayer fp-outlined" data-rtmp=<%= $rtmp_server %> data-ratio="0.4167">
|
||||
|
||||
<video controls="controls" autoplay="autoplay" poster="/home/bcast/noise.jpg" data-title="Transmisión en vivo">
|
||||
<source src=<%= $radio_server %>"/live.ogg" type="video/ogg">
|
||||
<source src=<%= $rtmp_channel %> type="video/flash">
|
||||
</video> </div>
|
||||
</section>
|
||||
|
||||
14
templates/users/loginu.html.ep
Executable file
14
templates/users/loginu.html.ep
Executable file
@@ -0,0 +1,14 @@
|
||||
<section class="hero">
|
||||
<article class="login">
|
||||
<p>Bienvenido</p>
|
||||
<form class="login" action="" method="post">
|
||||
<label class="name" >Nombre:</label>
|
||||
<input class="name" type="text" name="uname" value="grullas">
|
||||
<label>Nick chat:</label>
|
||||
<input type="text" size="20" name="nick" value=""/>
|
||||
<label class="pass">Contraseña:</label>
|
||||
<input class="pass" type="password" size="15" name="pass" value=""/>
|
||||
<input type="submit" id="submit" value="Entrar"/>
|
||||
</form>
|
||||
</article>
|
||||
</section>
|
||||
Reference in New Issue
Block a user