profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/kotedo/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Kai Janson kotedo Chattanooga, TN

elixir-chatt/take_five 0

photo booth from scratch

kotedo/testrepo_to_trash 0

nothing special, trying to see if the clone and mirror moves the wiki

kotedo-epbfi/transfertest 0

This is a test

PR opened phoenixframework/phoenix

Add typespecs to Phoenix.Socket.Transport

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.

+65 -23

0 comment

1 changed file

pr created time in 15 hours

created repositorygroxio-learning/tome

Groxio Ecto program

created time in a day

PR opened phoenixframework/phoenix

Update Elixir IRC channel references

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.

+2 -2

0 comment

2 changed files

pr created time in 2 days

Pull request review commentphoenixframework/phoenix

Asset pipeline rewrite

     "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

bcardarella

comment created time in 2 days

Pull request review commentphoenixframework/phoenix

Asset pipeline rewrite

     "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

bcardarella

comment created time in 2 days

Pull request review commentphoenixframework/phoenix

Asset pipeline rewrite

     "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.

bcardarella

comment created time in 2 days

Pull request review commentphoenixframework/phoenix

Asset pipeline rewrite

     "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.

bcardarella

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 :)

mario-132

comment created time in 2 days

created repositorygroxio-learning/otp_p1

OTP course shared repo

created time in 2 days

Pull request review commentphoenixframework/phoenix

Asset pipeline rewrite

     "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.

bcardarella

comment created time in 2 days

Pull request review commentphoenixframework/phoenix

Asset pipeline rewrite

     "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.

bcardarella

comment created time in 2 days

Pull request review commentphoenixframework/phoenix

Asset pipeline rewrite

     "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

bcardarella

comment created time in 2 days

Pull request review commentphoenixframework/phoenix

Asset pipeline rewrite

     "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.

bcardarella

comment created time in 2 days

Pull request review commentphoenixframework/phoenix

Asset pipeline rewrite

     "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.

bcardarella

comment created time in 2 days

Pull request review commentphoenixframework/phoenix

Asset pipeline rewrite

     "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.

bcardarella

comment created time in 2 days

Pull request review commentphoenixframework/phoenix

Asset pipeline rewrite

     "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.

bcardarella

comment created time in 2 days

issue commentlexbor/lexbor

Looking for a css parser and selector.

Hello

@lexborisov what is the status ?

Vincent

mario-132

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)
rylev

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).

acconrad

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?

acconrad

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

delete branch phoenixframework/phoenix

delete branch : jv-ex-latest

delete time in 4 days

pull request commentphoenixframework/phoenix

Require Elixir v1.12 for new apps

:green_heart: :blue_heart: :purple_heart: :yellow_heart: :heart:

josevalim

comment created time in 4 days

push eventphoenixframework/phoenix

José Valim

commit sha c030fb01276b806e62a6b1467c4dc57bd4f60d86

Require Elixir v1.12 for new apps (#4346)

view details

push time in 4 days

push eventphoenixframework/phoenix

José Valim

commit sha 0f67f6c432ff809a75c2b091b0cc77d4df4cdc6e

More fixes

view details

push time in 4 days

push eventphoenixframework/phoenix

José Valim

commit sha 6e6f8ffd1c2a44ae4c670b269cd5351a18fb0482

Fix integration tests

view details

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!!!

josevalim

comment created time in 4 days

push eventphoenixframework/phoenix

José Valim

commit sha f0cc72ca21aa4c48c0f56570cb72a5a76b4cadcf

Update ci.yml

view details

push time in 4 days

Pull request review commentphoenixframework/phoenix

adding version check

 test:     # Run unit tests     RUN mix test +   IF echo $ELIXIR | version ">=1.12" 

yep! The IFs should work like bash ifs

agbell

comment created time in 4 days