-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
config.plに更新あり --- a/config.pl.sample +++ b/config.pl.sample @@ -71,8 +71,9 @@ use strict; 'view' => { - class => 'Xslate', - 'function' => { + syntax => 'Kolon', + path => [qw(view)], + function => { static => sub { my $uri = shift; $uri =~ s/^\///;
- Loading branch information
1 parent
4ab81bf
commit 01e5466
Showing
4 changed files
with
59 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,59 @@ | ||
package Yancha::Web; | ||
|
||
my $config; | ||
|
||
BEGIN { | ||
use Yancha::Config::Simple; | ||
$config = Yancha::Config::Simple->load_file( $ENV{ YANCHA_CONFIG_FILE } || undef ); | ||
} | ||
|
||
use strict; | ||
use warnings; | ||
use Nephia; | ||
use utf8; | ||
use Yancha::Util; | ||
|
||
use Nephia plugins => [ | ||
'Dispatch', | ||
'View::Xslate' => $config->{'view'}, | ||
]; | ||
|
||
our $VERSION = 0.01; | ||
|
||
path '/' => sub { | ||
my ($req, @args) = @_; | ||
|
||
my $template; | ||
if (Yancha::Util->is_smartphone( $req->env->{HTTP_USER_AGENT} || '' )) { | ||
return res { redirect('/android.html'); }; | ||
} | ||
|
||
$template = 'chat.tx'; | ||
|
||
return { | ||
template => 'chat.tx', | ||
|
||
app { | ||
get '/' => sub { | ||
my $req = req; | ||
|
||
my $template; | ||
if (Yancha::Util->is_smartphone( $req->env->{HTTP_USER_AGENT} || '' )) { | ||
return $req->redirect('/android.html'); | ||
} | ||
|
||
return [200, [], render('chat.tx')]; | ||
}; | ||
}; | ||
|
||
path '/android.html' => sub { | ||
return { | ||
template => 'android.tx', | ||
|
||
get '/android.html' => sub { | ||
return [200, [], render('android.tx')]; | ||
}; | ||
}; | ||
|
||
path qr{^/about(\.html)?} => sub { | ||
my $req = shift; | ||
return { | ||
template => 'about.tx', | ||
|
||
get qr{^/about(\.html)?} => sub { | ||
return [200, [], render('about.tx')]; | ||
}; | ||
}; | ||
|
||
path qr{/hints(\.html)?} => sub { | ||
my $req = shift; | ||
return { | ||
template => 'hints.tx', | ||
|
||
get qr{/hints(\.html)?} => sub { | ||
return [200, [], render('hints.tx')]; | ||
}; | ||
}; | ||
|
||
path qr{^/join_users(\.html)?} => sub { | ||
my $req = shift; | ||
return { | ||
template => 'join_users.tx', | ||
|
||
get qr{^/join_users(\.html)?} => sub { | ||
return [200, [], render('join_users.tx')]; | ||
}; | ||
}; | ||
|
||
|
||
path qr{^/quot(ation\.html)?$} => sub { | ||
return { | ||
template => 'quot.tx', | ||
|
||
|
||
get qr{^/quot(ation\.html)?$} => sub { | ||
return [200, [], render('quot.tx')]; | ||
}; | ||
}; | ||
|
||
path qr{^/search(\.html)?$} => sub { | ||
my $req = shift; | ||
return { | ||
template => 'search.tx', | ||
|
||
get qr{^/search(\.html)?$} => sub { | ||
return [200, [], render('search.tx')]; | ||
}; | ||
}; | ||
|
||
1; |