aboutsummaryrefslogtreecommitdiff
path: root/shardweb/lib/shard_web/router.ex
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2018-10-12 14:40:21 +0200
committerAlex Auvolat <alex@adnab.me>2018-10-12 14:40:21 +0200
commit1e91dc596fd2f7fdd96b7fd2fc50724f93e46529 (patch)
tree067d56e6fb9e215cc76dea5c9c82e61ef369d90e /shardweb/lib/shard_web/router.ex
parentd15d5fbfc5133a9d0f0d99dbbfc023849f61cc37 (diff)
downloadshard-1e91dc596fd2f7fdd96b7fd2fc50724f93e46529.tar.gz
shard-1e91dc596fd2f7fdd96b7fd2fc50724f93e46529.zip
Move and reorganize some stuff
Diffstat (limited to 'shardweb/lib/shard_web/router.ex')
-rw-r--r--shardweb/lib/shard_web/router.ex53
1 files changed, 0 insertions, 53 deletions
diff --git a/shardweb/lib/shard_web/router.ex b/shardweb/lib/shard_web/router.ex
deleted file mode 100644
index 4311a29..0000000
--- a/shardweb/lib/shard_web/router.ex
+++ /dev/null
@@ -1,53 +0,0 @@
-defmodule ShardWeb.Router do
- use ShardWeb, :router
-
- pipeline :browser do
- plug :accepts, ["html"]
- plug :fetch_session
- plug :fetch_flash
- plug :protect_from_forgery
- plug :put_secure_browser_headers
- plug Plug.Parsers, parsers: [:urlencoded]
- plug :check_pk
- end
-
- pipeline :api do
- plug :accepts, ["json"]
- end
-
- scope "/", ShardWeb do
- pipe_through :browser # Use the default browser stack
-
- get "/", PageController, :index
- post "/peer/add", PageController, :add_peer
-
- get "/identity", IdentityController, :view
- post "/identity", IdentityController, :update
- post "/identity/switch", IdentityController, :switch
- post "/identity/create", IdentityController, :create
-
- get "/room/:room", RoomController, :show
- end
-
- # Other scopes may use custom stacks.
- # scope "/api", ShardWeb do
- # pipe_through :api
- # end
-
- def check_pk(conn, _kv) do
- pk1 = get_session(conn, :pk)
- {conn, pk} = if pk1 == nil || not Shard.Keys.have_sk? pk1 do
- pk = Shard.Keys.get_any_identity
- conn = put_session(conn, :pk, pk)
- {conn, pk}
- else
- {conn, pk1}
- end
- nick = SApp.Identity.get_nick pk
- conn
- |> assign(:pk, pk)
- |> assign(:nick, nick)
- |> PhoenixGon.Controller.put_gon(pk: (pk|>Base.encode16))
- end
-
-end