fluxy-bot 0.3.10 → 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,14 +3,8 @@
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-BHtLCJ52.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>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluxy-bot",
3
- "version": "0.3.10",
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,18 +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);
229
- } else if (isIos) {
230
- setShowIosModal(true);
227
+ if (isInIframe) {
228
+ // Ask parent window to handle install
229
+ window.parent.postMessage({ type: 'fluxy:install-app' }, '*');
231
230
  } else {
232
- // Fallback: try prompt anyway (some browsers)
231
+ // Direct page show iOS instructions (beforeinstallprompt won't help here)
233
232
  setShowIosModal(true);
234
233
  }
235
234
  }}
@@ -285,45 +284,70 @@ function FluxyApp() {
285
284
  </div>
286
285
  <div className="px-5 pb-6 pt-1">
287
286
  <p className="text-white/50 text-[13px] mb-5 leading-relaxed">
288
- {isIos
289
- ? 'Add Fluxy to your home screen for a full-screen app experience.'
290
- : 'Install Fluxy as an app on your device.'}
287
+ Add Fluxy to your home screen for a full-screen app experience.
291
288
  </p>
292
- <div className="space-y-3.5">
293
- <div className="flex items-start gap-3">
294
- <span className="flex-shrink-0 w-7 h-7 rounded-full bg-[#007AFF]/15 text-[#007AFF] text-[13px] font-semibold flex items-center justify-center mt-0.5">1</span>
295
- <div className="flex-1">
296
- <p className="text-white text-[14px] font-medium">
297
- Tap the Share button
298
- </p>
299
- <p className="text-white/40 text-[12px] mt-0.5 flex items-center gap-1.5">
300
- The <Share className="h-3.5 w-3.5 inline" /> icon at the bottom of Safari
301
- </p>
289
+ {isIos ? (
290
+ <div className="space-y-3.5">
291
+ <div className="flex items-start gap-3">
292
+ <span className="flex-shrink-0 w-7 h-7 rounded-full bg-[#007AFF]/15 text-[#007AFF] text-[13px] font-semibold flex items-center justify-center mt-0.5">1</span>
293
+ <div className="flex-1">
294
+ <p className="text-white text-[14px] font-medium">
295
+ Tap the Share button
296
+ </p>
297
+ <p className="text-white/40 text-[12px] mt-0.5 flex items-center gap-1.5">
298
+ The <Share className="h-3.5 w-3.5 inline" /> icon at the bottom of Safari
299
+ </p>
300
+ </div>
302
301
  </div>
303
- </div>
304
- <div className="flex items-start gap-3">
305
- <span className="flex-shrink-0 w-7 h-7 rounded-full bg-[#007AFF]/15 text-[#007AFF] text-[13px] font-semibold flex items-center justify-center mt-0.5">2</span>
306
- <div className="flex-1">
307
- <p className="text-white text-[14px] font-medium">
308
- Scroll down and tap
309
- </p>
310
- <p className="text-white/40 text-[12px] mt-0.5">
311
- "Add to Home Screen"
312
- </p>
302
+ <div className="flex items-start gap-3">
303
+ <span className="flex-shrink-0 w-7 h-7 rounded-full bg-[#007AFF]/15 text-[#007AFF] text-[13px] font-semibold flex items-center justify-center mt-0.5">2</span>
304
+ <div className="flex-1">
305
+ <p className="text-white text-[14px] font-medium">
306
+ Scroll down and tap
307
+ </p>
308
+ <p className="text-white/40 text-[12px] mt-0.5">
309
+ "Add to Home Screen"
310
+ </p>
311
+ </div>
312
+ </div>
313
+ <div className="flex items-start gap-3">
314
+ <span className="flex-shrink-0 w-7 h-7 rounded-full bg-[#007AFF]/15 text-[#007AFF] text-[13px] font-semibold flex items-center justify-center mt-0.5">3</span>
315
+ <div className="flex-1">
316
+ <p className="text-white text-[14px] font-medium">
317
+ Tap "Add"
318
+ </p>
319
+ <p className="text-white/40 text-[12px] mt-0.5">
320
+ Fluxy will appear on your home screen
321
+ </p>
322
+ </div>
313
323
  </div>
314
324
  </div>
315
- <div className="flex items-start gap-3">
316
- <span className="flex-shrink-0 w-7 h-7 rounded-full bg-[#007AFF]/15 text-[#007AFF] text-[13px] font-semibold flex items-center justify-center mt-0.5">3</span>
317
- <div className="flex-1">
318
- <p className="text-white text-[14px] font-medium">
319
- Tap "Add"
320
- </p>
321
- <p className="text-white/40 text-[12px] mt-0.5">
322
- Fluxy will appear on your home screen
323
- </p>
325
+ ) : (
326
+ <div className="space-y-3.5">
327
+ <div className="flex items-start gap-3">
328
+ <span className="flex-shrink-0 w-7 h-7 rounded-full bg-[#007AFF]/15 text-[#007AFF] text-[13px] font-semibold flex items-center justify-center mt-0.5">1</span>
329
+ <div className="flex-1">
330
+ <p className="text-white text-[14px] font-medium">
331
+ Open browser menu
332
+ </p>
333
+ <p className="text-white/40 text-[12px] mt-0.5">
334
+ Tap the three-dot menu in your browser
335
+ </p>
336
+ </div>
337
+ </div>
338
+ <div className="flex items-start gap-3">
339
+ <span className="flex-shrink-0 w-7 h-7 rounded-full bg-[#007AFF]/15 text-[#007AFF] text-[13px] font-semibold flex items-center justify-center mt-0.5">2</span>
340
+ <div className="flex-1">
341
+ <p className="text-white text-[14px] font-medium">
342
+ Tap "Install app" or "Add to Home screen"
343
+ </p>
344
+ <p className="text-white/40 text-[12px] mt-0.5">
345
+ Fluxy will be installed as a standalone app
346
+ </p>
347
+ </div>
324
348
  </div>
325
349
  </div>
326
- </div>
350
+ )}
327
351
  <button
328
352
  onClick={() => setShowIosModal(false)}
329
353
  className="w-full mt-5 py-2.5 bg-white/[0.06] hover:bg-white/[0.1] text-white text-[14px] font-medium rounded-xl transition-colors"
@@ -3,12 +3,6 @@
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">
@@ -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",
@@ -0,0 +1,4 @@
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', () => {});
@@ -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
- }