From 357a1239eeabdce627114430030154de3a668056 Mon Sep 17 00:00:00 2001 From: Christian Maddox Date: Thu, 15 Aug 2024 14:18:48 -0400 Subject: [PATCH] Remove unused dependencies. (#2133) --- assets/package-lock.json | 17 ---------- assets/package.json | 2 -- assets/src/socket.js | 68 ---------------------------------------- 3 files changed, 87 deletions(-) delete mode 100644 assets/src/socket.js diff --git a/assets/package-lock.json b/assets/package-lock.json index caac55da6..ca5d78b01 100644 --- a/assets/package-lock.json +++ b/assets/package-lock.json @@ -12,8 +12,6 @@ "lodash": "^4.17.21", "moment": "^2.30.1", "moment-timezone": "^0.5.45", - "phoenix": "file:../deps/phoenix", - "phoenix_html": "file:../deps/phoenix_html", "qrcode.react": "^1.0.1", "raven-js": "^3.27.2", "react": "^17.0.2", @@ -76,13 +74,6 @@ "whatwg-fetch": "^3.6.2" } }, - "../deps/phoenix": { - "version": "1.7.14", - "license": "MIT" - }, - "../deps/phoenix_html": { - "version": "4.1.0" - }, "node_modules/@ampproject/remapping": { "version": "2.2.0", "dev": true, @@ -12206,14 +12197,6 @@ "node": ">=0.12" } }, - "node_modules/phoenix": { - "resolved": "../deps/phoenix", - "link": true - }, - "node_modules/phoenix_html": { - "resolved": "../deps/phoenix_html", - "link": true - }, "node_modules/picocolors": { "version": "1.0.0", "dev": true, diff --git a/assets/package.json b/assets/package.json index c6f3ef5eb..71949ecec 100644 --- a/assets/package.json +++ b/assets/package.json @@ -24,8 +24,6 @@ "lodash": "^4.17.21", "moment": "^2.30.1", "moment-timezone": "^0.5.45", - "phoenix": "file:../deps/phoenix", - "phoenix_html": "file:../deps/phoenix_html", "qrcode.react": "^1.0.1", "raven-js": "^3.27.2", "react": "^17.0.2", diff --git a/assets/src/socket.js b/assets/src/socket.js deleted file mode 100644 index 2738a7782..000000000 --- a/assets/src/socket.js +++ /dev/null @@ -1,68 +0,0 @@ -// NOTE: The contents of this file will only be executed if -// you uncomment its entry in "assets/js/app.js". - -// To use Phoenix channels, the first step is to import Socket, -// and connect at the socket path in "lib/web/endpoint.ex". -// -// Pass the token on params as below. Or remove it -// from the params if you are not using authentication. -import { Socket } from "phoenix"; - -let socket = new Socket("/socket", { params: { token: window.userToken } }); - -// When you connect, you'll often need to authenticate the client. -// For example, imagine you have an authentication plug, `MyAuth`, -// which authenticates the session and assigns a `:current_user`. -// If the current user exists you can assign the user's token in -// the connection for use in the layout. -// -// In your "lib/web/router.ex": -// -// pipeline :browser do -// ... -// plug MyAuth -// plug :put_user_token -// end -// -// defp put_user_token(conn, _) do -// if current_user = conn.assigns[:current_user] do -// token = Phoenix.Token.sign(conn, "user socket", current_user.id) -// assign(conn, :user_token, token) -// else -// conn -// end -// end -// -// Now you need to pass this token to JavaScript. You can do so -// inside a script tag in "lib/web/templates/layout/app.html.eex": -// -// -// -// You will need to verify the user token in the "connect/3" function -// in "lib/web/channels/user_socket.ex": -// -// def connect(%{"token" => token}, socket, _connect_info) do -// # max_age: 1209600 is equivalent to two weeks in seconds -// case Phoenix.Token.verify(socket, "user socket", token, max_age: 1209600) do -// {:ok, user_id} -> -// {:ok, assign(socket, :user, user_id)} -// {:error, reason} -> -// :error -// end -// end -// -// Finally, connect to the socket: -socket.connect(); - -// Now that you are connected, you can join channels with a topic: -let channel = socket.channel("topic:subtopic", {}); -channel - .join() - .receive("ok", (resp) => { - console.log("Joined successfully", resp); - }) - .receive("error", (resp) => { - console.log("Unable to join", resp); - }); - -export default socket;