Attention ! Gitlab fournissant maintenant nativement des certificats Let’s Encrypt aux domaines personnalisés des Gitlab Pages, nous avons coupé notre service qui le faisait automatiquement pour vous.

Il est impératif, pour que votre domaine personnalisé continue à avoir un certificat Let’s Encrypt à jour, d’activer la fonctionnalité native dans les paramètres de votre projet. Cette activation remplacera votre certificat actuel par un nouveau certificat Let’s Encrypt géré par Gitlab.

Voir les détails sur https://docs.framasoft.org/fr/gitlab/gitlab-pages-le.html

Commit 324c8063 authored by Luc Didry's avatar Luc Didry

Fix #6

parent 235a93c1
......@@ -67,8 +67,17 @@ vim de.pm
There's just a few sentences, so it will be quick to translate. Please consider to send me you language file in order to help the other users :smile:.
##Official instance
You can see it working and use it at http://lstu.fr.
##API
You can shorten an URL with a GET request:
`http://lstu.fr/a?lsturl=http://example.com&format=json`
With `format=json`, you will get a json string like that:
`{"short":"http:\/\/lstu.fr\/XuHRAT6P","success":true,"url":"http:\/\/example.com"}`
If you don't use `format=json`, you will be redirected to http://lstu.fr where the shortened URL informations will be displayed.
##Others projects dependancies
Lstu is written in Perl with the Mojolicious framework and uses the Twitter bootstrap framework to look not too ugly.
##Demo
You can see it working at http://lstu.fiat-tux.fr.
......@@ -2,6 +2,7 @@ package Lstu;
use Mojo::Base 'Mojolicious';
use LstuModel;
use Data::Validate::URI qw(is_uri);
use Mojo::JSON;
# This method will run once at server start
sub startup {
......@@ -66,7 +67,24 @@ sub startup {
$r->get('/' => sub {
my $c = shift;
$c->render(template => 'index');
if (defined($c->flash('format')) && $c->flash('format') eq 'json') {
my %struct;
if (defined($c->flash('msg'))) {
%struct = (
success => Mojo::JSON->false,
msg => $c->flash('msg')
);
} else {
%struct = (
success => Mojo::JSON->true,
short => $c->url_for('/')->to_abs().$c->flash('short'),
url => $c->flash('url')
);
}
$c->render(json => \%struct);
} else {
$c->render(template => 'index');
}
# Check provisionning
$c->on(finish => sub {
......@@ -78,13 +96,16 @@ sub startup {
my $c = shift;
my $url = $c->param('lsturl');
my $custom_url = $c->param('lsturl-custom');
my $format = $c->param('format');
my @keys = $c->param;
my @params;
foreach my $key (sort @keys) {
push @params, $key.'='.$c->param($key) unless ($key eq 'lsturl' || $key eq 'lsturl-custom');
push @params, $key.'='.$c->param($key) unless ($key eq 'lsturl' || $key eq 'lsturl-custom' || ($key eq 'format' && $c->param('format') eq 'json'));
}
$c->flash(format => 'json') if (defined($c->param('format')) && $c->param('format') eq 'json');
$url.= '&'.join('&', @params) if (scalar(@params));
$custom_url = undef if (defined($custom_url) && $custom_url eq '');
......
......@@ -3,7 +3,7 @@
% title 'Lstu';
<h1>Let's Shorten That Url</h1>
<p>
<small><%=l 'api' %> <%= link_to url_for('add')->query(lsturl => 'http://example.com')->to_abs => begin %><%= url_for('add')->query(lsturl => 'http://example.com')->to_abs %><% end %></small>
<small><%=l 'api' %> <%= link_to url_for('add')->query(lsturl => 'http://example.com', format => 'json')->to_abs => begin %><%= url_for('add')->query(lsturl => 'http://example.com', format => 'json')->to_abs %><% end %></small>
</p>
<p>
<small>&copy; 2013 <%= link_to 'http://www.fiat-tux.fr' => begin %>Luc Didry<% end %>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment