Alice
view release on metacpan or search on metacpan
lib/Alice/HTTP/Server.pm view on Meta::CPAN
$req->env->{"psgix.session"} = {
is_logged_in => 1,
username => $user,
userid => $app->user,
};
$res->redirect($dest);
}
else {
$req->env->{"psgix.session"}{is_logged_in} = 0;
$req->env->{"psgix.session.options"}{expire} = 1;
$res->content_type("text/html; charset=utf-8");
$res->body($self->render("login", $dest, "bad username or password"));
}
$res->send;
});
}
# render the login page
else {
$res->content_type("text/html; charset=utf-8");
$res->body($self->render("login", $dest));
$res->send;
}
}
sub logout {
my ($self, $req, $res) = @_;
$_->close for @{$self->app->streams};
if (!$self->auth_enabled) {
$res->redirect("/");
lib/Alice/HTTP/Server.pm view on Meta::CPAN
$req->parameters->{images} = "hide";
$req->parameters->{avatars} = "hide";
$self->send_index($req, $res);
}
sub send_index {
my ($self, $req, $res) = @_;
my $options = $self->merged_options($req);
my $app = $self->app;
$res->headers(["Content-type" => "text/html; charset=utf-8"]);
my $writer = $res->writer;
my @windows = $app->sorted_windows;
my @queue;
push @queue, sub {$app->render('index_head', @windows)};
for my $window (@windows) {
push @queue, sub {$app->render('window_head', $window)};
push @queue, sub {$app->render('window_footer', $window)};
}
lib/Alice/HTTP/Server.pm view on Meta::CPAN
$cb->($success ? $self->app : ());
}
sub render {
my $self = shift;
return $self->app->render(@_);
}
sub export_config {
my ($self, $req, $res) = @_;
$res->content_type("text/plain; charset=utf-8");
{
$res->body(to_json($self->app->config->serialized,
{utf8 => 1, pretty => 1}));
}
$res->send;
}
__PACKAGE__->meta->make_immutable;
1;
lib/Alice/HTTP/Stream/XHR.pm view on Meta::CPAN
use JSON;
use Time::HiRes qw/time/;
use Any::Moose;
extends 'Alice::HTTP::Stream';
use strict;
use warnings;
my $separator = "xalicex";
our @headers = ('Content-Type' => "multipart/mixed; boundary=$separator; charset=utf-8");
has queue => (
is => 'rw',
isa => 'ArrayRef[HashRef]',
default => sub { [] },
);
sub clear_queue {$_[0]->queue([])}
sub enqueue {push @{shift->queue}, @_}
sub queue_empty {return @{$_[0]->queue} == 0}
share/static/alice-dark.css view on Meta::CPAN
@charset "UTF-8";
tr.input, div.msg {
-webkit-font-smoothing: antialiased; }
input[type="hidden"] {
display: none; }
body {
margin: 0;
padding: 0;
overflow: hidden;
share/static/alice-default.css view on Meta::CPAN
@charset "UTF-8";
input[type="hidden"] {
display: none; }
body {
margin: 0;
padding: 0;
overflow: hidden;
color: black;
-webkit-text-size-adjust: none !important; }
share/static/alice-solarized.css view on Meta::CPAN
@charset "UTF-8";
div.msg a {
color: #cb4b16; }
div.msg a:hover {
color: #B6461E; }
div.left span.nick, div#input button, #tabs li, #topic {
-webkit-font-smoothing: antialiased; }
::selection {
share/static/alice.js view on Meta::CPAN
setRequestHeaders: function() {
var headers = {
'X-Requested-With': 'XMLHttpRequest',
'X-Prototype-Version': Prototype.Version,
'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
};
if (this.method == 'post') {
headers['Content-type'] = this.options.contentType +
(this.options.encoding ? '; charset=' + this.options.encoding : '');
/* Force "Connection: close" for older Mozilla browsers to work
* around a bug where XMLHttpRequest sends an incorrect
* Content-length header. See Mozilla Bugzilla #246651.
*/
if (this.transport.overrideMimeType &&
(navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
headers['Connection'] = 'close';
}
( run in 0.256 second using v1.01-cache-2.11-cpan-4d50c553e7e )