mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-08 04:26:58 +03:00
consolidate test-ip definition, added missing Access-Control-Allow-Origin (#1741)
Co-authored-by: CaCO3 <caco@ruinelli.ch>
This commit is contained in:
@@ -1,8 +1,4 @@
|
||||
function readconfig_Version(){
|
||||
return "1.0.0 - 20200910";
|
||||
}
|
||||
|
||||
function SaveConfigToServer(_basepath){
|
||||
function SaveConfigToServer(_domainname){
|
||||
// leere Zeilen am Ende löschen
|
||||
var zw = config_split.length - 1;
|
||||
while (config_split[zw] == "") {
|
||||
@@ -15,16 +11,16 @@ function SaveConfigToServer(_basepath){
|
||||
config_gesamt = config_gesamt + config_split[i] + "\n";
|
||||
}
|
||||
|
||||
FileDeleteOnServer("/config/config.ini", _basepath);
|
||||
FileDeleteOnServer("/config/config.ini", _domainname);
|
||||
|
||||
FileSendContent(config_gesamt, "/config/config.ini", _basepath);
|
||||
FileSendContent(config_gesamt, "/config/config.ini", _domainname);
|
||||
}
|
||||
|
||||
function UpdateConfig(zw, _index, _enhance, _basepath){
|
||||
function UpdateConfig(zw, _index, _enhance, _domainname){
|
||||
var namezw = zw["name"];
|
||||
FileCopyOnServer("/img_tmp/ref_zw.jpg", namezw, _basepath);
|
||||
FileCopyOnServer("/img_tmp/ref_zw.jpg", namezw, _domainname);
|
||||
var namezw = zw["name"].replace(".jpg", "_org.jpg");
|
||||
FileCopyOnServer("/img_tmp/ref_zw_org.jpg", namezw, _basepath);
|
||||
FileCopyOnServer("/img_tmp/ref_zw_org.jpg", namezw, _domainname);
|
||||
}
|
||||
|
||||
|
||||
@@ -134,10 +130,10 @@ function getConfig()
|
||||
}
|
||||
|
||||
|
||||
function loadConfig(_basepath) {
|
||||
function loadConfig(_domainname) {
|
||||
var xhttp = new XMLHttpRequest();
|
||||
try {
|
||||
url = _basepath + '/fileserver/config/config.ini';
|
||||
url = _domainname + '/fileserver/config/config.ini';
|
||||
xhttp.open("GET", url, false);
|
||||
xhttp.send();
|
||||
config_gesamt = xhttp.responseText;
|
||||
@@ -162,8 +158,8 @@ function dataURLtoBlob(dataurl) {
|
||||
return new Blob([u8arr], {type:mime});
|
||||
}
|
||||
|
||||
function FileCopyOnServer(_source, _target, _basepath = ""){
|
||||
url = _basepath + "/editflow?task=copy&in=" + _source + "&out=" + _target;
|
||||
function FileCopyOnServer(_source, _target, _domainname = ""){
|
||||
url = _domainname + "/editflow?task=copy&in=" + _source + "&out=" + _target;
|
||||
var xhttp = new XMLHttpRequest();
|
||||
try {
|
||||
xhttp.open("GET", url, false);
|
||||
@@ -174,7 +170,7 @@ function FileCopyOnServer(_source, _target, _basepath = ""){
|
||||
}
|
||||
}
|
||||
|
||||
function FileDeleteOnServer(_filename, _basepath = ""){
|
||||
function FileDeleteOnServer(_filename, _domainname = ""){
|
||||
var xhttp = new XMLHttpRequest();
|
||||
var okay = false;
|
||||
|
||||
@@ -192,7 +188,7 @@ function FileDeleteOnServer(_filename, _basepath = ""){
|
||||
}
|
||||
};
|
||||
try {
|
||||
var url = _basepath + "/delete" + _filename;
|
||||
var url = _domainname + "/delete" + _filename;
|
||||
xhttp.open("POST", url, false);
|
||||
xhttp.send();
|
||||
}
|
||||
@@ -204,7 +200,7 @@ function FileDeleteOnServer(_filename, _basepath = ""){
|
||||
return okay;
|
||||
}
|
||||
|
||||
function FileSendContent(_content, _filename, _basepath = ""){
|
||||
function FileSendContent(_content, _filename, _domainname = ""){
|
||||
var xhttp = new XMLHttpRequest();
|
||||
var okay = false;
|
||||
|
||||
@@ -221,7 +217,7 @@ function FileSendContent(_content, _filename, _basepath = ""){
|
||||
};
|
||||
|
||||
try {
|
||||
upload_path = _basepath + "/upload" + _filename;
|
||||
upload_path = _domainname + "/upload" + _filename;
|
||||
xhttp.open("POST", upload_path, false);
|
||||
xhttp.send(_content);
|
||||
}
|
||||
@@ -233,21 +229,21 @@ function FileSendContent(_content, _filename, _basepath = ""){
|
||||
}
|
||||
|
||||
|
||||
function SaveCanvasToImage(_canvas, _filename, _delete = true, _basepath = ""){
|
||||
function SaveCanvasToImage(_canvas, _filename, _delete = true, _domainname = ""){
|
||||
var JPEG_QUALITY=0.8;
|
||||
var dataUrl = _canvas.toDataURL('image/jpeg', JPEG_QUALITY);
|
||||
var rtn = dataURLtoBlob(dataUrl);
|
||||
|
||||
if (_delete) {
|
||||
FileDeleteOnServer(_filename, _basepath);
|
||||
FileDeleteOnServer(_filename, _domainname);
|
||||
}
|
||||
|
||||
FileSendContent(rtn, _filename, _basepath);
|
||||
FileSendContent(rtn, _filename, _domainname);
|
||||
}
|
||||
|
||||
function MakeContrastImageZW(zw, _enhance, _basepath){
|
||||
function MakeContrastImageZW(zw, _enhance, _domainname){
|
||||
_filename = zw["name"].replace("/config/", "/img_tmp/");
|
||||
url = _basepath + "/editflow?task=cutref&in=/config/reference.jpg&out=" + _filename + "&x=" + zw["x"] + "&y=" + zw["y"] + "&dx=" + zw["dx"] + "&dy=" + zw["dy"];
|
||||
url = _domainname + "/editflow?task=cutref&in=/config/reference.jpg&out=" + _filename + "&x=" + zw["x"] + "&y=" + zw["y"] + "&dx=" + zw["dx"] + "&dy=" + zw["dy"];
|
||||
if (_enhance == true){
|
||||
url = url + "&enhance=true";
|
||||
}
|
||||
@@ -264,10 +260,10 @@ function MakeContrastImageZW(zw, _enhance, _basepath){
|
||||
|
||||
|
||||
|
||||
function MakeRefZW(zw, _basepath){
|
||||
function MakeRefZW(zw, _domainname){
|
||||
_filetarget = zw["name"].replace("/config/", "/img_tmp/");
|
||||
_filetarget = _filetarget.replace(".jpg", "_org.jpg");
|
||||
url = _basepath + "/editflow?task=cutref&in=/config/reference.jpg&out="+_filetarget+"&x=" + zw["x"] + "&y=" + zw["y"] + "&dx=" + zw["dx"] + "&dy=" + zw["dy"];
|
||||
url = _domainname + "/editflow?task=cutref&in=/config/reference.jpg&out="+_filetarget+"&x=" + zw["x"] + "&y=" + zw["y"] + "&dx=" + zw["dx"] + "&dy=" + zw["dy"];
|
||||
var xhttp = new XMLHttpRequest();
|
||||
try {
|
||||
xhttp.open("GET", url, false);
|
||||
@@ -278,6 +274,6 @@ function MakeRefZW(zw, _basepath){
|
||||
}
|
||||
_filetarget2 = zw["name"].replace("/config/", "/img_tmp/");
|
||||
// _filetarget2 = _filetarget2.replace(".jpg", "_org.jpg");
|
||||
FileCopyOnServer(_filetarget, _filetarget2, _basepath);
|
||||
FileCopyOnServer(_filetarget, _filetarget2, _domainname);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user