incognitolm commited on
Commit ·
6e9ada7
1
Parent(s): d04bf99
TOS Banner & Subscription Info
Browse files- public/index.html +10 -8
- public/js/auth.js +1 -0
- server/wsHandler.js +3 -2
public/index.html
CHANGED
|
@@ -106,6 +106,16 @@
|
|
| 106 |
|
| 107 |
<!-- Main chat area -->
|
| 108 |
<main id="main">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
<!-- Welcome / new chat state -->
|
| 110 |
<div id="welcome-view" class="welcome-view">
|
| 111 |
<h1 class="welcome-title">What's on your mind?</h1>
|
|
@@ -216,13 +226,5 @@
|
|
| 216 |
<!-- Turnstile widget handler (shows verification overlay) -->
|
| 217 |
<script type="module" src="/js/turnstile.js"></script>
|
| 218 |
<script type="module" src="/js/app.js"></script>
|
| 219 |
-
<div id="tos-banner">
|
| 220 |
-
<p>
|
| 221 |
-
By interacting with this website, you agree to
|
| 222 |
-
<a href="https://inference.js.org/security.html" style="color: white;">these Terms of Service</a>
|
| 223 |
-
and
|
| 224 |
-
<a href="https://inference.js.org/security.html" style="color: white;">this privacy policy</a>
|
| 225 |
-
</p>
|
| 226 |
-
</div>
|
| 227 |
</body>
|
| 228 |
</html>
|
|
|
|
| 106 |
|
| 107 |
<!-- Main chat area -->
|
| 108 |
<main id="main">
|
| 109 |
+
<!-- Terms of service banner -->
|
| 110 |
+
<div id="tos-banner">
|
| 111 |
+
<p>
|
| 112 |
+
By interacting with this website, you agree to
|
| 113 |
+
<a href="https://inference.js.org/security.html" style="color: white;">these Terms of Service</a>
|
| 114 |
+
and
|
| 115 |
+
<a href="https://inference.js.org/security.html" style="color: white;">this privacy policy</a>
|
| 116 |
+
</p>
|
| 117 |
+
</div>
|
| 118 |
+
|
| 119 |
<!-- Welcome / new chat state -->
|
| 120 |
<div id="welcome-view" class="welcome-view">
|
| 121 |
<h1 class="welcome-title">What's on your mind?</h1>
|
|
|
|
| 226 |
<!-- Turnstile widget handler (shows verification overlay) -->
|
| 227 |
<script type="module" src="/js/turnstile.js"></script>
|
| 228 |
<script type="module" src="/js/app.js"></script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
</body>
|
| 230 |
</html>
|
public/js/auth.js
CHANGED
|
@@ -128,6 +128,7 @@ function applyAuthOk(msg) {
|
|
| 128 |
currentUser = { id: msg.userId, email: msg.email };
|
| 129 |
userProfile = msg.profile;
|
| 130 |
userSettings = msg.settings;
|
|
|
|
| 131 |
const auth = loadAuth() || {};
|
| 132 |
saveAuth({ ...auth, userId: msg.userId, deviceToken: msg.deviceToken });
|
| 133 |
notifyListeners();
|
|
|
|
| 128 |
currentUser = { id: msg.userId, email: msg.email };
|
| 129 |
userProfile = msg.profile;
|
| 130 |
userSettings = msg.settings;
|
| 131 |
+
subscriptionInfo = msg.subscription || null;
|
| 132 |
const auth = loadAuth() || {};
|
| 133 |
saveAuth({ ...auth, userId: msg.userId, deviceToken: msg.deviceToken });
|
| 134 |
notifyListeners();
|
server/wsHandler.js
CHANGED
|
@@ -90,14 +90,15 @@ const handlers = {
|
|
| 90 |
const tId = client.tempId;
|
| 91 |
await sessionStore.transferTempToUser(tId, user.id, accessToken);
|
| 92 |
|
| 93 |
-
const [sessions, settings, profile] = await Promise.all([
|
| 94 |
sessionStore.loadUserSessions(user.id, accessToken),
|
| 95 |
getUserSettings(user.id, accessToken),
|
| 96 |
getUserProfile(user.id, accessToken),
|
|
|
|
| 97 |
]);
|
| 98 |
|
| 99 |
safeSend(ws, { type: 'auth:ok', userId: user.id, email: user.email,
|
| 100 |
-
deviceToken: client.deviceToken, sessions: sessions.map(ser), settings, profile });
|
| 101 |
|
| 102 |
bcast(wsClients, user.id, { type: 'auth:newLogin', message: 'New login on your account.',
|
| 103 |
ip: client.ip, userAgent: client.userAgent, timestamp: new Date().toISOString() }, ws);
|
|
|
|
| 90 |
const tId = client.tempId;
|
| 91 |
await sessionStore.transferTempToUser(tId, user.id, accessToken);
|
| 92 |
|
| 93 |
+
const [sessions, settings, profile, subscription] = await Promise.all([
|
| 94 |
sessionStore.loadUserSessions(user.id, accessToken),
|
| 95 |
getUserSettings(user.id, accessToken),
|
| 96 |
getUserProfile(user.id, accessToken),
|
| 97 |
+
getSubscriptionInfo(accessToken),
|
| 98 |
]);
|
| 99 |
|
| 100 |
safeSend(ws, { type: 'auth:ok', userId: user.id, email: user.email,
|
| 101 |
+
deviceToken: client.deviceToken, sessions: sessions.map(ser), settings, profile, subscription });
|
| 102 |
|
| 103 |
bcast(wsClients, user.id, { type: 'auth:newLogin', message: 'New login on your account.',
|
| 104 |
ip: client.ip, userAgent: client.userAgent, timestamp: new Date().toISOString() }, ws);
|