upgrade for our main bbs server

This commit is contained in:
2026-04-28 22:47:52 +02:00
parent ce005cdb1b
commit d9232eabb4
5 changed files with 31 additions and 5 deletions

View File

@@ -11,6 +11,8 @@ module BBS
confirm: "\e[1;36m",
}.freeze
attr_reader :session_id
def initialize(session, session_id, flow)
@session = session
@session_id = session_id
@@ -22,6 +24,9 @@ module BBS
execute(@flow.steps)
end
def write(data) = @session.write(data)
def readline = @session.readline
private
def execute(steps)
@@ -47,6 +52,7 @@ module BBS
when :confirm_block then run_confirm_block(step)
when :menu then run_menu(step)
when :exit_menu then :exit_menu
when :call then run_call(step)
end
end
@@ -159,12 +165,20 @@ module BBS
nil
end
def run_call(step)
result = step[:block].call(@ctx, self)
result == :halt ? :halt : nil
rescue IOError, Errno::EPIPE, Errno::ECONNRESET
:halt
end
# ── helpers ────────────────────────────────────────────────────────────────
def apply_transform(value, transform)
case transform
when :upcase then value.upcase
when :downcase then value.downcase
when Proc then transform.call(value)
else value
end
end
@@ -183,8 +197,5 @@ module BBS
else "Invalid input. Farewell."
end
end
def write(data) = @session.write(data)
def readline = @session.readline
end
end