window.open

This commit is contained in:
2026-05-13 21:12:39 +02:00
parent 757d999b9a
commit f79a98229a
10 changed files with 277 additions and 269 deletions

View File

@@ -2,32 +2,33 @@
module UI
module Windows
module_function
class SystemInfo
def self.open(app, services:)
rows = [
['Online users', services[:online].count.to_s],
['Messages', services[:boards].total_count.to_s],
['Boards', services[:boards].boards.size.to_s],
['Wiki', 'https://wiki.teletypegames.org'],
['Games API', 'https://teletypegames.org'],
['Platform', RUBY_PLATFORM],
['Ruby', RUBY_VERSION],
['Uptime', format_uptime(services[:uptime])],
]
BBS::Windows::Info.open(app,
title: ' System Info ', width: 60, height: 14,
body: [{ kv: rows, label_width: 15 }]
)
end
def system_info(app, services:)
rows = [
['Online users', services[:online].count.to_s],
['Messages', services[:boards].total_count.to_s],
['Boards', services[:boards].boards.size.to_s],
['Wiki', 'https://wiki.teletypegames.org'],
['Games API', 'https://teletypegames.org'],
['Platform', RUBY_PLATFORM],
['Ruby', RUBY_VERSION],
['Uptime', format_uptime(services[:uptime])],
]
BBS::Windows::Info.open(app,
title: ' System Info ', width: 60, height: 14,
body: [{ kv: rows, label_width: 15 }]
)
end
def format_uptime(start)
return '' unless start
seconds = (Time.now - start).to_i
h = seconds / 3600
m = (seconds % 3600) / 60
s = seconds % 60
"#{h}h #{m}m #{s}s"
def self.format_uptime(start)
return '' unless start
seconds = (Time.now - start).to_i
h = seconds / 3600
m = (seconds % 3600) / 60
s = seconds % 60
"#{h}h #{m}m #{s}s"
end
private_class_method :format_uptime
end
end
end