feat:更新请求路径管理

main
zhoulexin 4 months ago
parent 5b8263c464
commit ab4f59bdbd

@ -2,6 +2,7 @@ import * as THREE from "./lib/three.module.js";
import { globalObjectCategory } from "./obj_cfg.js";
import { saveWorldList } from "./save.js";
import { intersect } from "./util.js";
import request from "./request.js";
function Annotation(sceneMeta, world, frameInfo) {
this.world = world;
@ -514,7 +515,7 @@ function Annotation(sceneMeta, world, frameInfo) {
xhr.open(
"GET",
"/load_annotation" +
request + "/load_annotation" +
"?scene=" +
this.frameInfo.scene +
"&frame=" +

@ -1,4 +1,5 @@
import { globalObjectCategory } from "./obj_cfg.js";
import request from "./request.js";
function autoAnnotate(world, done, alg) {
var xhr = new XMLHttpRequest();
@ -25,7 +26,7 @@ function autoAnnotate(world, done, alg) {
xhr.open(
"GET",
"/auto_annotate?" +
request + "/auto_annotate?" +
"scene=" +
world.frameInfo.scene +
"&frame=" +

@ -1,4 +1,5 @@
import { PopupDialog } from "./popup_dialog.js";
import request from "./request.js";
class CropScene extends PopupDialog {
constructor(ui, editor) {
@ -27,7 +28,7 @@ class CropScene extends PopupDialog {
}
};
xhr.open("POST", "/cropscene", true);
xhr.open("POST", request + "/cropscene", true);
let para = {
rawSceneId: this.editor.data.world.frameInfo.scene,

@ -1,6 +1,7 @@
import { World } from "./world.js";
import { Debug } from "./debug.js";
import { logger } from "./log.js";
import request from "./request.js";
// 请求数据集合
class Data {
@ -428,7 +429,7 @@ class Data {
}
};
xhr.open("GET", `/scenemeta?scene=${sceneName}`, true);
xhr.open("GET", `${request}/scenemeta?scene=${sceneName}`, true);
xhr.send();
});
}

@ -1,3 +1,4 @@
import request from "./request.js";
class EgoPose {
constructor(sceneMeta, world, frameInfo) {
this.world = world;
@ -37,7 +38,7 @@ class EgoPose {
xhr.open(
"GET",
"/load_ego_pose" +
request + "/load_ego_pose" +
"?scene=" +
this.world.frameInfo.scene +
"&frame=" +

@ -1,3 +1,4 @@
import request from "../../request.js";
/////////////////////////////////////
/// Stand alone lalolib base functions
////////////////////////////////////
@ -1404,7 +1405,7 @@ Lalolab.prototype.import = function ( script, callback ) {
function importLaloScript ( script ) {
// load a script in lalolib language in the current Lab worker
var xhr = new XMLHttpRequest();
xhr.open('GET', script, false);
xhr.open('GET', request + script, false);
xhr.send();
var cmd = xhr.responseText;
return lalo(cmd);

@ -1,3 +1,4 @@
import request from "../../request.js";
/////////////////////////////////////
/// Stand alone lalolib base functions
////////////////////////////////////
@ -1404,7 +1405,7 @@ Lalolab.prototype.import = function ( script, callback ) {
function importLaloScript ( script ) {
// load a script in lalolib language in the current Lab worker
var xhr = new XMLHttpRequest();
xhr.open('GET', script, false);
xhr.open('GET', request + script, false);
xhr.send();
var cmd = xhr.responseText;
return lalo(cmd);
@ -26392,7 +26393,7 @@ function loadmodel ( url, format ) {
// load a remote file (from same web server only...)
var xhr = new XMLHttpRequest();
xhr.open('GET', url, false); // false = synchronous
xhr.open('GET', request + url, false); // false = synchronous
xhr.responseType = 'blob';
xhr.send(null);
@ -26418,7 +26419,7 @@ function loaddata ( url, format ) {
// load a remote file (from same web server only...)
var xhr = new XMLHttpRequest();
xhr.open('GET', url, false); // false = synchronous
xhr.open('GET', request + url, false); // false = synchronous
xhr.responseType = 'blob';
xhr.send(null);

@ -1,4 +1,5 @@
import { categoryZh } from "./obj_cfg.js";
import request from "./request.js";
class ObjectIdManager {
maxId = 1;
@ -107,7 +108,7 @@ class ObjectIdManager {
}
};
xhr.open("GET", "/objs_of_scene?scene=" + scene, true);
xhr.open("GET", request + "/objs_of_scene?scene=" + scene, true);
xhr.send();
}

@ -0,0 +1,2 @@
const request = location.host.indexOf('localhost')!=-1 ? '' : '/3Dpoints'
export default request

@ -1,6 +1,7 @@
import { Editor } from "./editor.js";
import { checkScene } from "./error_check.js";
import { logger } from "./log.js";
import request from "./request.js";
function reloadWorldList(worldList, done) {
var xhr = new XMLHttpRequest();
@ -27,7 +28,7 @@ function reloadWorldList(worldList, done) {
}
};
xhr.open("POST", "/loadworldlist", true);
xhr.open("POST", request + "/loadworldlist", true);
let para = worldList.map((w) => {
return {
@ -95,7 +96,7 @@ function doSaveWorldList(worldList, done) {
});
var xhr = new XMLHttpRequest();
xhr.open("POST", "/saveworldlist", true);
xhr.open("POST", request + "/saveworldlist", true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.onreadystatechange = function () {

Loading…
Cancel
Save