kopia lustrzana https://github.com/OpenDroneMap/NodeODM
Better token support in UI
rodzic
c23d8bde75
commit
1b64ce4b3b
2
index.js
2
index.js
|
@ -160,7 +160,7 @@ app.post('/task/new', authCheck, addRequestId, upload.array('images'), (req, res
|
||||||
};
|
};
|
||||||
|
|
||||||
if ((!req.files || req.files.length === 0) && !req.body.zipurl) die("Need at least 1 file or a zip file url.");
|
if ((!req.files || req.files.length === 0) && !req.body.zipurl) die("Need at least 1 file or a zip file url.");
|
||||||
if (config.maxImages > 0 && req.files && req.files.length > config.maxImages) die(`${req.files.length} images uploaded, but this node can only process up to ${config.maxImages}.`);
|
else if (config.maxImages > 0 && req.files && req.files.length > config.maxImages) die(`${req.files.length} images uploaded, but this node can only process up to ${config.maxImages}.`);
|
||||||
|
|
||||||
else {
|
else {
|
||||||
let destPath = path.join(Directories.data, req.id);
|
let destPath = path.join(Directories.data, req.id);
|
||||||
|
|
|
@ -16,6 +16,14 @@ You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
$(function() {
|
$(function() {
|
||||||
|
function query(key) {
|
||||||
|
key = key.replace(/[*+?^$.\[\]{}()|\\\/]/g, "\\$&"); // escape RegEx meta chars
|
||||||
|
var match = location.search.match(new RegExp("[?&]"+key+"=([^&]+)(&|$)"));
|
||||||
|
return match && decodeURIComponent(match[1].replace(/\+/g, " "));
|
||||||
|
}
|
||||||
|
|
||||||
|
var token = query('token') || "";
|
||||||
|
|
||||||
function hoursMinutesSecs(t) {
|
function hoursMinutesSecs(t) {
|
||||||
var ch = 60 * 60 * 1000,
|
var ch = 60 * 60 * 1000,
|
||||||
cm = 60 * 1000,
|
cm = 60 * 1000,
|
||||||
|
@ -134,7 +142,7 @@ $(function() {
|
||||||
}
|
}
|
||||||
Task.prototype.refreshInfo = function() {
|
Task.prototype.refreshInfo = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
var url = "/task/" + this.uuid + "/info";
|
var url = "/task/" + this.uuid + "/info?token=" + token;
|
||||||
$.get(url)
|
$.get(url)
|
||||||
.done(function(json) {
|
.done(function(json) {
|
||||||
// Track time
|
// Track time
|
||||||
|
@ -160,7 +168,7 @@ $(function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
function fetchOutput() {
|
function fetchOutput() {
|
||||||
var url = "/task/" + self.uuid + "/output";
|
var url = "/task/" + self.uuid + "/output?token=" + token;
|
||||||
$.get(url, { line: self.viewOutputLine })
|
$.get(url, { line: self.viewOutputLine })
|
||||||
.done(function(output) {
|
.done(function(output) {
|
||||||
for (var i in output) {
|
for (var i in output) {
|
||||||
|
@ -269,7 +277,7 @@ $(function() {
|
||||||
|
|
||||||
// Handle uploads
|
// Handle uploads
|
||||||
$("#images").fileinput({
|
$("#images").fileinput({
|
||||||
uploadUrl: '/task/new',
|
uploadUrl: '/task/new?token=' + token,
|
||||||
showPreview: false,
|
showPreview: false,
|
||||||
allowedFileExtensions: ['jpg', 'jpeg', 'txt', 'zip'],
|
allowedFileExtensions: ['jpg', 'jpeg', 'txt', 'zip'],
|
||||||
elErrorContainer: '#errorBlock',
|
elErrorContainer: '#errorBlock',
|
||||||
|
@ -299,18 +307,11 @@ $(function() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Start upload
|
// Start upload
|
||||||
$("#images").fileinput('upload');
|
$("#images").fileinput('upload');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#resetWebhook').on('click', function(){
|
$('#resetWebhook').on('click', function(){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$("#webhook").val('');
|
$("#webhook").val('');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -335,6 +336,7 @@ $(function() {
|
||||||
$('#zipurl').val('');
|
$('#zipurl').val('');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
var btnUploadLabel = $("#btnUpload").val();
|
var btnUploadLabel = $("#btnUpload").val();
|
||||||
$("#images")
|
$("#images")
|
||||||
.on('filebatchuploadsuccess', function(e, params) {
|
.on('filebatchuploadsuccess', function(e, params) {
|
||||||
|
@ -359,14 +361,6 @@ $(function() {
|
||||||
this.value(undefined);
|
this.value(undefined);
|
||||||
};
|
};
|
||||||
|
|
||||||
function query(key) {
|
|
||||||
key = key.replace(/[*+?^$.\[\]{}()|\\\/]/g, "\\$&"); // escape RegEx meta chars
|
|
||||||
var match = location.search.match(new RegExp("[?&]"+key+"=([^&]+)(&|$)"));
|
|
||||||
return match && decodeURIComponent(match[1].replace(/\+/g, " "));
|
|
||||||
}
|
|
||||||
|
|
||||||
var token = query('token') || "";
|
|
||||||
|
|
||||||
function OptionsModel() {
|
function OptionsModel() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue