Integrated stackedit-picasa-proxy service

This commit is contained in:
benweet 2014-08-20 00:24:23 +01:00
parent a037fb31a8
commit 3952ab6af1
4 changed files with 94 additions and 81 deletions

16
app/picasa.js Normal file
View File

@ -0,0 +1,16 @@
var request = require('request');
exports.importImg = function(req, res) {
var stream = req.pipe(request.post({
uri: 'https://picasaweb.google.com/data/feed/api/user/default/albumid/' + req.query.albumId,
headers: {
'Authorization': req.headers.authorization,
'Content-Type': req.headers['content-type'],
'Slug': req.headers.slug
}
}));
stream.on('error', function(err) {
res.send(400, err);
});
stream.pipe(res);
};

View File

@ -13,7 +13,8 @@
"dependencies": {
"express": "~3.16.6",
"ejs": "~0.8.4",
"request": "~2.40.0"
"request": "~2.40.0",
"ssh2": "^0.3.5"
},
"devDependencies": {
"grunt-contrib-requirejs": "~0.4.3",

View File

@ -145,8 +145,6 @@ define([
utils.setInputValue("#textarea-settings-pdf-template", settings.pdfTemplate);
// PDF options
utils.setInputValue("#textarea-settings-pdf-options", settings.pdfOptions);
// SSH proxy
utils.setInputValue("#input-settings-ssh-proxy", settings.sshProxy);
// Load extension settings
eventMgr.onLoadSettings();
@ -192,8 +190,6 @@ define([
newSettings.pdfTemplate = utils.getInputTextValue("#textarea-settings-pdf-template", event);
// PDF options
newSettings.pdfOptions = utils.getInputJSONValue("#textarea-settings-pdf-options", event);
// SSH proxy
newSettings.sshProxy = utils.checkUrl(utils.getInputTextValue("#input-settings-ssh-proxy", event), true);
// Save extension settings
newSettings.extensionSettings = {};
@ -509,9 +505,9 @@ define([
storage.clear();
var allowedKeys = /^file\.|^folder\.|^publish\.|^settings$|^sync\.|^google\.|^author\.|^themeV4$|^version$/;
_.each(newstorage, function(value, key) {
//if(allowedKeys.test(key)) {
if(allowedKeys.test(key)) {
storage[key] = value;
//}
}
});
window.location.reload();
});

View File

@ -74,10 +74,10 @@ define([
evt.dataTransfer.dropEffect = 'copy';
}
$('#wmd-input').each(function() {
this.addEventListener('dragover', handleDragOver, false);
this.addEventListener('drop', handleImgImport, false);
});
!window.viewerMode && (function(dragAndDropElt) {
dragAndDropElt.addEventListener('dragover', handleDragOver, false);
dragAndDropElt.addEventListener('drop', handleImgImport, false);
})(document.querySelector('.layout-wrapper-l3'));
});