sbpanel 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +3 -1
- data/lib/sbpanel/game.rb +11 -3
- data/lib/sbpanel/version.rb +1 -1
- data/views/index.erb +3 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3aac36e2ab77f66b73fff57fd00b676d3d013ed4
|
4
|
+
data.tar.gz: 6621508d9b25c1106f8ff8b0dcaf883d80975fbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c18ae1a12947cfdb8f9870915bb086d541cf326c477007f45341c761fab5acd6a4244470f3e86e0074b0c2946fa4692c33af0f1b87e45963f67e4e106b83615
|
7
|
+
data.tar.gz: 4893fe124652112aac4e8f9f08768400ae66f72ff9c6d3c30c572dbf775b016511726caf62171174fcbda88c64c76596c03d898082919042a15a3d158caccadd
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
# sbpanel 0.0.
|
1
|
+
# sbpanel 0.0.4
|
2
2
|
|
3
3
|
Starbound web status panel! Parses the server debug log to show connected players, active worlds and chat history. Can be observed here: [starbound.mispy.me](http://starbound.mispy.me/)
|
4
4
|
|
5
|
+
Thanks to [@collettiquette](http://twitter.com/collettiquette) for the idea!
|
6
|
+
|
5
7
|
## Installation
|
6
8
|
|
7
9
|
Requires [Ruby 1.9.3+](https://www.ruby-lang.org/en/). Since it relies on [fuser](https://en.wikipedia.org/wiki/Fuser_\(Unix\)) to find the Starbound process, probably UNIX systems only for the moment.
|
data/lib/sbpanel/game.rb
CHANGED
@@ -119,6 +119,7 @@ module SBPanel
|
|
119
119
|
player = @players[name] || {}
|
120
120
|
player[:name] = name
|
121
121
|
player[:last_connect] = time if @timing
|
122
|
+
player[:last_seen] = time if @timing
|
122
123
|
@players[name] = player
|
123
124
|
|
124
125
|
@online_players.push(player) unless @online_players.find { |pl| pl[:name] == name }
|
@@ -129,12 +130,12 @@ module SBPanel
|
|
129
130
|
|
130
131
|
player = @players[name] || {}
|
131
132
|
player[:name] = name
|
132
|
-
player[:
|
133
|
+
player[:last_seen] = time if @timing
|
133
134
|
@players[name] = player
|
134
135
|
|
135
136
|
@online_players.delete_if { |pl| pl[:name] == name }
|
136
137
|
@offline_players.push(player) unless @offline_players.find { |pl| pl[:name] == name }
|
137
|
-
puts "#{name} disconnected at #{player[:
|
138
|
+
puts "#{name} disconnected at #{player[:last_seen]}"
|
138
139
|
when :world
|
139
140
|
coords = event[1]
|
140
141
|
|
@@ -156,11 +157,18 @@ module SBPanel
|
|
156
157
|
@active_worlds.delete_if { |w| w[:coords] == coords }
|
157
158
|
puts "Unloaded world #{coords}"
|
158
159
|
when :chat
|
160
|
+
name = event[1]
|
161
|
+
|
159
162
|
chat = {
|
160
|
-
name:
|
163
|
+
name: name,
|
161
164
|
text: event[2]
|
162
165
|
}
|
163
166
|
|
167
|
+
player = @players[name] || {}
|
168
|
+
player[:name] = name
|
169
|
+
player[:last_seen] = time if @timing
|
170
|
+
@players[name] ||= player
|
171
|
+
|
164
172
|
# Hacky attempt to prevent chat desync
|
165
173
|
if @timing || @last_chat == @chat[-1]
|
166
174
|
@chat.push(chat)
|
data/lib/sbpanel/version.rb
CHANGED
data/views/index.erb
CHANGED
@@ -160,9 +160,9 @@
|
|
160
160
|
<% @offline_players.each do |player| %>
|
161
161
|
<tr>
|
162
162
|
<td><%= player[:name] %></td>
|
163
|
-
<td data-sort-value="<%= -player[:
|
164
|
-
<% if player[:
|
165
|
-
<%= time_ago_in_words(player[:
|
163
|
+
<td data-sort-value="<%= -player[:last_seen].to_i %>">
|
164
|
+
<% if player[:last_seen] %>
|
165
|
+
<%= time_ago_in_words(player[:last_seen]) %> ago
|
166
166
|
<% end %>
|
167
167
|
</td>
|
168
168
|
</tr>
|