@kosmas10/portal 0.0.2 → 0.0.3

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.
Files changed (3) hide show
  1. package/README.md +12 -2
  2. package/package.json +2 -3
  3. package/portal.html +60 -6
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Portal
2
2
 
3
- **Version:** 0.0.1
3
+ **Version:** 0.0.3
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,17 @@ portal-bootstrap.html?loaderVersion=1.0.0&appVersion=0.0.1
132
132
 
133
133
  ## 📝 Version History
134
134
 
135
- ### 0.0.1 (Current)
135
+ ### 0.0.3 (Current)
136
+ - **Improved @latest handling**: Resolves `@latest` to specific version numbers by fetching package.json first
137
+ - Avoids CDN cache issues by using specific version numbers instead of `@latest` tag
138
+ - Fetches version from `package.json` with cache buster to ensure fresh data
139
+ - Version caching to avoid multiple fetches for the same package
140
+ - Falls back to `@latest` if version fetch fails for backward compatibility
141
+
142
+ ### 0.0.2
143
+ - Bug fixes and improvements
144
+
145
+ ### 0.0.1
136
146
  - Initial release
137
147
  - Launcher interface for AI Chat Extensions apps
138
148
  - 3-stage loading architecture
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kosmas10/portal",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
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": [
@@ -10,8 +10,7 @@
10
10
  "LICENSE"
11
11
  ],
12
12
  "scripts": {
13
- "test": "echo \"No tests specified\" && exit 0",
14
- "purge-cdn": "bash purge-cdn.sh"
13
+ "test": "echo \"No tests specified\" && exit 0"
15
14
  },
16
15
  "keywords": [
17
16
  "portal",
package/portal.html CHANGED
@@ -357,16 +357,70 @@
357
357
 
358
358
  <script>
359
359
  // App version - keep in sync with package.json
360
- const APP_VERSION = '0.0.2';
361
- console.log('Portal v' + APP_VERSION + ' loaded');
360
+ const APP_VERSION = '0.0.3';
362
361
 
363
362
  // CDN base URL for loading apps
364
363
  const CDN_BASE = 'https://cdn.jsdelivr.net/npm/@kosmas10/';
365
364
 
366
- function openApp(packageName) {
367
- // Open the application bootstrap from CDN in a new tab/window
368
- const url = CDN_BASE + packageName + '@latest/' + packageName + '-bootstrap.html';
369
- window.open(url, '_blank');
365
+ // Cache for resolved versions to avoid multiple fetches
366
+ const versionCache = {};
367
+
368
+ /**
369
+ * Fetch the latest version from package.json
370
+ * This avoids @latest cache issues by fetching package.json (which updates faster)
371
+ * and then using the specific version number
372
+ */
373
+ async function getLatestVersion(packageName) {
374
+ // Check cache first
375
+ if (versionCache[packageName]) {
376
+ return versionCache[packageName];
377
+ }
378
+
379
+ try {
380
+ const cacheBuster = Date.now();
381
+ const packageJsonUrl = CDN_BASE + packageName + '@latest/package.json?t=' + cacheBuster;
382
+ console.log('Portal: Fetching version for', packageName, 'from:', packageJsonUrl);
383
+
384
+ const response = await fetch(packageJsonUrl);
385
+ if (!response.ok) {
386
+ throw new Error('Failed to fetch package.json: HTTP ' + response.status);
387
+ }
388
+
389
+ const packageData = await response.json();
390
+ if (!packageData.version) {
391
+ throw new Error('package.json does not contain version field');
392
+ }
393
+
394
+ console.log('Portal: Resolved latest version for', packageName, ':', packageData.version);
395
+
396
+ // Cache the version
397
+ versionCache[packageName] = packageData.version;
398
+ return packageData.version;
399
+ } catch (error) {
400
+ console.error('Portal: Error fetching latest version for', packageName, ':', error);
401
+ // Fallback to 'latest' if we can't fetch the version
402
+ console.warn('Portal: Falling back to @latest for', packageName);
403
+ return 'latest';
404
+ }
405
+ }
406
+
407
+ async function openApp(packageName) {
408
+ try {
409
+ // Resolve 'latest' to actual version number
410
+ const resolvedVersion = await getLatestVersion(packageName);
411
+
412
+ // Build URL with specific version (not @latest)
413
+ const url = CDN_BASE + packageName + '@' + resolvedVersion + '/' + packageName + '-bootstrap.html';
414
+ console.log('Portal: Opening app', packageName, 'at version', resolvedVersion);
415
+
416
+ // Open the application bootstrap from CDN in a new tab/window
417
+ window.open(url, '_blank');
418
+ } catch (error) {
419
+ console.error('Portal: Error opening app', packageName, ':', error);
420
+ // Fallback: try with @latest if version resolution fails
421
+ const fallbackUrl = CDN_BASE + packageName + '@latest/' + packageName + '-bootstrap.html';
422
+ window.open(fallbackUrl, '_blank');
423
+ }
370
424
  }
371
425
 
372
426
  // Add some interactive effects