Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Fiat Tux
Hat softwares
Lutim
Commits
f2f785e6
Verified
Commit
f2f785e6
authored
Jul 26, 2018
by
Luc Didry
Browse files
Fix
#5
- Allow to use a fixed domain
parent
78bb3f37
Changes
5
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
f2f785e6
...
...
@@ -16,6 +16,7 @@ Revision history for Lutim
- Add CLI command to remove images
- Add CLI command to search images based on the uploader's IP address
- Add .zip file check in the tests
- Allow to use a fixed domain
0.10.4 2018-05-07
- Fix bug in cache system that would allow someone to view an image with an incorrect decryption key
...
...
lib/Lutim/Plugin/Helpers.pm
View file @
f2f785e6
...
...
@@ -51,6 +51,7 @@ sub register {
$app
->
helper
(
decrypt
=>
\
&_decrypt
);
$app
->
helper
(
delete_image
=>
\
&_delete_image
);
$app
->
helper
(
iso639_native_name
=>
\
&_iso639_native_name
);
$app
->
helper
(
prefix
=>
\
&_prefix
);
}
sub
_pg
{
...
...
@@ -321,4 +322,15 @@ sub _iso639_native_name {
return
ucfirst
(
decode
'
UTF-8
',
get_iso639_1
(
shift
)
->
{
nativeName
});
}
sub
_prefix
{
my
$c
=
shift
;
my
$prefix
=
$c
->
url_for
('
/
')
->
to_abs
;
# Forced domain
$prefix
->
host
(
$c
->
config
('
fixed_domain
'))
if
(
defined
(
$c
->
config
('
fixed_domain
'))
&&
$c
->
config
('
fixed_domain
')
ne
'');
# Hack for prefix (subdir) handling
$prefix
.=
'
/
'
unless
(
$prefix
=~
m#/$#
);
return
$prefix
;
}
1
;
lutim.conf.template
View file @
f2f785e6
...
...
@@ -236,6 +236,10 @@
# optional, default is '1; mode=block'
#x_xss_protection => '1; mode=block',
# if set, the uploaded images will use this domain
# optional
#fixed_domain => 'example.org',
##########################
# Lutim cron jobs settings
##########################
...
...
themes/default/lib/Lutim/I18N/lutim.pot
View file @
f2f785e6
...
...
@@ -19,7 +19,7 @@ msgstr ""
#. (30)
#. ($delay)
#. (config('max_delay')
#: lib/Lutim/Command/cron/stats.pm:147 lib/Lutim/Command/cron/stats.pm:148 lib/Lutim/Command/cron/stats.pm:161 lib/Lutim/Command/cron/stats.pm:162 lib/Lutim/Command/cron/stats.pm:178 lib/Lutim/Command/cron/stats.pm:179 themes/default/templates/partial/for_my_delay.html.ep:13 themes/default/templates/partial/for_my_delay.html.ep:14 themes/default/templates/partial/for_my_delay.html.ep:4 themes/default/templates/partial/lutim.js.ep:140 themes/default/templates/partial/lutim.js.ep:149 themes/default/templates/partial/lutim.js.ep:150
#: lib/Lutim/Command/cron/stats.pm:147 lib/Lutim/Command/cron/stats.pm:148 lib/Lutim/Command/cron/stats.pm:161 lib/Lutim/Command/cron/stats.pm:162 lib/Lutim/Command/cron/stats.pm:178 lib/Lutim/Command/cron/stats.pm:179 themes/default/templates/partial/for_my_delay.html.ep:13 themes/default/templates/partial/for_my_delay.html.ep:14 themes/default/templates/partial/for_my_delay.html.ep:4 themes/default/templates/partial/lutim.js.ep:140 themes/default/templates/partial/lutim.js.ep:149 themes/default/templates/partial/lutim.js.ep:150
themes/default/templates/partial/raw.js.ep:23 themes/default/templates/partial/raw.js.ep:24 themes/default/templates/partial/raw.js.ep:6 themes/default/templates/partial/raw.js.ep:7 themes/default/templates/raw.html.ep:8 themes/default/templates/raw.html.ep:9
msgid "%1 days"
msgstr ""
...
...
@@ -32,11 +32,11 @@ msgstr ""
msgid "-or-"
msgstr ""
#: lib/Lutim.pm:221 lib/Lutim/Command/cron/stats.pm:149 lib/Lutim/Command/cron/stats.pm:163 lib/Lutim/Command/cron/stats.pm:180 themes/default/templates/index.html.ep:5
#: lib/Lutim.pm:221 lib/Lutim/Command/cron/stats.pm:149 lib/Lutim/Command/cron/stats.pm:163 lib/Lutim/Command/cron/stats.pm:180 themes/default/templates/index.html.ep:5
themes/default/templates/partial/raw.js.ep:25 themes/default/templates/partial/raw.js.ep:8 themes/default/templates/raw.html.ep:10
msgid "1 year"
msgstr ""
#: lib/Lutim.pm:220 lib/Lutim/Command/cron/stats.pm:146 lib/Lutim/Command/cron/stats.pm:160 lib/Lutim/Command/cron/stats.pm:177 themes/default/templates/index.html.ep:4 themes/default/templates/partial/for_my_delay.html.ep:13 themes/default/templates/partial/lutim.js.ep:149
#: lib/Lutim.pm:220 lib/Lutim/Command/cron/stats.pm:146 lib/Lutim/Command/cron/stats.pm:160 lib/Lutim/Command/cron/stats.pm:177 themes/default/templates/index.html.ep:4 themes/default/templates/partial/for_my_delay.html.ep:13 themes/default/templates/partial/lutim.js.ep:149
themes/default/templates/partial/raw.js.ep:22 themes/default/templates/partial/raw.js.ep:5 themes/default/templates/raw.html.ep:7
msgid "24 hours"
msgstr ""
...
...
@@ -48,7 +48,7 @@ msgstr ""
msgid "About"
msgstr ""
#: lib/Lutim/Command/cron/stats.pm:142
#: lib/Lutim/Command/cron/stats.pm:142
themes/default/templates/raw.html.ep:3
msgid "Active images"
msgstr ""
...
...
@@ -104,11 +104,11 @@ msgstr ""
msgid "Delete at first view?"
msgstr ""
#: lib/Lutim/Command/cron/stats.pm:143
#: lib/Lutim/Command/cron/stats.pm:143
themes/default/templates/raw.html.ep:4
msgid "Deleted images"
msgstr ""
#: lib/Lutim/Command/cron/stats.pm:144
#: lib/Lutim/Command/cron/stats.pm:144
themes/default/templates/raw.html.ep:5
msgid "Deleted images in 30 days"
msgstr ""
...
...
@@ -196,7 +196,7 @@ msgstr ""
msgid "Image URL"
msgstr ""
#: lib/Lutim/Command/cron/stats.pm:141
#: lib/Lutim/Command/cron/stats.pm:141
themes/default/templates/raw.html.ep:2
msgid "Image delay"
msgstr ""
...
...
@@ -413,7 +413,7 @@ msgstr ""
msgid "Toggle navigation"
msgstr ""
#: lib/Lutim/Command/cron/stats.pm:150
#: lib/Lutim/Command/cron/stats.pm:150
themes/default/templates/raw.html.ep:11
msgid "Total"
msgstr ""
...
...
@@ -430,7 +430,7 @@ msgstr ""
msgid "Unable to find the image %1."
msgstr ""
#: lib/Lutim/Controller.pm:572 lib/Lutim/Controller.pm:617 lib/Lutim/Controller.pm:656 lib/Lutim/Controller.pm:699 lib/Lutim/Controller.pm:711 lib/Lutim/Controller.pm:722 lib/Lutim/Controller.pm:749 lib/Lutim/Plugin/Helpers.pm:8
7
#: lib/Lutim/Controller.pm:572 lib/Lutim/Controller.pm:617 lib/Lutim/Controller.pm:656 lib/Lutim/Controller.pm:699 lib/Lutim/Controller.pm:711 lib/Lutim/Controller.pm:722 lib/Lutim/Controller.pm:749 lib/Lutim/Plugin/Helpers.pm:8
8
msgid "Unable to find the image: it has been deleted."
msgstr ""
...
...
@@ -455,7 +455,7 @@ msgid "Uploaded files by days"
msgstr ""
#. ($c->app->config('contact')
#: lib/Lutim/Plugin/Helpers.pm:22
0
#: lib/Lutim/Plugin/Helpers.pm:22
1
msgid "Uploading is currently disabled, please try later or contact the administrator (%1)."
msgstr ""
...
...
@@ -507,7 +507,7 @@ msgstr ""
msgid "core developer"
msgstr ""
#: lib/Lutim.pm:219 lib/Lutim/Command/cron/stats.pm:145 lib/Lutim/Command/cron/stats.pm:159 lib/Lutim/Command/cron/stats.pm:176 themes/default/templates/index.html.ep:3
#: lib/Lutim.pm:219 lib/Lutim/Command/cron/stats.pm:145 lib/Lutim/Command/cron/stats.pm:159 lib/Lutim/Command/cron/stats.pm:176 themes/default/templates/index.html.ep:3
themes/default/templates/partial/raw.js.ep:21 themes/default/templates/partial/raw.js.ep:4 themes/default/templates/raw.html.ep:6
msgid "no time limit"
msgstr ""
...
...
themes/default/templates/partial/common.js.ep
View file @
f2f785e6
%
#
vim
:
set
sw
=
4
ts
=
4
sts
=
4
ft
=
javascript
expandtab
:
window
.
gallery_url
=
'
<%=
url_for(
'
gallery
'
)->to_abs
%>#
'
;
window
.
zip_url
=
'
<%=
url_for(
'
zip
'
)->to_abs
%>?i=
'
;
window
.
gallery_url
=
'
<%=
prefix().
'
gallery
'
%>#
'
;
window
.
zip_url
=
'
<%=
prefix().
'
zip
'
%>?i=
'
;
window
.
short_hash
=
{};
window
.
zip_hash
=
{};
function
addToShortHash
(
short
)
{
...
...
@@ -173,7 +173,7 @@ function link(url, dl, token, modify, only_url) {
}
else
if
(
dl
!==
''
)
{
url
=
url
+
'
?
'
+
dl
;
}
return
'
<%==
url_for(
'
/
'
)->to_abs
() %>
'
+
url
;
return
'
<%==
prefix
() %>
'
+
url
;
}
function
badToast
(
msg
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment