Remove -r flag from mcrcon

This commit is contained in:
spengreb 2019-10-08 20:10:00 +02:00
parent 028007c03a
commit 7c394d03ef

View file

@ -18,13 +18,13 @@ class VouchersController < ApplicationController
def create
# Logic for creating a voucher
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)
@voucher = Voucher.new(voucher_params)
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
else
render json: @voucher.errors, status: :unprocessable_entity