Skip to content

Commit f7a492a

Browse files
committed
fix: update nodejs to latest
1 parent 72c339b commit f7a492a

File tree

4 files changed

+40
-36
lines changed

4 files changed

+40
-36
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ RUN set -uex; \
1919
mkdir -p /etc/apt/keyrings; \
2020
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key \
2121
| gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg; \
22-
NODE_MAJOR=18; \
22+
NODE_MAJOR=24; \
2323
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" \
2424
> /etc/apt/sources.list.d/nodesource.list; \
2525
apt-get -qy update; \

assets/js/app.js

Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { createClient } from "@supabase/supabase-js";
88
// LiveView is managing this page because we have Phoenix running
99
// We're using LiveView to handle the Realtime client via LiveView Hooks
1010

11-
let Hooks = {};
11+
const Hooks = {};
1212
Hooks.payload = {
1313
initRealtime(
1414
channelName,
@@ -24,8 +24,6 @@ Hooks.payload = {
2424
private_channel
2525
) {
2626
// Instantiate our client with the Realtime server and params to connect with
27-
{
28-
}
2927
const opts = {
3028
realtime: {
3129
params: {
@@ -36,17 +34,20 @@ Hooks.payload = {
3634

3735
this.realtimeSocket = createClient(host, token, opts);
3836

39-
if (bearer != "") {
37+
if (bearer !== "") {
4038
this.realtimeSocket.realtime.setAuth(bearer);
4139
}
4240

43-
private_channel = private_channel == "true";
41+
private_channel = private_channel === "true";
4442

4543
// Join the Channel 'any'
4644
// Channels can be named anything
4745
// All clients on the same Channel will get messages sent to that Channel
4846
this.channel = this.realtimeSocket.channel(channelName, {
49-
config: { broadcast: { self: true, private: private_channel } },
47+
config: {
48+
broadcast: { self: true },
49+
private: private_channel,
50+
},
5051
});
5152

5253
// Hack to confirm Postgres is subscribed
@@ -55,27 +56,27 @@ Hooks.payload = {
5556
if (payload.extension === "postgres_changes" && payload.status === "ok") {
5657
this.pushEventTo("#conn_info", "postgres_subscribed", {});
5758
}
58-
let ts = new Date();
59-
let line = `<tr class="bg-white border-b hover:bg-gray-50">
59+
const ts = new Date();
60+
const line = `<tr class="bg-white border-b hover:bg-gray-50">
6061
<td class="py-4 px-6">SYSTEM</td>
6162
<td class="py-4 px-6">${ts.toISOString()}</td>
6263
<td class="py-4 px-6">${JSON.stringify(payload)}</td>
6364
</tr>`;
64-
let list = document.querySelector("#plist");
65+
const list = document.querySelector("#plist");
6566
list.innerHTML = line + list.innerHTML;
6667
});
6768

6869
// Listen for all (`*`) `broadcast` events
6970
// The event name can by anything
7071
// Match on specific event names to filter for only those types of events and do something with them
7172
this.channel.on("broadcast", { event: "*" }, (payload) => {
72-
let ts = new Date();
73-
let line = `<tr class="bg-white border-b hover:bg-gray-50">
73+
const ts = new Date();
74+
const line = `<tr class="bg-white border-b hover:bg-gray-50">
7475
<td class="py-4 px-6">BROADCAST</td>
7576
<td class="py-4 px-6">${ts.toISOString()}</td>
7677
<td class="py-4 px-6">${JSON.stringify(payload)}</td>
7778
</tr>`;
78-
let list = document.querySelector("#plist");
79+
const list = document.querySelector("#plist");
7980
list.innerHTML = line + list.innerHTML;
8081
});
8182

@@ -85,29 +86,33 @@ Hooks.payload = {
8586

8687
this.channel.on("presence", { event: "*" }, (payload) => {
8788
this.pushEventTo("#conn_info", "presence_subscribed", {});
88-
let ts = new Date();
89-
let line = `<tr class="bg-white border-b hover:bg-gray-50">
89+
const ts = new Date();
90+
const line = `<tr class="bg-white border-b hover:bg-gray-50">
9091
<td class="py-4 px-6">PRESENCE</td>
9192
<td class="py-4 px-6">${ts.toISOString()}</td>
9293
<td class="py-4 px-6">${JSON.stringify(payload)}</td>
9394
</tr>`;
94-
let list = document.querySelector("#plist");
95+
const list = document.querySelector("#plist");
9596
list.innerHTML = line + list.innerHTML;
9697
});
9798
}
9899

99100
// Listen for all (`*`) `postgres_changes` events on tables in the `public` schema
100101
if (enable_db_changes === "true") {
101-
let postgres_changes_opts = { event: "*", schema: schema, table: table };
102+
const postgres_changes_opts = {
103+
event: "*",
104+
schema: schema,
105+
table: table,
106+
};
102107
if (filter !== "") {
103108
postgres_changes_opts.filter = filter;
104109
}
105110
this.channel.on("postgres_changes", postgres_changes_opts, (payload) => {
106-
let ts = performance.now() + performance.timeOrigin;
107-
let iso_ts = new Date();
108-
let payload_ts = Date.parse(payload.commit_timestamp);
109-
let latency = ts - payload_ts;
110-
let line = `<tr class="bg-white border-b hover:bg-gray-50">
111+
const ts = performance.now() + performance.timeOrigin;
112+
const iso_ts = new Date();
113+
const payload_ts = Date.parse(payload.commit_timestamp);
114+
const latency = ts - payload_ts;
115+
const line = `<tr class="bg-white border-b hover:bg-gray-50">
111116
<td class="py-4 px-6">POSTGRES</td>
112117
<td class="py-4 px-6">${iso_ts.toISOString()}</td>
113118
<td class="py-4 px-6">
@@ -117,7 +122,7 @@ Hooks.payload = {
117122
)} ms</div>
118123
</td>
119124
</tr>`;
120-
let list = document.querySelector("#plist");
125+
const list = document.querySelector("#plist");
121126
list.innerHTML = line + list.innerHTML;
122127
});
123128
}
@@ -178,10 +183,9 @@ Hooks.payload = {
178183
// }
179184
if (enable_presence === "true") {
180185
const name = "user_name_" + Math.floor(Math.random() * 100);
181-
this.channel.send({
182-
type: "presence",
183-
event: "TRACK",
184-
payload: { name: name, t: performance.now() },
186+
await this.channel.track({
187+
name: name,
188+
t: performance.now(),
185189
});
186190
}
187191
} else {
@@ -214,7 +218,7 @@ Hooks.payload = {
214218
},
215219

216220
mounted() {
217-
let params = {
221+
const params = {
218222
log_level: localStorage.getItem("log_level"),
219223
token: localStorage.getItem("token"),
220224
host: localStorage.getItem("host"),
@@ -250,9 +254,9 @@ Hooks.payload = {
250254
this.sendRealtime(message.event, message.payload)
251255
);
252256

253-
this.handleEvent("disconnect", ({}) => this.disconnectRealtime());
257+
this.handleEvent("disconnect", () => this.disconnectRealtime());
254258

255-
this.handleEvent("clear_local_storage", ({}) => this.clearLocalStorage());
259+
this.handleEvent("clear_local_storage", () => this.clearLocalStorage());
256260
},
257261
};
258262

@@ -266,18 +270,18 @@ Hooks.latency = {
266270
},
267271
};
268272

269-
let csrfToken = document
273+
const csrfToken = document
270274
.querySelector("meta[name='csrf-token']")
271275
.getAttribute("content");
272276

273-
let liveSocket = new LiveSocket("/live", Socket, {
277+
const liveSocket = new LiveSocket("/live", Socket, {
274278
hooks: Hooks,
275279
params: { _csrf_token: csrfToken },
276280
});
277281

278282
topbar.config({ barColors: { 0: "#29d" }, shadowColor: "rgba(0, 0, 0, .3)" });
279-
window.addEventListener("phx:page-loading-start", (info) => topbar.show());
280-
window.addEventListener("phx:page-loading-stop", (info) => topbar.hide());
283+
window.addEventListener("phx:page-loading-start", () => topbar.show());
284+
window.addEventListener("phx:page-loading-stop", () => topbar.hide());
281285

282286
liveSocket.connect();
283287

assets/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"dependencies": {
3-
"@supabase/supabase-js": "^2.50.0"
3+
"@supabase/supabase-js": "^2.85.0"
44
}
55
}

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ defmodule Realtime.MixProject do
44
def project do
55
[
66
app: :realtime,
7-
version: "2.67.2",
7+
version: "2.67.3",
88
elixir: "~> 1.18",
99
elixirc_paths: elixirc_paths(Mix.env()),
1010
start_permanent: Mix.env() == :prod,

0 commit comments

Comments
 (0)