@kosmas10/portal 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Portal
2
2
 
3
- **Version:** 0.0.3
3
+ **Version:** 0.0.4
4
4
  **Package:** `@kosmas10/portal`
5
5
 
6
6
  A launcher portal for AI Chat Extensions applications. Provides a unified entry point to access Chat & Verify, Folder LLM Analyzer, and other AI-powered tools.
@@ -132,7 +132,12 @@ portal-bootstrap.html?loaderVersion=1.0.0&appVersion=0.0.1
132
132
 
133
133
  ## 📝 Version History
134
134
 
135
- ### 0.0.3 (Current)
135
+ ### 0.0.4 (Current)
136
+ - Removed all non-error console output to prevent console popups during normal operation
137
+ - Cleaner console output - only shows errors when something goes wrong
138
+ - Bootstrap file updated with cleaner code structure and version resolution
139
+
140
+ ### 0.0.3
136
141
  - **Improved @latest handling**: Resolves `@latest` to specific version numbers by fetching package.json first
137
142
  - Avoids CDN cache issues by using specific version numbers instead of `@latest` tag
138
143
  - Fetches version from `package.json` with cache buster to ensure fresh data
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kosmas10/portal",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "A launcher portal for AI Chat Extensions applications. Provides a unified entry point to access Chat & Verify, Folder LLM Analyzer, and other AI-powered tools. Part of a 3-stage loading architecture for maximum reliability.",
5
5
  "main": "portal.html",
6
6
  "files": [
@@ -20,16 +20,17 @@
20
20
  // STAGE 1 BOOTSTRAP - IMMUTABLE
21
21
  // ============================================================================
22
22
  // This file should NEVER be modified after deployment.
23
- // Always uses @latest to automatically get loader updates.
23
+ // Fetches loader version from package.json to avoid @latest cache issues.
24
24
  // Only change: the app package name (@kosmas10/portal)
25
25
  // ============================================================================
26
26
  (function() {
27
- var script = document.createElement('script');
28
- // Add timestamp to force cache refresh (helps with CDN caching issues)
29
- script.src = 'https://cdn.jsdelivr.net/npm/@kosmas10/html-app-loader@latest/loader.js?app=@kosmas10/portal&_=' + Date.now();
30
- script.onerror = function() {
31
- document.body.innerHTML =
32
- '<!DOCTYPE html>' +
27
+ // Configuration: Only change this for different apps
28
+ var APP_PACKAGE = '@kosmas10/portal';
29
+ var APP_NAME = 'Portal';
30
+
31
+ // Shared error HTML generator
32
+ function createErrorHtml(url) {
33
+ return '<!DOCTYPE html>' +
33
34
  '<html><head><meta charset="UTF-8"><style>' +
34
35
  'body{margin:0;padding:40px;font-family:system-ui,sans-serif;line-height:1.6}' +
35
36
  '.error{max-width:600px;margin:0 auto;padding:30px;background:#fee;border:2px solid #c33;border-radius:8px}' +
@@ -40,7 +41,7 @@
40
41
  '<div class="error">' +
41
42
  '<h1>Failed to Load Application</h1>' +
42
43
  '<p>The application loader could not be loaded from:</p>' +
43
- '<p><code>' + script.src + '</code></p>' +
44
+ '<p><code>' + url + '</code></p>' +
44
45
  '<p><strong>Possible causes:</strong></p>' +
45
46
  '<ul>' +
46
47
  '<li>No internet connection</li>' +
@@ -59,8 +60,47 @@
59
60
  '<li>Contact your IT department if on a corporate network</li>' +
60
61
  '</ul>' +
61
62
  '</div></body></html>';
62
- };
63
- document.head.appendChild(script);
63
+ }
64
+
65
+ // Load script with error handling
66
+ function loadScript(url) {
67
+ var script = document.createElement('script');
68
+ script.src = url + '&_=' + Date.now();
69
+ script.onerror = function() {
70
+ document.body.innerHTML = createErrorHtml(url);
71
+ };
72
+ document.head.appendChild(script);
73
+ }
74
+
75
+ // Fetch loader version from package.json
76
+ async function getLoaderVersion() {
77
+ var cacheBuster = Date.now();
78
+ var packageJsonUrl = 'https://cdn.jsdelivr.net/npm/@kosmas10/html-app-loader@latest/package.json?t=' + cacheBuster;
79
+ var response = await fetch(packageJsonUrl);
80
+ if (!response.ok) {
81
+ throw new Error('Failed to fetch loader package.json: HTTP ' + response.status);
82
+ }
83
+ var packageData = await response.json();
84
+ if (!packageData.version) {
85
+ throw new Error('package.json does not contain version field');
86
+ }
87
+ return packageData.version;
88
+ }
89
+
90
+ // Main loader function
91
+ async function loadLoader() {
92
+ try {
93
+ var loaderVersion = await getLoaderVersion();
94
+ var loaderUrl = 'https://cdn.jsdelivr.net/npm/@kosmas10/html-app-loader@' + loaderVersion + '/loader.js?app=' + APP_PACKAGE;
95
+ loadScript(loaderUrl);
96
+ } catch (error) {
97
+ console.error(APP_NAME + ' Bootstrap: Error fetching loader version:', error);
98
+ var fallbackUrl = 'https://cdn.jsdelivr.net/npm/@kosmas10/html-app-loader@latest/loader.js?app=' + APP_PACKAGE;
99
+ loadScript(fallbackUrl);
100
+ }
101
+ }
102
+
103
+ loadLoader();
64
104
  })();
65
105
  </script>
66
106
  </body>
package/portal.html CHANGED
@@ -357,7 +357,7 @@
357
357
 
358
358
  <script>
359
359
  // App version - keep in sync with package.json
360
- const APP_VERSION = '0.0.3';
360
+ const APP_VERSION = '0.0.4';
361
361
 
362
362
  // CDN base URL for loading apps
363
363
  const CDN_BASE = 'https://cdn.jsdelivr.net/npm/@kosmas10/';
@@ -379,7 +379,6 @@
379
379
  try {
380
380
  const cacheBuster = Date.now();
381
381
  const packageJsonUrl = CDN_BASE + packageName + '@latest/package.json?t=' + cacheBuster;
382
- console.log('Portal: Fetching version for', packageName, 'from:', packageJsonUrl);
383
382
 
384
383
  const response = await fetch(packageJsonUrl);
385
384
  if (!response.ok) {
@@ -391,15 +390,12 @@
391
390
  throw new Error('package.json does not contain version field');
392
391
  }
393
392
 
394
- console.log('Portal: Resolved latest version for', packageName, ':', packageData.version);
395
-
396
393
  // Cache the version
397
394
  versionCache[packageName] = packageData.version;
398
395
  return packageData.version;
399
396
  } catch (error) {
400
397
  console.error('Portal: Error fetching latest version for', packageName, ':', error);
401
398
  // Fallback to 'latest' if we can't fetch the version
402
- console.warn('Portal: Falling back to @latest for', packageName);
403
399
  return 'latest';
404
400
  }
405
401
  }
@@ -411,7 +407,6 @@
411
407
 
412
408
  // Build URL with specific version (not @latest)
413
409
  const url = CDN_BASE + packageName + '@' + resolvedVersion + '/' + packageName + '-bootstrap.html';
414
- console.log('Portal: Opening app', packageName, 'at version', resolvedVersion);
415
410
 
416
411
  // Open the application bootstrap from CDN in a new tab/window
417
412
  window.open(url, '_blank');