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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b022058e1c5258ef560dbeb9aa1bbb5a1c354c19
4
- data.tar.gz: 27f279efc621f9eadf37088f8f732e20adee1f01
3
+ metadata.gz: 3aac36e2ab77f66b73fff57fd00b676d3d013ed4
4
+ data.tar.gz: 6621508d9b25c1106f8ff8b0dcaf883d80975fbe
5
5
  SHA512:
6
- metadata.gz: 845307f847c6bae89fc804c3c7a9d5e500fc98166c510e04a8985390f4da1d8b864b65483b599485ab7910e59104f1b0b73586e310a94850227342a1d6f26de4
7
- data.tar.gz: 4b14d7c772df25c90db6a8ceeab9fe71cd6069e1313ffa9f39f61751064c2db5ee1ff78151dca4a1eae74debe578733773004f0f5d3ffd2cf9ed186a832aff1f
6
+ metadata.gz: 7c18ae1a12947cfdb8f9870915bb086d541cf326c477007f45341c761fab5acd6a4244470f3e86e0074b0c2946fa4692c33af0f1b87e45963f67e4e106b83615
7
+ data.tar.gz: 4893fe124652112aac4e8f9f08768400ae66f72ff9c6d3c30c572dbf775b016511726caf62171174fcbda88c64c76596c03d898082919042a15a3d158caccadd
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sbpanel (0.0.2)
4
+ sbpanel (0.0.3)
5
5
  actionpack
6
6
  file-tail
7
7
  sinatra
data/README.md CHANGED
@@ -1,7 +1,9 @@
1
- # sbpanel 0.0.3
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[:last_disconnect] = time if @timing
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[:last_disconnect]}"
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: event[1],
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)
@@ -1,3 +1,3 @@
1
1
  module SBPanel
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
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[:last_disconnect].to_i %>">
164
- <% if player[:last_disconnect] %>
165
- <%= time_ago_in_words(player[:last_disconnect]) %> ago
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>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sbpanel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaiden Mispy