aboutsummaryrefslogblamecommitdiff
path: root/shardweb/lib/controllers/directory_controller.ex
blob: 1e3a0b030aaafff5d8b0581331bac0c754b0b6f1 (plain) (tree)




























                                                                             
defmodule ShardWeb.DirectoryController do
  use ShardWeb, :controller

  def view_pub(conn, %{"owner" => owner, "name" => name}) do
    owner = Base.decode16! owner
    shard = %SApp.Directory.Manifest{public: true, owner: owner, name: name}
    pid = Shard.Manager.find_or_start shard

    render conn, "view.html",
      public: true,
      shard: shard,
      pid: pid,
      owner: owner,
      name: name
  end

  def view_priv(conn, %{"owner" => owner, "name" => name}) do
    owner = Base.decode16! owner
    shard = %SApp.Directory.Manifest{public: false, owner: owner, name: name}
    pid = Shard.Manager.find_or_start shard

    render conn, "view.html",
      public: false,
      shard: shard,
      pid: pid,
      owner: owner,
      name: name
  end
end