✨ — Fix #174 — Show latest tag and commit of the instance
It’s showed in about page and config API endpoint
This commit is contained in:
parent
89f1b60635
commit
17600fd679
|
@ -4,6 +4,7 @@ Revision history for Lufi
|
|||
- Notifications when uploading and downloading files (#181)
|
||||
- Use Weblate instead of Zanata for translations (https://weblate.framasoft.org/projects/lufi/development/)
|
||||
- Add config API endpoint (#183)
|
||||
- Show latest tag and commit of the instance in about page and config API endpoint (#174)
|
||||
|
||||
0.04.6 2019-11-07
|
||||
- Now can send large files (>2Gio) while using a DB other than SQLite (#165)
|
||||
|
|
|
@ -32,7 +32,12 @@ sub change_lang {
|
|||
}
|
||||
|
||||
sub about {
|
||||
shift->render(template => 'about');
|
||||
my $c = shift;
|
||||
|
||||
$c->render(
|
||||
template => 'about',
|
||||
version => $c->git_version
|
||||
);
|
||||
}
|
||||
|
||||
sub config_infos {
|
||||
|
@ -52,6 +57,7 @@ sub config_infos {
|
|||
keep_ip_during => $c->config('keep_ip_during'),
|
||||
stop_upload => (-f 'stop-upload' || -f 'stop-upload.manual') ? true : false,
|
||||
need_authentication => (defined($c->config('ldap')) || defined($c->config('htpasswd'))) ? true : false,
|
||||
version => $c->git_version
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -69,14 +69,15 @@ sub register {
|
|||
$app->helper(create_invitation_token => \&_create_invitation_token);
|
||||
$app->helper(is_guest => \&_is_guest);
|
||||
$app->helper(get_date_lang => \&_get_date_lang);
|
||||
$app->helper(git_version => \&_git_version);
|
||||
}
|
||||
|
||||
sub _pg {
|
||||
my $c = shift;
|
||||
|
||||
my $pgdb = $c->config('pgdb');
|
||||
my $port = (defined $pgdb->{port}) ? $pgdb->{port}: 5432;
|
||||
my $addr = $c->pg_url({
|
||||
my $pgdb = $c->config('pgdb');
|
||||
my $port = (defined $pgdb->{port}) ? $pgdb->{port}: 5432;
|
||||
my $addr = $c->pg_url({
|
||||
host => $pgdb->{host}, port => $port, database => $pgdb->{database}, user => $pgdb->{user}, pwd => $pgdb->{pwd}
|
||||
});
|
||||
state $pg = Mojo::Pg->new($addr);
|
||||
|
@ -85,11 +86,11 @@ sub _pg {
|
|||
}
|
||||
|
||||
sub _mysql {
|
||||
my $c = shift;
|
||||
my $c = shift;
|
||||
|
||||
my $mysqldb = $c->config('mysqldb');
|
||||
my $port = (defined $mysqldb->{port}) ? $mysqldb->{port}: 3306;
|
||||
my $addr = $c->pg_url({
|
||||
my $mysqldb = $c->config('mysqldb');
|
||||
my $port = (defined $mysqldb->{port}) ? $mysqldb->{port}: 3306;
|
||||
my $addr = $c->pg_url({
|
||||
host => $mysqldb->{host}, port => $port, database => $mysqldb->{database}, user => $mysqldb->{user}, pwd => $mysqldb->{pwd}
|
||||
});
|
||||
$addr =~ s/postgresql/mysql/;
|
||||
|
@ -123,7 +124,7 @@ sub _provisioning {
|
|||
}
|
||||
|
||||
sub _get_empty {
|
||||
my $c = shift;
|
||||
my $c = shift;
|
||||
|
||||
my $ldfile = Lufi::DB::File->new(app => $c->app)->get_empty;
|
||||
|
||||
|
@ -219,7 +220,7 @@ my %date_langs = (
|
|||
);
|
||||
|
||||
sub _get_date_lang {
|
||||
my $c = shift;
|
||||
my $c = shift;
|
||||
|
||||
my $l = $c->languages();
|
||||
|
||||
|
@ -231,4 +232,18 @@ sub _get_date_lang {
|
|||
return Date::Language->new('English');
|
||||
}
|
||||
|
||||
sub _git_version {
|
||||
my $c = shift;
|
||||
|
||||
my $last_tag = `git describe --abbrev=0`;
|
||||
my $last_commit = `git rev-parse HEAD`;
|
||||
chomp $last_tag;
|
||||
chomp $last_commit;
|
||||
|
||||
return {
|
||||
tag => $last_tag,
|
||||
commit => $last_commit
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -94,7 +94,7 @@ msgstr "As Lufi is a free software licensed under of the terms of the <a href=\"
|
|||
msgid "Asking for file part XX1 of %1"
|
||||
msgstr "Asking for file part XX1 of %1"
|
||||
|
||||
#: themes/default/templates/about.html.ep:20
|
||||
#: themes/default/templates/about.html.ep:23
|
||||
msgid "Back to homepage"
|
||||
msgstr "Back to homepage"
|
||||
|
||||
|
@ -389,6 +389,16 @@ msgstr "Javascript is disabled. You won't be able to use Lufi."
|
|||
msgid "Language"
|
||||
msgstr "Language"
|
||||
|
||||
#. (sprintf('<a href="https://framagit.org/fiat-tux/hat-softwares/lufi/-/commit/%s" class="classic">%s</a>', stash('version')
|
||||
#: themes/default/templates/about.html.ep:22
|
||||
msgid "Latest commit of this instance: %1"
|
||||
msgstr "Latest commit of this instance: %1"
|
||||
|
||||
#. (sprintf('<a href="https://framagit.org/fiat-tux/hat-softwares/lufi/-/releases/%s" class="classic">%s</a>', stash('version')
|
||||
#: themes/default/templates/about.html.ep:21
|
||||
msgid "Latest tag of this instance: %1"
|
||||
msgstr "Latest tag of this instance: %1"
|
||||
|
||||
#: themes/default/templates/login.html.ep:15
|
||||
msgid "Login"
|
||||
msgstr "Login"
|
||||
|
@ -694,6 +704,10 @@ msgstr "Uploaded at"
|
|||
msgid "Uploaded files"
|
||||
msgstr "Uploaded files"
|
||||
|
||||
#: themes/default/templates/about.html.ep:20
|
||||
msgid "Version"
|
||||
msgstr "Version"
|
||||
|
||||
#: themes/default/templates/partial/index.js.ep:31
|
||||
msgid "Websocket communication error"
|
||||
msgstr "Websocket communication error"
|
||||
|
|
|
@ -441,6 +441,16 @@ msgstr "Javascript est désactivé. Lufi ne fonctionnera pas."
|
|||
msgid "Language"
|
||||
msgstr "Langue"
|
||||
|
||||
#. (sprintf('<a href="https://framagit.org/fiat-tux/hat-softwares/lufi/-/commit/%s" class="classic">%s</a>', stash('version')
|
||||
#: themes/default/templates/about.html.ep:22
|
||||
msgid "Latest commit of this instance: %1"
|
||||
msgstr "Dernier commit de cette instance : %1"
|
||||
|
||||
#. (sprintf('<a href="https://framagit.org/fiat-tux/hat-softwares/lufi/-/releases/%s" class="classic">%s</a>', stash('version')
|
||||
#: themes/default/templates/about.html.ep:21
|
||||
msgid "Latest tag of this instance: %1"
|
||||
msgstr "Dernière étiquette de cette instance : %1"
|
||||
|
||||
#: themes/default/templates/login.html.ep:15
|
||||
msgid "Login"
|
||||
msgstr "Identifiant"
|
||||
|
@ -833,6 +843,10 @@ msgstr "Envoyé le"
|
|||
msgid "Uploaded files"
|
||||
msgstr "Fichiers envoyés"
|
||||
|
||||
#: themes/default/templates/about.html.ep:20
|
||||
msgid "Version"
|
||||
msgstr "Version"
|
||||
|
||||
#: themes/default/templates/partial/index.js.ep:30
|
||||
msgid "Websocket communication error"
|
||||
msgstr "Erreur de communication WebSocket"
|
||||
|
|
|
@ -94,7 +94,7 @@ msgstr ""
|
|||
msgid "Asking for file part XX1 of %1"
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/about.html.ep:20
|
||||
#: themes/default/templates/about.html.ep:23
|
||||
msgid "Back to homepage"
|
||||
msgstr ""
|
||||
|
||||
|
@ -389,6 +389,16 @@ msgstr ""
|
|||
msgid "Language"
|
||||
msgstr ""
|
||||
|
||||
#. (sprintf('<a href="https://framagit.org/fiat-tux/hat-softwares/lufi/-/commit/%s" class="classic">%s</a>', stash('version')
|
||||
#: themes/default/templates/about.html.ep:22
|
||||
msgid "Latest commit of this instance: %1"
|
||||
msgstr ""
|
||||
|
||||
#. (sprintf('<a href="https://framagit.org/fiat-tux/hat-softwares/lufi/-/releases/%s" class="classic">%s</a>', stash('version')
|
||||
#: themes/default/templates/about.html.ep:21
|
||||
msgid "Latest tag of this instance: %1"
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/login.html.ep:15
|
||||
msgid "Login"
|
||||
msgstr ""
|
||||
|
@ -694,6 +704,10 @@ msgstr ""
|
|||
msgid "Uploaded files"
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/about.html.ep:20
|
||||
msgid "Version"
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/partial/index.js.ep:31
|
||||
msgid "Websocket communication error"
|
||||
msgstr ""
|
||||
|
|
|
@ -17,5 +17,8 @@
|
|||
<p><%== l('As Lufi is a free software licensed under of the terms of the <a href="https://gnu.org/licenses/agpl.html" class="classic">AGPLv3</a>, you can install it on you own server. Have a look on the <a href="https://framagit.org/fiat-tux/hat-softwares/lufi/wikis/home" class="classic">Wiki</a> for the procedure.') %><br>
|
||||
<%== l('Get the source code on <a href="https://framagit.org/fiat-tux/hat-softwares/lufi" class="classic">the official repository</a> or on its <a href="https://github.com/ldidry/lufi" class="classic">Github mirror</a>') %>
|
||||
</p>
|
||||
<h3><%= l('Version') %></h3>
|
||||
<p><%== l('Latest tag of this instance: %1', sprintf('<a href="https://framagit.org/fiat-tux/hat-softwares/lufi/-/releases/%s" class="classic">%s</a>', stash('version')->{tag}, stash('version')->{tag})) %></p>
|
||||
<p><%== l('Latest commit of this instance: %1', sprintf('<a href="https://framagit.org/fiat-tux/hat-softwares/lufi/-/commit/%s" class="classic">%s</a>', stash('version')->{commit}, stash('version')->{commit})) %></p>
|
||||
<p><%= link_to url_for('/') => ( class => "btn waves-effect waves-light cyan" ) => begin %><%= l('Back to homepage') %><% end%></p>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue