diff --git a/server-console/src/content-update.css b/server-console/src/content-update.css
new file mode 100644
index 0000000000..ebfd8aeba0
--- /dev/null
+++ b/server-console/src/content-update.css
@@ -0,0 +1,172 @@
+@font-face {
+ font-family: 'Raleway';
+ src: url('vendor/Raleway/Raleway-Regular.ttf');
+ font-weight: normal;
+ font-style: normal;
+}
+@font-face {
+ font-family: 'Raleway';
+ src: url('vendor/Raleway/Raleway-ExtraLight.ttf');
+ font-weight: 200;
+ font-style: normal;
+}
+@font-face {
+ font-family: 'Raleway';
+ src: url('vendor/Raleway/Raleway-SemiBold.ttf');
+ font-weight: bold;
+ font-style: normal;
+}
+
+
+* {
+ font-family: "Raleway", "Open Sans", Arial, Helvetica, sans-serif;
+ line-height: 130%;
+}
+
+body {
+ margin: 0;
+ padding: 0;
+ color: #808785;
+ margin: 0 auto;
+ text-align: left;
+ font-size: 13.5pt;
+ -webkit-touch-callout: none; -webkit-user-select: none;
+ cursor: default;
+ overflow: hidden;
+ font-variant-numeric: lining-nums;
+ -moz-font-feature-settings: "lnum";
+ -webkit-font-feature-settings: "lnum";
+ font-feature-settings: "lnum";
+}
+
+.selectable {
+ -webkit-touch-callout: text;
+ -webkit-user-select: text;
+ cursor: text;
+}
+
+a:link,
+a:visited,
+a:hover,
+a:active {
+ color: #B4B4B4;
+}
+
+a:hover {
+ color: #2D88A4;
+}
+
+.header{
+ width: 95%;
+ left: 2.5%
+}
+.colmask{
+ width: 95%;
+ left: 2.5%
+}
+.colmid{ right: 25% }
+.colin{ right: 25% }
+.colleft{ right: 25% }
+.col1{
+ width: 23%;
+ left: 101%
+}
+.col2{
+ width: 23%;
+ left: 53%
+}
+.col3{
+ width: 23%;
+ left: 80%
+}
+.col4{
+ width: 23%;
+ left: 82%
+}
+.footer{
+ width: 95%;
+ left: 2.5%
+}
+.header{
+ clear: both;
+ float: left;
+ position: relative;
+ border-bottom: #000 1px solid;
+ background-color: #b4d2f7
+}
+.colmask{
+ clear: both;
+ float: left;
+ overflow: hidden;
+ position: relative;
+
+}
+.colmid{
+ float: left;
+ width: 100%;
+ position: relative;
+
+}
+.colin{
+ float: left;
+ width: 100%;
+ position: relative;
+
+}
+.colleft{
+ float: left;
+ width: 100%;
+ position: relative;
+
+}
+.col1{
+ padding: 0px 0px 1em 0px;
+ overflow: hidden;
+ float: left;
+ position: relative;
+
+}
+.col2{
+ padding: 0px 0px 1em 0px;
+ overflow: hidden;
+ float: left;
+ position: relative;
+
+}
+.col3{
+ padding: 0px 0px 1em 0px;
+ overflow: hidden;
+ float: left;
+ position: relative;
+
+}
+.col4{
+ padding: 0px 0px 1em 0px;
+ overflow: hidden;
+ float: left;
+ position: relative;
+
+}
+.footer{
+ clear: both;
+ float: left;
+ position: relative;
+ padding-top: 8px;
+ border-top: #000 1px solid;
+
+}
+.bottom{
+ clear: both;
+ width: 100%;
+ float: left;
+ position: relative;
+
+}
+body {
+ border-width: 0px;
+ padding: 0px;
+ margin: 0px;
+ font-size: 90%;
+ width: 100%;
+ min-width: 600px;
+}
diff --git a/server-console/src/content-update.html b/server-console/src/content-update.html
new file mode 100644
index 0000000000..c4ed14473a
--- /dev/null
+++ b/server-console/src/content-update.html
@@ -0,0 +1,53 @@
+
+
+
+ Server Backup
+
+
+
+
+
+
We backed up your old Sandbox content, just in case.
+
To restore it, follow these steps:
+
+
+
+
+
+
+
+
+
+

+
2. Go to your backup directory:
+
+
+
+
+

+
1. Stop your Sandbox server.
+
+
+
+

+
3. Copy the backed up content and paste it into the parent directory.
+
+
+
+

+
4. Restart your Sandbox server.
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/server-console/src/content-update.js b/server-console/src/content-update.js
new file mode 100644
index 0000000000..c77cfc92c6
--- /dev/null
+++ b/server-console/src/content-update.js
@@ -0,0 +1,12 @@
+function ready() {
+ console.log("Ready");
+
+ const electron = require('electron');
+ window.$ = require('./vendor/jquery/jquery-2.1.4.min.js');
+
+ electron.ipcRenderer.on('update', function(event, message) {
+ $('#directory').html(message);
+ });
+
+ electron.ipcRenderer.send('ready');
+}
diff --git a/server-console/src/images/step1.jpg b/server-console/src/images/step1.jpg
new file mode 100644
index 0000000000..cd80ae5537
Binary files /dev/null and b/server-console/src/images/step1.jpg differ
diff --git a/server-console/src/images/step2.jpg b/server-console/src/images/step2.jpg
new file mode 100644
index 0000000000..6bc285ac47
Binary files /dev/null and b/server-console/src/images/step2.jpg differ
diff --git a/server-console/src/images/step3.jpg b/server-console/src/images/step3.jpg
new file mode 100644
index 0000000000..a819dd2cdb
Binary files /dev/null and b/server-console/src/images/step3.jpg differ
diff --git a/server-console/src/images/step4.jpg b/server-console/src/images/step4.jpg
new file mode 100644
index 0000000000..27694aee74
Binary files /dev/null and b/server-console/src/images/step4.jpg differ
diff --git a/server-console/src/main.js b/server-console/src/main.js
index 82fe6b6b4d..ea8ba6337e 100644
--- a/server-console/src/main.js
+++ b/server-console/src/main.js
@@ -408,6 +408,13 @@ var labels = {
logWindow.open();
}
},
+ restoreBackup: {
+ label: 'Restore Backup Instructions',
+ click: function() {
+ var folder = getRootHifiDataDirectory() + "/Server Backup";
+ openBackupInstructions(folder);
+ }
+ },
share: {
label: 'Share',
click: function() {
@@ -443,6 +450,7 @@ function buildMenuArray(serverState) {
menuArray.push(labels.stopServer);
menuArray.push(labels.settings);
menuArray.push(labels.viewLogs);
+ menuArray.push(labels.restoreBackup);
menuArray.push(separator);
menuArray.push(labels.share);
menuArray.push(separator);
@@ -488,27 +496,62 @@ function updateTrayMenu(serverState) {
const httpStatusPort = 60332;
-function deleteResourceDirectories() {
- const dsResourceDirectory = getDomainServerClientResourcesDirectory();
+function backupResourceDirectories(folder) {
try {
- fs.removeSync(dsResourceDirectory);
- console.log("Deleted directory " + dsResourceDirectory);
- } catch (e) {
- console.log(e);
- }
- const acResourceDirectory = getAssignmentClientResourcesDirectory();
- try {
- fs.removeSync(acResourceDirectory);
- console.log("Deleted directory " + acResourceDirectory);
+ fs.mkdirSync(folder);
+ console.log("Created directory " + folder);
+
+
+ var dsBackup = path.join(folder, '/domain-server');
+ fs.renameSync(getDomainServerClientResourcesDirectory(), dsBackup);
+ console.log("Moved directory " + getDomainServerClientResourcesDirectory());
+ console.log("to " + dsBackup);
+
+ var acBackup = path.join(folder, '/assignment-client');
+ fs.renameSync(getAssignmentClientResourcesDirectory(), acBackup);
+ console.log("Moved directory " + getDomainServerClientResourcesDirectory());
+ console.log("to " + acBackup);
+ return true;
} catch (e) {
console.log(e);
+ return false;
}
}
-function deleteResourceDirectoriesAndRestart() {
+function openBackupInstructions(folder) {
+ // Explain user how to restore server
+ var window = new BrowserWindow({
+ icon: appIcon,
+ width: 800,
+ height: 520,
+ });
+ window.loadURL('file://' + __dirname + '/content-update.html');
+ if (!debug) {
+ window.setMenu(null);
+ }
+ window.show();
+
+ electron.ipcMain.on('ready', function() {
+ console.log("got ready");
+ window.webContents.send('update', folder);
+ });
+
+}
+function backupResourceDirectoriesAndRestart() {
homeServer.stop();
- deleteResourceDirectories();
- maybeInstallDefaultContentSet(onContentLoaded);
+
+ var folder = getRootHifiDataDirectory() + "/Server Backup - " + Date.now();
+ if (backupResourceDirectories(folder)) {
+ maybeInstallDefaultContentSet(onContentLoaded);
+ openBackupInstructions(folder);
+ } else {
+ dialog.showMessageBox({
+ type: 'warning',
+ buttons: ['Ok'],
+ title: 'Update Error',
+ message: 'There was an error updating the content, aborting.'
+ }, function() {});
+ }
}
function checkNewContent() {
@@ -537,16 +580,7 @@ function checkNewContent() {
message: 'A newer version of the home content set is available.\nDo you wish to update?'
}, function(idx) {
if (idx === 0) {
- dialog.showMessageBox({
- type: 'question',
- buttons: ['Yes', 'No'],
- title: 'Are you sure?',
- message: 'This action will delete your current sandbox content.\nDo you wish to continue?'
- }, function(idx) {
- if (idx === 0 && homeServer) {
- deleteResourceDirectoriesAndRestart();
- }
- });
+ backupResourceDirectoriesAndRestart();
} else {
// They don't want to update, mark content set as current
userConfig.set('homeContentLastModified', new Date());