- Refactored all IPC methods and parameters to snake_case for consistency with SvelteKit. - Implemented exhaustive background caching engine with download locking. - Reverted to legacy-proven flat hash storage pattern (hash.file). - Added axios for reliable stream-based binary downloads. - Updated preload and main handlers to support recursive room data fetching.
71 lines
2.9 KiB
JavaScript
71 lines
2.9 KiB
JavaScript
"use strict";
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
}
|
|
Object.defineProperty(o, k2, desc);
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = (this && this.__importStar) || (function () {
|
|
var ownKeys = function(o) {
|
|
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
var ar = [];
|
|
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
return ar;
|
|
};
|
|
return ownKeys(o);
|
|
};
|
|
return function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
})();
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.registerShellHandlers = registerShellHandlers;
|
|
const electron_1 = require("electron");
|
|
const child_process_1 = require("child_process");
|
|
const fs = __importStar(require("fs"));
|
|
function registerShellHandlers() {
|
|
// Open a local directory in the OS File Manager
|
|
electron_1.ipcMain.handle('native:open-folder', async (event, folderPath) => {
|
|
console.log(`Native: Opening folder ${folderPath}`);
|
|
const error = await electron_1.shell.openPath(folderPath);
|
|
return { success: !error, error };
|
|
});
|
|
// Run a generic shell command (Whitelisted logic can be added here)
|
|
electron_1.ipcMain.handle('native:run-cmd', async (event, command) => {
|
|
console.log(`Native: Running command: ${command}`);
|
|
return new Promise((resolve) => {
|
|
(0, child_process_1.exec)(command, (error, stdout, stderr) => {
|
|
resolve({
|
|
success: !error,
|
|
stdout,
|
|
stderr,
|
|
error: error ? error.message : null
|
|
});
|
|
});
|
|
});
|
|
});
|
|
// Specific handler for launching a presentation file
|
|
electron_1.ipcMain.handle('native:launch-file', async (event, filePath) => {
|
|
console.log(`Native: Launching file: ${filePath}`);
|
|
if (!fs.existsSync(filePath)) {
|
|
return { success: false, error: 'File not found' };
|
|
}
|
|
const error = await electron_1.shell.openPath(filePath);
|
|
return { success: !error, error };
|
|
});
|
|
}
|
|
//# sourceMappingURL=shell_handlers.js.map
|