app/main.rb in nephos-server-0.5.4 vs app/main.rb in nephos-server-0.6.1

- old
+ new

@@ -1,11 +1,28 @@ class MainController < Nephos::Controller + before_action :fct_before_all + before_action :fct_before_root, :root + after_action :fct_after_root, :root + + def fct_before_all + # puts "BEFORE ALL" + end + + def fct_before_root + # puts "BEFORE" + end + + def fct_after_root + # puts "AFTER" + end + def root + # puts "ROOT" cookies["a"] = "b" cookies.delete("b").to_h - puts cookies + # puts "Cookies from the root:", cookies { json: { list: $dataset, add: '/add', rm: '/rm', @@ -37,10 +54,10 @@ {html: "<html><body><h1>hello world</h1><p>lol</p></body></html>"} end AUTH_IMG_EXT = %w(.jpg .jpeg .png .gif) def image - dir = File.expand_path('controllers/') + dir = File.expand_path('app/') file = File.expand_path(params["image"], dir) if not file[0..(dir.size-1)] == dir or not AUTH_IMG_EXT.include?(File.extname(file)) return {status: 500, content: "invalid path #{params['image']}"} elsif not File.exists? file return {status: 404, content: "invalid path #{params['image']}"}