fix chat sw

This commit is contained in:
mynah
2019-03-21 18:50:06 +01:00
parent 5b10b5521f
commit 63ffc6c7d4
2 changed files with 6 additions and 6 deletions

View File

@@ -30,15 +30,16 @@ use Dojo::Model::Users;
$r->any('/tst')->to('home#tst'); $r->any('/tst')->to('home#tst');
# ============================================================================= # =============================================================================
# json ========================================================================
$r->any('/json/*dreq')->to('data#simple');
# =============================================================================
# candy ======================================================================= # candy =======================================================================
$r->any('/json/candy/:command')->to('data#candy'); $r->any('/json/candy/:command')->to('data#candy');
$r->any('/candy')->to('home#candy'); $r->any('/candy')->to('home#candy');
# ============================================================================= # =============================================================================
# json ========================================================================
$r->any('/json/*dreq')->to('data#simple');
# =============================================================================
# register user =============================================================== # register user ===============================================================
$r->any('/reg')->to('users#reg'); $r->any('/reg')->to('users#reg');
# ============================================================================= # =============================================================================

View File

@@ -2,7 +2,7 @@ package Dojo::Controller::Data;
use Mojo::File 'path'; use Mojo::File 'path';
use Mojo::JSON qw(decode_json encode_json); use Mojo::JSON qw(decode_json encode_json);
use Mojo::Base 'Mojolicious::Controller'; use Mojo::Base 'Mojolicious::Controller';
use Dojo::Support qw{ dmph merge_hash load_module }; use Dojo::Support qw{ log };
use Net::Telnet; use Net::Telnet;
my $server_name = ""; my $server_name = "";
@@ -13,7 +13,6 @@ sub simple{
my $n=$c->param("dreq")//""; my $n=$c->param("dreq")//"";
my $json = {status => "304"}; my $json = {status => "304"};
$json = { srv =>$c->config->{radio_server} } if $n =~m/^radio$/ ; $json = { srv =>$c->config->{radio_server} } if $n =~m/^radio$/ ;
$json = candy() if $n =~m/^candy$/ ;
$json = decode_json($data_path->child("$n")->slurp) $json = decode_json($data_path->child("$n")->slurp)
if $n=~m/^podcast\/podcast.json$/; if $n=~m/^podcast\/podcast.json$/;
$c->render(json=>$json); $c->render(json=>$json);