feat: implement basic info display for anemos
14
.idea/ecoffee.iml
generated
|
@ -42,23 +42,22 @@
|
|||
<orderEntry type="library" scope="PROVIDED" name="addressable (v2.8.7, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="base64 (v0.2.0, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="bcrypt_pbkdf (v1.1.1, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="benchmark (v0.4.0, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="bigdecimal (v3.1.9, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="bindata (v2.5.0, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="bindex (v0.8.1, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="bootsnap (v1.18.4, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="brakeman (v7.0.0, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="builder (v3.3.0, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.5.23, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="capybara (v3.40.0, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="citrus (v3.0.2, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.3.5, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="connection_pool (v2.5.0, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="crass (v1.0.6, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="date (v3.4.1, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="debug (v1.10.0, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="dotenv (v3.1.7, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="drb (v2.2.1, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="ed25519 (v1.3.0, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="erubi (v1.13.1, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="et-orbi (v1.2.11, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="fugit (v1.11.1, mise: 3.3.6) [gem]" level="application" />
|
||||
|
@ -69,7 +68,6 @@
|
|||
<orderEntry type="library" scope="PROVIDED" name="irb (v1.15.1, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="jbuilder (v2.13.0, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="json (v2.10.1, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="kamal (v2.5.3, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="language_server-protocol (v3.17.0.4, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="lint_roller (v1.1.0, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="logger (v1.6.6, mise: 3.3.6) [gem]" level="application" />
|
||||
|
@ -80,16 +78,13 @@
|
|||
<orderEntry type="library" scope="PROVIDED" name="mini_mime (v1.1.5, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.25.4, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="msgpack (v1.8.0, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="nanoid (v2.0.0, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="net-imap (v0.5.6, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="net-pop (v0.1.2, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="net-protocol (v0.2.2, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="net-scp (v4.1.0, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="net-sftp (v4.0.0, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="net-smtp (v0.5.1, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="net-ssh (v7.3.0, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="nio4r (v2.7.4, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.18.3, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="ostruct (v0.6.1, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="parallel (v1.26.3, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="parser (v3.3.7.1, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="pg (v1.5.9, mise: 3.3.6) [gem]" level="application" />
|
||||
|
@ -127,12 +122,13 @@
|
|||
<orderEntry type="library" scope="PROVIDED" name="solid_cable (v3.0.7, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="solid_cache (v1.0.7, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="solid_queue (v1.1.3, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="sshkit (v1.24.0, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="spicy-proton (v2.1.15, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="stimulus-rails (v1.3.4, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="stringio (v3.1.5, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="thor (v1.3.2, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="thruster (v0.1.12, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="timeout (v0.4.3, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="toml-rb (v3.0.1, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="turbo-rails (v2.0.13, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v2.0.6, mise: 3.3.6) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v3.1.4, mise: 3.3.6) [gem]" level="application" />
|
||||
|
|
31
Gemfile
|
@ -1,63 +1,38 @@
|
|||
source "https://rubygems.org"
|
||||
|
||||
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
|
||||
gem "rails", "~> 8.0.1"
|
||||
# The modern asset pipeline for Rails [https://github.com/rails/propshaft]
|
||||
gem "propshaft"
|
||||
# Use postgresql as the database for Active Record
|
||||
gem "pg", "~> 1.1"
|
||||
# Use the Puma web server [https://github.com/puma/puma]
|
||||
gem "puma", ">= 5.0"
|
||||
# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
|
||||
gem "importmap-rails"
|
||||
# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
|
||||
gem "turbo-rails"
|
||||
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
|
||||
gem "stimulus-rails"
|
||||
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
|
||||
gem "jbuilder"
|
||||
gem "toml-rb"
|
||||
gem "nanoid"
|
||||
gem "spicy-proton"
|
||||
|
||||
# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
|
||||
# gem "bcrypt", "~> 3.1.7"
|
||||
|
||||
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
||||
gem "tzinfo-data", platforms: %i[ windows jruby ]
|
||||
|
||||
# Use the database-backed adapters for Rails.cache, Active Job, and Action Cable
|
||||
gem "solid_cache"
|
||||
gem "solid_queue"
|
||||
gem "solid_cable"
|
||||
|
||||
# Reduces boot times through caching; required in config/boot.rb
|
||||
gem "bootsnap", require: false
|
||||
|
||||
# Deploy this application anywhere as a Docker container [https://kamal-deploy.org]
|
||||
gem "kamal", require: false
|
||||
|
||||
# Add HTTP asset caching/compression and X-Sendfile acceleration to Puma [https://github.com/basecamp/thruster/]
|
||||
gem "thruster", require: false
|
||||
|
||||
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
|
||||
# gem "image_processing", "~> 1.2"
|
||||
|
||||
group :development, :test do
|
||||
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
|
||||
gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"
|
||||
|
||||
# Static analysis for security vulnerabilities [https://brakemanscanner.org/]
|
||||
gem "brakeman", require: false
|
||||
|
||||
# Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]
|
||||
gem "rubocop-rails-omakase", require: false
|
||||
end
|
||||
|
||||
group :development do
|
||||
# Use console on exceptions pages [https://github.com/rails/web-console]
|
||||
gem "web-console"
|
||||
end
|
||||
|
||||
group :test do
|
||||
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
|
||||
gem "capybara"
|
||||
gem "selenium-webdriver"
|
||||
end
|
||||
|
|
41
Gemfile.lock
|
@ -76,11 +76,9 @@ GEM
|
|||
public_suffix (>= 2.0.2, < 7.0)
|
||||
ast (2.4.2)
|
||||
base64 (0.2.0)
|
||||
bcrypt_pbkdf (1.1.1)
|
||||
bcrypt_pbkdf (1.1.1-arm64-darwin)
|
||||
bcrypt_pbkdf (1.1.1-x86_64-darwin)
|
||||
benchmark (0.4.0)
|
||||
bigdecimal (3.1.9)
|
||||
bindata (2.5.0)
|
||||
bindex (0.8.1)
|
||||
bootsnap (1.18.4)
|
||||
msgpack (~> 1.2)
|
||||
|
@ -96,6 +94,7 @@ GEM
|
|||
rack-test (>= 0.6.3)
|
||||
regexp_parser (>= 1.5, < 3.0)
|
||||
xpath (~> 3.2)
|
||||
citrus (3.0.2)
|
||||
concurrent-ruby (1.3.5)
|
||||
connection_pool (2.5.0)
|
||||
crass (1.0.6)
|
||||
|
@ -103,9 +102,7 @@ GEM
|
|||
debug (1.10.0)
|
||||
irb (~> 1.10)
|
||||
reline (>= 0.3.8)
|
||||
dotenv (3.1.7)
|
||||
drb (2.2.1)
|
||||
ed25519 (1.3.0)
|
||||
erubi (1.13.1)
|
||||
et-orbi (1.2.11)
|
||||
tzinfo
|
||||
|
@ -129,17 +126,6 @@ GEM
|
|||
actionview (>= 5.0.0)
|
||||
activesupport (>= 5.0.0)
|
||||
json (2.10.1)
|
||||
kamal (2.5.3)
|
||||
activesupport (>= 7.0)
|
||||
base64 (~> 0.2)
|
||||
bcrypt_pbkdf (~> 1.0)
|
||||
concurrent-ruby (~> 1.2)
|
||||
dotenv (~> 3.1)
|
||||
ed25519 (~> 1.2)
|
||||
net-ssh (~> 7.3)
|
||||
sshkit (>= 1.23.0, < 2.0)
|
||||
thor (~> 1.3)
|
||||
zeitwerk (>= 2.6.18, < 3.0)
|
||||
language_server-protocol (3.17.0.4)
|
||||
lint_roller (1.1.0)
|
||||
logger (1.6.6)
|
||||
|
@ -156,6 +142,7 @@ GEM
|
|||
mini_mime (1.1.5)
|
||||
minitest (5.25.4)
|
||||
msgpack (1.8.0)
|
||||
nanoid (2.0.0)
|
||||
net-imap (0.5.6)
|
||||
date
|
||||
net-protocol
|
||||
|
@ -163,13 +150,8 @@ GEM
|
|||
net-protocol
|
||||
net-protocol (0.2.2)
|
||||
timeout
|
||||
net-scp (4.1.0)
|
||||
net-ssh (>= 2.6.5, < 8.0.0)
|
||||
net-sftp (4.0.0)
|
||||
net-ssh (>= 5.0.0, < 8.0.0)
|
||||
net-smtp (0.5.1)
|
||||
net-protocol
|
||||
net-ssh (7.3.0)
|
||||
nio4r (2.7.4)
|
||||
nokogiri (1.18.3-aarch64-linux-gnu)
|
||||
racc (~> 1.4)
|
||||
|
@ -187,7 +169,6 @@ GEM
|
|||
racc (~> 1.4)
|
||||
nokogiri (1.18.3-x86_64-linux-musl)
|
||||
racc (~> 1.4)
|
||||
ostruct (0.6.1)
|
||||
parallel (1.26.3)
|
||||
parser (3.3.7.1)
|
||||
ast (~> 2.4.1)
|
||||
|
@ -306,13 +287,8 @@ GEM
|
|||
fugit (~> 1.11.0)
|
||||
railties (>= 7.1)
|
||||
thor (~> 1.3.1)
|
||||
sshkit (1.24.0)
|
||||
base64
|
||||
logger
|
||||
net-scp (>= 1.1.2)
|
||||
net-sftp (>= 2.1.2)
|
||||
net-ssh (>= 2.8.0)
|
||||
ostruct
|
||||
spicy-proton (2.1.15)
|
||||
bindata (~> 2.3)
|
||||
stimulus-rails (1.3.4)
|
||||
railties (>= 6.0.0)
|
||||
stringio (3.1.5)
|
||||
|
@ -323,6 +299,9 @@ GEM
|
|||
thruster (0.1.12-x86_64-darwin)
|
||||
thruster (0.1.12-x86_64-linux)
|
||||
timeout (0.4.3)
|
||||
toml-rb (3.0.1)
|
||||
citrus (~> 3.0, > 3.0)
|
||||
racc (~> 1.7)
|
||||
turbo-rails (2.0.13)
|
||||
actionpack (>= 7.1.0)
|
||||
railties (>= 7.1.0)
|
||||
|
@ -366,7 +345,7 @@ DEPENDENCIES
|
|||
debug
|
||||
importmap-rails
|
||||
jbuilder
|
||||
kamal
|
||||
nanoid
|
||||
pg (~> 1.1)
|
||||
propshaft
|
||||
puma (>= 5.0)
|
||||
|
@ -376,8 +355,10 @@ DEPENDENCIES
|
|||
solid_cable
|
||||
solid_cache
|
||||
solid_queue
|
||||
spicy-proton
|
||||
stimulus-rails
|
||||
thruster
|
||||
toml-rb
|
||||
turbo-rails
|
||||
tzinfo-data
|
||||
web-console
|
||||
|
|
|
@ -1,10 +1,82 @@
|
|||
/*
|
||||
* This is a manifest file that'll be compiled into application.css.
|
||||
*
|
||||
* With Propshaft, assets are served efficiently without preprocessing steps. You can still include
|
||||
* application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
|
||||
* cascading order, meaning styles declared later in the document or manifest will override earlier ones,
|
||||
* depending on specificity.
|
||||
*
|
||||
* Consider organizing styles into separate files for maintainability.
|
||||
*/
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
margin: 40px;
|
||||
}
|
||||
|
||||
header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 3px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
header h1 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
header .muted {
|
||||
color: #666;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.new-buttons {
|
||||
display: flex;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
.new-button {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.nm-list {
|
||||
|
||||
}
|
||||
|
||||
.nm-list section {
|
||||
margin-bottom: 5px;
|
||||
display: grid;
|
||||
grid-template-columns: .05fr 1fr 1fr .5fr;
|
||||
align-items: center;
|
||||
padding: 0 10px;
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
img {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
h3.nm-info {
|
||||
margin: 0;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.spawn-info {
|
||||
display: inline-block;
|
||||
font-size: 14px;
|
||||
opacity: .6;
|
||||
}
|
||||
|
||||
.badge {
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
border: 1px solid black;
|
||||
vertical-align: middle;
|
||||
padding: 1px 6px;
|
||||
border-radius: 10px;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
small.badge {
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
button.action {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
section .meta {
|
||||
padding-left: 10px;
|
||||
padding-top: 4px;
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
|
|
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
|
@ -0,0 +1,4 @@
|
|||
class PageController < ApplicationController
|
||||
def index
|
||||
end
|
||||
end
|
2
app/helpers/instance_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
module InstanceHelper
|
||||
end
|
2
app/helpers/page_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
module PageHelper
|
||||
end
|
0
app/javascript/save_password.js
Normal file
3
app/models/instance.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
class Instance < ApplicationRecord
|
||||
validates :zone, inclusion: { in: %w[anemos pagos pyros hydatos] }
|
||||
end
|
9
app/views/instance/_zone_img.html.erb
Normal file
|
@ -0,0 +1,9 @@
|
|||
<% if zone == "anemos" %>
|
||||
<img src="/wind.png" width="35" alt=<%= alt %> title=<%= title %> />
|
||||
<% elsif zone == "pagos" %>
|
||||
<img src="/ice.png" width="35" alt=<%= alt %> title=<%= title %> />
|
||||
<% elsif zone == "pyros" %>
|
||||
<img src="/fire.png" width="35" alt=<%= alt %> title=<%= title %> />
|
||||
<% elsif zone == "hydatos" %>
|
||||
<img src="/water.png" width="35" alt=<%= alt %> title=<%= title %> />
|
||||
<% end %>
|
40
app/views/instance/show.html.erb
Normal file
|
@ -0,0 +1,40 @@
|
|||
<header>
|
||||
<img src="/icon.png" width="50" alt="eureka.coffee logo" />
|
||||
<h1><span class="muted">instance</span> <%= @instance.name %></h1>
|
||||
<%= render partial: "zone_img", locals: { zone: @instance.zone, alt: @instance.zone, title: @instance.zone.upcase_first } %>
|
||||
</header>
|
||||
|
||||
<main class="nm-list">
|
||||
<% APP_DATA[@instance.zone.to_sym][:nms].each do |nm| %>
|
||||
<section class="<%= nm[:element] %>">
|
||||
<div>
|
||||
<img src="<%= "/#{nm[:element]}.png" %>" alt="<%= nm[:element] %>" width="30" />
|
||||
</div>
|
||||
<div class="meta">
|
||||
<h3 class="nm-info">
|
||||
<span class="badge">LV<%= nm[:level].to_s.rjust(2, "0") %></span>
|
||||
<%= nm[:name] %>
|
||||
<% if nm[:weather] %>
|
||||
<img src="/<%= nm[:weather] %>.png" title="during <%= nm[:weather] %> only" width="15" />
|
||||
<% end %>
|
||||
</h3>
|
||||
<div class="spawn-info">
|
||||
«
|
||||
<strong><%= nm[:spawned_by][:name] %></strong>
|
||||
<% if nm[:spawned_by][:night_only] %>
|
||||
<span title="only at night">🌙</span>
|
||||
<% end %>
|
||||
<% if nm[:spawned_by][:weather] %>
|
||||
<img src="/<%= nm[:spawned_by][:weather] %>.png" title="during <%= nm[:spawned_by][:weather] %> only" width="15" />
|
||||
<% end %>
|
||||
<small class="badge">LV<%= nm[:spawned_by][:level].to_s.rjust(2, "0") %></small>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div></div>
|
||||
<div>
|
||||
<button class="action">Pop</button>
|
||||
</div>
|
||||
</section>
|
||||
<% end %>
|
||||
</main>
|
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title><%= content_for(:title) || "Ecoffee" %></title>
|
||||
<title><%= content_for(:title) || "eureka.coffee" %></title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
|
@ -14,7 +14,6 @@
|
|||
<%#= tag.link rel: "manifest", href: pwa_manifest_path(format: :json) %>
|
||||
|
||||
<link rel="icon" href="/icon.png" type="image/png">
|
||||
<link rel="icon" href="/icon.svg" type="image/svg+xml">
|
||||
<link rel="apple-touch-icon" href="/icon.png">
|
||||
|
||||
<%# Includes all stylesheet files in app/assets/stylesheets %>
|
||||
|
|
34
app/views/page/index.html.erb
Normal file
|
@ -0,0 +1,34 @@
|
|||
<header>
|
||||
<img src="/icon.png" width="50" alt="eureka.coffee logo" />
|
||||
<h1>eureka.coffee</h1>
|
||||
</header>
|
||||
|
||||
<div class="new-buttons">
|
||||
<%= form_tag "/new?zone=anemos", method: :post do %>
|
||||
<button type="submit" class="new-button">
|
||||
<img src="/wind.png" width="50" alt="Wind" /><br/>
|
||||
Anemos
|
||||
</button>
|
||||
<% end %>
|
||||
|
||||
<%= form_tag "/new?zone=pagos", method: :post do %>
|
||||
<button type="submit" class="new-button">
|
||||
<img src="/ice.png" width="50" alt="Wind" /><br/>
|
||||
Pagos
|
||||
</button>
|
||||
<% end %>
|
||||
|
||||
<%= form_tag "/new?zone=pyros", method: :post do %>
|
||||
<button type="submit" class="new-button">
|
||||
<img src="/fire.png" width="50" alt="Wind" /><br/>
|
||||
Pyros
|
||||
</button>
|
||||
<% end %>
|
||||
|
||||
<%= form_tag "/new?zone=hydatos", method: :post do %>
|
||||
<button type="submit" class="new-button">
|
||||
<img src="/water.png" width="50" alt="Wind" /><br/>
|
||||
Hydatos
|
||||
</button>
|
||||
<% end %>
|
||||
</div>
|
5
config/initializers/data.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
anemos_data = TomlRB.load_file("./data/anemos.toml", symbolize_keys: true)
|
||||
|
||||
APP_DATA = {
|
||||
anemos: anemos_data
|
||||
}
|
|
@ -1,14 +1,12 @@
|
|||
Rails.application.routes.draw do
|
||||
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
|
||||
root "page#index"
|
||||
|
||||
post "/new", to: "instance#create", as: :new_instance
|
||||
get "/:public_id", to: "instance#show", as: :show_instance
|
||||
|
||||
# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
|
||||
# Can be used by load balancers and uptime monitors to verify that the app is live.
|
||||
get "up" => "rails/health#show", as: :rails_health_check
|
||||
|
||||
# Render dynamic PWA files from app/views/pwa/* (remember to link manifest in application.html.erb)
|
||||
# get "manifest" => "rails/pwa#manifest", as: :pwa_manifest
|
||||
# get "service-worker" => "rails/pwa#service_worker", as: :pwa_service_worker
|
||||
|
||||
# Defines the root path route ("/")
|
||||
# root "posts#index"
|
||||
end
|
||||
|
|
232
data/anemos.toml
Normal file
|
@ -0,0 +1,232 @@
|
|||
[[nms]]
|
||||
name = "Sabotender Corrido"
|
||||
level = 1
|
||||
element = "wind"
|
||||
x = 14
|
||||
y = 22
|
||||
|
||||
[nms.spawned_by]
|
||||
name = "Flowering Sabotender"
|
||||
level = 6
|
||||
|
||||
[[nms]]
|
||||
name = "The Lord of Anemos"
|
||||
level = 2
|
||||
element = "water"
|
||||
x = 30
|
||||
y = 27
|
||||
drops = "The Prince of Anemos (minion)"
|
||||
|
||||
[nms.spawned_by]
|
||||
name = "Sea Bishop"
|
||||
level = 7
|
||||
|
||||
[[nms]]
|
||||
name = "Teles"
|
||||
level = 3
|
||||
element = "wind"
|
||||
x = 26
|
||||
y = 28
|
||||
|
||||
[nms.spawned_by]
|
||||
name = "Anemos Harpeia"
|
||||
level = 8
|
||||
|
||||
[[nms]]
|
||||
name = "The Emperor of Anemos"
|
||||
level = 4
|
||||
element = "wind"
|
||||
x = 17
|
||||
y = 22
|
||||
drops = "Emperor Hairpin"
|
||||
|
||||
[nms.spawned_by]
|
||||
name = "Darner"
|
||||
level = 9
|
||||
|
||||
[[nms]]
|
||||
name = "Callisto"
|
||||
level = 5
|
||||
element = "earth"
|
||||
x = 26
|
||||
y = 22
|
||||
|
||||
[nms.spawned_by]
|
||||
name = "Val Bear"
|
||||
level = 10
|
||||
|
||||
[[nms]]
|
||||
name = "Number"
|
||||
level = 6
|
||||
element = "lightning"
|
||||
x = 24
|
||||
y = 23
|
||||
|
||||
[nms.spawned_by]
|
||||
name = "Pneumaflayer"
|
||||
level = 11
|
||||
|
||||
[[nms]]
|
||||
name = "Jahannam"
|
||||
level = 7
|
||||
element = "wind"
|
||||
x = 18
|
||||
y = 19
|
||||
|
||||
[nms.spawned_by]
|
||||
name = "Typhoon Sprite"
|
||||
level = 12
|
||||
weather = "gales"
|
||||
|
||||
[[nms]]
|
||||
name = "Amemet"
|
||||
level = 8
|
||||
element = "fire"
|
||||
x = 15
|
||||
y = 16
|
||||
|
||||
[nms.spawned_by]
|
||||
name = "Abraxas"
|
||||
level = 13
|
||||
|
||||
[[nms]]
|
||||
name = "Caym"
|
||||
level = 9
|
||||
element = "ice"
|
||||
x = 14
|
||||
y = 13
|
||||
|
||||
[nms.spawned_by]
|
||||
name = "Stalker Ziz"
|
||||
level = 14
|
||||
|
||||
[[nms]]
|
||||
name = "Bombadeel"
|
||||
level = 10
|
||||
element = "earth"
|
||||
x = 28
|
||||
y = 20
|
||||
|
||||
[nms.spawned_by]
|
||||
name = "Traveling Gourmand"
|
||||
level = 15
|
||||
night_only = true
|
||||
|
||||
[[nms]]
|
||||
name = "Serket"
|
||||
level = 11
|
||||
element = "earth"
|
||||
x = 25
|
||||
y = 18
|
||||
drops = "Scorpion Harness, Wind-up Mithra"
|
||||
|
||||
[nms.spawned_by]
|
||||
name = "Khor Claw"
|
||||
level = 16
|
||||
|
||||
[[nms]]
|
||||
name = "Judgmental Julika"
|
||||
level = 12
|
||||
element = "ice"
|
||||
x = 22
|
||||
y = 16
|
||||
|
||||
[nms.spawned_by]
|
||||
name = "Henbane"
|
||||
level = 17
|
||||
|
||||
[[nms]]
|
||||
name = "The White Rider"
|
||||
level = 13
|
||||
element = "lightning"
|
||||
x = 20
|
||||
y = 13
|
||||
|
||||
[nms.spawned_by]
|
||||
name = "Duskfall Dullahan"
|
||||
level = 18
|
||||
night_only = true
|
||||
|
||||
[[nms]]
|
||||
name = "Polyphemus"
|
||||
level = 14
|
||||
element = "ice"
|
||||
x = 26
|
||||
y = 14
|
||||
|
||||
[nms.spawned_by]
|
||||
name = "Monoeye"
|
||||
level = 19
|
||||
|
||||
[[nms]]
|
||||
name = "Simurgh's Strider"
|
||||
level = 15
|
||||
element = "wind"
|
||||
x = 29
|
||||
y = 13
|
||||
drops = "Strider Boots"
|
||||
|
||||
[nms.spawned_by]
|
||||
name = "Old World Zu"
|
||||
level = 20
|
||||
|
||||
[[nms]]
|
||||
name = "King Hazmat"
|
||||
level = 16
|
||||
element = "fire"
|
||||
x = 35
|
||||
y = 18
|
||||
|
||||
[nms.spawned_by]
|
||||
name = "Anemos Anala"
|
||||
level = 21
|
||||
|
||||
[[nms]]
|
||||
name = "Fafnir"
|
||||
level = 17
|
||||
element = "fire"
|
||||
x = 36
|
||||
y = 22
|
||||
drops = "Wind-up Fafnir"
|
||||
|
||||
[nms.spawned_by]
|
||||
name = "Fossil Dragon"
|
||||
level = 22
|
||||
night_only = true
|
||||
|
||||
[[nms]]
|
||||
name = "Amarok"
|
||||
level = 18
|
||||
element = "ice"
|
||||
x = 8
|
||||
y = 18
|
||||
|
||||
[nms.spawned_by]
|
||||
name = "Voidscale"
|
||||
level = 23
|
||||
|
||||
[[nms]]
|
||||
name = "Lamashtu"
|
||||
level = 19
|
||||
element = "wind"
|
||||
x = 8
|
||||
y = 23
|
||||
|
||||
[nms.spawned_by]
|
||||
name = "Val Specter"
|
||||
level = 24
|
||||
night_only = true
|
||||
|
||||
[[nms]]
|
||||
name = "Pazuzu"
|
||||
level = 20
|
||||
element = "wind"
|
||||
x = 7
|
||||
y = 22
|
||||
weather = "gales"
|
||||
drops = "Altar to Pazuzu, Pazuzu (card)"
|
||||
|
||||
[nms.spawned_by]
|
||||
name = "Shadow Wraith"
|
||||
night_only = true
|
||||
level = 25
|
12
db/migrate/20250310183139_create_instances.rb
Normal file
|
@ -0,0 +1,12 @@
|
|||
class CreateInstances < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
create_table :instances do |t|
|
||||
t.string :public_id
|
||||
t.string :name
|
||||
t.string :password
|
||||
t.string :zone
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
10
db/migrate/20250310183556_create_pops.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
class CreatePops < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
create_table :pops do |t|
|
||||
t.string :name
|
||||
t.references :instance, null: false, foreign_key: true
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
12
db/migrate/20250310183912_create_fairies.rb
Normal file
|
@ -0,0 +1,12 @@
|
|||
class CreateFairies < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
create_table :fairies do |t|
|
||||
t.integer :location
|
||||
t.boolean :is_despawned
|
||||
t.boolean :is_suggested
|
||||
t.references :instance, null: false, foreign_key: true
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
46
db/schema.rb
generated
Normal file
|
@ -0,0 +1,46 @@
|
|||
# This file is auto-generated from the current state of the database. Instead
|
||||
# of editing this file, please use the migrations feature of Active Record to
|
||||
# incrementally modify your database, and then regenerate this schema definition.
|
||||
#
|
||||
# This file is the source Rails uses to define your schema when running `bin/rails
|
||||
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
|
||||
# be faster and is potentially less error prone than running all of your
|
||||
# migrations from scratch. Old migrations may fail to apply correctly if those
|
||||
# migrations use external dependencies or application code.
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[8.0].define(version: 2025_03_10_183912) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pg_catalog.plpgsql"
|
||||
|
||||
create_table "fairies", force: :cascade do |t|
|
||||
t.integer "location"
|
||||
t.boolean "is_despawned"
|
||||
t.boolean "is_suggested"
|
||||
t.bigint "instance_id", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["instance_id"], name: "index_fairies_on_instance_id"
|
||||
end
|
||||
|
||||
create_table "instances", force: :cascade do |t|
|
||||
t.string "public_id"
|
||||
t.string "name"
|
||||
t.string "password"
|
||||
t.string "zone"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "pops", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.bigint "instance_id", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["instance_id"], name: "index_pops_on_instance_id"
|
||||
end
|
||||
|
||||
add_foreign_key "fairies", "instances"
|
||||
add_foreign_key "pops", "instances"
|
||||
end
|
BIN
public/earth.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
public/fire.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
public/gales.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
public/ice.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
public/icon.png
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 13 KiB |
|
@ -1,3 +0,0 @@
|
|||
<svg width="512" height="512" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="256" cy="256" r="256" fill="red"/>
|
||||
</svg>
|
Before Width: | Height: | Size: 122 B |
BIN
public/lightning.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
public/water.png
Normal file
After Width: | Height: | Size: 2 KiB |
BIN
public/wind.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
13
test/controllers/instance_controller_test.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
require "test_helper"
|
||||
|
||||
class InstanceControllerTest < ActionDispatch::IntegrationTest
|
||||
test "should get create" do
|
||||
get instance_create_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get show" do
|
||||
get instance_show_url
|
||||
assert_response :success
|
||||
end
|
||||
end
|
8
test/controllers/page_controller_test.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
require "test_helper"
|
||||
|
||||
class PageControllerTest < ActionDispatch::IntegrationTest
|
||||
test "should get index" do
|
||||
get page_index_url
|
||||
assert_response :success
|
||||
end
|
||||
end
|
11
test/fixtures/instances.yml
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
# This model initially had no columns defined. If you add columns to the
|
||||
# model remove the "{}" from the fixture names and add the columns immediately
|
||||
# below each fixture, per the syntax in the comments below
|
||||
#
|
||||
one: {}
|
||||
# column: value
|
||||
#
|
||||
two: {}
|
||||
# column: value
|
7
test/models/instance_test.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
require "test_helper"
|
||||
|
||||
class InstanceTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|