feat: implement basic info display for anemos
This commit is contained in:
parent
06a12df43f
commit
ce5d327ca2
34 changed files with 582 additions and 88 deletions
26
app/controllers/instance_controller.rb
Normal file
26
app/controllers/instance_controller.rb
Normal file
|
@ -0,0 +1,26 @@
|
|||
class InstanceController < ApplicationController
|
||||
def create
|
||||
zone = create_instance_params
|
||||
public_id = Nanoid.generate(size: 6)
|
||||
name = Spicy::Proton.pair(" ")
|
||||
password = Nanoid.generate(size: 3, alphabet: "0123456789")
|
||||
instance = Instance.new(zone: zone, public_id: public_id, name: name, password: password)
|
||||
if instance.save
|
||||
redirect_to(show_instance_path(public_id: public_id))
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@instance = Instance.find_by(public_id: show_instance_params)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def create_instance_params
|
||||
params.expect(:zone)
|
||||
end
|
||||
|
||||
def show_instance_params
|
||||
params.expect(:public_id)
|
||||
end
|
||||
end
|
4
app/controllers/page_controller.rb
Normal file
4
app/controllers/page_controller.rb
Normal file
|
@ -0,0 +1,4 @@
|
|||
class PageController < ApplicationController
|
||||
def index
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue