mirror of
https://github.com/AeThex-Corporation/AeThex-OS.git
synced 2026-04-18 14:27:20 +00:00
Major Features: - Custom .aethex programming language with cross-platform compilation - Compiles to JavaScript, Lua (Roblox), Verse (UEFN), and C# (Unity) - Built-in COPPA compliance and PII detection for safe metaverse development Integration Points: 1. Terminal Integration - Added 'aethex' command for in-terminal compilation - Support for all compilation targets with --target flag - Real-time error reporting and syntax highlighting 2. IDE Integration - Native .aethex file support in Monaco editor - One-click compilation with target selector - Download compiled code functionality - Two example files: hello.aethex and auth.aethex 3. Curriculum Integration - New "AeThex Language" section in Foundry tech tree - Three modules: Realities & Journeys, Cross-Platform Sync, COPPA Compliance - Certification path for students 4. Documentation Site - Complete docs at /docs route (client/src/pages/aethex-docs.tsx) - Searchable documentation with sidebar navigation - Language guide, standard library reference, and examples - Ready for deployment to aethex.dev 5. npm Package Publishing - @aethex.os/core@1.0.0 - Standard library (published) - @aethex.os/cli@1.0.1 - Command line compiler (published) - Both packages live on npm and globally installable Domain Configuration: - DNS setup for 29+ domains (aethex.app, aethex.co, etc.) - nginx reverse proxy configuration - CORS configuration for cross-domain requests - OAuth redirect fixes for hash-based routing Standard Library Features: - Passport: Universal identity across platforms - DataSync: Cross-platform data synchronization - SafeInput: PII detection (phone, email, SSN, credit cards) - Compliance: COPPA/FERPA age gates and audit logging Documentation Package: - Created aethex-dev-docs.zip with complete documentation - Ready for static site deployment - Includes examples, API reference, and quickstart guide Technical Improvements: - Fixed OAuth blank page issue (hash routing) - Added .gitignore rules for temp files - Cleaned up build artifacts and temporary files - Updated all package references to @aethex.os namespace Co-Authored-By: Claude <noreply@anthropic.com>
117 lines
3.3 KiB
TypeScript
117 lines
3.3 KiB
TypeScript
export type PlatformType = 'web' | 'desktop' | 'mobile';
|
|
|
|
declare global {
|
|
interface Window {
|
|
__TAURI__?: unknown;
|
|
flutter_inappwebview?: unknown;
|
|
Capacitor?: unknown;
|
|
}
|
|
}
|
|
|
|
interface PlatformConfig {
|
|
platform: PlatformType;
|
|
apiBaseUrl: string;
|
|
isSecureContext: boolean;
|
|
supportsNotifications: boolean;
|
|
supportsFileSystem: boolean;
|
|
}
|
|
|
|
let cachedPlatform: PlatformType | null = null;
|
|
|
|
export function detectPlatform(): PlatformType {
|
|
// Always re-check unless we've confirmed a native environment
|
|
if (cachedPlatform === 'mobile' || cachedPlatform === 'desktop') {
|
|
return cachedPlatform;
|
|
}
|
|
|
|
if (typeof window === 'undefined') {
|
|
console.log('[Platform] Detected: web (no window)');
|
|
return 'web';
|
|
}
|
|
|
|
// Check for specific native bridges
|
|
if (window.__TAURI__ !== undefined) {
|
|
console.log('[Platform] Detected: desktop (Tauri)');
|
|
cachedPlatform = 'desktop';
|
|
return cachedPlatform;
|
|
}
|
|
|
|
// Capacitor check - sometimes injected late, so don't cache 'web' result immediately
|
|
if (window.Capacitor !== undefined) {
|
|
console.log('[Platform] Detected: mobile (Capacitor)');
|
|
cachedPlatform = 'mobile';
|
|
return cachedPlatform;
|
|
}
|
|
|
|
// Flutter check
|
|
if (window.flutter_inappwebview !== undefined) {
|
|
console.log('[Platform] Detected: mobile (Flutter)');
|
|
cachedPlatform = 'mobile';
|
|
return cachedPlatform;
|
|
}
|
|
|
|
const userAgent = navigator.userAgent.toLowerCase();
|
|
|
|
if (userAgent.includes('electron')) {
|
|
console.log('[Platform] Detected: desktop (Electron)');
|
|
cachedPlatform = 'desktop';
|
|
return cachedPlatform;
|
|
}
|
|
|
|
if (userAgent.includes('cordova')) {
|
|
console.log('[Platform] Detected: mobile (Cordova)');
|
|
cachedPlatform = 'mobile';
|
|
return cachedPlatform;
|
|
}
|
|
|
|
// Fallback: Check for Android/iOS in User Agent if Capacitor isn't ready yet
|
|
if (userAgent.includes('android') || userAgent.includes('iphone') || userAgent.includes('ipad') || userAgent.includes('vortex')) {
|
|
console.log('[Platform] Detected: mobile (UA override)', userAgent);
|
|
// We don't cache this as 'mobile' permanently yet in case it's just a mobile browser,
|
|
// but for this specific hybrid app, treating it as mobile is safer.
|
|
return 'mobile';
|
|
}
|
|
|
|
// Default to web, but do NOT cache it so we can re-check later when Capacitor might be ready
|
|
console.log('[Platform] Detected: web (default check)');
|
|
return 'web';
|
|
}
|
|
|
|
function getApiBaseUrl(): string {
|
|
const platform = detectPlatform();
|
|
|
|
if (platform === 'web') {
|
|
return '';
|
|
}
|
|
|
|
const envUrl = import.meta.env.VITE_API_BASE_URL;
|
|
if (envUrl) return envUrl;
|
|
|
|
return 'https://aethex.network';
|
|
}
|
|
|
|
export function getPlatformConfig(): PlatformConfig {
|
|
const platform = detectPlatform();
|
|
|
|
return {
|
|
platform,
|
|
apiBaseUrl: getApiBaseUrl(),
|
|
isSecureContext: typeof window !== 'undefined' && window.isSecureContext,
|
|
supportsNotifications: typeof Notification !== 'undefined',
|
|
supportsFileSystem: typeof window !== 'undefined' && 'showOpenFilePicker' in window,
|
|
};
|
|
}
|
|
|
|
export function isDesktop(): boolean {
|
|
return detectPlatform() === 'desktop';
|
|
}
|
|
|
|
export function isMobile(): boolean {
|
|
return detectPlatform() === 'mobile';
|
|
}
|
|
|
|
export function isWeb(): boolean {
|
|
return detectPlatform() === 'web';
|
|
}
|
|
|
|
export const platformConfig = getPlatformConfig();
|