photo booth from scratch
nothing special, trying to see if the clone and mirror moves the wiki
This is a test
PR opened phoenixframework/phoenix
I recently wrote a custom transport module to support WebSocket protocol extension, and initially thought that it was not possible to handle the extension via Phoenix.Socket.Transport.
After tracing through Phoenix sockets into cowboy_websocket and a lot of trial and error, I discovered all of the required behavior was actually possible, as Phoenix delegates most of the handling of these callbacks to cowboy. I thought that by documenting more of the valid return values as well as their consequences, I might save someone else the trouble of tracing the code paths.
Please let me know if there are any issues with these changes, or suggested modifications, and I would be happy to make changes.
pr created time in 15 hours
PR opened phoenixframework/phoenix
Spotted this when creating a new project: the initial template still references the old Freenode channel #elixir-lang.
Update this to #elixir on Libera, which is the new official IRC channel.
pr created time in 2 days
Pull request review commentphoenixframework/phoenix
"topbar": "^0.1.4"<% end %> }, "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",- "hard-source-webpack-plugin": "^0.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"+ "copy-webpack-plugin": "^9.0.0",+ "css-loader": "^5.2.6",+ "css-minimizer-webpack-plugin": "^3.0.0",+ "expose-loader": "3.0.0",
works for me
comment created time in 2 days
Pull request review commentphoenixframework/phoenix
"topbar": "^0.1.4"<% end %> }, "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",- "hard-source-webpack-plugin": "^0.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"+ "copy-webpack-plugin": "^9.0.0",+ "css-loader": "^5.2.6",+ "css-minimizer-webpack-plugin": "^3.0.0",+ "expose-loader": "3.0.0",
To be clear, keeping it on the internal webpack config, not the one in the installer template
comment created time in 2 days
Pull request review commentphoenixframework/phoenix
"topbar": "^0.1.4"<% end %> }, "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",- "hard-source-webpack-plugin": "^0.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"+ "copy-webpack-plugin": "^9.0.0",+ "css-loader": "^5.2.6",+ "css-minimizer-webpack-plugin": "^3.0.0",+ "expose-loader": "3.0.0",
It could technically be done without expose-loader but I think it s going to be some crazy rule writing. I would vote to keep the dependency to do this.
comment created time in 2 days
Pull request review commentphoenixframework/phoenix
"topbar": "^0.1.4"<% end %> }, "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",- "hard-source-webpack-plugin": "^0.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"+ "copy-webpack-plugin": "^9.0.0",+ "css-loader": "^5.2.6",+ "css-minimizer-webpack-plugin": "^3.0.0",+ "expose-loader": "3.0.0",
To be clear, the Phoenix constant needs to be on window when the built js is loaded, for folks not using an asset builder and for the live reload project. If we can ditch expose-loader and do this directly then great, but we need to make sure it is exposed from the bundle.
comment created time in 2 days
issue commentlexbor/lexbor
Looking for a css parser and selector.
It seems many members are waiting for this great feature :)
comment created time in 2 days
Pull request review commentphoenixframework/phoenix
"topbar": "^0.1.4"<% end %> }, "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",- "hard-source-webpack-plugin": "^0.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"+ "copy-webpack-plugin": "^9.0.0",
@cw789 I'm working on putting it back right now, the API changed with the version bump so I just have to ensure that it's doing everything we want.
comment created time in 2 days
Pull request review commentphoenixframework/phoenix
"topbar": "^0.1.4"<% end %> }, "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",- "hard-source-webpack-plugin": "^0.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"+ "copy-webpack-plugin": "^9.0.0",
Then it would be necessary to bring it back in.
I'm not aware of any simpler out of the box webpack solution.
One thing I once encountered but haven't evaluated in detail then,
copy-webpack-plugin caused to copy (or touch all copy files) if one of them canged. Means live reload reloads x times (or logged to reload).
But could be, that this was only true fot a certain version of the updated plugin.
comment created time in 2 days
Pull request review commentphoenixframework/phoenix
"topbar": "^0.1.4"<% end %> }, "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",- "hard-source-webpack-plugin": "^0.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"+ "copy-webpack-plugin": "^9.0.0",
We need to support copying assets from assets/static/ to priv/static, so we'lll need copy-webpack unless webpack can do something like this out of the box now. This allows folks to put all assets inside the assets directory, and build them into private/static, which is especially important for our digest task, which will digest the copied/built assets
comment created time in 2 days
Pull request review commentphoenixframework/phoenix
"topbar": "^0.1.4"<% end %> }, "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",- "hard-source-webpack-plugin": "^0.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"+ "copy-webpack-plugin": "^9.0.0",+ "css-loader": "^5.2.6",+ "css-minimizer-webpack-plugin": "^3.0.0",+ "expose-loader": "3.0.0",
I left it in because @chrismccord and I were going back and forth on if the Phoenix constant should be exposed. He fell on the side that it wasn't necessary but I wanted to give the community a chance to provide feedback if for some reason a need for that constant is being overlooked.
comment created time in 2 days
Pull request review commentphoenixframework/phoenix
"topbar": "^0.1.4"<% end %> }, "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",- "hard-source-webpack-plugin": "^0.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"+ "copy-webpack-plugin": "^9.0.0",
moving them over to priv/static might make sense, but it depends upon what experience @chrismccord wants here. If all web assets should be in the assets/ directory then copied over at build time I can bring back the copy rule.
comment created time in 2 days
Pull request review commentphoenixframework/phoenix
"topbar": "^0.1.4"<% end %> }, "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",- "hard-source-webpack-plugin": "^0.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"+ "copy-webpack-plugin": "^9.0.0",+ "css-loader": "^5.2.6",+ "css-minimizer-webpack-plugin": "^3.0.0",+ "expose-loader": "3.0.0",
expose-loader not being used within webpack.config.js.
comment created time in 2 days
Pull request review commentphoenixframework/phoenix
"topbar": "^0.1.4"<% end %> }, "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",- "hard-source-webpack-plugin": "^0.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"+ "copy-webpack-plugin": "^9.0.0",
I do not see copy-webpack-plugin beeing used anymore within webpack.config.js.
Means it could be removed here.
But by removing copy-webpack-plugin I think in installer/lib/phx_new/single.ex copy path of robots.txt, phoenix.png and favicon.ico should be changed from assets/static/ to priv/static/.
With this change /priv/static should get removed in the .gitignore.
comment created time in 2 days
issue commentlexbor/lexbor
Looking for a css parser and selector.
Hello
@lexborisov what is the status ?
Vincent
comment created time in 2 days
issue commentphoenixframework/phoenix
Way to Read Request Body As String
In our use case we need to verify an incoming webhook request by doing SHA256(app secret + raw request body). Since we just dump the webhooks and process them asynchronously, we need a way to store the raw body. Using the suggestions above, here's what we did:
- Add custom body reader:
defmodule MyAppWeb.Plugs.CachingBodyReader do
@moduledoc """
A body reader that caches raw request body for later use.
This module is intended to be used as the `:body_reader` option of `Plug.Parsers`.
Note that caching is only enabled for specific paths. See `enabled_for?/1`.
"""
@raw_body_key :my_app_raw_body
def read_body(%Plug.Conn{} = conn, opts \\ []) do
case Plug.Conn.read_body(conn, opts) do
{:ok, binary, conn} ->
{:ok, binary, maybe_store_body_chunk(conn, binary)}
{:more, binary, conn} ->
{:more, binary, maybe_store_body_chunk(conn, binary)}
{:error, reason} ->
{:error, reason}
end
end
defp enabled_for?(conn) do
case conn.path_info do
["webhooks" | _rest] -> true
_ -> false
end
end
defp maybe_store_body_chunk(conn, chunk) do
if enabled_for?(conn) do
store_body_chunk(conn, chunk)
else
conn
end
end
def store_body_chunk(%Plug.Conn{} = conn, chunk) when is_binary(chunk) do
chunks = conn.private[@raw_body_key] || []
Plug.Conn.put_private(conn, @raw_body_key, [chunk | chunks])
end
def get_raw_body(%Plug.Conn{} = conn) do
case conn.private[@raw_body_key] do
nil -> nil
chunks -> chunks |> Enum.reverse() |> Enum.join("")
end
end
end
- Use it in
Plug.Parsers:
plug Plug.Parsers,
parsers: [:urlencoded, :multipart, :json],
pass: ["*/*"],
json_decoder: Phoenix.json_library(),
body_reader: {MyAppWeb.Plugs.CachingBodyReader, :read_body, []}
- Pull the raw body when needed:
MyAppWeb.Plugs.CachingBodyReader.get_raw_body(conn)
comment created time in 2 days
Pull request review commentphoenixframework/phoenix
Use Webpack v5.x for asset bundling
{ "private": true,+ "engines": {+ "node": ">= 14.16.1"+ }, "scripts": {- "deploy": "webpack --mode production",- "watch": "webpack --mode development --watch"+ "deploy": "webpack --mode=production",+ "watch": "webpack --mode=development --watch"
No. It's fine here without.
mix phx.server does not use this command directly (npm run watch).
comment created time in 2 days
Pull request review commentphoenixframework/phoenix
Use Webpack v5.x for asset bundling
{ "private": true,+ "engines": {+ "node": ">= 14.16.1"+ }, "scripts": {- "deploy": "webpack --mode production",- "watch": "webpack --mode development --watch"+ "deploy": "webpack --mode=production",+ "watch": "webpack --mode=development --watch"
this also needs --watch-options-stdin?
comment created time in 2 days
created repositorypragdave/pdp11-playground
A simple PDP-11 assembler and emulator, designed to help teach the basics of what goes on inside a computer.
created time in 3 days
pull request commentphoenixframework/phoenix
Require Elixir v1.12 for new apps
:green_heart: :blue_heart: :purple_heart: :yellow_heart: :heart:
comment created time in 4 days
push eventphoenixframework/phoenix
commit sha c030fb01276b806e62a6b1467c4dc57bd4f60d86
Require Elixir v1.12 for new apps (#4346)
push time in 4 days
push eventphoenixframework/phoenix
commit sha 0f67f6c432ff809a75c2b091b0cc77d4df4cdc6e
More fixes
push time in 4 days
push eventphoenixframework/phoenix
commit sha 6e6f8ffd1c2a44ae4c670b269cd5351a18fb0482
Fix integration tests
push time in 4 days
Pull request review commentphoenixframework/phoenix
Require Elixir v1.12 for new apps
test: # Run unit tests RUN mix test - # Run installer tests- WORKDIR /src/installer- RUN mix test+ IF [ "$RUN_INSTALLER_TESTS" = "1" ]
It works!!!
comment created time in 4 days
push eventphoenixframework/phoenix
commit sha f0cc72ca21aa4c48c0f56570cb72a5a76b4cadcf
Update ci.yml
push time in 4 days
Pull request review commentphoenixframework/phoenix
test: # Run unit tests RUN mix test + IF echo $ELIXIR | version ">=1.12"
yep! The IFs should work like bash ifs
comment created time in 4 days