posibly working with netlify?

This commit is contained in:
Quicksticks-oss committed 2024-03-21 13:20:44 -04:00
1 parent 865894bb63
commit bd8bb31f9c
3 files changed
+16 -18

No files matched your search

+1 -3
View File
@@ -13,9 +13,7 @@ class MediaUploadManager {
method: 'POST',
mode: 'cors',
headers: {
'Authorization': `Bearer ${this.sessionToken}`, // Assuming the session token is a Bearer token
'Access-Control-Allow-Origin': 'http://localhost:3000',
'Access-Control-Allow-Credentials': true
'Authorization': `Bearer ${this.sessionToken}`,
},
body: formData,
});
+8 -5
View File
@@ -61,14 +61,12 @@ class Editor {
this.rendering = false;
// API.
this.api_manager = new MediaUploadManager();
this.locked = false;
this.api_manager = new MediaUploadManager("eyJhbGciOiJIUzI1NiJ9.eyJjb29raWVfdmVyc2lvbiI6IjIiLCJzZXNzaW9uX3Rva2VuIjoic2Vzc2lvbl9kaDRuazE2OHI3OWI4emNjeWJiNGNzYnEiLCJ1c2VyX3Rva2VuIjoidXNlcl9uczg3MWt5OW56OXB3In0.xwgWhGQ6oHOd6irj-CzJZkZlmCirDwM8BGnBPHbs0UE");
// Debug & Movement.
this.stats = null;
this.orbit = null;
this.locked = false;
// Recording params.
this.capturer = null;
@@ -302,10 +300,15 @@ class Editor {
this.control.detach(this.selected);
this.activeScene.scene.remove(this.control);
this.activeScene.scene.remove(this.activeScene.gridHelper);
this.save_manager.save(this.activeScene.scene);
this.save_manager.save(this.activeScene.scene, this._save_to_cloud.bind(this));
this.activeScene._createGrid();
}
_save_to_cloud(blob) {
console.log("Posting to cloud!");
this.api_manager.uploadMedia(blob, "test.bin");
}
load() {
let uploadedFile = document.getElementById("load-upload").files[0];
this.save_manager.load(uploadedFile, this.load_callback.bind(this));
+7 -10
View File
@@ -8,7 +8,7 @@ class SaveManager {
this.scene = null;
}
save(scene, scene_data) {
save(scene, scene_callback) {
let gltfExporter = new GLTFExporter();
gltfExporter.parse(
scene,
@@ -18,6 +18,8 @@ class SaveManager {
let blob = new Blob([jsonString], {type: 'application/octet-stream'})
let blobUrl = URL.createObjectURL(blob);
scene_callback(blob);
let a = document.createElement('a');
const now = new Date();
@@ -51,18 +53,13 @@ class SaveManager {
reader.onload = function(e) {
const contents = e.target.result;
const loader = new THREE.GLTFLoader();
const loader = new GLTFLoader();
loader.parse(contents, '', function(gltf) {
scene.add(gltf.scene);
console.log(gltf);
load_callback(gltf.scene);
});
};
reader.readAsArrayBuffer(file);
//const loader = new GLTFLoader();
//loader.load(uploadedFile, function ( gltf ) {
// console.log(gltf);
// load_callback(gltf.scene);
//});
reader.readAsArrayBuffer(uploadedFile);
}
download(data, filename, type) {