Commit 39b444da authored by Luc Didry's avatar Luc Didry

Really big commit

* Change internationalization system (.po files now)
* Fixed domain for shortened URLs system (#12)
* Fix XSS vulnerability (#15)
* Subdirectory mounting system (#16)
* Show your URLs page
* Show all URLs page for admin (#11)
* API description page
* API change
* Self-documented configuration template
parent 2102b93a
EXTRACTFILES=utilities/locales_files.txt
EXTRACTTO=lib/Lstu/I18N/en.po
XGETTEXT=carton exec local/bin/xgettext.pl
locales:
$(XGETTEXT) -f $(EXTRACTFILES) -o $(EXTRACTTO)
# LSTU
# Lstu
## What Lstu means ?
Please register or sign in to reply
## What LSTU means ?
It means Let's Shorten That Url.
## License
Lstu is licensed under the terms of the WTFPL. See the LICENSE file.
## Dependancies
Please register or sign in to reply
* Carton : Perl dependancies manager, it will get what you need, so don't bother for dependancies (but you can read the file `cpanfile` if you want).
Please register or sign in to reply
* Carton : Perl dependencies manager, it will get what you need, so don't bother for dependencies (but you can read the file `cpanfile` if you want).
```shell
sudo cpan Carton
......@@ -15,6 +18,7 @@ sudo cpan Carton
## Installation
After installing Carton :
```shell
git clone https://git.framasoft.org/luc/lstu.git
cd lstu
......@@ -23,6 +27,7 @@ cp lstu.conf.template lstu.conf
```
## Usage
```
carton exec hypnotoad script/lstu
```
......@@ -31,14 +36,21 @@ Yup, that's all, it will listen at "http://127.0.0.1:8080".
For more options (interfaces, user, etc.), change the configuration in `lstu.conf` (have a look at http://mojolicio.us/perldoc/Mojo/Server/Hypnotoad#SETTINGS for the available options).
## Other options
There is the `contact` option (mandatory), where you have to put some way for the users to contact you, and the `secret` where you have to put a random string in order to protect your Mojolicious cookies (not really useful and optional).
Please, have a look at the `lstu.conf.template`, it's full of options and self-documented.
## How many urls can it handle ?
Well, by default, there is 8 361 453 672 available combinations. I think the sqlite db will explod before you reach this limit. If you want more shortened URLs than that, open `lstu.conf` and change the `length` setting.
Everytime somebody uses LSTU, it will create 'waiting' shortened URLs codes in order to be quick to shorten the URLs.
By default, there are 8 361 453 672 available combinations. I think the sqlite db will explode before you reach this limit. If you want more shortened URLs than that, open `lstu.conf` and change the `length` setting.
Accordingly to the `lstu.conf` configuration file, it will create `provisionning` waiting URLs, adding them `provis_step` by `provis_step`.
Everytime somebody uses Lstu, it will create 'waiting' shortened URLs codes in order to be quick to shorten the URLs.
This provisionning asks to modify your database if your updating LSTU from 0.01 to 0.02:
Accordingly to the `lstu.conf` configuration file, it will create `provisioning` waiting URLs, adding them `provis_step` by `provis_step`.
This provisioning asks to modify your database if you're updating Lstu from 0.01 to 0.02:
```shell
sqlite3 lstu.db
```
......@@ -49,35 +61,28 @@ UPDATE SQLITE_MASTER SET SQL = 'CREATE TABLE lstu (short TEXT PRIMARY KEY, url T
PRAGMA writable_schema = 0;
```
## Other options
Well, there is the `contact` option, where you a to put some way for the users to contact you, and the `secret` where you have to put a random string in order to protect your Mojolicious cookies (not really useful and optional).
## Reverse proxy
You can use a reverse proxy like Nginx or Varnish (or Apache with the mod\_proxy module). The web is full of tutos.
## Internationalization
LSTU comes with english and french languages. It will choose the language to display with the browser's settings.
If you want to add more languages, for example german:
```shell
cd lib/I18N
cp en.pm de.pm
vim de.pm
```
Lstu comes with English and French languages. It will choose the language to display with the browser's settings.
If you want to add more languages, please help on <https://www.transifex.com/projects/p/lstu/>
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:.
There are just a few sentences, so it will be quick to translate.
If you add sentences to translate, just do `make locales` to update the en.po file and don't forget to update the others translation files.
## Official instance
You can see it working and use it at http://lstu.fr.
You can see it working and use it at https://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"}`
See https://lstu.fr/api
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 dependencies
Please register or sign in to reply
## Others projects dependancies
Lstu is written in Perl with the Mojolicious framework and uses the Twitter bootstrap framework to look not too ugly.
......@@ -2,3 +2,5 @@ requires 'Mojolicious', '>= 4.63';
requires 'ORLite';
requires 'Data::Validate::URI';
requires 'Mojolicious::Plugin::I18N';
requires 'Locale::Maketext';
requires 'Locale::Maketext::Extract';
# carton snapshot format: version 1.0
DISTRIBUTIONS
CPAN-Meta-2.150001
pathname: D/DA/DAGOLDEN/CPAN-Meta-2.150001.tar.gz
provides:
CPAN::Meta 2.150001
CPAN::Meta::Converter 2.150001
CPAN::Meta::Feature 2.150001
CPAN::Meta::History 2.150001
CPAN::Meta::Merge 2.150001
CPAN::Meta::Prereqs 2.150001
CPAN::Meta::Spec 2.150001
CPAN::Meta::Validator 2.150001
requirements:
CPAN::Meta::Requirements 2.121
CPAN::Meta::YAML 0.008
Carp 0
ExtUtils::MakeMaker 6.17
JSON::PP 2.27200
Parse::CPAN::Meta 1.4414
Scalar::Util 0
perl 5.008
strict 0
version 0.88
warnings 0
DBD-SQLite-1.40
pathname: I/IS/ISHIGAKI/DBD-SQLite-1.40.tar.gz
provides:
......@@ -9,7 +32,7 @@ DISTRIBUTIONS
DBD::SQLite::dr 1.40
requirements:
DBI 1.57
ExtUtils::MakeMaker 6.48
ExtUtils::MakeMaker 0
File::Spec 0.82
Test::Builder 0.86
Test::More 0.47
......@@ -156,8 +179,86 @@ DISTRIBUTIONS
ExtUtils::MakeMaker 0
Test::More 0.31
Time::HiRes 0
Mojolicious-4.39
pathname: S/SR/SRI/Mojolicious-4.39.tar.gz
Locale-Maketext-Lexicon-1.00
pathname: D/DR/DRTECH/Locale-Maketext-Lexicon-1.00.tar.gz
provides:
Locale::Maketext::Extract 1.00
Locale::Maketext::Extract::Plugin::Base 1.00
Locale::Maketext::Extract::Plugin::FormFu 1.00
Locale::Maketext::Extract::Plugin::FormFu::Extractor 1.00
Locale::Maketext::Extract::Plugin::Generic 1.00
Locale::Maketext::Extract::Plugin::Haml 1.00
Locale::Maketext::Extract::Plugin::Mason 1.00
Locale::Maketext::Extract::Plugin::PPI 1.00
Locale::Maketext::Extract::Plugin::Perl 1.00
Locale::Maketext::Extract::Plugin::TT2 1.00
Locale::Maketext::Extract::Plugin::TT2::Directive 1.00
Locale::Maketext::Extract::Plugin::TT2::Parser 1.00
Locale::Maketext::Extract::Plugin::TextTemplate 1.00
Locale::Maketext::Extract::Plugin::TextTemplate::Parser 1.00
Locale::Maketext::Extract::Plugin::YAML 1.00
Locale::Maketext::Extract::Plugin::YAML::Extractor 1.00
Locale::Maketext::Extract::Run 1.00
Locale::Maketext::Lexicon 1.00
Locale::Maketext::Lexicon::Auto 1.00
Locale::Maketext::Lexicon::Gettext 1.00
Locale::Maketext::Lexicon::Msgcat 1.00
Locale::Maketext::Lexicon::Tie 1.00
requirements:
ExtUtils::MakeMaker 6.30
Locale::Maketext 1.17
Module-Build-0.4212
pathname: L/LE/LEONT/Module-Build-0.4212.tar.gz
provides:
Module::Build 0.4212
Module::Build::Base 0.4212
Module::Build::Compat 0.4212
Module::Build::Config 0.4212
Module::Build::Cookbook 0.4212
Module::Build::Dumper 0.4212
Module::Build::Notes 0.4212
Module::Build::PPMMaker 0.4212
Module::Build::Platform::Default 0.4212
Module::Build::Platform::MacOS 0.4212
Module::Build::Platform::Unix 0.4212
Module::Build::Platform::VMS 0.4212
Module::Build::Platform::VOS 0.4212
Module::Build::Platform::Windows 0.4212
Module::Build::Platform::aix 0.4212
Module::Build::Platform::cygwin 0.4212
Module::Build::Platform::darwin 0.4212
Module::Build::Platform::os2 0.4212
Module::Build::PodParser 0.4212
requirements:
CPAN::Meta 2.142060
CPAN::Meta::YAML 0.003
Cwd 0
Data::Dumper 0
ExtUtils::CBuilder 0.27
ExtUtils::Install 0
ExtUtils::Manifest 0
ExtUtils::Mkbootstrap 0
ExtUtils::ParseXS 2.21
File::Basename 0
File::Compare 0
File::Copy 0
File::Find 0
File::Path 0
File::Spec 0.82
File::Temp 0.15
Getopt::Long 0
Module::Metadata 1.000002
Parse::CPAN::Meta 1.4401
Perl::OSType 1
Pod::Man 2.17
Test::Harness 3.16
Test::More 0.49
Text::Abbrev 0
Text::ParseWords 0
perl 5.008000
version 0.87
Mojolicious-6.11
pathname: S/SR/SRI/Mojolicious-6.11.tar.gz
provides:
Mojo undef
Mojo::Asset undef
......@@ -216,9 +317,11 @@ DISTRIBUTIONS
Mojo::Upload undef
Mojo::UserAgent undef
Mojo::UserAgent::CookieJar undef
Mojo::UserAgent::Proxy undef
Mojo::UserAgent::Server undef
Mojo::UserAgent::Transactor undef
Mojo::Util undef
Mojolicious 4.39
Mojolicious 6.11
Mojolicious::Command undef
Mojolicious::Command::cgi undef
Mojolicious::Command::cpanify undef
......@@ -228,7 +331,7 @@ DISTRIBUTIONS
Mojolicious::Command::generate::app undef
Mojolicious::Command::generate::lite_app undef
Mojolicious::Command::generate::makefile undef
Mojolicious::Command::generate::plugin 0.01
Mojolicious::Command::generate::plugin undef
Mojolicious::Command::get undef
Mojolicious::Command::inflate undef
Mojolicious::Command::prefork undef
......@@ -260,18 +363,23 @@ DISTRIBUTIONS
Mojolicious::Sessions undef
Mojolicious::Static undef
Mojolicious::Types undef
Mojolicious::Validator undef
Mojolicious::Validator::Validation undef
Test::Mojo undef
ojo undef
requirements:
ExtUtils::MakeMaker 0
Mojolicious-Plugin-I18N-1.0
pathname: S/SH/SHARIFULN/Mojolicious-Plugin-I18N-1.0.tar.gz
IO::Socket::IP 0.26
Pod::Simple 3.09
Time::Local 1.2
Mojolicious-Plugin-I18N-1.5
pathname: S/SH/SHARIFULN/Mojolicious-Plugin-I18N-1.5.tar.gz
provides:
Mojolicious::Plugin::I18N 1.0
Mojolicious::Plugin::I18N 1.5
requirements:
I18N::LangTags 0.35
Module::Build 0.36
Mojolicious 3
Module::Build 0.42
Mojolicious 5
Test::More 0
perl 5.010001
Net-Domain-TLD-1.70
......
This diff is collapsed.
package Lstu::I18N;
use base 'Locale::Maketext';
use File::Basename qw/dirname/;
use Locale::Maketext::Lexicon {
_auto => 1,
_decode => 1,
'*' => [Gettext => dirname(__FILE__) . '/I18N/*.po']
};
1;
package Lstu::I18N::en;
use Mojo::Base 'Lstu::I18N';
our %Lexicon = (
'about' => 'About',
'already_taken' => 'The shortened text ([_1]) is already used. Please choose another one.',
'api' => 'Fast way to shorten an URL:',
'custom-url' => 'Custom shortened text',
'go' => 'Go !',
'license' => 'License:',
'no_more_short' => 'No shortened URL available. Please retry or contact the administrator at [_1]. Your URL to shorten: [_2]',
'no_valid_shorcut' => 'The shortened text can contain only numbers, letters and the - and _ characters and can\'t be "a".',
'no_valid_url' => '[_1] is not a valid URL.',
'url_not_found' => 'The shortened URL [_1] doesn\'t exist.',
'url_to_shorten' => 'URL to shorten',
);
1;
# Lstu
# Copyright (C) 2013 - 2015 Luc Didry
# This file is distributed under the same license as the Lstu package.
# Luc Didry <luc@didry.org>, 2015.
#
msgid ""
msgstr ""
"Project-Id-Version: Lstu - 0.04\n"
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: 2015-05-28 23:35+0100\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Last-Translator: Luc Didry <luc@didry.org>\n"
"Language-Team: Luc Didry <admin@lstu.fr>\n"
"Language: en\n"
"X-Generator: Poedit 1.7.7\n"
"X-Poedit-SourceCharset: UTF-8\n"
#. ($url)
#: lib/Lstu.pm:172
msgid "%1 is not a valid URL."
msgstr ""
#: templates/layouts/default.html.ep:27
msgid "About"
msgstr ""
#: templates/stats.html.ep:10 templates/stats.html.ep:9
msgid "Admin password"
msgstr ""
#: lib/Lstu.pm:274
msgid "Bad password"
msgstr ""
#: templates/stats.html.ep:26
msgid "Counter"
msgstr ""
#: templates/stats.html.ep:27
msgid "Created"
msgstr ""
#: templates/api.html.ep:15 templates/index.html.ep:10 templates/index.html.ep:9
msgid "Custom shortened text"
msgstr ""
#: templates/api.html.ep:21 templates/api.html.ep:39
msgid "Failure reason"
msgstr ""
#: templates/index.html.ep:12 templates/stats.html.ep:13
msgid "Go!"
msgstr ""
#: templates/api.html.ep:16
msgid "If equal to \"json\", response will be in JSON format, HTML format otherwise"
msgstr ""
#: templates/api.html.ep:21 templates/api.html.ep:39
msgid "JSON: failure"
msgstr ""
#: templates/api.html.ep:20 templates/api.html.ep:38
msgid "JSON: success"
msgstr ""
#: templates/layouts/default.html.ep:26
msgid "License:"
msgstr ""
#: templates/stats.html.ep:51
msgid "Next"
msgstr ""
#. ($c->config('contact')
#: lib/Lstu.pm:165
msgid "No shortened URL available. Please retry or contact the administrator at %1. Your URL to shorten: %2"
msgstr ""
#: templates/api.html.ep:12
msgid "Parameters:"
msgstr ""
#: templates/stats.html.ep:50
msgid "Previous"
msgstr ""
#: templates/api.html.ep:22
msgid "Response for HTML format"
msgstr ""
#: templates/api.html.ep:18 templates/api.html.ep:27 templates/api.html.ep:36
msgid "Response:"
msgstr ""
#: templates/stats.html.ep:25
msgid "Shortened URL"
msgstr ""
#: templates/layouts/default.html.ep:29 templates/stats.html.ep:4
msgid "Statistics"
msgstr ""
#. ($c->url_for('/')
#: lib/Lstu.pm:300
msgid "The shortened URL %1 doesn't exist."
msgstr ""
#. ($custom_url)
#: lib/Lstu.pm:135
msgid "The shortened text (%1) is already used. Please choose another one."
msgstr ""
#. ($url)
#: lib/Lstu.pm:133
msgid "The shortened text can contain only numbers, letters and the - and _ characters and can't be \"a\", \"api\" or \"stats\". Your URL to shorten: %1"
msgstr ""
#: templates/stats.html.ep:24
msgid "URL"
msgstr ""
#: templates/api.html.ep:14 templates/index.html.ep:5 templates/index.html.ep:6
msgid "URL to shorten"
msgstr ""
#: templates/api.html.ep:22
msgid "You will be redirected to the Lstu interface with a message giving the shortened URL"
msgstr ""
#: templates/api.html.ep:30
msgid "You will be redirected to the targeted URL or to the Lstu interface with a message giving the failure reason"
msgstr ""
#: templates/api.html.ep:14
msgid "mandatory"
msgstr ""
#: templates/api.html.ep:15 templates/api.html.ep:16
msgid "optional"
msgstr ""
#: templates/api.html.ep:25 templates/api.html.ep:34
msgid "shortened_url"
msgstr ""
package Lstu::I18N::fr;
use Mojo::Base 'Lstu::I18N';
our %Lexicon = (
'about' => 'À propos',
'already_taken' => 'Le texte du raccourci ([_1]) est déjà utilisé. Veuillez en choisir un autre',
'api' => 'Raccourcir rapidement une URL :',
'custom-url' => 'Texte du raccourci personnalisé',
'go' => 'Allons-y !',
'license' => 'Licence : ',
'no_more_short' => 'Il n\'y a plus d\'URL raccourcie disponible. Veuillez réessayer ou contactez l\'administrateur sur [_1]. Rappel de l\'URL à raccourcir : [_2]',
'no_valid_shorcut' => 'Le texte du raccourci ne doit contenir que des chiffres, des lettres et les caractères - et _ et ne peut être "a".',
'no_valid_url' => '[_1] n\'est pas une URL valide.',
'url_not_found' => 'L\'URL raccourcie [_1] n\'existe pas.',
'url_to_shorten' => 'URL à raccourcir',
);
1;
# Lstu
# Copyright (C) 2013 - 2015 Luc Didry
# This file is distributed under the same license as the Lstu package.
# Luc Didry <luc@didry.org>, 2015.
#
msgid ""
msgstr ""
"Project-Id-Version: Lstu - 0.04\n"
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: 2015-05-28 23:52+0100\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"Last-Translator: Luc Didry <luc@didry.org>\n"
"Language-Team: Luc Didry <admin@lstu.fr>\n"
"Language: fr\n"
"X-Generator: Poedit 1.7.7\n"
#. ($url)
#: lib/Lstu.pm:172
msgid "%1 is not a valid URL."
msgstr "%1 n’est pas une URL valide."
#: templates/layouts/default.html.ep:27
msgid "About"
msgstr "À propos"
#: templates/stats.html.ep:10 templates/stats.html.ep:9
msgid "Admin password"
msgstr "Mot de passe administrateur"
#: lib/Lstu.pm:274
msgid "Bad password"
msgstr "Mot de passe incorrect"
#: templates/stats.html.ep:26
msgid "Counter"
msgstr "Compteur"
#: templates/stats.html.ep:27
msgid "Created"
msgstr "Créé le"
#: templates/api.html.ep:15 templates/index.html.ep:10
#: templates/index.html.ep:9
msgid "Custom shortened text"
msgstr "Texte du raccourci personnalisé"
#: templates/api.html.ep:21 templates/api.html.ep:39
msgid "Failure reason"
msgstr "Raison de l’échec"
#: templates/index.html.ep:12 templates/stats.html.ep:13
msgid "Go!"
msgstr "Allons-y !"
#: templates/api.html.ep:16
msgid "If equal to \"json\", response will be in JSON format, HTML format otherwise"
msgstr "Si égal à \"json\", la réponse sera au format JSON, sinon ce sera une réponse en HTML"
#: templates/api.html.ep:21 templates/api.html.ep:39
msgid "JSON: failure"
msgstr "JSON : échec"
#: templates/api.html.ep:20 templates/api.html.ep:38
msgid "JSON: success"
msgstr "JSON : succès"
#: templates/layouts/default.html.ep:26
msgid "License:"
msgstr "Licence :"
#: templates/stats.html.ep:51
msgid "Next"
msgstr "Suivant"
#. ($c->config('contact')
#: lib/Lstu.pm:165
msgid "No shortened URL available. Please retry or contact the administrator at %1. Your URL to shorten: %2"
msgstr "Il n’y a plus d’URL raccourcie disponible. Veuillez réessayer ou contactez l’administrateur sur %1. Rappel de l’URL à raccourcir : %2"
#: templates/api.html.ep:12
msgid "Parameters:"
msgstr "Paramètres :"
#: templates/stats.html.ep:50
msgid "Previous"
msgstr "Précédent"
#: templates/api.html.ep:22
msgid "Response for HTML format"
msgstr "Réponse pour le format HTML"
#: templates/api.html.ep:18 templates/api.html.ep:27 templates/api.html.ep:36
msgid "Response:"
msgstr "Réponse :"
#: templates/stats.html.ep:25
msgid "Shortened URL"
msgstr "URL raccourcie"
#: templates/layouts/default.html.ep:29 templates/stats.html.ep:4
msgid "Statistics"
msgstr "Statistiques"
#. ($c->url_for('/')
#: lib/Lstu.pm:300
msgid "The shortened URL %1 doesn't exist."
msgstr "L’URL raccourcie %1 n’existe pas"
#. ($custom_url)
#: lib/Lstu.pm:135
msgid "The shortened text (%1) is already used. Please choose another one."
msgstr "Le texte du raccourci (%1) est déjà utilisé. Veuillez en choisir un autre"
#. ($url)
#: lib/Lstu.pm:133
msgid "The shortened text can contain only numbers, letters and the - and _ characters and can't be \"a\", \"api\" or \"stats\". Your URL to shorten: %1"
msgstr "Le texte du raccourci ne doit contenir que des chiffres, des lettres et les caractères - et _ et ne peut être \"a\", \"api\" ou \"stats\". Rappel de l’URL à raccourcir : %2"
#: templates/stats.html.ep:24
msgid "URL"
msgstr "URL"
#: templates/api.html.ep:14 templates/index.html.ep:5
#: templates/index.html.ep:6
msgid "URL to shorten"
msgstr "URL à raccourcir"
#: templates/api.html.ep:22
msgid "You will be redirected to the Lstu interface with a message giving the shortened URL"
msgstr "Vous aurez l’interface normale de Lstu avec un message indiquant l’URL raccourcie"
#: templates/api.html.ep:30
msgid "You will be redirected to the targeted URL or to the Lstu interface with a message giving the failure reason"
msgstr "Vous serez redirigé vers l’URL cible ou vers la page d’accueil de Lstu avec un message indiquant la raison de l’échec"
#: templates/api.html.ep:14
msgid "mandatory"
msgstr "obligatoire"
#: templates/api.html.ep:15 templates/api.html.ep:16
msgid "optional"
msgstr "facultatif"
#: templates/api.html.ep:25 templates/api.html.ep:34
msgid "shortened_url"
msgstr "url_raccourcie"
package Mounter;
use Mojo::Base 'Mojolicious';
use FindBin qw($Bin);
use File::Spec qw(catfile);
# This method will run once at server start
sub startup {
my $self = shift;
my $config = $self->plugin('Config' =>
{
file => File::Spec->catfile($Bin, '..' ,'lstu.conf'),
default => {
prefix => '/'
}
}
);
$self->plugin('Mount' => {$config->{prefix} => File::Spec->catfile($Bin, '..', 'script', 'application')});
}
1;
# vim:set sw=4 ts=4 sts=4 ft=perl expandtab:
{
####################
# Hypnotoad settings
####################
# see http://mojolicio.us/perldoc/Mojo/Server/Hypnotoad for a full list of settings
hypnotoad => {
# array of IP addresses and ports you want to listen to
listen => ['http://127.0.0.1:8080'],
# user and group you want for Lstu to run with
# be sure that this user/group have rights on the lstu directory
# if you launch lstu from a different user, be sure that this user have the right to su this user/group
# => if current_user is not the user that you sets here and is not root, there's chances that it will fail (see https://github.com/ldidry/lstu/issues/25)
user => 'www-data',
group => 'www-data'
},
contact => 'admin[at]example.com',
secret => ['fdjsofjoihrei'], # optional, but it has to be an array
length => 8, # optional
provis_step => 5, # optional
provisionning => 100 # optional
# put a way to contact you here and uncomment it
# MANDATORY
#contact => 'admin[at]example.com',
# array of random strings used to encrypt cookies
# optional, default is ['fdjsofjoihrei'], PLEASE, CHANGE IT
#secret => ['fdjsofjoihrei'],
# secret passphrase to access some admin features
# optional, but you won't have access to admin /stats if not set
#adminpwd => 's3cr3T',
# number of URLs to be displayed per page in /stats
# optional, default is 10
#page_offset => 10,
# length of the random URL
# optional, default is 8
#length => 8,
# how many URLs will be provisioned in a batch ?
# optional, default is 5
#provis_step => 5,
# max number of URLs to be provisioned
# optional, default is 100
#provisioning => 100,
# URL sub-directory in which you want Lstu to be accessible
# example: you want to have Lstu under https://example.org/lstu/
# => set url_sub_dir to '/lstu' or to '/lstu/', it doesn't matter
# optional, defaut is /
#prefix => '/',
# array of authorized domains for API calls.
# if you want to authorize everyone to use the API: ['*']
# optional, no domains allowed by default
#allowed_domains => ['http://1.example.com', 'http://2.example.com'],
# if set, the shortened URLs will use this domain
# optional
#fixed_domain => 'example.org',
};
#!/usr/bin/env perl
use strict;
use warnings;
use FindBin;
BEGIN { unshift @INC, "$FindBin::Bin/../lib" }
# Start command line interface for application
require Mojolicious::Commands;
Mojolicious::Commands->start_app('Lstu');
......@@ -8,4 +8,4 @@ BEGIN { unshift @INC, "$FindBin::Bin/../lib" }
# Start command line interface for application
require Mojolicious::Commands;
Mojolicious::Commands->start_app('Lstu');
Mojolicious::Commands->start_app('Mounter');
% # vim:set sw=4 ts=4 sts=4 ft=html.epl expandtab:
% title 'Lstu API';
%= stylesheet begin
dd > strong {
padding-left: 15px;
}
% end
<h2>Lstu API</h2>
<dl>
<dt>POST /a</dt>
<dd>
<strong><%=