... | ... |
@@ -0,0 +1,32 @@ |
1 |
+#!/usr/bin/env perl |
|
2 |
+ |
|
3 |
+use strict; |
|
4 |
+use warnings; |
|
5 |
+use utf8; |
|
6 |
+use FindBin; |
|
7 |
+use lib "$FindBin::Bin/../mojo/lib"; |
|
8 |
+use lib "$FindBin::Bin/../lib"; |
|
9 |
+use lib "$FindBin::Bin/../extlib/lib/perl5"; |
|
10 |
+use Gitprep; |
|
11 |
+ |
|
12 |
+my $user = shift; |
|
13 |
+ |
|
14 |
+die "User not specifed" unless defined $user; |
|
15 |
+ |
|
16 |
+my $app = Gitprep->new; |
|
17 |
+my $dbi = $app->dbi; |
|
18 |
+ |
|
19 |
+my $public_key = $dbi->model('user')->select('public_keys', id => $user)->value || ''; |
|
20 |
+ |
|
21 |
+print $public_key; |
|
22 |
+ |
|
23 |
+=head1 NAME |
|
24 |
+ |
|
25 |
+authorized_keys_command - AuthorizedKeysCommand for sshd |
|
26 |
+ |
|
27 |
+=head1 USAGE |
|
28 |
+ |
|
29 |
+ ./authorized_keys_command kimoto |
|
30 |
+ |
|
31 |
+This command return user public_key |
|
32 |
+ |
... | ... |
@@ -19,9 +19,6 @@ |
19 | 19 |
# Authors |
20 | 20 |
my $authors = $git->authors($user, $project, $rev, $file); |
21 | 21 |
|
22 |
- # Blob lines |
|
23 |
- my $lines = $git->blob($user, $project, $rev, $file); |
|
24 |
- |
|
25 | 22 |
# File size |
26 | 23 |
my $file_size = $git->blob_size($user, $project, $rev, $file); |
27 | 24 |
|
... | ... |
@@ -32,6 +29,10 @@ |
32 | 29 |
# MIME type |
33 | 30 |
my $mime_type = $git->blob_mime_type($user, $project, $rev, $file); |
34 | 31 |
|
32 |
+ # Blob lines(only text) |
|
33 |
+ my $lines; |
|
34 |
+ $lines = $git->blob($user, $project, $rev, $file) if $mime_type =~ /^text/; |
|
35 |
+ |
|
35 | 36 |
# Variables for included template |
36 | 37 |
stash(id => $rev, project => $project, rev => $rev); |
37 | 38 |
%> |
... | ... |
@@ -65,8 +66,10 @@ |
65 | 66 |
<div class="span7" style="padding-top:5px"> |
66 | 67 |
<i class="icon-file icon-white"></i> |
67 | 68 |
<%= $file_type %> |
68 |
- <span class="muted">|</span> |
|
69 |
- <%= @$lines %> lines |
|
69 |
+ % if ($lines) { |
|
70 |
+ <span class="muted">|</span> |
|
71 |
+ <%= @$lines %> lines |
|
72 |
+ % } |
|
70 | 73 |
<span class="muted">|</span> |
71 | 74 |
<%= $file_size %>kb |
72 | 75 |
</div> |
... | ... |
@@ -77,13 +80,7 @@ |
77 | 80 |
</div> |
78 | 81 |
</div> |
79 | 82 |
</div> |
80 |
- % if ($file =~ /\.md$/) { |
|
81 |
- % my $readme = join "\n", @$lines; |
|
82 |
- % my $readme_e = Text::Markdown::Hoedown::markdown($readme, extensions => HOEDOWN_EXT_FENCED_CODE); |
|
83 |
- <div class="markdown border-gray"> |
|
84 |
- <%== $readme_e %> |
|
85 |
- </div> |
|
86 |
- % } elsif ($mime_type =~ m#^image/#) { |
|
83 |
+ % if ($mime_type =~ m#^image/#) { |
|
87 | 84 |
<div style="background:#ddd;text-align:center;padding-top:30px;padding-bottom:30px;margin-bottom:30px"> |
88 | 85 |
<img type="<%= $mime_type %> |
89 | 86 |
% if (defined $file) { |
... | ... |
@@ -93,7 +90,15 @@ |
93 | 90 |
/> |
94 | 91 |
</div> |
95 | 92 |
% } elsif ($mime_type =~ m#^text/#) { |
96 |
- <pre class="prettyprint linenums"><% for my $line (@$lines) { %><%= "$line\n" %><% } %></pre> |
|
93 |
+ % if ($file =~ /\.md$/) { |
|
94 |
+ % my $readme = join "\n", @$lines; |
|
95 |
+ % my $readme_e = Text::Markdown::Hoedown::markdown($readme, extensions => HOEDOWN_EXT_FENCED_CODE); |
|
96 |
+ <div class="markdown border-gray"> |
|
97 |
+ <%== $readme_e %> |
|
98 |
+ </div> |
|
99 |
+ % } else { |
|
100 |
+ <pre class="prettyprint linenums"><% for my $line (@$lines) { %><%= "$line\n" %><% } %></pre> |
|
101 |
+ % } |
|
97 | 102 |
% } else { |
98 | 103 |
<div style="font-size:16px;background:#ddd;text-align:center;padding-top:30px;padding-bottom:30px;margin-bottom:30px"> |
99 | 104 |
<a href="<%= url_for("/$user/$project/raw/$rev/$file") %>">View raw</a> |