Skip to content

Commit

Permalink
Merge pull request #370 from electerious/develop
Browse files Browse the repository at this point in the history
Lychee 3.0.3
  • Loading branch information
electerious committed Jun 28, 2015
2 parents d8f3a78 + a73d008 commit 2ca41af
Show file tree
Hide file tree
Showing 15 changed files with 144 additions and 58 deletions.
2 changes: 1 addition & 1 deletion dist/main.css
100644 → 100755

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions dist/main.js
100644 → 100755

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions docs/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## v3.0.3

Released June 28, 2015

- `New` Skip duplicates on upload (#367, [How to activate](settings.md))
- `Fixed` Clicks not recognized when using a mouse on a touchscreen-device (#345)

## v3.0.2

Released June 13, 2015
Expand Down
20 changes: 16 additions & 4 deletions docs/Settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,17 @@ Less means an inferiority quality of your thumbs, but faster loading. More means

If `1`, Lychee will check if you are using the latest version. The notice will be displayed beside the version-number when you sign in.

#### Sorting
#### Album-Sorting

sorting = ORDER BY [row] [ASC|DESC]
sortingAlbums = ORDER BY [field] [ASC|DESC]

A typical part of a MySQL statement. This string will be appended to mostly every MySQL query.
Substring of a MySQL query. This string will be appended to all album-related MySQL queries.

#### Photo-Sorting

sortingPhotos = ORDER BY [field] [ASC|DESC]

Substring of a MySQL query. This string will be appended to all photo-related MySQL queries.

#### Dropbox Key

Expand All @@ -56,4 +62,10 @@ If `1`, Lychee will use Imagick when available. Disable [Imagick](http://www.ima

medium = [0|1]

If `1`, Lychee will create a second, smaller version of your photo. This feature requires [Imagick](http://www.imagemagick.org) on your server and an activated `imagick` option the the settings table.
If `1`, Lychee will create a second, smaller version of your photo. This feature requires [Imagick](http://www.imagemagick.org) on your server and an activated `imagick` option the the settings table.

#### Skip Duplicates on Upload

skipDuplicates = [0|1]

Lychee will skip the upload of existing photos when actived.
25 changes: 25 additions & 0 deletions php/database/update_030003.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

###
# @name Update to version 3.0.3
# @copyright 2015 by Tobias Reich
###

if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');

# Add skipDuplicates to settings
$query = Database::prepare($database, "SELECT `key` FROM `?` WHERE `key` = 'skipDuplicates' LIMIT 1", array(LYCHEE_TABLE_SETTINGS));
$result = $database->query($query);
if ($result->num_rows===0) {
$query = Database::prepare($database, "INSERT INTO `?` (`key`, `value`) VALUES ('skipDuplicates', '0')", array(LYCHEE_TABLE_SETTINGS));
$result = $database->query($query);
if (!$result) {
Log::error($database, 'update_030003', __LINE__, 'Could not update database (' . $database->error . ')');
return false;
}
}

# Set version
if (Database::setVersion($database, '030003')===false) return false;

?>
3 changes: 2 additions & 1 deletion php/modules/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ static function update($database, $dbName, $version = 0) {
'020602', #2.6.2
'020700', #2.7.0
'030000', #3.0.0
'030001' #3.0.1
'030001', #3.0.1
'030003' #3.0.3
);

# For each update
Expand Down
11 changes: 10 additions & 1 deletion php/modules/Photo.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __construct($database, $plugins, $settings, $photoIDs) {
public function add($files, $albumID, $description = '', $tags = '') {

# Check dependencies
self::dependencies(isset($this->database));
self::dependencies(isset($this->database, $this->settings, $files));

# Check permissions
if (hasPermissions(LYCHEE_UPLOADS)===false||
Expand Down Expand Up @@ -150,6 +150,15 @@ public function add($files, $albumID, $description = '', $tags = '') {
}
}

} else {

# Photo already exists
# Check if the user wants to skip duplicates
if ($this->settings['skipDuplicates']==='1') {
Log::notice($this->database, __METHOD__, __LINE__, 'Skipped upload of existing photo because skipDuplicates is activated');
exit('Warning: This photo has been skipped because it\'s already in your library.');
}

}

# Read infos
Expand Down
3 changes: 0 additions & 3 deletions src/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
"name": "Lychee",
"private": true,
"dependencies": {
"jQuery": "~2.1.4",
"mousetrap": "~1.5.2",
"basicContext": "~2.0.9",
"basicModal": "~2.0.8"
}
}
12 changes: 6 additions & 6 deletions src/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ paths.view = {
'./scripts/view/main.js'
],
scripts: [
'bower_components/jQuery/dist/jquery.min.js',
'node_modules/jquery/dist/jquery.min.js',
'../dist/_view--javascript.js'
],
svg: [
Expand Down Expand Up @@ -84,18 +84,18 @@ paths.main = {
'./scripts/*.js'
],
scripts: [
'bower_components/jQuery/dist/jquery.min.js',
'bower_components/mousetrap/mousetrap.min.js',
'bower_components/mousetrap/plugins/global-bind/mousetrap-global-bind.min.js',
'bower_components/basicContext/dist/basicContext.min.js',
'node_modules/jquery/dist/jquery.min.js',
'node_modules/mousetrap/mousetrap.min.js',
'node_modules/mousetrap/plugins/global-bind/mousetrap-global-bind.min.js',
'node_modules/basiccontext/dist/basicContext.min.js',
'bower_components/basicModal/dist/basicModal.min.js',
'../dist/_main--javascript.js'
],
scss: [
'./styles/*.scss'
],
styles: [
'bower_components/basicContext/src/styles/main.scss',
'node_modules/basiccontext/src/styles/main.scss',
'bower_components/basicModal/src/styles/main.scss',
'./styles/main.scss'
],
Expand Down
17 changes: 10 additions & 7 deletions src/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Lychee",
"version": "3.0.2",
"version": "3.0.3",
"description": "Self-hosted photo-management done right.",
"authors": "Tobias Reich <[email protected]>",
"license": "MIT",
Expand All @@ -10,15 +10,18 @@
"url": "https://github.com/electerious/Lychee.git"
},
"devDependencies": {
"basiccontext": "^3.1.2",
"gulp": "^3.9.0",
"gulp-autoprefixer": "2.3.1",
"gulp-babel": "^5.1.0",
"gulp-concat": "^2.5.2",
"gulp-inject": "^1.2.0",
"gulp-load-plugins": "^0.10.0",
"gulp-minify-css": "^1.1.5",
"gulp-concat": "^2.6.0",
"gulp-inject": "^1.3.1",
"gulp-load-plugins": "^1.0.0-rc",
"gulp-minify-css": "^1.2.0",
"gulp-rimraf": "^0.1.1",
"gulp-sass": "^2.0.1",
"gulp-uglify": "^1.2.0"
"gulp-sass": "^2.0.3",
"gulp-uglify": "^1.2.0",
"jquery": "^2.1.4",
"mousetrap": "^1.5.2"
}
}
26 changes: 13 additions & 13 deletions src/scripts/contextMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ contextMenu.add = function(e) {
{ type: 'item', title: build.iconic('folder') + 'New Album', fn: album.add }
];

basicContext.show(items, e);
basicContext.show(items, e.originalEvent);

upload.notify();

Expand All @@ -37,7 +37,7 @@ contextMenu.settings = function(e) {
{ type: 'item', title: build.iconic('account-logout') + 'Sign Out', fn: lychee.logout }
];

basicContext.show(items, e);
basicContext.show(items, e.originalEvent);

}

Expand All @@ -60,7 +60,7 @@ contextMenu.album = function(albumID, e) {

$('.album[data-id="' + albumID + '"]').addClass('active');

basicContext.show(items, e, contextMenu.close);
basicContext.show(items, e.originalEvent, contextMenu.close);

}

Expand All @@ -74,7 +74,7 @@ contextMenu.albumMulti = function(albumIDs, e) {
{ type: 'item', title: build.iconic('trash') + 'Delete All', fn: function() { album.delete(albumIDs) } }
];

basicContext.show(items, e, contextMenu.close);
basicContext.show(items, e.originalEvent, contextMenu.close);

}

Expand Down Expand Up @@ -106,7 +106,7 @@ contextMenu.albumTitle = function(albumID, e) {

items.unshift({ type: 'item', title: build.iconic('pencil') + 'Rename', fn: function() { album.setTitle([albumID]) } });

basicContext.show(items, e, contextMenu.close);
basicContext.show(items, e.originalEvent, contextMenu.close);

});

Expand Down Expand Up @@ -135,7 +135,7 @@ contextMenu.mergeAlbum = function(albumID, e) {

if (items.length===0) return false;

basicContext.show(items, e, contextMenu.close);
basicContext.show(items, e.originalEvent, contextMenu.close);

});

Expand All @@ -159,7 +159,7 @@ contextMenu.photo = function(photoID, e) {

$('.photo[data-id="' + photoID + '"]').addClass('active');

basicContext.show(items, e, contextMenu.close);
basicContext.show(items, e.originalEvent, contextMenu.close);

}

Expand All @@ -181,7 +181,7 @@ contextMenu.photoMulti = function(photoIDs, e) {
{ type: 'item', title: build.iconic('trash') + 'Delete All', fn: function() { photo.delete(photoIDs) } }
];

basicContext.show(items, e, contextMenu.close);
basicContext.show(items, e.originalEvent, contextMenu.close);

}

Expand Down Expand Up @@ -211,7 +211,7 @@ contextMenu.photoTitle = function(albumID, photoID, e) {

}

basicContext.show(items, e, contextMenu.close);
basicContext.show(items, e.originalEvent, contextMenu.close);

}

Expand All @@ -228,7 +228,7 @@ contextMenu.photoMore = function(photoID, e) {
if (!(album.json&&album.json.downloadable&&album.json.downloadable==='1')&&
lychee.publicMode===true) items.splice(1, 1);

basicContext.show(items, e);
basicContext.show(items, e.originalEvent);

}

Expand Down Expand Up @@ -269,7 +269,7 @@ contextMenu.move = function(photoIDs, e) {

}

basicContext.show(items, e, contextMenu.close);
basicContext.show(items, e.originalEvent, contextMenu.close);

});

Expand All @@ -294,7 +294,7 @@ contextMenu.sharePhoto = function(photoID, e) {
{ type: 'item', title: build.iconic('ban') + 'Make Private', fn: function() { photo.setPublic(photoID) } }
];

basicContext.show(items, e);
basicContext.show(items, e.originalEvent);
$('.basicContext input#link').focus().select();

}
Expand All @@ -314,7 +314,7 @@ contextMenu.shareAlbum = function(albumID, e) {
{ type: 'item', title: build.iconic('ban') + 'Make Private', fn: function() { album.setPublic(albumID, false) } }
];

basicContext.show(items, e);
basicContext.show(items, e.originalEvent);
$('.basicContext input#link').focus().select();

}
Expand Down
3 changes: 2 additions & 1 deletion src/scripts/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
$(document).ready(function() {

/* Event Name */
var eventName = ('ontouchend' in document.documentElement) ? 'touchend' : 'click';
var touchendSupport = (/Android|iPhone|iPad|iPod/i).test(navigator.userAgent || navigator.vendor || window.opera) && ('ontouchend' in document.documentElement),
eventName = (touchendSupport===true ? 'touchend' : 'click');

/* Set API error handler */
api.onError = lychee.error;
Expand Down
4 changes: 2 additions & 2 deletions src/scripts/lychee.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
lychee = {

title: document.title,
version: '3.0.2',
version_code: '030002',
version: '3.0.3',
version_code: '030003',

update_path: 'http://lychee.electerious.com/version/index.php',
updateURL: 'https://github.com/electerious/Lychee',
Expand Down
Loading

0 comments on commit 2ca41af

Please sign in to comment.