Edit the Dropbox key (#84)

pull/91/head
Tobias Reich 10 years ago
parent f0065bbebc
commit 11cfb939b5

@ -85,6 +85,7 @@ contextMenu = {
contextMenu.fns = [
function() { settings.setLogin() },
function() { settings.setSorting() },
function() { settings.setDropboxKey() },
function() { window.open(lychee.website, "_newtab"); },
function() { window.open("plugins/check.php", "_newtab"); },
function() { lychee.logout() }
@ -93,10 +94,12 @@ contextMenu = {
items = [
["<a class='icon-user'></a> Change Login", 0],
["<a class='icon-sort'></a> Change Sorting", 1],
["<a class='icon-info-sign'></a> About Lychee", 2],
["<a class='icon-dashboard'></a> Diagnostics", 3],
["<a class='icon-folder-open'></a> Set Dropbox", 2],
["separator", -1],
["<a class='icon-signout'></a> Sign Out", 4]
["<a class='icon-info-sign'></a> About Lychee", 3],
["<a class='icon-dashboard'></a> Diagnostics", 4],
["separator", -1],
["<a class='icon-signout'></a> Sign Out", 5]
];
contextMenu.show(items, mouse_x, mouse_y, "right");

@ -7,7 +7,7 @@
var lychee = {
version: "2.1 b4",
version: "2.1 b3",
api_path: "php/api.php",
update_path: "http://lychee.electerious.com/version/index.php",
@ -44,9 +44,9 @@ var lychee = {
if (data.loggedIn!==true) {
lychee.setMode("public");
} else {
lychee.username = data.config.username;
lychee.sorting = data.config.sorting;
lychee.dropboxKey = data.config.dropboxKey;
lychee.username = data.config.username || '';
lychee.sorting = data.config.sorting || '';
lychee.dropboxKey = data.config.dropboxKey || '';
}
// No configuration
@ -294,7 +294,7 @@ var lychee = {
loadDropbox: function(callback) {
if (!lychee.dropbox) {
if (!lychee.dropbox&&lychee.dropboxKey) {
loadingBar.show();
@ -315,7 +315,15 @@ var lychee = {
};
s.parentNode.insertBefore(g, s);
} else callback();
} else if (lychee.dropbox&&lychee.dropboxKey) {
callback();
} else {
settings.setDropboxKey(callback);
};
},

@ -80,6 +80,7 @@ var settings = {
}],
["", function() {}]
];
modal.show("Configuration", "Enter your database connection details below: <input id='dbHost' class='text less' type='text' placeholder='Host (optional)' value=''><input id='dbUser' class='text less' type='text' placeholder='Username' value=''><input id='dbPassword' class='text more' type='password' placeholder='Password' value=''><br>Lychee will create its own database. If required, you can enter the name of an existing database instead:<input id='dbName' class='text more' type='text' placeholder='Database (optional)' value=''>", buttons, -215, false);
},
@ -137,6 +138,7 @@ var settings = {
}],
["", function() {}]
];
modal.show("Create Login", "Enter a username and password for your installation: <input id='username' class='text less' type='text' placeholder='New Username' value=''><input id='password' class='text' type='password' placeholder='New Password' value=''>", buttons, -122, false);
},
@ -181,6 +183,7 @@ var settings = {
}],
["Cancel", function() {}]
];
modal.show("Change Login", "Enter your current password: <input id='old_password' class='text more' type='password' placeholder='Current Password' value=''><br>Your username and password will be changed to the following: <input id='username' class='text less' type='text' placeholder='New Username' value=''><input id='password' class='text' type='password' placeholder='New Password' value=''>", buttons, -171);
},
@ -233,6 +236,35 @@ var settings = {
$("select#settings_order").val(sorting[1]);
}
},
setDropboxKey: function(callback) {
var buttons,
params,
key;
buttons = [
["Set Key", function() {
key = $(".message input.text#key").val();
params = "setDropboxKey&key=" + key;
lychee.api(params, function(data) {
if (data===true) {
lychee.dropboxKey = key;
if (callback) lychee.loadDropbox(callback);
} else lychee.error(null, params, data);
});
}],
["Cancel", function() {}]
];
modal.show("Set Dropbox Key", "In order to import photos from your Dropbox, you need a valid drop-ins app key from <a href='https://www.dropbox.com/developers/apps/create'>their website</a>. Generate yourself a personal key and enter it below: <input id='key' class='text' type='text' placeholder='Dropbox API Key' value='" + lychee.dropboxKey + "'>", buttons);
}
}

@ -38,4 +38,10 @@ If `1`, Lychee will check if you are using the latest version. The notice will b
sorting = ORDER BY [row] [ASC|DESC]
A typical part of a MySQL statement. This string will be appended to mostly every MySQL query.
A typical part of a MySQL statement. This string will be appended to mostly every MySQL query.
#### Dropbox Key
This key is required to use the Dropbox import feature from your server. Lychee will ask you for this key, the first time you try to use the import. You can get your personal drop-ins app key from [their website](https://www.dropbox.com/developers/apps/create).
dropboxKey = Your personal App Key

@ -122,6 +122,10 @@ switch ($_POST['function']) {
echo setSorting($_POST['type'], $_POST['order']);
break;
case 'setDropboxKey': if (isset($_POST['key']))
echo setDropboxKey($_POST['key']);
break;
// Miscellaneous
default: switch ($_GET['function']) {

@ -58,7 +58,7 @@ if (!empty($_POST['function'])||!empty($_GET['function'])) {
// Fallback for switch statement
if (!isset($_POST['function'])) $_POST['function'] = '';
if (!isset($_GET['function'])) $_GET['function'] = '';
if (isset($_SESSION['login'])&&$_SESSION['login']==true) {
/**

@ -66,22 +66,18 @@ function setPassword($password) {
}
/*function setCheckForUpdates() {
function setDropboxKey($key) {
global $database;
$result = $database->query("SELECT value FROM lychee_settings WHERE `key` = 'checkForUpdates';");
$row = $result->fetch_object();
if (strlen($key)<1||strlen($key)>50) return false;
if ($row->value==0) $checkForUpdates = 1;
else $checkForUpdates = 0;
$result = $database->query("UPDATE lychee_settings SET value = '$checkForUpdates' WHERE `key` = 'checkForUpdates';");
$result = $database->query("UPDATE lychee_settings SET value = '$key' WHERE `key` = 'dropboxKey';");
if (!$result) return false;
return true;
}*/
}
function setSorting($type, $order) {

@ -31,6 +31,10 @@ Lychee is ready to use, right out of the box. If you want to contribute and edit
These shortcuts will help you to use Lychee even faster. [Keyboard Shortcuts &#187;](docs/md/Keyboard Shortcuts.md)
### Dropbox import
In order to use the Dropbox import from your server, you need a valid drop-ins app key from [their website](https://www.dropbox.com/developers/apps/create). Lychee will ask you for this key, the first time you try to use the import. Want to change your code? Take a loot at [the settings](docs/md/Settings.md) of Lychee.
### Twitter Cards
Lychee supports [Twitter Cards](https://dev.twitter.com/docs/cards) and [Open Graph](http://opengraphprotocol.org) for shared images (not albums). In order to use Twitter Cards you need to request an approval for your domain. Simply share an image with Lychee, copy its link and paste it in [Twitters Card Validator](https://dev.twitter.com/docs/cards/validation/validator).

Loading…
Cancel
Save