Skip to content
Permalink
Browse files

Tweaked some redirects

  • Loading branch information...
davidmerfield committed Mar 8, 2019
1 parent 3d5dc77 commit 2541d25f219524d2254661ccdc10b14cde819330
@@ -1,32 +1,14 @@
var createClient = require("../util/createClient");

module.exports = function(req, res, next) {

if (req.unsavedAccount.full_access === false && !req.otherBlogsUseAppFolder)
return next();

var client = createClient(req.unsavedAccount.access_token);


// check if // The user has an existing dropbox account stored
// if (
// !req.account ||
// req.unsavedAccount.account_id !== req.account.account_id ||
// req.unsavedAccount.full_access !== req.account.full_access
// ) {
// next();
// } else {
// database.set(req.blog.id, { access_token: req.token, error_code: 0 }, function(err) {
// if (err) return next(err);
// res.message("/", "Set up Dropbox successfuly!");
// });
// }


client
.filesCreateFolder({ path: "/" + req.blog.title, autorename: true })
.then(function(res) {

req.unsavedAccount.folder = res.path_display;
req.unsavedAccount.folder_id = res.id;

@@ -46,7 +46,7 @@ dashboard
.get(require("./createFolder"))
.get(require("./saveDropboxAccount"))
.get(function(req, res, next) {
res.message("/", "Set up Dropbox successfuly!");
res.message("/settings", "Set up Dropbox successfuly!");

require("./writeExistingContents")(req, res, function(err) {
// Headers have been sent at this point, so just log this error
@@ -85,7 +85,7 @@ dashboard
.post(require("./createFolder"))
.post(require("./saveDropboxAccount"))
.post(function(req, res, next) {
res.message("/", "Set up Dropbox successfuly!");
res.message("/settings", "Set up Dropbox successfuly!");

// This happens in the background. It would be nice to
// expose a progress bar in future.
@@ -14,7 +14,7 @@ Dashboard.get("/", function(req, res, next) {
Folder.get(req.blog.id, function(err, folder) {
if (err) return next(err);

res.render(__dirname + "/views/index.html", { folder: folder });
res.render(__dirname + "/views/index.html", { dir: folder });
});
});

@@ -1,11 +1,11 @@
<p>Your folder: {{folder}}</p>
{{^folder}}
<p>Your folder: {{dir}}</p>
{{^dir}}
<form method="POST" action="{{{base}}}/set">
<label>Name of a folder inside your home directory:</label>
<input name="folder" type="text" value="">
<input type="submit">
</form>
{{/folder}}
{{/dir}}
<form method="POST" action="{{{base}}}/disconnect">
<input type="submit" value="Disconnect">
</form>

0 comments on commit 2541d25

Please sign in to comment.
You can’t perform that action at this time.