fluxy-bot 0.3.11 → 0.3.12

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.
@@ -3,19 +3,12 @@
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0, interactive-widget=resizes-content" />
6
- <meta name="theme-color" content="#212121" />
7
- <meta name="apple-mobile-web-app-capable" content="yes" />
8
- <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
9
- <meta name="apple-mobile-web-app-title" content="Fluxy" />
10
- <link rel="apple-touch-icon" href="/fluxy_frame1.png" />
11
- <link rel="manifest" href="/fluxy/manifest.json" />
12
6
  <title>Fluxy Chat</title>
13
- <script type="module" crossorigin src="/fluxy/assets/fluxy-DLIL3txd.js"></script>
7
+ <script type="module" crossorigin src="/fluxy/assets/fluxy-CJQXNGIn.js"></script>
14
8
  <link rel="modulepreload" crossorigin href="/fluxy/assets/globals-rUljfzoe.js">
15
9
  <link rel="stylesheet" crossorigin href="/fluxy/assets/globals-BfWXHFxc.css">
16
10
  </head>
17
11
  <body class="bg-background text-foreground">
18
12
  <div id="root"></div>
19
- <script>if('serviceWorker' in navigator){navigator.serviceWorker.register('/fluxy/sw.js',{scope:'/fluxy/'})}</script>
20
13
  </body>
21
14
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluxy-bot",
3
- "version": "0.3.11",
3
+ "version": "0.3.12",
4
4
  "description": "Self-hosted AI bot — run your own AI assistant from anywhere",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -22,19 +22,21 @@ function FluxyApp() {
22
22
  const wasConnected = useRef(false);
23
23
 
24
24
  // Install App (PWA)
25
- const [installPrompt, setInstallPrompt] = useState<any>(null);
26
25
  const [showIosModal, setShowIosModal] = useState(false);
27
26
  const isIos = /iPad|iPhone|iPod/.test(navigator.userAgent);
28
27
  const isStandalone = window.matchMedia('(display-mode: standalone)').matches || (navigator as any).standalone;
28
+ const isMobile = /Android|iPhone|iPad|iPod|webOS|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
29
+ const isInIframe = window.self !== window.top;
29
30
 
30
- // Capture the beforeinstallprompt event (Android/Chrome)
31
+ // Listen for install result from parent (when in iframe)
31
32
  useEffect(() => {
32
- const handler = (e: Event) => {
33
- e.preventDefault();
34
- setInstallPrompt(e);
33
+ const handler = (e: MessageEvent) => {
34
+ if (e.data?.type === 'fluxy:show-ios-install') {
35
+ setShowIosModal(true);
36
+ }
35
37
  };
36
- window.addEventListener('beforeinstallprompt', handler);
37
- return () => window.removeEventListener('beforeinstallprompt', handler);
38
+ window.addEventListener('message', handler);
39
+ return () => window.removeEventListener('message', handler);
38
40
  }, []);
39
41
 
40
42
  // Auth state
@@ -218,16 +220,15 @@ function FluxyApp() {
218
220
  <Trash2 className="h-4 w-4" />
219
221
  Clear context
220
222
  </button>
221
- {!isStandalone && (
223
+ {isMobile && !isStandalone && (
222
224
  <button
223
- onClick={async () => {
225
+ onClick={() => {
224
226
  setMenuOpen(false);
225
- if (installPrompt) {
226
- installPrompt.prompt();
227
- const result = await installPrompt.userChoice;
228
- if (result.outcome === 'accepted') setInstallPrompt(null);
227
+ if (isInIframe) {
228
+ // Ask parent window to handle install
229
+ window.parent.postMessage({ type: 'fluxy:install-app' }, '*');
229
230
  } else {
230
- // iOS or browser that doesn't support beforeinstallprompt show instructions
231
+ // Direct page show iOS instructions (beforeinstallprompt won't help here)
231
232
  setShowIosModal(true);
232
233
  }
233
234
  }}
@@ -3,17 +3,10 @@
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0, interactive-widget=resizes-content" />
6
- <meta name="theme-color" content="#212121" />
7
- <meta name="apple-mobile-web-app-capable" content="yes" />
8
- <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
9
- <meta name="apple-mobile-web-app-title" content="Fluxy" />
10
- <link rel="apple-touch-icon" href="/fluxy_frame1.png" />
11
- <link rel="manifest" href="/fluxy/manifest.json" />
12
6
  <title>Fluxy Chat</title>
13
7
  </head>
14
8
  <body class="bg-background text-foreground">
15
9
  <div id="root"></div>
16
10
  <script type="module" src="/fluxy-main.tsx"></script>
17
- <script>if('serviceWorker' in navigator){navigator.serviceWorker.register('/fluxy/sw.js',{scope:'/fluxy/'})}</script>
18
11
  </body>
19
12
  </html>
@@ -73,9 +73,32 @@
73
73
  if (e.key === 'Escape' && isOpen) toggle();
74
74
  });
75
75
 
76
- // Close from iframe (e.g. close button inside chat)
76
+ // ── PWA Install ──
77
+ var deferredInstallPrompt = null;
78
+ window.addEventListener('beforeinstallprompt', function (e) {
79
+ e.preventDefault();
80
+ deferredInstallPrompt = e;
81
+ });
82
+
83
+ // Handle messages from iframe
77
84
  window.addEventListener('message', function (e) {
78
- if (e.data && e.data.type === 'fluxy:close' && isOpen) toggle();
85
+ if (!e.data || !e.data.type) return;
86
+
87
+ // Close chat panel
88
+ if (e.data.type === 'fluxy:close' && isOpen) toggle();
89
+
90
+ // Install App request from chat iframe
91
+ if (e.data.type === 'fluxy:install-app') {
92
+ if (deferredInstallPrompt) {
93
+ deferredInstallPrompt.prompt();
94
+ deferredInstallPrompt.userChoice.then(function (result) {
95
+ if (result.outcome === 'accepted') deferredInstallPrompt = null;
96
+ });
97
+ } else {
98
+ // No native prompt available — tell chat to show instructions modal
99
+ iframe.contentWindow.postMessage({ type: 'fluxy:show-ios-install' }, '*');
100
+ }
101
+ }
79
102
  });
80
103
 
81
104
  // Restore open state after HMR reload (so chat isn't disrupted)
@@ -4,6 +4,11 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0, interactive-widget=resizes-content" />
6
6
  <meta name="theme-color" content="#212121" />
7
+ <meta name="apple-mobile-web-app-capable" content="yes" />
8
+ <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
9
+ <meta name="apple-mobile-web-app-title" content="Fluxy" />
10
+ <link rel="apple-touch-icon" href="/fluxy_frame1.png" />
11
+ <link rel="manifest" href="/manifest.json" />
7
12
  <title>Fluxy</title>
8
13
  </head>
9
14
  <body class="bg-background text-foreground">
@@ -25,7 +30,7 @@
25
30
  });
26
31
  </script>
27
32
  <script type="module" src="/src/main.tsx"></script>
28
- <script>if('serviceWorker' in navigator){navigator.serviceWorker.getRegistrations().then(r=>r.forEach(w=>w.unregister()))}</script>
33
+ <script>if('serviceWorker' in navigator){navigator.serviceWorker.register('/sw.js')}</script>
29
34
  <script src="/fluxy/widget.js"></script>
30
35
  </body>
31
36
  </html>
@@ -2,7 +2,7 @@
2
2
  "name": "Fluxy",
3
3
  "short_name": "Fluxy",
4
4
  "description": "Your AI assistant",
5
- "start_url": "/fluxy/fluxy.html",
5
+ "start_url": "/",
6
6
  "display": "standalone",
7
7
  "background_color": "#212121",
8
8
  "theme_color": "#212121",
@@ -1,21 +0,0 @@
1
- {
2
- "name": "Fluxy",
3
- "short_name": "Fluxy",
4
- "description": "Your AI assistant",
5
- "start_url": "/fluxy/fluxy.html",
6
- "display": "standalone",
7
- "background_color": "#212121",
8
- "theme_color": "#212121",
9
- "icons": [
10
- {
11
- "src": "/fluxy_frame1.png",
12
- "sizes": "192x192",
13
- "type": "image/png"
14
- },
15
- {
16
- "src": "/fluxy_frame1.png",
17
- "sizes": "512x512",
18
- "type": "image/png"
19
- }
20
- ]
21
- }
@@ -1,4 +0,0 @@
1
- // Minimal service worker — required for PWA installability
2
- self.addEventListener('install', () => self.skipWaiting());
3
- self.addEventListener('activate', (e) => e.waitUntil(self.clients.claim()));
4
- self.addEventListener('fetch', () => {});
File without changes