Skip to content

Commit c0c924f

Browse files
committed
Merge pull request #444 from electerious/develop
Lychee 3.0.9
2 parents b60f9ed + 7a7ae24 commit c0c924f

23 files changed

+205
-225
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist/**/* binary

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2016 Tobias Reich (http://electerious.com/)
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

+2-19
Original file line numberDiff line numberDiff line change
@@ -64,29 +64,12 @@ Here's a list of all available Plugins and Extensions:
6464
| lychee-watermark | Adds a second watermarked photo when uploading images | [More »](https://github.com/electerious/lychee-watermark) |
6565
| lychee-rss | Creates a RSS-Feed out of your photos | [More »](https://github.com/cternes/Lychee-RSS) |
6666
| lychee-FlashAir | Import from a Toshiba FlashAir WiFi SD card | [More »](https://github.com/mhp/Lychee-FlashAir) |
67+
| lychee-webroot | Controls photos accessibility and keeps Lychee files hidden | [More »](https://github.com/Bramas/lychee-webroot) |
6768

6869
## Troubleshooting
6970

7071
Take a look at the [FAQ](docs/FAQ.md) if you have problems. Discovered a bug? Please create an issue here on GitHub!
7172

72-
## Developer
73-
| Version | Name |
74-
|:-----------|:------------|
75-
| 1.2, 1.3, 2.x, 3.x | [Tobias Reich](http://electerious.com)|
76-
| 1.0, 1.1 | [Tobias Reich](http://electerious.com)<br>[Philipp Maurer](http://phinal.net) |
77-
7873
## Donate
7974

80-
I am working hard on continuously developing and maintaining Lychee. Please consider making a donation via [Flattr](https://flattr.com/submit/auto?user_id=electerious&url=http%3A%2F%2Flychee.electerious.com&title=Lychee&category=software) or PayPal (from [our site](http://lychee.electerious.com/)) to keep the project going strong and me motivated.
81-
82-
## License
83-
84-
(MIT License)
85-
86-
Copyright (C) 2015 [Tobias Reich](http://electerious.com)
87-
88-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
89-
90-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
91-
92-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
75+
I am working hard on continuously developing and maintaining Lychee. Please consider making a donation via [Flattr](https://flattr.com/submit/auto?user_id=electerious&url=http%3A%2F%2Flychee.electerious.com&title=Lychee&category=software) or PayPal (from [our site](http://lychee.electerious.com/)) to keep the project going strong and me motivated.

dist/main.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/main.js

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/view.js

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/Changelog.md

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## v3.0.9
2+
3+
Released January 10, 2016
4+
5+
- `Improved` Disabled dragging for thumbnails
6+
- `Improved` Avoided unnecessary devicePixelRatio checks by using srcset for all thumbnails
7+
- `Improved` Avoided devicePixelRatio check by using srcset for the imageview image
8+
- `Improved` Don't show log and system information when logged out (Thanks @Bramas, #421)
9+
- `Fixed` Swipe-gestures on mobile devices
10+
111
## v3.0.8
212

313
Released December 20, 2015

docs/Installation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ You can also use the [direct download](https://github.com/electerious/Lychee/arc
2525

2626
### 3. Permissions
2727

28-
Change the permissions of `uploads/`, `data/` and all their subfolders. Sufficient read/write privileges are reqiured.
28+
Change the permissions of `uploads/`, `data/` and all their subfolders. Sufficient read/write privileges are required.
2929

3030
chmod -R 777 uploads/ data/
3131

php/modules/Album.php

+9-4
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,20 @@ public static function prepareData($data) {
6969
$album['title'] = $data['title'];
7070
$album['public'] = $data['public'];
7171

72+
# Additional attributes
73+
# Only part of $album when available
74+
if (isset($data['description'])) $album['description'] = $data['description'];
75+
if (isset($data['visible'])) $album['visible'] = $data['visible'];
76+
if (isset($data['downloadable'])) $album['downloadable'] = $data['downloadable'];
77+
7278
# Parse date
7379
$album['sysdate'] = date('F Y', $data['sysstamp']);
7480

7581
# Parse password
7682
$album['password'] = ($data['password']=='' ? '0' : '1');
7783

78-
# Set placeholder for thumbs
79-
$album['thumbs'] = array();
84+
# Parse thumbs or set default value
85+
$album['thumbs'] = (isset($data['thumbs']) ? explode(',', $data['thumbs']) : array());
8086

8187
return $album;
8288

@@ -112,8 +118,7 @@ public function get() {
112118
default: $query = Database::prepare($this->database, "SELECT * FROM ? WHERE id = '?' LIMIT 1", array(LYCHEE_TABLE_ALBUMS, $this->albumIDs));
113119
$albums = $this->database->query($query);
114120
$return = $albums->fetch_assoc();
115-
$return['sysdate'] = date('d M. Y', $return['sysstamp']);
116-
$return['password'] = ($return['password']=='' ? '0' : '1');
121+
$return = Album::prepareData($return);
117122
$query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url FROM ? WHERE album = '?' " . $this->settings['sortingPhotos'], array(LYCHEE_TABLE_PHOTOS, $this->albumIDs));
118123
break;
119124

plugins/check/index.php

+36-22
Original file line numberDiff line numberDiff line change
@@ -103,27 +103,41 @@
103103
echo(PHP_EOL . PHP_EOL . 'System Information' . PHP_EOL);
104104
echo('------------------' . PHP_EOL);
105105

106-
# Load json
107-
$json = file_get_contents(LYCHEE_SRC . 'package.json');
108-
$json = json_decode($json, true);
109-
110-
# About imagick
111-
$imagick = extension_loaded('imagick');
112-
if ($imagick===true) $imagickVersion = @Imagick::getVersion();
113-
else $imagick = '-';
114-
if (!isset($imagickVersion, $imagickVersion['versionNumber'])||$imagickVersion==='') $imagickVersion = '-';
115-
else $imagickVersion = $imagickVersion['versionNumber'];
116-
117-
# Output system information
118-
echo('Lychee Version: ' . $json['version'] . PHP_EOL);
119-
echo('DB Version: ' . $settings['version'] . PHP_EOL);
120-
echo('System: ' . PHP_OS . PHP_EOL);
121-
echo('PHP Version: ' . floatval(phpversion()) . PHP_EOL);
122-
echo('MySQL Version: ' . $database->server_version . PHP_EOL);
123-
echo('Imagick: ' . $imagick . PHP_EOL);
124-
echo('Imagick Active: ' . $settings['imagick'] . PHP_EOL);
125-
echo('Imagick Version: ' . $imagickVersion . PHP_EOL);
126-
echo('GD Version: ' . $gdVersion['GD Version'] . PHP_EOL);
127-
echo('Plugins: ' . $settings['plugins'] . PHP_EOL);
106+
# Ensure that user is logged in
107+
session_start();
108+
109+
if ((isset($_SESSION['login'])&&$_SESSION['login']===true)&&
110+
(isset($_SESSION['identifier'])&&$_SESSION['identifier']===$settings['identifier'])) {
111+
112+
# Load json
113+
$json = file_get_contents(LYCHEE_SRC . 'package.json');
114+
$json = json_decode($json, true);
115+
116+
# About imagick
117+
$imagick = extension_loaded('imagick');
118+
if ($imagick===true) $imagickVersion = @Imagick::getVersion();
119+
else $imagick = '-';
120+
if (!isset($imagickVersion, $imagickVersion['versionNumber'])||$imagickVersion==='') $imagickVersion = '-';
121+
else $imagickVersion = $imagickVersion['versionNumber'];
122+
123+
# Output system information
124+
echo('Lychee Version: ' . $json['version'] . PHP_EOL);
125+
echo('DB Version: ' . $settings['version'] . PHP_EOL);
126+
echo('System: ' . PHP_OS . PHP_EOL);
127+
echo('PHP Version: ' . floatval(phpversion()) . PHP_EOL);
128+
echo('MySQL Version: ' . $database->server_version . PHP_EOL);
129+
echo('Imagick: ' . $imagick . PHP_EOL);
130+
echo('Imagick Active: ' . $settings['imagick'] . PHP_EOL);
131+
echo('Imagick Version: ' . $imagickVersion . PHP_EOL);
132+
echo('GD Version: ' . $gdVersion['GD Version'] . PHP_EOL);
133+
echo('Plugins: ' . $settings['plugins'] . PHP_EOL);
134+
135+
} else {
136+
137+
# Don't go further if the user is not logged in
138+
echo('You have to be logged in to see more information.');
139+
exit();
140+
141+
}
128142

129143
?>

plugins/displaylog/index.php

+30-12
Original file line numberDiff line numberDiff line change
@@ -37,27 +37,45 @@
3737
exit();
3838
}
3939

40-
# Result
41-
$query = Database::prepare($database, "SELECT FROM_UNIXTIME(time), type, function, line, text FROM ?", array(LYCHEE_TABLE_LOG));
42-
$result = $database->query($query);
40+
# Load settings
41+
$settings = new Settings($database);
42+
$settings = $settings->get();
4343

44-
# Output
45-
if ($result->num_rows===0) {
44+
# Ensure that user is logged in
45+
session_start();
4646

47-
echo('Everything looks fine, Lychee has not reported any problems!' . PHP_EOL . PHP_EOL);
47+
if ((isset($_SESSION['login'])&&$_SESSION['login']===true)&&
48+
(isset($_SESSION['identifier'])&&$_SESSION['identifier']===$settings['identifier'])) {
4849

49-
} else {
50+
# Result
51+
$query = Database::prepare($database, "SELECT FROM_UNIXTIME(time), type, function, line, text FROM ?", array(LYCHEE_TABLE_LOG));
52+
$result = $database->query($query);
53+
54+
# Output
55+
if ($result->num_rows===0) {
56+
57+
echo('Everything looks fine, Lychee has not reported any problems!');
58+
59+
} else {
60+
61+
while($row = $result->fetch_row()) {
5062

51-
while($row = $result->fetch_row()) {
63+
# Encode result before printing
64+
$row = array_map('htmlentities', $row);
5265

53-
# Encode result before printing
54-
$row = array_map("htmlentities", $row);
66+
# Format: time TZ - type - function(line) - text
67+
printf ("%s - %s - %s (%s) \t- %s\n", $row[0], $row[1], $row[2], $row[3], $row[4]);
5568

56-
# Format: time TZ - type - function(line) - text
57-
printf ("%s %s - %s - %s (%s) \t- %s\n", $row[0], date_default_timezone_get(), $row[1], $row[2], $row[3], $row[4]);
69+
}
5870

5971
}
6072

73+
} else {
74+
75+
# Don't go further if the user is not logged in
76+
echo('You have to be logged in to see the log.');
77+
exit();
78+
6179
}
6280

6381
?>

src/package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Lychee",
3-
"version": "3.0.8",
3+
"version": "3.0.9",
44
"description": "Self-hosted photo-management done right.",
55
"authors": "Tobias Reich <[email protected]>",
66
"license": "MIT",
@@ -11,15 +11,15 @@
1111
},
1212
"devDependencies": {
1313
"babel-preset-es2015": "^6.3.13",
14-
"basiccontext": "^3.5.0",
15-
"basicmodal": "^3.3.0",
14+
"basiccontext": "^3.5.1",
15+
"basicmodal": "^3.3.2",
1616
"gulp": "^3.9.0",
1717
"gulp-autoprefixer": "3.1.0",
1818
"gulp-babel": "^6.1.1",
1919
"gulp-concat": "^2.6.0",
2020
"gulp-inject": "^3.0.0",
21-
"gulp-load-plugins": "^1.1.0",
22-
"gulp-minify-css": "^1.2.2",
21+
"gulp-load-plugins": "^1.2.0",
22+
"gulp-minify-css": "^1.2.3",
2323
"gulp-rimraf": "^0.2.0",
2424
"gulp-sass": "^2.1.1",
2525
"gulp-uglify": "^1.5.1",

src/scripts/build.js

+13-19
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ build.album = function(data) {
4545

4646
let html = ''
4747

48-
let { path: thumbPath, hasRetina: thumbRetina } = lychee.retinize(data.thumbs[0])
48+
let { path: retinaThumbUrl, isPhoto } = lychee.retinize(data.thumbs[0])
4949

5050
html += lychee.html`
5151
<div class='album' data-id='$${ data.id }'>
52-
<img src='$${ data.thumbs[2] }' width='200' height='200' alt='thumb' data-overlay='false'>
53-
<img src='$${ data.thumbs[1] }' width='200' height='200' alt='thumb' data-overlay='false'>
54-
<img src='$${ thumbPath }' width='200' height='200' alt='thumb' data-overlay='$${ thumbRetina }'>
52+
<img src='$${ data.thumbs[2] }' width='200' height='200' alt='Photo thumbnail' data-overlay='false' draggable='false'>
53+
<img src='$${ data.thumbs[1] }' width='200' height='200' alt='Photo thumbnail' data-overlay='false' draggable='false'>
54+
<img src='$${ data.thumbs[0] }' srcset='$${ retinaThumbUrl } 1.5x' width='200' height='200' alt='Photo thumbnail' data-overlay='$${ isPhoto }' draggable='false'>
5555
<div class='overlay'>
5656
<h1 title='$${ data.title }'>$${ data.title }</h1>
5757
<a>$${ data.sysdate }</a>
@@ -82,11 +82,11 @@ build.photo = function(data) {
8282

8383
let html = ''
8484

85-
let { path: thumbPath, hasRetina: thumbRetina } = lychee.retinize(data.thumbUrl)
85+
let { path: retinaThumbUrl } = lychee.retinize(data.thumbUrl)
8686

8787
html += lychee.html`
8888
<div class='photo' data-album-id='$${ data.album }' data-id='$${ data.id }'>
89-
<img src='$${ thumbPath }' width='200' height='200' alt='thumb'>
89+
<img src='$${ data.thumbUrl }' srcset='$${ retinaThumbUrl } 1.5x' width='200' height='200' alt='Photo thumbnail' draggable='false'>
9090
<div class='overlay'>
9191
<h1 title='$${ data.title }'>$${ data.title }</h1>
9292
`
@@ -113,24 +113,18 @@ build.photo = function(data) {
113113

114114
}
115115

116-
build.imageview = function(data, size, visibleControls) {
116+
build.imageview = function(data, visibleControls) {
117117

118-
let html = ''
119-
120-
if (size==='big') {
118+
let html = '',
119+
hasMedium = data.medium!==''
121120

122-
if (visibleControls===true) html += lychee.html`<div id='image' style='background-image: url($${ data.url })'></div>`
123-
else html += lychee.html`<div id='image' style='background-image: url($${ data.url });' class='full'></div>`
121+
if (hasMedium===false) {
124122

125-
} else if (size==='medium') {
123+
html += lychee.html`<div id='image' class='$${ visibleControls===true ? '' : 'full' }'><div><img src='$${ data.url }' draggable='false'></div></div>`
126124

127-
if (visibleControls===true) html += lychee.html`<div id='image' style='background-image: url($${ data.medium })'></div>`
128-
else html += lychee.html`<div id='image' style='background-image: url($${ data.medium });' class='full'></div>`
129-
130-
} else if (size==='small') {
125+
} else {
131126

132-
if (visibleControls===true) html += lychee.html`<div id='image' class='small' style='background-image: url($${ data.url }); width: $${ data.width }px; height: $${ data.height }px; margin-top: -$${ parseInt(data.height/2-20) }px; margin-left: -$${ data.width/2 }px;'></div>`
133-
else html += lychee.html`<div id='image' class='small' style='background-image: url($${ data.url }); width: $${ data.width }px; height: $${ data.height }px; margin-top: -$${ parseInt(data.height/2) }px; margin-left: -$${ data.width/2 }px;'></div>`
127+
html += lychee.html`<div id='image' class='$${ visibleControls===true ? '' : 'full' }'><div><img src='$${ data.url }' srcset='$${ data.medium } 1920w, $${ data.url } $${ data.width }w' draggable='false'></div></div>`
134128

135129
}
136130

src/scripts/header.js

-12
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,11 @@ header.bind = function() {
6767

6868
header.show = function() {
6969

70-
let newMargin = (-1 * ($('#imageview #image').height()/2) + 20)
71-
7270
clearTimeout($(window).data('timeout'))
7371

7472
lychee.imageview.removeClass('full')
7573
header.dom().removeClass('header--hidden')
7674

77-
// Adjust position or size of photo
78-
if ($('#imageview #image.small').length>0) $('#imageview #image').css('margin-top', newMargin)
79-
else $('#imageview #image').removeClass('full')
80-
8175
return true
8276

8377
}
@@ -90,15 +84,9 @@ header.hide = function(e, delay = 500) {
9084

9185
$(window).data('timeout', setTimeout(function() {
9286

93-
let newMargin = (-1 * ($('#imageview #image').height()/2))
94-
9587
lychee.imageview.addClass('full')
9688
header.dom().addClass('header--hidden')
9789

98-
// Adjust position or size of photo
99-
if ($('#imageview #image.small').length>0) $('#imageview #image').css('margin-top', newMargin)
100-
else $('#imageview #image').addClass('full')
101-
10290
}, delay))
10391

10492
return true

src/scripts/init.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,15 @@ $(document).ready(function() {
7878
$(document)
7979

8080
// Fullscreen on mobile
81-
.on('touchend', '#image', function(e) {
81+
.on('touchend', '#imageview #image', function(e) {
8282
if (swipe.obj==null || (swipe.offset>=-5&&swipe.offset<=5)) {
8383
if (visible.header()) header.hide(e, 0)
8484
else header.show()
8585
}
8686
})
8787

8888
// Swipe on mobile
89-
.swipe().on('swipeStart', function() { if (visible.photo()) swipe.start($('#image')) })
89+
.swipe().on('swipeStart', function() { if (visible.photo()) swipe.start($('#imageview #image')) })
9090
.swipe().on('swipeMove', function(e) { if (visible.photo()) swipe.move(e.swipe) })
9191
.swipe().on('swipeEnd', function(e) { if (visible.photo()) swipe.stop(e.swipe, photo.previous, photo.next) })
9292

0 commit comments

Comments
 (0)