mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Add in restore page
This commit is contained in:
parent
6aee795e67
commit
ea651ee9bd
4 changed files with 52 additions and 1 deletions
|
@ -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)
|
|
@ -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
|
||||||
|
|
|
@ -64,7 +64,7 @@ block content
|
||||||
.span12
|
.span12
|
||||||
.alert.alert-info
|
.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 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 <strong> <a href="mailto:team@sharelatex.com"> Get In Touch </a></strong> (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 <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.
|
p We are very sorry about this. More details on what happened will follow as soon as possible.
|
||||||
|
|
||||||
.row-fluid
|
.row-fluid
|
||||||
|
|
31
services/web/app/views/restore.jade
Normal file
31
services/web/app/views/restore.jade
Normal file
|
@ -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
|
Loading…
Reference in a new issue