Merge branch 'master' of github.com:sharelatex/web-sharelatex

This commit is contained in:
Henry Oswald 2014-04-15 13:59:04 +01:00
commit 4b11790a54
4 changed files with 56 additions and 6 deletions

View file

@ -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)

View file

@ -33,6 +33,7 @@ ProjectDownloadsController = require "./Features/Downloads/ProjectDownloadsContr
FileStoreController = require("./Features/FileStore/FileStoreController") FileStoreController = require("./Features/FileStore/FileStoreController")
TrackChangesController = require("./Features/TrackChanges/TrackChangesController") TrackChangesController = require("./Features/TrackChanges/TrackChangesController")
DropboxUserController = require("./Features/Dropbox/DropboxUserController") DropboxUserController = require("./Features/Dropbox/DropboxUserController")
RestoreController = require("./Features/Restore/RestoreController")
logger = require("logger-sharelatex") logger = require("logger-sharelatex")
_ = require("underscore") _ = require("underscore")
@ -82,6 +83,9 @@ module.exports = class Router
app.del '/user/newsletter/unsubscribe', AuthenticationController.requireLogin(), UserController.unsubscribe app.del '/user/newsletter/unsubscribe', AuthenticationController.requireLogin(), UserController.unsubscribe
app.del '/user', AuthenticationController.requireLogin(), UserController.deleteUser 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/beginAuth', DropboxUserController.redirectUserToDropboxAuth
app.get '/dropbox/completeRegistration', DropboxUserController.completeDropboxRegistration app.get '/dropbox/completeRegistration', DropboxUserController.completeDropboxRegistration
app.get '/dropbox/unlink', DropboxUserController.unlinkDropbox app.get '/dropbox/unlink', DropboxUserController.unlinkDropbox

View file

@ -58,14 +58,15 @@ block content
.content-with-navigation-sidebar .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 <strong> a<href="mailto:team@sharelatex.com"> Get In Touch Here </a></strong> 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 .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 any or your projects are missing, or have been rolled-back to a previous version, then you can <strong> <a href="/restore">restore them from our latest back ups</a></strong>.
p We are very sorry about this. More details on what happened will follow as soon as possible.
.row-fluid .row-fluid
.span12 .span12
.page-header .page-header

View file

@ -0,0 +1,29 @@
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 latest version as Zip
include general/small-footer