fluxy-bot 0.5.6 → 0.5.7
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/dist-fluxy/fluxy.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
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
|
<title>Fluxy Chat</title>
|
|
7
|
-
<script type="module" crossorigin src="/fluxy/assets/fluxy-
|
|
7
|
+
<script type="module" crossorigin src="/fluxy/assets/fluxy-C55TbNi6.js"></script>
|
|
8
8
|
<link rel="modulepreload" crossorigin href="/fluxy/assets/globals-BeMw745s.js">
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/fluxy/assets/globals-GP9z02As.css">
|
|
10
10
|
</head>
|
package/package.json
CHANGED
|
@@ -79,34 +79,6 @@ function FluxyApp() {
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
// Check push state on mount
|
|
83
|
-
useEffect(() => {
|
|
84
|
-
if (!authenticated) return;
|
|
85
|
-
(async () => {
|
|
86
|
-
if (!('PushManager' in window) || !('serviceWorker' in navigator)) {
|
|
87
|
-
setPushState('unsupported');
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
if (Notification.permission === 'denied') {
|
|
91
|
-
setPushState('denied');
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
try {
|
|
95
|
-
const reg = await navigator.serviceWorker.ready;
|
|
96
|
-
const subscription = await reg.pushManager.getSubscription();
|
|
97
|
-
if (subscription) {
|
|
98
|
-
const res = await fetch(`/api/push/status?endpoint=${encodeURIComponent(subscription.endpoint)}`);
|
|
99
|
-
const data = await res.json();
|
|
100
|
-
setPushState(data.subscribed ? 'subscribed' : 'unsubscribed');
|
|
101
|
-
} else {
|
|
102
|
-
setPushState('unsubscribed');
|
|
103
|
-
}
|
|
104
|
-
} catch {
|
|
105
|
-
setPushState('unsupported');
|
|
106
|
-
}
|
|
107
|
-
})();
|
|
108
|
-
}, [authenticated]);
|
|
109
|
-
|
|
110
82
|
// Install App (PWA)
|
|
111
83
|
const [showIosModal, setShowIosModal] = useState(false);
|
|
112
84
|
const isIos = /iPad|iPhone|iPod/.test(navigator.userAgent);
|
|
@@ -182,6 +154,34 @@ function FluxyApp() {
|
|
|
182
154
|
});
|
|
183
155
|
}, []);
|
|
184
156
|
|
|
157
|
+
// Check push state on mount
|
|
158
|
+
useEffect(() => {
|
|
159
|
+
if (!authenticated) return;
|
|
160
|
+
(async () => {
|
|
161
|
+
if (!('PushManager' in window) || !('serviceWorker' in navigator)) {
|
|
162
|
+
setPushState('unsupported');
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
if (Notification.permission === 'denied') {
|
|
166
|
+
setPushState('denied');
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
try {
|
|
170
|
+
const reg = await navigator.serviceWorker.ready;
|
|
171
|
+
const subscription = await reg.pushManager.getSubscription();
|
|
172
|
+
if (subscription) {
|
|
173
|
+
const res = await fetch(`/api/push/status?endpoint=${encodeURIComponent(subscription.endpoint)}`);
|
|
174
|
+
const data = await res.json();
|
|
175
|
+
setPushState(data.subscribed ? 'subscribed' : 'unsubscribed');
|
|
176
|
+
} else {
|
|
177
|
+
setPushState('unsubscribed');
|
|
178
|
+
}
|
|
179
|
+
} catch {
|
|
180
|
+
setPushState('unsupported');
|
|
181
|
+
}
|
|
182
|
+
})();
|
|
183
|
+
}, [authenticated]);
|
|
184
|
+
|
|
185
185
|
// Connect WebSocket only when authenticated
|
|
186
186
|
useEffect(() => {
|
|
187
187
|
if (!authenticated) return;
|