From edd7c33ff619fb996f71f20b40fe6a0076714947 Mon Sep 17 00:00:00 2001 From: Tariq Soliman Date: Thu, 24 Oct 2019 17:10:17 -0700 Subject: [PATCH] Mission folder creation, add indication that Apache support is deprecating --- API/routes/configs.js | 27 ++- config/configconfig.json | 297 ++++++++++++----------- config/css/configOLD.css | 168 +++++++++++++ config/index.html | 4 +- index.html | 6 +- scripts/essence/Ancillary/Login/Login.js | 2 +- 6 files changed, 350 insertions(+), 154 deletions(-) create mode 100644 config/css/configOLD.css diff --git a/API/routes/configs.js b/API/routes/configs.js index b8982cd4..cf791f52 100644 --- a/API/routes/configs.js +++ b/API/routes/configs.js @@ -4,15 +4,14 @@ **********************************************************/ const express = require('express'); const router = express.Router(); -const crypto = require('crypto'); -const bcrypt = require('bcryptjs'); -const buf = crypto.randomBytes(128); const execFile = require("child_process").execFile; const logger = require('../logger'); const Config = require('../models/config'); const config_template = require('../templates/config_template'); +const fs = require('fs'); + function get(req, res, next, cb ) { Config.findAll( { where: { @@ -88,6 +87,13 @@ function add(req, res, next, cb) { configTemplate = req.body.config || configTemplate; configTemplate.msv.mission = req.body.mission; + if( req.body.mission !== req.body.mission.replace(/[`~!@#$%^&*()|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, '') && + req.body.mission.length === 0 && + !isNaN(req.body.mission[0]) ) { + res.send( { status: 'failure', message: 'Bad mission name.' } ); + return; + } + let newConfig = { mission: req.body.mission, config: configTemplate, @@ -105,6 +111,19 @@ function add(req, res, next, cb) { if( !mission ) { Config.create(newConfig) .then(created => { + let dir = './Missions/' + created.mission + if (!fs.existsSync(dir)){ + fs.mkdirSync(dir); + let dir2 = dir + '/Layers' + if (!fs.existsSync(dir2)){ + fs.mkdirSync(dir2); + } + let dir3 = dir + '/Data' + if (!fs.existsSync(dir3)){ + fs.mkdirSync(dir3); + } + } + if( cb ) cb( { status: 'success', mission: created.mission, version: created.version } ); else @@ -323,7 +342,7 @@ router.post('/destroy', function(req, res, next) { stdout, stderr ) { - res.send( stdout ); + res.send( { s: stdout, d: process.cwd() } ); }); }) .catch( err => { diff --git a/config/configconfig.json b/config/configconfig.json index afe036ee..80317b92 100644 --- a/config/configconfig.json +++ b/config/configconfig.json @@ -1,151 +1,156 @@ { - "missions": [], - "tools": [ - { - "defaultIcon": "buffer", - "description": "Hierarchically toggle layers on and off and alter their opacities.", - "descriptionFull": "", - "hasVars": false, - "name": "Layers" - }, - { - "defaultIcon": "format-list-bulleted-type", - "description": "Show a chart mapping colors and symbols to meaning.", - "descriptionFull": "", - "hasVars": false, - "name": "Legend" - }, - { - "defaultIcon": "information-variant", - "description": "Display the geojson properties field of a clicked point.", - "descriptionFull": "", - "hasVars": false, - "name": "Info" - }, - { - "defaultIcon": "pin", - "description": "A button bar to navigate between various map locations.", - "descriptionFull": { - "title": "A button bar to quickly navigate between preset map locations.", - "example": { - "sites": [ - { - "name": "(str) Name of site", - "code": "(str) Unique identifier. Can match header layer to toggle it's sublayers", - "view": ["(num) Latitude", "(num) Longitude", "(num) Zoom level"] + "missions": [ + ], + "tools": [ + { + "defaultIcon": "buffer", + "description": "Hierarchically toggle layers on and off and alter their opacities.", + "descriptionFull": "", + "hasVars": false, + "name": "Layers" + }, + { + "defaultIcon": "format-list-bulleted-type", + "description": "Show a chart mapping colors and symbols to meaning.", + "descriptionFull": "", + "hasVars": false, + "name": "Legend" + }, + { + "defaultIcon": "information-variant", + "description": "Display the geojson properties field of a clicked point.", + "descriptionFull": "", + "hasVars": false, + "name": "Info" + }, + { + "defaultIcon": "pin", + "description": "A button bar to navigate between various map locations.", + "descriptionFull": { + "title": "A button bar to quickly navigate between preset map locations.", + "example": { + "sites": [ + { + "name": "(str) Name of site", + "code": "(str) Unique identifier. Can match header layer to toggle it's sublayers", + "view": [ + "(num) Latitude", + "(num) Longitude", + "(num) Zoom level" + ] + }, + { + "...": "..." + } + ] + } }, - { - "...": "..." - } - ] - } - }, - "hasVars": true, - "name": "Sites" - }, - { - "defaultIcon": "folder-multiple", - "description": "A file finder/explorer to access and display other users' drawings.", - "descriptionFull": "", - "hasVars": false, - "name": "FileManager" - }, - { - "defaultIcon": "chart-areaspline", - "description": "Measure distances and generates elevation profiles.", - "descriptionFull": { - "title": "Specify a path to a Digital Elevation Model (dem) .tif. Measure distances and generates elevation profiles. Can also query specific bands at specific points of images and generate profiles of them.", - "example": { - "dem": "(str) path to Data/missionDEM.tif" - } - }, - "hasVars": true, - "name": "Measure" - }, - { - "defaultIcon": "lead-pencil", - "description": "Draw polygons with colors, names and descriptions.", - "descriptionFull": { - "title": "Please specify a color legend. Draw polygons with colors, names and descriptions. Polygons of the same file never overlap each other and there are options to draw, erase, delete, draw over, draw under, change the color, name, description, download and choose which file you're drawing to.", - "example": { - "colorlegend": [ - { - "name": "Smooth Regolith", - "color": "#1E5CB3", - "value": "0", - "invertTextColor": true + "hasVars": true, + "name": "Sites" + }, + { + "defaultIcon": "folder-multiple", + "description": "A file finder\/explorer to access and display other users' drawings.", + "descriptionFull": "", + "hasVars": false, + "name": "FileManager" + }, + { + "defaultIcon": "chart-areaspline", + "description": "Measure distances and generates elevation profiles.", + "descriptionFull": { + "title": "Specify a path to a Digital Elevation Model (dem) .tif. Measure distances and generates elevation profiles. Can also query specific bands at specific points of images and generate profiles of them.", + "example": { + "dem": "(str) path to Data\/missionDEM.tif" + } }, - { - "...": "..." - } - ], - "demtilesets": { - "path_to_DEM_tiles/{z}/{x}/{y}.png": { - "dim": "(int) dimension of dem tiles used. 32 for 32x32 tiles", - "z": "(int) zoom level to query elevation data off of dem tiles" + "hasVars": true, + "name": "Measure" + }, + { + "defaultIcon": "lead-pencil", + "description": "Draw polygons with colors, names and descriptions.", + "descriptionFull": { + "title": "Please specify a color legend. Draw polygons with colors, names and descriptions. Polygons of the same file never overlap each other and there are options to draw, erase, delete, draw over, draw under, change the color, name, description, download and choose which file you're drawing to.", + "example": { + "colorlegend": [ + { + "name": "Smooth Regolith", + "color": "#1E5CB3", + "value": "0", + "invertTextColor": true + }, + { + "...": "..." + } + ], + "demtilesets": { + "path_to_DEM_tiles\/{z}\/{x}\/{y}.png": { + "dim": "(int) dimension of dem tiles used. 32 for 32x32 tiles", + "z": "(int) zoom level to query elevation data off of dem tiles" + }, + "...": { + "...": "..." + } + } + } }, - "...": { - "...": "..." - } - } - } - }, - "hasVars": true, - "name": "Sketch" - }, - { - "defaultIcon": "flask", - "description": "Display chemistry percentages via graphs of a clicked point.", - "descriptionFull": "", - "hasVars": false, - "name": "Chemistry" - }, - { - "defaultIcon": "eye", - "description": "Search a layer for a string.", - "descriptionFull": { - "title": "Please specify search fields. Search a layer for a string and either go to it and/or select it. The strings are built from the layer elements' properties object. Which properties it searches through depends on the defined searchfields for each layer. Try to choose a combination that's unique. propN is a geojson property key of that layer. All propNs are placed between parentheses and separated by a space. Place 'round' or 'rmunder' before a prop to round it or remove its underscores.", - "example": { - "searchfields": { - "[Layer_Name]": "(prop1) round(prop3)", - "...": "..." - } - } - }, - "hasVars": true, - "name": "Search" - }, - { - "defaultIcon": "map-marker", - "description": "Mouse over the map for a by-pixel legend of a raster.", - "descriptionFull": { - "title": "Mouse over to query underlying datasets.", - "example": { - "[Layer_Name]": { - "url": "(str) path_to_data/data.tif", - "bands": "(int) how many bands to query from", - "sigfigs": "(int) how many digits after the decimal", - "unit": "(str) whatever string unit" - }, - "...": {} + "hasVars": true, + "name": "Sketch" + }, + { + "defaultIcon": "flask", + "description": "Display chemistry percentages via graphs of a clicked point.", + "descriptionFull": "", + "hasVars": false, + "name": "Chemistry" + }, + { + "defaultIcon": "eye", + "description": "Search a layer for a string.", + "descriptionFull": { + "title": "Please specify search fields. Search a layer for a string and either go to it and\/or select it. The strings are built from the layer elements' properties object. Which properties it searches through depends on the defined searchfields for each layer. Try to choose a combination that's unique. propN is a geojson property key of that layer. All propNs are placed between parentheses and separated by a space. Place 'round' or 'rmunder' before a prop to round it or remove its underscores.", + "example": { + "searchfields": { + "[Layer_Name]": "(prop1) round(prop3)", + "...": "..." + } + } + }, + "hasVars": true, + "name": "Search" + }, + { + "defaultIcon": "map-marker", + "description": "Mouse over the map for a by-pixel legend of a raster.", + "descriptionFull": { + "title": "Mouse over to query underlying datasets.", + "example": { + "[Layer_Name]": { + "url": "(str) path_to_data\/data.tif", + "bands": "(int) how many bands to query from", + "sigfigs": "(int) how many digits after the decimal", + "unit": "(str) whatever string unit" + }, + "...": [] + } + }, + "hasVars": true, + "name": "Identifier" + }, + { + "defaultIcon": "magnify", + "description": "Spatially query layer data", + "descriptionFull": "A more complete description that you see when you click on the description", + "hasVars": true, + "name": "Query" + }, + { + "defaultIcon": "tent", + "description": "Advanced drawing", + "descriptionFull": "", + "hasVars": true, + "name": "Draw" } - }, - "hasVars": true, - "name": "Identifier" - }, - { - "defaultIcon": "magnify", - "description": "Spatially query layer data", - "descriptionFull": "A more complete description that you see when you click on the description", - "hasVars": true, - "name": "Query" - }, - { - "defaultIcon": "tent", - "description": "Advanced drawing", - "descriptionFull": "", - "hasVars": true, - "name": "Draw" - } - ] -} + ] +} \ No newline at end of file diff --git a/config/css/configOLD.css b/config/css/configOLD.css new file mode 100644 index 00000000..9f41c3a5 --- /dev/null +++ b/config/css/configOLD.css @@ -0,0 +1,168 @@ +@font-face { + font-family: venus; + src: url(../../public/fonts/taxidriver/TaxiDriver.ttf); +} + +html { + height: 100%; + background-color: #171717; +} +body { + background-color: #171717; + /*background: linear-gradient(to top, #0e3443, #1E2021);*/ + background-repeat: no-repeat; + height: 100%; + color: black; + overflow-x: hidden; + margin: 0 4% 0 4%; +} +#topbar { + text-align: center; + padding: 4px; +} +#topbar #tbtitle, #topbar #tbtitle a { + font-size: 24px; + color: #CCC; + margin: 0; + padding: 0; +} +#topbar #tbmmgis { + -webkit-transition: all 0.2s ease-in; + transition: all 0.2s ease-in; + font-family: venus; +} +#topbar #tbmmgis:hover { + color: #999; +} +#topbar #tbconfig { + font-family: roboto; + cursor: default; +} +#topbar #divline { + width: 100%; + height: 1px; + background-color: #000; + background: -webkit-radial-gradient(circle, transparent, transparent, #999); /* Safari */ + background: -o-radial-gradient(circle, transparent, transparent, #999); /* Opera 11.6 to 12.0 */ + background: -moz-radial-gradient(circle, transparent, transparent, #999); /* Firefox 3.6 to 15 */ + background: radial-gradient(circle, transparent, transparent, #999); /* Standard syntax */ + position: absolute; + top: 22px; + left: 0; +} + +#c_logo { + width: 5vw; + height: auto; + display: block; + margin-left: auto; + margin-right: auto; +} + +#new_mission { + border-radius: 0; + padding-top: 6px; + padding-bottom: 6px; + height: 100%; + border-right: 8px solid #1E2021; + box-shadow: inset 0px 0px 12px #222; +} + +#new_mission:hover { + color: #95cd6c; +} + +textarea { + resize: vertical; +} + +.CodeMirror { + border: 1px solid #eee; + height: auto; +} + +#missions a { + cursor: pointer; +} + +.tabs { + box-shadow: inset 0px 0px 12px #222; + background-color: rgba(255,255,255,0.12); +} +.tabs .tab { + z-index: 10; +} +.tabs .tab a { + color: white; +} +.tabs .tab a:hover { + color: #95cd6c; +} + +.tabs .indicator { + -webkit-transition: background-color 0.7s, box-shadow 0.7s; + transition: background-color 0.7s, box-shadow 0.7s; + box-shadow: inset 0px -12px 12px -12px #222; + height: 100%; + z-index: 9; + background-color: transparent; +} + +#tab_new_mission, #tab_initial, #tab_projection, #tab_look, #tab_panels, #tab_tools, #tab_layers { + box-shadow: inset 0px 0px 12px black; +} +.checkbox-color[type="checkbox"].filled-in:checked + label:after { + border: 2px solid #558b2f; + background-color: #558b2f; +} + +#home_cont { + height: 100%; + top: 50%; + color: #888; + font-size: 30px; + text-align: center; +} + +.modal { + overflow: visible !important; + max-height: 100% !important; +} +.modal .modal-title { + display: flex; + justify-content: space-between; +} +.modal .clone { + height: 35px; + cursor: pointer; + color: #777; + transition: color 0.1s cubic-bezier(0.39, 0.575, 0.565, 1); +} +.modal .clone:hover { + color: #000; +} + +#toast-container { + pointer-events: none; + top: 110px !important; + right: 6px !important; +} + +.mmgisScrollbar::-webkit-scrollbar-track +{ + -webkit-box-shadow: inset 0px 0px 6px rgba(0,0,0,0.3); + background-color: Transparent; +} + +.mmgisScrollbar::-webkit-scrollbar +{ + width: 6px; + height: 6px; + background-color: transparent; +} + +.mmgisScrollbar::-webkit-scrollbar-thumb +{ + border-radius: 2px; + background-color: rgba(255,255,255,0.25); +} \ No newline at end of file diff --git a/config/index.html b/config/index.html index d88160db..9e50c64b 100644 --- a/config/index.html +++ b/config/index.html @@ -3,13 +3,13 @@ MMGIS / Config - + - + diff --git a/index.html b/index.html index 23f4860e..1a55c507 100644 --- a/index.html +++ b/index.html @@ -81,8 +81,12 @@ "██║ ╚═╝ ██║██║ ╚═╝ ██║╚██████╔╝██║███████║ JQuery v1.11.3\n" + "╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═╝╚══════╝ OpenSeadragon 2.2.1" ); + console.log( + '%c!!! Running with Apache is being deprecated; please switch to Node by setting SERVER=node within your .env !!!', + 'border: 2px solid #ff2626; padding: 0px 4px 0px 4px;' + ); - + diff --git a/scripts/essence/Ancillary/Login/Login.js b/scripts/essence/Ancillary/Login/Login.js index f7334de7..c14e84c8 100644 --- a/scripts/essence/Ancillary/Login/Login.js +++ b/scripts/essence/Ancillary/Login/Login.js @@ -399,7 +399,7 @@ define([ } function loginSuccess(data, ignoreError) { - if (data.status == 'success') { + if (data && data.status == 'success') { document.cookie = 'MMGISUser=' + JSON.stringify({