aboutsummaryrefslogtreecommitdiff
path: root/shardweb/lib/controllers/directory_controller.ex
diff options
context:
space:
mode:
Diffstat (limited to 'shardweb/lib/controllers/directory_controller.ex')
-rw-r--r--shardweb/lib/controllers/directory_controller.ex29
1 files changed, 29 insertions, 0 deletions
diff --git a/shardweb/lib/controllers/directory_controller.ex b/shardweb/lib/controllers/directory_controller.ex
new file mode 100644
index 0000000..1e3a0b0
--- /dev/null
+++ b/shardweb/lib/controllers/directory_controller.ex
@@ -0,0 +1,29 @@
+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