fix error

This commit is contained in:
rulingcom 2023-07-01 10:39:15 +08:00
parent c65d0a9ef0
commit 08c2990a53
1 changed files with 2 additions and 2 deletions

View File

@ -2,14 +2,14 @@ class Admin::BoxController < OrbitAdminController
include ReverseProxy::Controller include ReverseProxy::Controller
SocketFile = "#{Rails.root}/tmp/box.sock" SocketFile = "#{Rails.root}/tmp/box.sock"
Binary = File.expand_path("../../../../bin/box", __FILE__) Binary = File.expand_path("../../../../bin/box", __FILE__)
CSSFile = File.expand_path("../../../../white-on-black.css", __FILE__) CSSFile = File.expand_path("../../../white-on-black.css", __FILE__)
skip_before_filter :verify_authenticity_token skip_before_filter :verify_authenticity_token
def index def index
is_not_open = `fuser #{SocketFile}`.gsub(/\n/, '').empty? is_not_open = `fuser #{SocketFile}`.gsub(/\n/, '').empty?
if !File.exists?(SocketFile) || `ss -elx | grep -w "$(stat -c 'ino:%i dev:0/%d' '#{SocketFile}')"`.blank? if !File.exists?(SocketFile) || `ss -elx | grep -w "$(stat -c 'ino:%i dev:0/%d' '#{SocketFile}')"`.blank?
Thread.new do Thread.new do
`#{Binary} --unixdomain-only #{SocketFile}:$USER:$USER:0666 --disable-ssl --css #{CSSFile}` `#{Binary} --unixdomain-only #{SocketFile}:$USER:$USER:0666 --disable-ssl --debug --css #{CSSFile}`
end end
sleep 3 sleep 3
end end