From c750797ca44a2009717dda59b0f5a9c27d4455bf Mon Sep 17 00:00:00 2001 From: James Allen Date: Sun, 13 Apr 2014 23:38:44 +0100 Subject: [PATCH 1/4] Update message --- services/web/app/views/project/list.jade | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/services/web/app/views/project/list.jade b/services/web/app/views/project/list.jade index 48f2aab844..c7fe4f6561 100644 --- a/services/web/app/views/project/list.jade +++ b/services/web/app/views/project/list.jade @@ -58,14 +58,15 @@ block content .content-with-navigation-sidebar - .row-fluid - .span12 - .alert.alert-info - p Due to issues with our database project changed oon the 12th of April may have been rolled back 24 hours or lost. If you have expreneced this please a Get In Touch Here and we will restore any lost work from our backup system. - p We are very sorry about this. More details on what happened will follow soon. - .box#projectListArea + .row-fluid + .span12 + .alert.alert-info + p Due to unforeseen issues with our database, some projects which were changed or created on the 12th of April may have been rolled back 24 hours to Saturday morning (6am UTC on 12th April). + p If you have experienced this please Get In Touch and we will restore any lost work from our backup system. + p We are very sorry about this. More details on what happened will follow as soon as possible. + .row-fluid .span12 .page-header From 6aee795e678e24eda62c3e1b0c11a532cb6d0582 Mon Sep 17 00:00:00 2001 From: James Allen Date: Mon, 14 Apr 2014 00:03:42 +0100 Subject: [PATCH 2/4] Add project URL to message --- services/web/app/views/project/list.jade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/web/app/views/project/list.jade b/services/web/app/views/project/list.jade index c7fe4f6561..6bbc24e500 100644 --- a/services/web/app/views/project/list.jade +++ b/services/web/app/views/project/list.jade @@ -64,7 +64,7 @@ block content .span12 .alert.alert-info p Due to unforeseen issues with our database, some projects which were changed or created on the 12th of April may have been rolled back 24 hours to Saturday morning (6am UTC on 12th April). - p If you have experienced this please Get In Touch and we will restore any lost work from our backup system. + p If you have experienced this please Get In Touch (with the project URL if possible) and we will restore any lost work from our backup system. p We are very sorry about this. More details on what happened will follow as soon as possible. .row-fluid From ea651ee9bd11076bc3a52fca7285f3ebb1ec7c06 Mon Sep 17 00:00:00 2001 From: James Allen Date: Mon, 14 Apr 2014 06:17:07 +0100 Subject: [PATCH 3/4] Add in restore page --- .../Features/Restore/RestoreController.coffee | 16 ++++++++++ services/web/app/coffee/router.coffee | 4 +++ services/web/app/views/project/list.jade | 2 +- services/web/app/views/restore.jade | 31 +++++++++++++++++++ 4 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 services/web/app/coffee/Features/Restore/RestoreController.coffee create mode 100644 services/web/app/views/restore.jade diff --git a/services/web/app/coffee/Features/Restore/RestoreController.coffee b/services/web/app/coffee/Features/Restore/RestoreController.coffee new file mode 100644 index 0000000000..9ff9f3ee4b --- /dev/null +++ b/services/web/app/coffee/Features/Restore/RestoreController.coffee @@ -0,0 +1,16 @@ +Settings = require "settings-sharelatex" +mongojs = require "mongojs" +db = mongojs.connect(Settings.mongo.restoreUrl, ["projects", "users"]) +ObjectId = mongojs.ObjectId +VersioningApiHandler = require "../Versioning/VersioningApiHandler" + +module.exports = RestoreController = + restore: (req, res, next = (error) ->) -> + user_id = req.session.user._id + db.projects.find { owner_ref: ObjectId(user_id) }, { _id: 1, name: 1 }, (error, projects) -> + return next(error) if error? + res.render 'restore', projects: projects, title: "Restore projects" + + getZip: (req, res, next = (error) ->) -> + project_id = req.params.Project_id + VersioningApiHandler.proxyToVersioningApi(req, res) \ No newline at end of file diff --git a/services/web/app/coffee/router.coffee b/services/web/app/coffee/router.coffee index ad61b4ce94..0a158afd3c 100644 --- a/services/web/app/coffee/router.coffee +++ b/services/web/app/coffee/router.coffee @@ -33,6 +33,7 @@ ProjectDownloadsController = require "./Features/Downloads/ProjectDownloadsContr FileStoreController = require("./Features/FileStore/FileStoreController") TrackChangesController = require("./Features/TrackChanges/TrackChangesController") DropboxUserController = require("./Features/Dropbox/DropboxUserController") +RestoreController = require("./Features/Restore/RestoreController") logger = require("logger-sharelatex") _ = require("underscore") @@ -82,6 +83,9 @@ module.exports = class Router app.del '/user/newsletter/unsubscribe', AuthenticationController.requireLogin(), UserController.unsubscribe app.del '/user', AuthenticationController.requireLogin(), UserController.deleteUser + app.get "/restore", AuthenticationController.requireLogin(), RestoreController.restore + app.get "/project/:Project_id/zip", SecurityManager.requestCanAccessProject, RestoreController.getZip + app.get '/dropbox/beginAuth', DropboxUserController.redirectUserToDropboxAuth app.get '/dropbox/completeRegistration', DropboxUserController.completeDropboxRegistration app.get '/dropbox/unlink', DropboxUserController.unlinkDropbox diff --git a/services/web/app/views/project/list.jade b/services/web/app/views/project/list.jade index 6bbc24e500..9c88abbba9 100644 --- a/services/web/app/views/project/list.jade +++ b/services/web/app/views/project/list.jade @@ -64,7 +64,7 @@ block content .span12 .alert.alert-info p Due to unforeseen issues with our database, some projects which were changed or created on the 12th of April may have been rolled back 24 hours to Saturday morning (6am UTC on 12th April). - p If you have experienced this please Get In Touch (with the project URL if possible) and we will restore any lost work from our backup system. + p If any or your projects are missing, or have been rolled-back to a previous version, then you can restore them from our latest back ups. p We are very sorry about this. More details on what happened will follow as soon as possible. .row-fluid diff --git a/services/web/app/views/restore.jade b/services/web/app/views/restore.jade new file mode 100644 index 0000000000..497a9fc8c3 --- /dev/null +++ b/services/web/app/views/restore.jade @@ -0,0 +1,31 @@ +extends layout + +block content + .content + .row + .span10.offset1 + .box + .row-fluid + .span12 + .page-header + h1 Recover projects + + .row-fluid + .span12 + .well + p If any of your projects are missing, or are not showing the most recent updates, you + | can recover from our latest back ups here. If you have any problems, please get in + | touch (team@sharelatex.com). + + .row-fluid + table.table + -each project in projects + tr + - project_id = project._id.toString() + td(width="50%") #{project.name} + td(width="25%") + a.btn(href="/project/#{project_id}/zip") Download as Zip + td(width="25%") + a.btn.btn-primary(href="/project/new/template?zipUrl=/project/#{project_id}/zip&templateName=#{project.name}_(Restored)") Restore to ShareLaTeX + + include general/small-footer From c249ea91f976ba1b4f5e5980f07347ef532656f3 Mon Sep 17 00:00:00 2001 From: James Allen Date: Mon, 14 Apr 2014 06:28:36 +0100 Subject: [PATCH 4/4] Restore button doesn't work --- services/web/app/views/restore.jade | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/services/web/app/views/restore.jade b/services/web/app/views/restore.jade index 497a9fc8c3..5644a1302d 100644 --- a/services/web/app/views/restore.jade +++ b/services/web/app/views/restore.jade @@ -24,8 +24,6 @@ block content - project_id = project._id.toString() td(width="50%") #{project.name} td(width="25%") - a.btn(href="/project/#{project_id}/zip") Download as Zip - td(width="25%") - a.btn.btn-primary(href="/project/new/template?zipUrl=/project/#{project_id}/zip&templateName=#{project.name}_(Restored)") Restore to ShareLaTeX + a.btn(href="/project/#{project_id}/zip") Download latest version as Zip include general/small-footer