Remove -r flag from mcrcon
This commit is contained in:
parent
028007c03a
commit
7c394d03ef
1 changed files with 2 additions and 2 deletions
|
|
@ -18,13 +18,13 @@ class VouchersController < ApplicationController
|
||||||
def create
|
def create
|
||||||
# Logic for creating a voucher
|
# Logic for creating a voucher
|
||||||
output = ""
|
output = ""
|
||||||
whitelist = `mcrcon -r -H mine.vereto.net -p #{ENV["MC_RCON_PASS"]} "whitelist list" | sed 's/There are*.*whitelisted players: //g'`.split(", ")
|
whitelist = `mcrcon -H mine.vereto.net -p #{ENV["MC_RCON_PASS"]} "whitelist list" | sed 's/There are*.*whitelisted players: //g'`.split(", ")
|
||||||
|
|
||||||
if Voucher.exists?(vouchee: params[:voucher]) && params[:voucher].in?(whitelist)
|
if Voucher.exists?(vouchee: params[:voucher]) && params[:voucher].in?(whitelist)
|
||||||
@voucher = Voucher.new(voucher_params)
|
@voucher = Voucher.new(voucher_params)
|
||||||
|
|
||||||
if @voucher.save
|
if @voucher.save
|
||||||
output = `mcrcon -r -H mine.vereto.net -p #{ENV["MC_RCON_PASS"]} "whitelist add #{params[:vouchee]}"`
|
output = `mcrcon -H mine.vereto.net -p #{ENV["MC_RCON_PASS"]} "whitelist add #{params[:vouchee]}"`
|
||||||
render json: output, status: :created, location: @voucher
|
render json: output, status: :created, location: @voucher
|
||||||
else
|
else
|
||||||
render json: @voucher.errors, status: :unprocessable_entity
|
render json: @voucher.errors, status: :unprocessable_entity
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue