feat(source2): push all latest files - device labeling, help system, proxy docs, database isolation fix

- Added DOKUMENTASI-FILTER-PER-SITE.md (site isolation docs)
- Fixed start-with-env.js to force-load .env.production
- Fixed MONGODB_URI hostname from mongodb-netify to mongodb.prod.proit.id
- Updated .gitignore to exclude sensitive scripts and credential files
- Minor UI and labeling improvements
This commit is contained in:
rafif committed 2026-07-29 14:14:29 +07:00
1 parent a403f752f3
commit dd4c8f6876
385 files changed
+31016 -8268

No files matched your search

+64
View File
@@ -0,0 +1,64 @@
const fs = require('fs');
const mongoose = require('mongoose');
async function main() {
const dumpPath = 'C:\\Users\\demo\\.gemini\\antigravity-ide\\scratch\\remote_db_dump.json';
if (!fs.existsSync(dumpPath)) {
console.error('Error: Dump file not found.');
return;
}
const rawData = fs.readFileSync(dumpPath, 'utf8');
const data = JSON.parse(rawData);
const LOCAL_URI = 'mongodb://127.0.0.1:27017/backone_dpi';
console.log('Connecting to local MongoDB...');
await mongoose.connect(LOCAL_URI);
console.log('✓ Connected to local MongoDB.');
const db = mongoose.connection.db;
for (const [colName, info] of Object.entries(data)) {
if (info.docs) {
console.log(`\n--- Loading collection "${colName}" (${info.docs.length} docs) ---`);
// Clear local collection first
await db.collection(colName).deleteMany({});
console.log(`- Cleared local "${colName}"`);
// If we have documents to insert, convert any _id strings to ObjectIds (if appropriate) and insert
if (info.docs.length > 0) {
const cleanedDocs = info.docs.map(doc => {
// MongoDB serialization via JSON converts ObjectId to string/object representation.
// Let's restore _id to ObjectId.
if (doc._id) {
try {
if (typeof doc._id === 'string') {
doc._id = new mongoose.Types.ObjectId(doc._id);
} else if (doc._id.$oid) {
doc._id = new mongoose.Types.ObjectId(doc._id.$oid);
}
} catch (e) {
// fallback to original if not a valid ObjectId format
}
}
// Also restore date fields
for (const key of Object.keys(doc)) {
if (typeof doc[key] === 'string' && doc[key].match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/)) {
doc[key] = new Date(doc[key]);
}
}
return doc;
});
await db.collection(colName).insertMany(cleanedDocs);
console.log(`- Inserted ${cleanedDocs.length} documents into "${colName}"`);
}
}
}
await mongoose.disconnect();
console.log('\n✓ Successfully loaded remote dump into local database!');
}
main().catch(console.error);