Spaces:
Sleeping
Sleeping
Update server.js
Browse files
server.js
CHANGED
|
@@ -13,7 +13,6 @@ const DUMMY_ZIP = 'dummy_lite.zepeto.zip';
|
|
| 13 |
|
| 14 |
if (!fs.existsSync('uploads')) fs.mkdirSync('uploads', { recursive: true });
|
| 15 |
|
| 16 |
-
// 🎯 FUNGSI BARU: Menghapus Blueprint Dummy agar tidak bentrok
|
| 17 |
function cleanDummyBlueprints(dir) {
|
| 18 |
if (!fs.existsSync(dir)) return;
|
| 19 |
const items = fs.readdirSync(dir);
|
|
@@ -43,7 +42,6 @@ function copyLooseFiles(srcDir, destDir, logMsg) {
|
|
| 43 |
copyLooseFiles(srcPath, destPath, logMsg);
|
| 44 |
}
|
| 45 |
} else {
|
| 46 |
-
// 🎯 PERBAIKAN MUTLAK: Kita salin SEMUA file, termasuk .prefab dan .meta milik HighPoly!
|
| 47 |
fs.copyFileSync(srcPath, destPath);
|
| 48 |
}
|
| 49 |
}
|
|
@@ -69,7 +67,7 @@ app.post('/convert', async (req, res) => {
|
|
| 69 |
const logMsg = (msg) => { console.log(msg); logs.push(msg); };
|
| 70 |
|
| 71 |
logMsg(`\n======================================================`);
|
| 72 |
-
logMsg(`[INIT] BOT MENEMBAK! Misi AssetRipper + UABE untuk: ${req.body.filename || 'result.zepeto'}`);
|
| 73 |
|
| 74 |
const timeId = Date.now();
|
| 75 |
const tempHighPoly = path.join(__dirname, 'uploads', `hp_${timeId}.zepeto`);
|
|
@@ -95,25 +93,27 @@ app.post('/convert', async (req, res) => {
|
|
| 95 |
logMsg(`[STEP 3] ASSET-RIPPER: Membongkar Biner...`);
|
| 96 |
const hpAssetBundles = path.join(extractHpPath, 'assetbundles');
|
| 97 |
try {
|
| 98 |
-
|
|
|
|
| 99 |
|
| 100 |
if (!fs.existsSync(ripperExe)) {
|
| 101 |
-
throw new Error(`Mesin
|
| 102 |
}
|
| 103 |
|
|
|
|
| 104 |
execSync(`chmod +x "${ripperExe}"`);
|
| 105 |
-
logMsg(`[ASSET-RIPPER] Mengeksekusi Mesin
|
| 106 |
|
| 107 |
const uploadDir = path.join(__dirname, 'uploads');
|
| 108 |
-
execSync(`"${ripperExe}" "${hpAssetBundles}"`, { cwd: uploadDir });
|
| 109 |
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
logMsg(`
|
|
|
|
| 115 |
} else {
|
| 116 |
-
logMsg(`[ASSET-RIPPER WARN] Folder output
|
| 117 |
}
|
| 118 |
} catch (ripperErr) {
|
| 119 |
logMsg(`[ASSET-RIPPER WARN] ${ripperErr.message}`);
|
|
@@ -122,7 +122,6 @@ app.post('/convert', async (req, res) => {
|
|
| 122 |
}
|
| 123 |
|
| 124 |
logMsg(`[STEP 4] Mengamankan Loose Files & Blueprint...`);
|
| 125 |
-
// 🎯 PERBAIKAN MUTLAK: Bersihkan sisa blueprint Dummy, lalu injeksi blueprint HighPoly
|
| 126 |
cleanDummyBlueprints(extractDummyPath);
|
| 127 |
copyLooseFiles(extractHpPath, extractDummyPath, logMsg);
|
| 128 |
|
|
|
|
| 13 |
|
| 14 |
if (!fs.existsSync('uploads')) fs.mkdirSync('uploads', { recursive: true });
|
| 15 |
|
|
|
|
| 16 |
function cleanDummyBlueprints(dir) {
|
| 17 |
if (!fs.existsSync(dir)) return;
|
| 18 |
const items = fs.readdirSync(dir);
|
|
|
|
| 42 |
copyLooseFiles(srcPath, destPath, logMsg);
|
| 43 |
}
|
| 44 |
} else {
|
|
|
|
| 45 |
fs.copyFileSync(srcPath, destPath);
|
| 46 |
}
|
| 47 |
}
|
|
|
|
| 67 |
const logMsg = (msg) => { console.log(msg); logs.push(msg); };
|
| 68 |
|
| 69 |
logMsg(`\n======================================================`);
|
| 70 |
+
logMsg(`[INIT] BOT MENEMBAK! Misi AssetRipper Console + UABE untuk: ${req.body.filename || 'result.zepeto'}`);
|
| 71 |
|
| 72 |
const timeId = Date.now();
|
| 73 |
const tempHighPoly = path.join(__dirname, 'uploads', `hp_${timeId}.zepeto`);
|
|
|
|
| 93 |
logMsg(`[STEP 3] ASSET-RIPPER: Membongkar Biner...`);
|
| 94 |
const hpAssetBundles = path.join(extractHpPath, 'assetbundles');
|
| 95 |
try {
|
| 96 |
+
// 🎯 PERBAIKAN MUTLAK: Mengunci target ke mesin Console v0.2.1.1 milik Bos!
|
| 97 |
+
const ripperExe = path.join(__dirname, 'AssetRipper', 'AssetRipperConsole');
|
| 98 |
|
| 99 |
if (!fs.existsSync(ripperExe)) {
|
| 100 |
+
throw new Error(`Mesin AssetRipperConsole tidak ditemukan di: ${ripperExe}`);
|
| 101 |
}
|
| 102 |
|
| 103 |
+
// Memberikan izin eksekusi agar tidak Permission Denied
|
| 104 |
execSync(`chmod +x "${ripperExe}"`);
|
| 105 |
+
logMsg(`[ASSET-RIPPER] Mengeksekusi Mesin Console Murni: ${ripperExe}`);
|
| 106 |
|
| 107 |
const uploadDir = path.join(__dirname, 'uploads');
|
|
|
|
| 108 |
|
| 109 |
+
// Karena ini mesin Console murni, kita bisa bebas menggunakan parameter CLI
|
| 110 |
+
execSync(`"${ripperExe}" "${hpAssetBundles}" -o "${rippedHpPath}" -q`, { cwd: uploadDir });
|
| 111 |
+
|
| 112 |
+
if (fs.existsSync(rippedHpPath)) {
|
| 113 |
+
logMsg(`[ASSET-RIPPER] Sukses membongkar biner ke: ${rippedHpPath}`);
|
| 114 |
+
logMsg(`\n=== 📁 LOG DEBUG STRUKTUR BONGKARAN ===\n${getDirectoryTree(rippedHpPath)}============================\n`);
|
| 115 |
} else {
|
| 116 |
+
logMsg(`[ASSET-RIPPER WARN] Mesin tereksekusi, tetapi Folder output tidak terbuat.`);
|
| 117 |
}
|
| 118 |
} catch (ripperErr) {
|
| 119 |
logMsg(`[ASSET-RIPPER WARN] ${ripperErr.message}`);
|
|
|
|
| 122 |
}
|
| 123 |
|
| 124 |
logMsg(`[STEP 4] Mengamankan Loose Files & Blueprint...`);
|
|
|
|
| 125 |
cleanDummyBlueprints(extractDummyPath);
|
| 126 |
copyLooseFiles(extractHpPath, extractDummyPath, logMsg);
|
| 127 |
|