Pretty web #2

Merged
alpha6 merged 3 commits from pretty_web into master 2017-08-01 15:34:39 +03:00
3 changed files with 5 additions and 22 deletions
Showing only changes of commit e58b7bb839 - Show all commits

View file

@ -54,7 +54,7 @@ plugin 'authentication', {
my $digest = $sha->add($password);
my $user_id = $db->check_user( $username, $digest->hexdigest() );
$self->app->log->debug("user id: [$user_id]");
# $self->app->log->debug("user id: [$user_id]");
return $user_id;
},
@ -126,22 +126,6 @@ get '/' => sub {
my $current_user = $self->current_user;
my $files_list = $db->get_files($current_user->{'user_id'}, 20);
my $thumbs_dir = File::Spec->catfile( $IMAGE_DIR, $current_user->{'user_id'}, $thumbs_size );
my @images = map { $_->{'file_name'} } @$files_list;
# Render
return $self->render(
images => \@images,
image_base => $IMAGE_BASE,
orig => $ORIG_DIR,
thumbs_size => $thumbs_size,
scales => \@scale_width,
user_id => $current_user->{'user_id'},
);
} => 'index';
get '/get_images' => ( authenticated => 1 ) => sub {
@ -163,10 +147,13 @@ get '/get_images' => ( authenticated => 1 ) => sub {
$img_hash->{'original_url'} = File::Spec->catfile( '/', $IMAGE_BASE, $current_user->{'user_id'}, $ORIG_DIR, $file );
$img_hash->{'thumbnail_url'} = File::Spec->catfile( '/', $IMAGE_BASE, $current_user->{'user_id'}, $thumbs_size, $file );
my @scaled = ();
for my $scale (@scale_width) {
$img_hash->{$scale} = File::Spec->catfile( '/', $IMAGE_BASE, $current_user->{'user_id'}, $scale, $file );
push(@scaled, {'size' => $scale, 'url' => File::Spec->catfile( '/', $IMAGE_BASE, $current_user->{'user_id'}, $scale, $file )}) ;
}
$img_hash->{'scales'} = \@scaled;
push(@$images, $img_hash);
}

View file

@ -19,7 +19,6 @@ sub new {
}
sub check_user ($self, $nickname, $password) {
print STDERR "[$nickname][$password]";
my ($user_id) = $self->{'dbh'}->selectrow_array(q~select user_id from users where nickname=? and password=?~, undef, ($nickname, $password));
return $user_id;
}

View file

@ -16,9 +16,6 @@
<script src="https://vuejs.org/js/vue.min.js"></script>
<!-- CSS adjustments for browsers with JavaScript disabled -->
<noscript><link rel="stylesheet" href="/file_uploader/css/jquery.fileupload-noscript.css"></noscript>
<noscript><link rel="stylesheet" href="/file_uploader/css/jquery.fileupload-ui-noscript.css"></noscript>
<style>
.bar {
height: 18px;