chore: Remove dead assets
This commit is contained in:
parent
9da9b9409d
commit
a5cdecfabb
40 changed files with 12 additions and 24562 deletions
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"presets": [
|
|
||||||
"@babel/preset-env"
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
/* This file is for your main application css. */
|
|
||||||
@import "./phoenix.css";
|
|
||||||
|
|
||||||
/* Alerts and form errors */
|
|
||||||
.alert {
|
|
||||||
padding: 15px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
border: 1px solid transparent;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.alert-info {
|
|
||||||
color: #31708f;
|
|
||||||
background-color: #d9edf7;
|
|
||||||
border-color: #bce8f1;
|
|
||||||
}
|
|
||||||
.alert-warning {
|
|
||||||
color: #8a6d3b;
|
|
||||||
background-color: #fcf8e3;
|
|
||||||
border-color: #faebcc;
|
|
||||||
}
|
|
||||||
.alert-danger {
|
|
||||||
color: #a94442;
|
|
||||||
background-color: #f2dede;
|
|
||||||
border-color: #ebccd1;
|
|
||||||
}
|
|
||||||
.alert p {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
.alert:empty {
|
|
||||||
display: none;
|
|
||||||
}
|
|
File diff suppressed because one or more lines are too long
|
@ -1,15 +0,0 @@
|
||||||
// We need to import the CSS so that webpack will load it.
|
|
||||||
// The MiniCssExtractPlugin is used to separate it out into
|
|
||||||
// its own CSS file.
|
|
||||||
import "../css/app.css"
|
|
||||||
|
|
||||||
// webpack automatically bundles all modules in your
|
|
||||||
// entry points. Those entry points can be configured
|
|
||||||
// in "webpack.config.js".
|
|
||||||
//
|
|
||||||
// Import deps with the dep name or local files with a relative path, for example:
|
|
||||||
//
|
|
||||||
// import {Socket} from "phoenix"
|
|
||||||
// import socket from "./socket"
|
|
||||||
//
|
|
||||||
import "phoenix_html"
|
|
|
@ -1,63 +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":
|
|
||||||
//
|
|
||||||
// <script>window.userToken = "<%= assigns[:user_token] %>";</script>
|
|
||||||
//
|
|
||||||
// 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
|
|
7929
apps/admin/assets/package-lock.json
generated
7929
apps/admin/assets/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -1,27 +0,0 @@
|
||||||
{
|
|
||||||
"repository": {},
|
|
||||||
"description": " ",
|
|
||||||
"license": "MIT",
|
|
||||||
"scripts": {
|
|
||||||
"deploy": "webpack --mode production",
|
|
||||||
"watch": "webpack --mode development --watch"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"phoenix": "file:../../../deps/phoenix",
|
|
||||||
"phoenix_html": "file:../../../deps/phoenix_html"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@babel/core": "^7.0.0",
|
|
||||||
"@babel/preset-env": "^7.0.0",
|
|
||||||
"babel-loader": "^8.0.0",
|
|
||||||
"copy-webpack-plugin": "^5.1.1",
|
|
||||||
"css-loader": "^3.4.2",
|
|
||||||
"sass-loader": "^8.0.2",
|
|
||||||
"node-sass": "^4.13.1",
|
|
||||||
"mini-css-extract-plugin": "^0.9.0",
|
|
||||||
"optimize-css-assets-webpack-plugin": "^5.0.1",
|
|
||||||
"terser-webpack-plugin": "^2.3.2",
|
|
||||||
"webpack": "4.41.5",
|
|
||||||
"webpack-cli": "^3.3.2"
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 14 KiB |
|
@ -1,5 +0,0 @@
|
||||||
# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
|
|
||||||
#
|
|
||||||
# To ban all spiders from the entire site uncomment the next two lines:
|
|
||||||
# User-agent: *
|
|
||||||
# Disallow: /
|
|
|
@ -1,51 +0,0 @@
|
||||||
const path = require('path');
|
|
||||||
const glob = require('glob');
|
|
||||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
||||||
const TerserPlugin = require('terser-webpack-plugin');
|
|
||||||
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
|
|
||||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
||||||
|
|
||||||
module.exports = (env, options) => {
|
|
||||||
const devMode = options.mode !== 'production';
|
|
||||||
|
|
||||||
return {
|
|
||||||
optimization: {
|
|
||||||
minimizer: [
|
|
||||||
new TerserPlugin({ cache: true, parallel: true, sourceMap: devMode }),
|
|
||||||
new OptimizeCSSAssetsPlugin({})
|
|
||||||
]
|
|
||||||
},
|
|
||||||
entry: {
|
|
||||||
'app': glob.sync('./vendor/**/*.js').concat(['./js/app.js'])
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
filename: '[name].js',
|
|
||||||
path: path.resolve(__dirname, '../priv/static/js'),
|
|
||||||
publicPath: '/js/'
|
|
||||||
},
|
|
||||||
devtool: devMode ? 'source-map' : undefined,
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.js$/,
|
|
||||||
exclude: /node_modules/,
|
|
||||||
use: {
|
|
||||||
loader: 'babel-loader'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.[s]?css$/,
|
|
||||||
use: [
|
|
||||||
MiniCssExtractPlugin.loader,
|
|
||||||
'css-loader',
|
|
||||||
'sass-loader',
|
|
||||||
],
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new MiniCssExtractPlugin({ filename: '../css/app.css' }),
|
|
||||||
new CopyWebpackPlugin([{ from: 'static/', to: '../' }])
|
|
||||||
]
|
|
||||||
}
|
|
||||||
};
|
|
|
@ -64,7 +64,8 @@ defmodule Admin.MixProject do
|
||||||
defp aliases do
|
defp aliases do
|
||||||
[
|
[
|
||||||
setup: ["deps.get", "cmd npm install --prefix assets"],
|
setup: ["deps.get", "cmd npm install --prefix assets"],
|
||||||
test: ["ecto.create --quiet", "ecto.migrate --quiet", "test"]
|
test: ["ecto.create --quiet", "ecto.migrate --quiet", "test"],
|
||||||
|
"npm.install": [],
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -62,7 +62,8 @@ defmodule App.MixProject do
|
||||||
defp aliases do
|
defp aliases do
|
||||||
[
|
[
|
||||||
setup: ["deps.get", "cmd npm install --prefix assets"],
|
setup: ["deps.get", "cmd npm install --prefix assets"],
|
||||||
test: ["ecto.create --quiet", "ecto.migrate --quiet", "test"]
|
test: ["ecto.create --quiet", "ecto.migrate --quiet", "test"],
|
||||||
|
"npm.install": ["cmd npm install --prefix assets"],
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
3
apps/auth/assets/package-lock.json
generated
3
apps/auth/assets/package-lock.json
generated
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"lockfileVersion": 1
|
|
||||||
}
|
|
|
@ -56,7 +56,8 @@ defmodule Auth.MixProject do
|
||||||
setup: ["deps.get", "ecto.setup"],
|
setup: ["deps.get", "ecto.setup"],
|
||||||
"ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
|
"ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
|
||||||
"ecto.reset": ["ecto.drop", "ecto.setup"],
|
"ecto.reset": ["ecto.drop", "ecto.setup"],
|
||||||
test: ["ecto.create --quiet", "ecto.migrate --quiet", "test"]
|
test: ["ecto.create --quiet", "ecto.migrate --quiet", "test"],
|
||||||
|
"npm.install": [],
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"presets": [
|
|
||||||
"@babel/preset-env"
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
/* This file is for your main application css. */
|
|
||||||
@import "./phoenix.css";
|
|
||||||
|
|
||||||
/* Alerts and form errors */
|
|
||||||
.alert {
|
|
||||||
padding: 15px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
border: 1px solid transparent;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.alert-info {
|
|
||||||
color: #31708f;
|
|
||||||
background-color: #d9edf7;
|
|
||||||
border-color: #bce8f1;
|
|
||||||
}
|
|
||||||
.alert-warning {
|
|
||||||
color: #8a6d3b;
|
|
||||||
background-color: #fcf8e3;
|
|
||||||
border-color: #faebcc;
|
|
||||||
}
|
|
||||||
.alert-danger {
|
|
||||||
color: #a94442;
|
|
||||||
background-color: #f2dede;
|
|
||||||
border-color: #ebccd1;
|
|
||||||
}
|
|
||||||
.alert p {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
.alert:empty {
|
|
||||||
display: none;
|
|
||||||
}
|
|
File diff suppressed because one or more lines are too long
|
@ -1,15 +0,0 @@
|
||||||
// We need to import the CSS so that webpack will load it.
|
|
||||||
// The MiniCssExtractPlugin is used to separate it out into
|
|
||||||
// its own CSS file.
|
|
||||||
import "../css/app.css"
|
|
||||||
|
|
||||||
// webpack automatically bundles all modules in your
|
|
||||||
// entry points. Those entry points can be configured
|
|
||||||
// in "webpack.config.js".
|
|
||||||
//
|
|
||||||
// Import deps with the dep name or local files with a relative path, for example:
|
|
||||||
//
|
|
||||||
// import {Socket} from "phoenix"
|
|
||||||
// import socket from "./socket"
|
|
||||||
//
|
|
||||||
import "phoenix_html"
|
|
|
@ -1,63 +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":
|
|
||||||
//
|
|
||||||
// <script>window.userToken = "<%= assigns[:user_token] %>";</script>
|
|
||||||
//
|
|
||||||
// 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
|
|
7931
apps/auth_web/assets/package-lock.json
generated
7931
apps/auth_web/assets/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -1,27 +0,0 @@
|
||||||
{
|
|
||||||
"repository": {},
|
|
||||||
"description": " ",
|
|
||||||
"license": "MIT",
|
|
||||||
"scripts": {
|
|
||||||
"deploy": "webpack --mode production",
|
|
||||||
"watch": "webpack --mode development --watch"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"phoenix": "file:../../../deps/phoenix",
|
|
||||||
"phoenix_html": "file:../../../deps/phoenix_html"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@babel/core": "^7.0.0",
|
|
||||||
"@babel/preset-env": "^7.0.0",
|
|
||||||
"babel-loader": "^8.0.0",
|
|
||||||
"copy-webpack-plugin": "^5.1.1",
|
|
||||||
"css-loader": "^3.4.2",
|
|
||||||
"sass-loader": "^8.0.2",
|
|
||||||
"node-sass": "^4.13.1",
|
|
||||||
"mini-css-extract-plugin": "^0.9.0",
|
|
||||||
"optimize-css-assets-webpack-plugin": "^5.0.1",
|
|
||||||
"terser-webpack-plugin": "^2.3.2",
|
|
||||||
"webpack": "4.41.5",
|
|
||||||
"webpack-cli": "^3.3.2"
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 14 KiB |
|
@ -1,5 +0,0 @@
|
||||||
# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
|
|
||||||
#
|
|
||||||
# To ban all spiders from the entire site uncomment the next two lines:
|
|
||||||
# User-agent: *
|
|
||||||
# Disallow: /
|
|
|
@ -1,51 +0,0 @@
|
||||||
const path = require('path');
|
|
||||||
const glob = require('glob');
|
|
||||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
||||||
const TerserPlugin = require('terser-webpack-plugin');
|
|
||||||
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
|
|
||||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
||||||
|
|
||||||
module.exports = (env, options) => {
|
|
||||||
const devMode = options.mode !== 'production';
|
|
||||||
|
|
||||||
return {
|
|
||||||
optimization: {
|
|
||||||
minimizer: [
|
|
||||||
new TerserPlugin({ cache: true, parallel: true, sourceMap: devMode }),
|
|
||||||
new OptimizeCSSAssetsPlugin({})
|
|
||||||
]
|
|
||||||
},
|
|
||||||
entry: {
|
|
||||||
'app': glob.sync('./vendor/**/*.js').concat(['./js/app.js'])
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
filename: '[name].js',
|
|
||||||
path: path.resolve(__dirname, '../priv/static/js'),
|
|
||||||
publicPath: '/js/'
|
|
||||||
},
|
|
||||||
devtool: devMode ? 'source-map' : undefined,
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.js$/,
|
|
||||||
exclude: /node_modules/,
|
|
||||||
use: {
|
|
||||||
loader: 'babel-loader'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.[s]?css$/,
|
|
||||||
use: [
|
|
||||||
MiniCssExtractPlugin.loader,
|
|
||||||
'css-loader',
|
|
||||||
'sass-loader',
|
|
||||||
],
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new MiniCssExtractPlugin({ filename: '../css/app.css' }),
|
|
||||||
new CopyWebpackPlugin([{ from: 'static/', to: '../' }])
|
|
||||||
]
|
|
||||||
}
|
|
||||||
};
|
|
|
@ -64,6 +64,7 @@ defmodule AuthWeb.MixProject do
|
||||||
setup: ["deps.get", "cmd npm install --prefix assets"],
|
setup: ["deps.get", "cmd npm install --prefix assets"],
|
||||||
test: ["ecto.create --quiet", "ecto.migrate --quiet", "test"],
|
test: ["ecto.create --quiet", "ecto.migrate --quiet", "test"],
|
||||||
"ecto.migrate": [],
|
"ecto.migrate": [],
|
||||||
|
"npm.install": [],
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"presets": [
|
|
||||||
"@babel/preset-env"
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
// We need to import the CSS so that webpack will load it.
|
|
||||||
// The MiniCssExtractPlugin is used to separate it out into
|
|
||||||
// its own CSS file.
|
|
||||||
import "../css/app.css"
|
|
||||||
|
|
||||||
// webpack automatically bundles all modules in your
|
|
||||||
// entry points. Those entry points can be configured
|
|
||||||
// in "webpack.config.js".
|
|
||||||
//
|
|
||||||
// Import deps with the dep name or local files with a relative path, for example:
|
|
||||||
//
|
|
||||||
// import {Socket} from "phoenix"
|
|
||||||
// import socket from "./socket"
|
|
||||||
//
|
|
||||||
import "phoenix_html"
|
|
|
@ -1,63 +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":
|
|
||||||
//
|
|
||||||
// <script>window.userToken = "<%= assigns[:user_token] %>";</script>
|
|
||||||
//
|
|
||||||
// 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
|
|
7931
apps/content/assets/package-lock.json
generated
7931
apps/content/assets/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -1,27 +0,0 @@
|
||||||
{
|
|
||||||
"repository": {},
|
|
||||||
"description": " ",
|
|
||||||
"license": "MIT",
|
|
||||||
"scripts": {
|
|
||||||
"deploy": "webpack --mode production",
|
|
||||||
"watch": "webpack --mode development --watch"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"phoenix": "file:../../../deps/phoenix",
|
|
||||||
"phoenix_html": "file:../../../deps/phoenix_html"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@babel/core": "^7.0.0",
|
|
||||||
"@babel/preset-env": "^7.0.0",
|
|
||||||
"babel-loader": "^8.0.0",
|
|
||||||
"copy-webpack-plugin": "^5.1.1",
|
|
||||||
"css-loader": "^3.4.2",
|
|
||||||
"sass-loader": "^8.0.2",
|
|
||||||
"node-sass": "^4.13.1",
|
|
||||||
"mini-css-extract-plugin": "^0.9.0",
|
|
||||||
"optimize-css-assets-webpack-plugin": "^5.0.1",
|
|
||||||
"terser-webpack-plugin": "^2.3.2",
|
|
||||||
"webpack": "4.41.5",
|
|
||||||
"webpack-cli": "^3.3.2"
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 14 KiB |
|
@ -1,5 +0,0 @@
|
||||||
# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
|
|
||||||
#
|
|
||||||
# To ban all spiders from the entire site uncomment the next two lines:
|
|
||||||
# User-agent: *
|
|
||||||
# Disallow: /
|
|
|
@ -1,51 +0,0 @@
|
||||||
const path = require('path');
|
|
||||||
const glob = require('glob');
|
|
||||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
||||||
const TerserPlugin = require('terser-webpack-plugin');
|
|
||||||
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
|
|
||||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
||||||
|
|
||||||
module.exports = (env, options) => {
|
|
||||||
const devMode = options.mode !== 'production';
|
|
||||||
|
|
||||||
return {
|
|
||||||
optimization: {
|
|
||||||
minimizer: [
|
|
||||||
new TerserPlugin({ cache: true, parallel: true, sourceMap: devMode }),
|
|
||||||
new OptimizeCSSAssetsPlugin({})
|
|
||||||
]
|
|
||||||
},
|
|
||||||
entry: {
|
|
||||||
'app': glob.sync('./vendor/**/*.js').concat(['./js/app.js'])
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
filename: '[name].js',
|
|
||||||
path: path.resolve(__dirname, '../priv/static/js'),
|
|
||||||
publicPath: '/js/'
|
|
||||||
},
|
|
||||||
devtool: devMode ? 'source-map' : undefined,
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.js$/,
|
|
||||||
exclude: /node_modules/,
|
|
||||||
use: {
|
|
||||||
loader: 'babel-loader'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.[s]?css$/,
|
|
||||||
use: [
|
|
||||||
MiniCssExtractPlugin.loader,
|
|
||||||
'css-loader',
|
|
||||||
'sass-loader',
|
|
||||||
],
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new MiniCssExtractPlugin({ filename: '../css/app.css' }),
|
|
||||||
new CopyWebpackPlugin([{ from: 'static/', to: '../' }])
|
|
||||||
]
|
|
||||||
}
|
|
||||||
};
|
|
|
@ -77,7 +77,8 @@ defmodule Content.MixProject do
|
||||||
[
|
[
|
||||||
"ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
|
"ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
|
||||||
"ecto.reset": ["ecto.drop", "ecto.setup"],
|
"ecto.reset": ["ecto.drop", "ecto.setup"],
|
||||||
test: ["ecto.create --quiet", "ecto.migrate", "test"]
|
test: ["ecto.create --quiet", "ecto.migrate", "test"],
|
||||||
|
"npm.install": [],
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -72,7 +72,8 @@ defmodule Core.MixProject do
|
||||||
setup: ["deps.get", "ecto.setup", "cmd npm install --prefix assets"],
|
setup: ["deps.get", "ecto.setup", "cmd npm install --prefix assets"],
|
||||||
"ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
|
"ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
|
||||||
"ecto.reset": ["ecto.drop", "ecto.setup"],
|
"ecto.reset": ["ecto.drop", "ecto.setup"],
|
||||||
test: ["ecto.create --quiet", "ecto.migrate --quiet", "test"]
|
test: ["ecto.create --quiet", "ecto.migrate --quiet", "test"],
|
||||||
|
"npm.install": ["cmd npm install --prefix assets"],
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
2
mix.exs
2
mix.exs
|
@ -22,7 +22,7 @@ defmodule Legendary.Mixfile do
|
||||||
"deps.get": ["cmd mix deps.get"],
|
"deps.get": ["cmd mix deps.get"],
|
||||||
"coveralls.html": ["cmd mix coveralls.html"],
|
"coveralls.html": ["cmd mix coveralls.html"],
|
||||||
"ecto.migrate": ["cmd mix ecto.migrate"],
|
"ecto.migrate": ["cmd mix ecto.migrate"],
|
||||||
"npm.install": ["cmd npm install --prefix assets"],
|
"npm.install": ["cmd mix npm.install"],
|
||||||
test: ["cmd mix test"]
|
test: ["cmd mix test"]
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue