Initial scaffold for Aether Native V3 Electron Launcher
This commit is contained in:
99
dist/main/index.js
vendored
Normal file
99
dist/main/index.js
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
"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 });
|
||||
const electron_1 = require("electron");
|
||||
const path = __importStar(require("path"));
|
||||
const config_loader_1 = require("./config_loader");
|
||||
const api_client_1 = require("./api_client");
|
||||
let mainWindow = null;
|
||||
let cachedSeed = null;
|
||||
let cachedFullConfig = null;
|
||||
async function createWindow() {
|
||||
// 1. Initial Load of Configs
|
||||
cachedSeed = await (0, config_loader_1.loadSeedConfig)();
|
||||
if (cachedSeed) {
|
||||
cachedFullConfig = await (0, api_client_1.fetchFullConfig)(cachedSeed);
|
||||
}
|
||||
mainWindow = new electron_1.BrowserWindow({
|
||||
width: 1400,
|
||||
height: 900,
|
||||
title: 'OSIT Aether Launcher (Native)',
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, '../preload/index.js'),
|
||||
contextIsolation: true,
|
||||
nodeIntegration: false,
|
||||
},
|
||||
});
|
||||
// Prioritize demo.localhost for local development
|
||||
const devUrl = 'http://demo.localhost:5173';
|
||||
// Fallback URL if local is offline
|
||||
const fallbackUrl = 'https://dev-demo.oneskyit.com/';
|
||||
console.log(`Loading UI from: ${devUrl}`);
|
||||
mainWindow.loadURL(devUrl).catch(() => {
|
||||
console.warn(`Failed to load ${devUrl}. Falling back to ${fallbackUrl}`);
|
||||
mainWindow?.loadURL(fallbackUrl);
|
||||
});
|
||||
mainWindow.on('closed', () => {
|
||||
mainWindow = null;
|
||||
});
|
||||
}
|
||||
electron_1.app.on('ready', createWindow);
|
||||
electron_1.app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
electron_1.app.quit();
|
||||
}
|
||||
});
|
||||
electron_1.app.on('activate', () => {
|
||||
if (mainWindow === null) {
|
||||
createWindow();
|
||||
}
|
||||
});
|
||||
// IPC Handlers
|
||||
electron_1.ipcMain.handle('get-seed-config', async () => {
|
||||
return cachedSeed || await (0, config_loader_1.loadSeedConfig)();
|
||||
});
|
||||
electron_1.ipcMain.handle('get-device-config', async () => {
|
||||
if (cachedFullConfig)
|
||||
return cachedFullConfig;
|
||||
if (cachedSeed) {
|
||||
cachedFullConfig = await (0, api_client_1.fetchFullConfig)(cachedSeed);
|
||||
return cachedFullConfig;
|
||||
}
|
||||
return null;
|
||||
});
|
||||
electron_1.ipcMain.handle('get-jwt', async () => {
|
||||
return null;
|
||||
});
|
||||
//# sourceMappingURL=index.js.map
|
||||
Reference in New Issue
Block a user