Skip to content

Commit

Permalink
Fix Spoke import
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo committed Apr 22, 2024
1 parent 8cee6ce commit f6c3bb0
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/api/backup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ async function backupBlenderProjects(
path.join(sceneDir, `${scene.scene_id}.json`),
JSON.stringify(scene, null, 2),
{
encoding: "ascii",
encoding: "utf-8",
}
);
const url = new URL(scene.model_url);
Expand Down Expand Up @@ -193,13 +193,7 @@ async function backupSpokeProjects(
path.join(projectDir, `${project.project_id}.json`),
JSON.stringify(project, null, 2),

{ encoding: "ascii" }
);
writeFileSync(
path.join(projectDir, `${project.name}.spoke`),
JSON.stringify(project, null, 2),

{ encoding: "ascii" }
{ encoding: "utf-8" }
);
if (project.project_url) {
const url = new URL(project.project_url);
Expand All @@ -210,6 +204,10 @@ async function backupSpokeProjects(
outPath: path.join(projectDir, fileName),
override,
});
copyFileSync(
path.join(projectDir, fileName),
path.join(projectDir, `${project.name}.spoke`)
);
}
}
if (project.thumbnail_url) {
Expand All @@ -227,7 +225,7 @@ async function backupSpokeProjects(
writeFileSync(
path.join(projectDir, `${projectScene.scene.scene_id}.json`),
JSON.stringify(projectScene, null, 2),
{ encoding: "ascii" }
{ encoding: "utf-8" }
);
const url = new URL(projectScene.scene.model_url);
const fileName = url.pathname.split("/").pop();
Expand Down Expand Up @@ -394,7 +392,7 @@ async function backupAvatars(
writeFileSync(
path.join(avatarDir, `${avatar.avatar_id}.json`),
JSON.stringify(avatar, null, 2),
{ encoding: "ascii" }
{ encoding: "utf-8" }
);
if (avatar.files.base_map) {
const url = new URL(avatar.files.base_map);
Expand Down Expand Up @@ -551,7 +549,7 @@ async function backupRooms(
path.join(hubDir, `${hub.id}.json`),
JSON.stringify(hub, null, 2),
{
encoding: "ascii",
encoding: "utf-8",
}
);

Expand Down Expand Up @@ -607,7 +605,7 @@ async function backupMedia(
path.join(assetsOutputDir, `assets.json`),
JSON.stringify(assets, null, 2),

{ encoding: "ascii" }
{ encoding: "utf-8" }
);
const assetsNum = assets.length;
let count = 0;
Expand Down

0 comments on commit f6c3bb0

Please sign in to comment.