add de_rainfall
This commit is contained in:
+103
-86
@@ -3,10 +3,10 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
function fetch_servers() {
|
function fetch_servers() {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/api/servers',
|
url: "/api/servers",
|
||||||
type: 'GET',
|
type: "GET",
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
$('#serverList').empty();
|
$("#serverList").empty();
|
||||||
|
|
||||||
data.servers.forEach(function (server) {
|
data.servers.forEach(function (server) {
|
||||||
const card = `
|
const card = `
|
||||||
@@ -19,48 +19,53 @@ $(document).ready(function () {
|
|||||||
<button class="btn btn-sm btn-secondary toggle-password" server-id="${server.id}" class="hide-unhide-rcon">
|
<button class="btn btn-sm btn-secondary toggle-password" server-id="${server.id}" class="hide-unhide-rcon">
|
||||||
<i class="fa fa-eye" server-id="${server.id}" id="toggleEyeIcon-${server.id}"></i>
|
<i class="fa fa-eye" server-id="${server.id}" id="toggleEyeIcon-${server.id}"></i>
|
||||||
</button>
|
</button>
|
||||||
<p class="status connected-status ${server.connected ? 'connected' : 'disconnected'}">
|
<p class="status connected-status ${server.connected ? "connected" : "disconnected"}">
|
||||||
RCON Connected: ${server.connected ? 'Yes' : 'No'}
|
RCON Connected: ${server.connected ? "Yes" : "No"}
|
||||||
</p>
|
</p>
|
||||||
<p class="status authenticated-status ${server.authenticated ? 'authenticated' : 'not-authenticated'}">
|
<p class="status authenticated-status ${server.authenticated ? "authenticated" : "not-authenticated"}">
|
||||||
RCON Authenticated: ${server.authenticated ? 'Yes' : 'No'}
|
RCON Authenticated: ${server.authenticated ? "Yes" : "No"}
|
||||||
</p>
|
</p>
|
||||||
${(!server.connected || !server.authenticated) ? '<button class="btn btn-success" server-id="' + server.id + '" id="reconnect_server">Reconnect</button>' : ''}
|
${!server.connected || !server.authenticated ? '<button class="btn btn-success" server-id="' + server.id + '" id="reconnect_server">Reconnect</button>' : ""}
|
||||||
<a href="/manage/${server.id}" class="btn btn-primary">Manage</a>
|
<a href="/manage/${server.id}" class="btn btn-primary">Manage</a>
|
||||||
<button class="btn btn-danger" server-id='${server.id}' id="delete_server">Delete</button>
|
<button class="btn btn-danger" server-id='${server.id}' id="delete_server">Delete</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
$('#serverList').append(card);
|
$("#serverList").append(card);
|
||||||
});
|
});
|
||||||
$(".toggle-password").click((event) => {
|
$(".toggle-password").click((event) => {
|
||||||
let server_id = $(event.target).attr("server-id");
|
let server_id = $(event.target).attr("server-id");
|
||||||
toggle_password_visibility(server_id)
|
toggle_password_visibility(server_id);
|
||||||
});
|
});
|
||||||
$("#reconnect_server").click(async (element) => {
|
$("#reconnect_server").click(async (element) => {
|
||||||
try {
|
try {
|
||||||
const server_id = $(element.target).attr("server-id");
|
const server_id = $(element.target).attr("server-id");
|
||||||
const response = await $.ajax({
|
const response = await $.ajax({
|
||||||
url: '/api/reconnect-server',
|
url: "/api/reconnect-server",
|
||||||
type: 'POST',
|
type: "POST",
|
||||||
data: JSON.stringify({ server_id: server_id }),
|
data: JSON.stringify({ server_id: server_id }),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
"Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
fetch_servers();
|
fetch_servers();
|
||||||
} else {
|
} else {
|
||||||
console.error('Server responded with a non-200 status code:', response.status);
|
console.error(
|
||||||
alert('An error occurred while reconnecting to the server.');
|
"Server responded with a non-200 status code:",
|
||||||
|
response.status,
|
||||||
|
);
|
||||||
|
alert("An error occurred while reconnecting to the server.");
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
alert('An error occurred while reconnecting to the server.');
|
alert("An error occurred while reconnecting to the server.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$("#delete_server").click(async (element) => {
|
$("#delete_server").click(async (element) => {
|
||||||
const confirmed = confirm("Are you sure you want to delete this server?");
|
const confirmed = confirm(
|
||||||
|
"Are you sure you want to delete this server?",
|
||||||
|
);
|
||||||
if (confirmed) {
|
if (confirmed) {
|
||||||
window.server_id = $(element.target).attr("server-id");
|
window.server_id = $(element.target).attr("server-id");
|
||||||
await send_post_request("/api/delete-server");
|
await send_post_request("/api/delete-server");
|
||||||
@@ -70,7 +75,7 @@ $(document).ready(function () {
|
|||||||
},
|
},
|
||||||
error: function (error) {
|
error: function (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
alert('An error occurred while fetching servers.');
|
alert("An error occurred while fetching servers.");
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -79,148 +84,154 @@ $(document).ready(function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function toggle_password_visibility(server_id) {
|
function toggle_password_visibility(server_id) {
|
||||||
const password_field = document.getElementsByClassName("rcon-password-" + server_id)[0]
|
const password_field = document.getElementsByClassName(
|
||||||
|
"rcon-password-" + server_id,
|
||||||
|
)[0];
|
||||||
const eye_icon = document.getElementById(`toggleEyeIcon-${server_id}`);
|
const eye_icon = document.getElementById(`toggleEyeIcon-${server_id}`);
|
||||||
|
|
||||||
if (password_field.type === 'password') {
|
if (password_field.type === "password") {
|
||||||
password_field.type = 'text';
|
password_field.type = "text";
|
||||||
eye_icon.classList.remove('fa-eye');
|
eye_icon.classList.remove("fa-eye");
|
||||||
eye_icon.classList.add('fa-eye-slash');
|
eye_icon.classList.add("fa-eye-slash");
|
||||||
} else {
|
} else {
|
||||||
password_field.type = 'password';
|
password_field.type = "password";
|
||||||
eye_icon.classList.remove('fa-eye-slash');
|
eye_icon.classList.remove("fa-eye-slash");
|
||||||
eye_icon.classList.add('fa-eye');
|
eye_icon.classList.add("fa-eye");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function send_post_request(apiEndpoint, data = {}) {
|
async function send_post_request(apiEndpoint, data = {}) {
|
||||||
try {
|
try {
|
||||||
data.server_id = window.server_id
|
data.server_id = window.server_id;
|
||||||
const response = await fetch(apiEndpoint, {
|
const response = await fetch(apiEndpoint, {
|
||||||
method: 'POST',
|
method: "POST",
|
||||||
body: JSON.stringify(data),
|
body: JSON.stringify(data),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
"Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
console.log(data.message)
|
console.log(data.message);
|
||||||
if(apiEndpoint == '/api/rcon') {
|
if (apiEndpoint == "/api/rcon") {
|
||||||
if (data.message.includes("Response received")) {
|
if (data.message.includes("Response received")) {
|
||||||
$('#rconResultBox').show();
|
$("#rconResultBox").show();
|
||||||
$('#rconResultText').text(data.message.split("Command sent! Response received:")[1]);
|
$("#rconResultText").text(
|
||||||
|
data.message.split("Command sent! Response received:")[1],
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$('#rconResultBox').hide();
|
$("#rconResultBox").hide();
|
||||||
alert(data.message);
|
alert(data.message);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
alert(data.message);
|
alert(data.message);
|
||||||
}
|
}
|
||||||
} else if (response.status == 401) {
|
} else if (response.status == 401) {
|
||||||
alert('Unauthorized, please reload and relogin.');
|
alert("Unauthorized, please reload and relogin.");
|
||||||
}
|
} else {
|
||||||
else {
|
alert("Failed to perform the action");
|
||||||
alert('Failed to perform the action');
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error:', error);
|
console.error("Error:", error);
|
||||||
alert('An error occurred');
|
alert("An error occurred");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#pause_game').on('click', function () {
|
$("#pause_game").on("click", function () {
|
||||||
if (confirm("Are you sure you want to pause the game?")) {
|
if (confirm("Are you sure you want to pause the game?")) {
|
||||||
send_post_request('/api/pause');
|
send_post_request("/api/pause");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#unpause_game').on('click', function () {
|
$("#unpause_game").on("click", function () {
|
||||||
if (confirm("Are you sure you want to unpause the game?")) {
|
if (confirm("Are you sure you want to unpause the game?")) {
|
||||||
send_post_request('/api/unpause');
|
send_post_request("/api/unpause");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#restart_game').on('click', function () {
|
$("#restart_game").on("click", function () {
|
||||||
if (confirm("Are you sure you want to restart the game?")) {
|
if (confirm("Are you sure you want to restart the game?")) {
|
||||||
send_post_request('/api/restart');
|
send_post_request("/api/restart");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#start_warmup').on('click', function () {
|
$("#start_warmup").on("click", function () {
|
||||||
if (confirm("Are you sure you want to start the warm-up?")) {
|
if (confirm("Are you sure you want to start the warm-up?")) {
|
||||||
send_post_request('/api/start-warmup');
|
send_post_request("/api/start-warmup");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#swap_team').on('click', function () {
|
$("#swap_team").on("click", function () {
|
||||||
if (confirm("Are you sure you want to swap teams?")) {
|
if (confirm("Are you sure you want to swap teams?")) {
|
||||||
send_post_request('/api/swap-team');
|
send_post_request("/api/swap-team");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#go_live').on('click', function () {
|
$("#go_live").on("click", function () {
|
||||||
if (confirm("Are you sure you want to go live?")) {
|
if (confirm("Are you sure you want to go live?")) {
|
||||||
send_post_request('/api/go-live');
|
send_post_request("/api/go-live");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#rconInputBtn').on('click', function () {
|
$("#rconInputBtn").on("click", function () {
|
||||||
let data = {
|
let data = {
|
||||||
command: $('#rconInput').val()
|
command: $("#rconInput").val(),
|
||||||
};
|
};
|
||||||
send_post_request('/api/rcon', data);
|
send_post_request("/api/rcon", data);
|
||||||
$('#rconInput').val('');
|
$("#rconInput").val("");
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#say_input_btn').on('click', function () {
|
$("#say_input_btn").on("click", function () {
|
||||||
let data = {
|
let data = {
|
||||||
message: $('#say_input').val()
|
message: $("#say_input").val(),
|
||||||
};
|
};
|
||||||
send_post_request('/api/say-admin', data);
|
send_post_request("/api/say-admin", data);
|
||||||
$('#say_input').val('');
|
$("#say_input").val("");
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#list_backups').on('click', function () {
|
$("#list_backups").on("click", function () {
|
||||||
send_post_request('/api/list-backups');
|
send_post_request("/api/list-backups");
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#restore_latest_backup').on('click', function () {
|
$("#restore_latest_backup").on("click", function () {
|
||||||
if (confirm("Are you sure you want to restore the latest round backup?")) {
|
if (confirm("Are you sure you want to restore the latest round backup?")) {
|
||||||
send_post_request('/api/restore-latest-backup');
|
send_post_request("/api/restore-latest-backup");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#restore_backup').on('click', function () {
|
$("#restore_backup").on("click", function () {
|
||||||
const round_number = prompt('Enter round number to restore:');
|
const round_number = prompt("Enter round number to restore:");
|
||||||
if (round_number !== null && round_number.trim() !== '') {
|
if (round_number !== null && round_number.trim() !== "") {
|
||||||
const round_number_value = parseInt(round_number);
|
const round_number_value = parseInt(round_number);
|
||||||
if (!isNaN(round_number_value)) {
|
if (!isNaN(round_number_value)) {
|
||||||
send_post_request('/api/restore-round', { round_number: round_number_value });
|
send_post_request("/api/restore-round", {
|
||||||
|
round_number: round_number_value,
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
alert('Invalid round number. Please enter a valid number.');
|
alert("Invalid round number. Please enter a valid number.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
alert('Round number cannot be empty. Please enter a valid number.');
|
alert("Round number cannot be empty. Please enter a valid number.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('#server_setup_form').on('submit', async function (event) {
|
$("#server_setup_form").on("submit", async function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const data = {
|
const data = {
|
||||||
team1: $('#team1').val(),
|
team1: $("#team1").val(),
|
||||||
team2: $('#team2').val(),
|
team2: $("#team2").val(),
|
||||||
map: $('#map').val(),
|
map: $("#map").val(),
|
||||||
game: $('#game').val(),
|
game: $("#game").val(),
|
||||||
server_id: window.server_id
|
server_id: window.server_id,
|
||||||
};
|
};
|
||||||
send_post_request('/api/setup-game', data);
|
send_post_request("/api/setup-game", data);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#game').on('change', function () {
|
$("#game").on("change", function () {
|
||||||
var map_list = [];
|
var map_list = [];
|
||||||
var e = document.getElementById("game");
|
var e = document.getElementById("game");
|
||||||
if (e.value == "1" || e.value == "2" || e.value == "3" || e.value == "4") { // CASUAL OR COMPETITIVE
|
if (e.value == "1" || e.value == "2" || e.value == "3" || e.value == "4") {
|
||||||
|
// CASUAL OR COMPETITIVE
|
||||||
// CS maps
|
// CS maps
|
||||||
//map_list.push("cs_agency");
|
//map_list.push("cs_agency");
|
||||||
map_list.push("cs_italy");
|
map_list.push("cs_italy");
|
||||||
@@ -256,11 +267,13 @@ $(document).ready(function () {
|
|||||||
map_list.push("de_mirage_bricks"); // 3464733042
|
map_list.push("de_mirage_bricks"); // 3464733042
|
||||||
map_list.push("de_palais"); // 3257582863
|
map_list.push("de_palais"); // 3257582863
|
||||||
map_list.push("de_poseidon");
|
map_list.push("de_poseidon");
|
||||||
|
map_list.push("de_rainfall"); // 3265650949
|
||||||
map_list.push("de_rooftop"); // 3536622725
|
map_list.push("de_rooftop"); // 3536622725
|
||||||
map_list.push("de_sanctum");
|
map_list.push("de_sanctum");
|
||||||
map_list.push("de_transit"); // 3542662073
|
map_list.push("de_transit"); // 3542662073
|
||||||
map_list.push("de_whistle"); // 3308613773
|
map_list.push("de_whistle"); // 3308613773
|
||||||
} else if (e.value == "5") { // WINGMAN
|
} else if (e.value == "5") {
|
||||||
|
// WINGMAN
|
||||||
// DE maps (valve)
|
// DE maps (valve)
|
||||||
map_list.push("de_inferno");
|
map_list.push("de_inferno");
|
||||||
map_list.push("de_nuke");
|
map_list.push("de_nuke");
|
||||||
@@ -275,27 +288,31 @@ $(document).ready(function () {
|
|||||||
map_list.push("de_mirage_bricks"); // 3464733042
|
map_list.push("de_mirage_bricks"); // 3464733042
|
||||||
map_list.push("de_palais"); // 3257582863
|
map_list.push("de_palais"); // 3257582863
|
||||||
map_list.push("de_poseidon");
|
map_list.push("de_poseidon");
|
||||||
|
map_list.push("de_rainfall"); // 3265650949
|
||||||
map_list.push("de_rooftop"); // 3536622725
|
map_list.push("de_rooftop"); // 3536622725
|
||||||
map_list.push("de_sanctum");
|
map_list.push("de_sanctum");
|
||||||
map_list.push("de_transit"); // 3542662073
|
map_list.push("de_transit"); // 3542662073
|
||||||
map_list.push("de_whistle"); // 3308613773
|
map_list.push("de_whistle"); // 3308613773
|
||||||
} else if (e.value == "6") { // arms race
|
} else if (e.value == "6") {
|
||||||
|
// arms race
|
||||||
map_list.push("ar_baggage");
|
map_list.push("ar_baggage");
|
||||||
map_list.push("ar_pool_day");
|
map_list.push("ar_pool_day");
|
||||||
map_list.push("ar_shoots");
|
map_list.push("ar_shoots");
|
||||||
map_list.push("ar_shoots_night");
|
map_list.push("ar_shoots_night");
|
||||||
} else if (e.value == "7") { // other
|
} else if (e.value == "7") {
|
||||||
|
// other
|
||||||
// WORKSHOP
|
// WORKSHOP
|
||||||
map_list.push("de_inferno_prophunt"); // 3608612434
|
map_list.push("de_inferno_prophunt"); // 3608612434
|
||||||
map_list.push("cs_office_prophunt"); // 3644811896
|
map_list.push("cs_office_prophunt"); // 3644811896
|
||||||
map_list.push("de_mirage_prophunt"); // 3615968422
|
map_list.push("de_mirage_prophunt"); // 3615968422
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#map').empty();
|
$("#map").empty();
|
||||||
|
|
||||||
for (var i = 0; i < map_list.length; i++) {
|
for (var i = 0; i < map_list.length; i++) {
|
||||||
const opt = '<option value="' + map_list[i] + '">' + map_list[i] + '</option>'
|
const opt =
|
||||||
$('#map').append(opt);
|
'<option value="' + map_list[i] + '">' + map_list[i] + "</option>";
|
||||||
|
$("#map").append(opt);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
+146
-110
@@ -1,14 +1,14 @@
|
|||||||
const express = require('express');
|
const express = require("express");
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
const readline = require('readline');
|
const readline = require("readline");
|
||||||
const fs = require('fs');
|
const fs = require("fs");
|
||||||
|
|
||||||
const rcon = require("../modules/rcon");
|
const rcon = require("../modules/rcon");
|
||||||
const is_authenticated = require("../modules/middleware");
|
const is_authenticated = require("../modules/middleware");
|
||||||
|
|
||||||
const ALLOWED_STEAM_IDS = ['76561198154367261']
|
const ALLOWED_STEAM_IDS = ["76561198154367261"];
|
||||||
|
|
||||||
router.post('/api/setup-game', is_authenticated, async (req, res) => {
|
router.post("/api/setup-game", is_authenticated, async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const server_id = req.body.server_id;
|
const server_id = req.body.server_id;
|
||||||
const team1 = req.body.team1;
|
const team1 = req.body.team1;
|
||||||
@@ -53,6 +53,9 @@ router.post('/api/setup-game', is_authenticated, async (req, res) => {
|
|||||||
case "de_palais":
|
case "de_palais":
|
||||||
map = 3257582863;
|
map = 3257582863;
|
||||||
break;
|
break;
|
||||||
|
case "de_rainfall":
|
||||||
|
map = 3265650949;
|
||||||
|
break;
|
||||||
case "de_rooftop":
|
case "de_rooftop":
|
||||||
map = 3536622725;
|
map = 3536622725;
|
||||||
break;
|
break;
|
||||||
@@ -77,46 +80,53 @@ router.post('/api/setup-game', is_authenticated, async (req, res) => {
|
|||||||
await rcon.execute_command(server_id, `mp_teamname_2 "${team2}"`);
|
await rcon.execute_command(server_id, `mp_teamname_2 "${team2}"`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (game == "1") { // Competitive Short
|
if (game == "1") {
|
||||||
|
// Competitive Short
|
||||||
await rcon.execute_command(server_id, `game_type 0`);
|
await rcon.execute_command(server_id, `game_type 0`);
|
||||||
await rcon.execute_command(server_id, `game_mode 1`);
|
await rcon.execute_command(server_id, `game_mode 1`);
|
||||||
await rcon.execute_command(server_id, `sv_skirmish_id 0`);
|
await rcon.execute_command(server_id, `sv_skirmish_id 0`);
|
||||||
execute_cfg_on_server(server_id, './cfg/live_competitive_16.cfg');
|
execute_cfg_on_server(server_id, "./cfg/live_competitive_16.cfg");
|
||||||
await rcon.execute_command(server_id, `mp_warmup_pausetimer 1`);
|
await rcon.execute_command(server_id, `mp_warmup_pausetimer 1`);
|
||||||
} else if (game == "2") { // Competitive Long
|
} else if (game == "2") {
|
||||||
|
// Competitive Long
|
||||||
await rcon.execute_command(server_id, `game_type 0`);
|
await rcon.execute_command(server_id, `game_type 0`);
|
||||||
await rcon.execute_command(server_id, `game_mode 1`);
|
await rcon.execute_command(server_id, `game_mode 1`);
|
||||||
await rcon.execute_command(server_id, `sv_skirmish_id 0`);
|
await rcon.execute_command(server_id, `sv_skirmish_id 0`);
|
||||||
execute_cfg_on_server(server_id, './cfg/live_competitive_24.cfg');
|
execute_cfg_on_server(server_id, "./cfg/live_competitive_24.cfg");
|
||||||
await rcon.execute_command(server_id, `mp_warmup_pausetimer 1`);
|
await rcon.execute_command(server_id, `mp_warmup_pausetimer 1`);
|
||||||
} else if (game == "3") { // Casual Short
|
} else if (game == "3") {
|
||||||
|
// Casual Short
|
||||||
await rcon.execute_command(server_id, `game_type 0`);
|
await rcon.execute_command(server_id, `game_type 0`);
|
||||||
await rcon.execute_command(server_id, `game_mode 0`);
|
await rcon.execute_command(server_id, `game_mode 0`);
|
||||||
await rcon.execute_command(server_id, `sv_skirmish_id 0`);
|
await rcon.execute_command(server_id, `sv_skirmish_id 0`);
|
||||||
execute_cfg_on_server(server_id, './cfg/live_casual_16.cfg');
|
execute_cfg_on_server(server_id, "./cfg/live_casual_16.cfg");
|
||||||
await rcon.execute_command(server_id, `mp_warmup_pausetimer 1`);
|
await rcon.execute_command(server_id, `mp_warmup_pausetimer 1`);
|
||||||
} else if (game == "4") { // Casual Long
|
} else if (game == "4") {
|
||||||
|
// Casual Long
|
||||||
await rcon.execute_command(server_id, `game_type 0`);
|
await rcon.execute_command(server_id, `game_type 0`);
|
||||||
await rcon.execute_command(server_id, `game_mode 0`);
|
await rcon.execute_command(server_id, `game_mode 0`);
|
||||||
await rcon.execute_command(server_id, `sv_skirmish_id 0`);
|
await rcon.execute_command(server_id, `sv_skirmish_id 0`);
|
||||||
execute_cfg_on_server(server_id, './cfg/live_casual_24.cfg');
|
execute_cfg_on_server(server_id, "./cfg/live_casual_24.cfg");
|
||||||
await rcon.execute_command(server_id, `mp_warmup_pausetimer 1`);
|
await rcon.execute_command(server_id, `mp_warmup_pausetimer 1`);
|
||||||
} else if (game == "5") { // Wingman
|
} else if (game == "5") {
|
||||||
|
// Wingman
|
||||||
await rcon.execute_command(server_id, `game_type 0`);
|
await rcon.execute_command(server_id, `game_type 0`);
|
||||||
await rcon.execute_command(server_id, `game_mode 2`);
|
await rcon.execute_command(server_id, `game_mode 2`);
|
||||||
await rcon.execute_command(server_id, `sv_skirmish_id 0`);
|
await rcon.execute_command(server_id, `sv_skirmish_id 0`);
|
||||||
execute_cfg_on_server(server_id, './cfg/live_wingman.cfg');
|
execute_cfg_on_server(server_id, "./cfg/live_wingman.cfg");
|
||||||
await rcon.execute_command(server_id, `mp_warmup_pausetimer 1`);
|
await rcon.execute_command(server_id, `mp_warmup_pausetimer 1`);
|
||||||
} else if (game == "6") { // Arms race
|
} else if (game == "6") {
|
||||||
|
// Arms race
|
||||||
await rcon.execute_command(server_id, `game_type 1`);
|
await rcon.execute_command(server_id, `game_type 1`);
|
||||||
await rcon.execute_command(server_id, `game_mode 0`);
|
await rcon.execute_command(server_id, `game_mode 0`);
|
||||||
await rcon.execute_command(server_id, `sv_skirmish_id 10`);
|
await rcon.execute_command(server_id, `sv_skirmish_id 10`);
|
||||||
execute_cfg_on_server(server_id, './cfg/live_arms_race.cfg');
|
execute_cfg_on_server(server_id, "./cfg/live_arms_race.cfg");
|
||||||
} else if (game == "7") { // Prophunt
|
} else if (game == "7") {
|
||||||
|
// Prophunt
|
||||||
await rcon.execute_command(server_id, `game_type 0`);
|
await rcon.execute_command(server_id, `game_type 0`);
|
||||||
await rcon.execute_command(server_id, `game_mode 0`);
|
await rcon.execute_command(server_id, `game_mode 0`);
|
||||||
await rcon.execute_command(server_id, `sv_skirmish_id 0`);
|
await rcon.execute_command(server_id, `sv_skirmish_id 0`);
|
||||||
execute_cfg_on_server(server_id, './cfg/live_prophunt.cfg');
|
execute_cfg_on_server(server_id, "./cfg/live_prophunt.cfg");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isNaN(map)) {
|
if (isNaN(map)) {
|
||||||
@@ -128,64 +138,64 @@ router.post('/api/setup-game', is_authenticated, async (req, res) => {
|
|||||||
// Adding 1 second delay in executing warmup.cfg to make it effective after map has been changed.
|
// Adding 1 second delay in executing warmup.cfg to make it effective after map has been changed.
|
||||||
if (game == "1" || game == "3" || game == "5") {
|
if (game == "1" || game == "3" || game == "5") {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
execute_cfg_on_server(server_id, './cfg/warmup_16.cfg');
|
execute_cfg_on_server(server_id, "./cfg/warmup_16.cfg");
|
||||||
}, 1000)
|
}, 1000);
|
||||||
} else if (game == "2" || game == "4") {
|
} else if (game == "2" || game == "4") {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
execute_cfg_on_server(server_id, './cfg/warmup_24.cfg');
|
execute_cfg_on_server(server_id, "./cfg/warmup_24.cfg");
|
||||||
}, 1000)
|
}, 1000);
|
||||||
} else if (game == "6") {
|
} else if (game == "6") {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
rcon.execute_command(server_id, `mp_restartgame 30`);
|
rcon.execute_command(server_id, `mp_restartgame 30`);
|
||||||
}, 1000)
|
}, 1000);
|
||||||
} else if (game == "7") {
|
} else if (game == "7") {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
rcon.execute_command(server_id, 'mp_restartgame 3');
|
rcon.execute_command(server_id, "mp_restartgame 3");
|
||||||
}, 1000)
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
return res.status(200).json({ message: 'Game Created!' });
|
return res.status(200).json({ message: "Game Created!" });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
res.status(500).json({ error: 'Internal server error' });
|
res.status(500).json({ error: "Internal server error" });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
router.post('/api/restart', is_authenticated, async (req, res) => {
|
router.post("/api/restart", is_authenticated, async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const server_id = req.body.server_id;
|
const server_id = req.body.server_id;
|
||||||
await rcon.execute_command(server_id, `mp_restartgame 1`);
|
await rcon.execute_command(server_id, `mp_restartgame 1`);
|
||||||
return res.status(200).json({ message: 'Game restarted' });
|
return res.status(200).json({ message: "Game restarted" });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
res.status(500).json({ error: 'Internal server error' });
|
res.status(500).json({ error: "Internal server error" });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
router.post('/api/start-warmup', is_authenticated, async (req, res) => {
|
router.post("/api/start-warmup", is_authenticated, async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const server_id = req.body.server_id;
|
const server_id = req.body.server_id;
|
||||||
execute_cfg_on_server(server_id, './cfg/warmup.cfg');
|
execute_cfg_on_server(server_id, "./cfg/warmup.cfg");
|
||||||
execute_cfg_on_server(server_id, './cfg/warmup_restart.cfg');
|
execute_cfg_on_server(server_id, "./cfg/warmup_restart.cfg");
|
||||||
|
|
||||||
return res.status(200).json({ message: 'Warmup started!' });
|
return res.status(200).json({ message: "Warmup started!" });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
res.status(500).json({ error: 'Internal server error' });
|
res.status(500).json({ error: "Internal server error" });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
router.post('/api/swap-team', is_authenticated, async (req, res) => {
|
router.post("/api/swap-team", is_authenticated, async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const server_id = req.body.server_id;
|
const server_id = req.body.server_id;
|
||||||
await rcon.execute_command(server_id, `mp_swapteams`);
|
await rcon.execute_command(server_id, `mp_swapteams`);
|
||||||
return res.status(200).json({ message: 'Teams Swapped!' });
|
return res.status(200).json({ message: "Teams Swapped!" });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
res.status(500).json({ error: 'Internal server error' });
|
res.status(500).json({ error: "Internal server error" });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
router.post('/api/go-live', is_authenticated, async (req, res) => {
|
router.post("/api/go-live", is_authenticated, async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const server_id = req.body.server_id;
|
const server_id = req.body.server_id;
|
||||||
|
|
||||||
@@ -199,103 +209,122 @@ router.post('/api/go-live', is_authenticated, async (req, res) => {
|
|||||||
const maxrounds = res_rounds.split("=")[1].trim().toString();
|
const maxrounds = res_rounds.split("=")[1].trim().toString();
|
||||||
|
|
||||||
if (game_mode == "1" && maxrounds == "16") {
|
if (game_mode == "1" && maxrounds == "16") {
|
||||||
console.log("Executing live_competitive_16.cfg")
|
console.log("Executing live_competitive_16.cfg");
|
||||||
execute_cfg_on_server(server_id, './cfg/live_competitive_16.cfg');
|
execute_cfg_on_server(server_id, "./cfg/live_competitive_16.cfg");
|
||||||
} else if (game_mode == "1" && maxrounds == "24") {
|
} else if (game_mode == "1" && maxrounds == "24") {
|
||||||
console.log("Executing live_competitive_24.cfg")
|
console.log("Executing live_competitive_24.cfg");
|
||||||
execute_cfg_on_server(server_id, './cfg/live_competitive_24.cfg');
|
execute_cfg_on_server(server_id, "./cfg/live_competitive_24.cfg");
|
||||||
} else if (game_mode == "0" && maxrounds == "16") {
|
} else if (game_mode == "0" && maxrounds == "16") {
|
||||||
console.log("Executing live_casual_16.cfg")
|
console.log("Executing live_casual_16.cfg");
|
||||||
execute_cfg_on_server(server_id, './cfg/live_casual_16.cfg');
|
execute_cfg_on_server(server_id, "./cfg/live_casual_16.cfg");
|
||||||
} else if (game_mode == "0" && maxrounds == "24") {
|
} else if (game_mode == "0" && maxrounds == "24") {
|
||||||
console.log("Executing live_casual_24.cfg")
|
console.log("Executing live_casual_24.cfg");
|
||||||
execute_cfg_on_server(server_id, './cfg/live_casual_24.cfg');
|
execute_cfg_on_server(server_id, "./cfg/live_casual_24.cfg");
|
||||||
} else if (game_mode == "2") {
|
} else if (game_mode == "2") {
|
||||||
console.log("Executing live_wingman.cfg")
|
console.log("Executing live_wingman.cfg");
|
||||||
execute_cfg_on_server(server_id, './cfg/live_wingman.cfg');
|
execute_cfg_on_server(server_id, "./cfg/live_wingman.cfg");
|
||||||
}
|
}
|
||||||
|
|
||||||
execute_cfg_on_server(server_id, './cfg/live_restart.cfg');
|
execute_cfg_on_server(server_id, "./cfg/live_restart.cfg");
|
||||||
|
|
||||||
return res.status(200).json({ message: 'Match is live!!' });
|
return res.status(200).json({ message: "Match is live!!" });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
res.status(500).json({ error: 'Internal server error' });
|
res.status(500).json({ error: "Internal server error" });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// List Round Backups API
|
// List Round Backups API
|
||||||
router.post('/api/list-backups', is_authenticated, async (req, res) => {
|
router.post("/api/list-backups", is_authenticated, async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const server_id = req.body.server_id;
|
const server_id = req.body.server_id;
|
||||||
const response = await rcon.execute_command(server_id, "mp_backup_restore_list_files");
|
const response = await rcon.execute_command(
|
||||||
console.log('Server response:', response);
|
server_id,
|
||||||
|
"mp_backup_restore_list_files",
|
||||||
|
);
|
||||||
|
console.log("Server response:", response);
|
||||||
return res.status(200).json({ message: response });
|
return res.status(200).json({ message: response });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error);
|
||||||
res.status(500).json({ error: 'Internal server error' });
|
res.status(500).json({ error: "Internal server error" });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Restore Round API
|
// Restore Round API
|
||||||
router.post('/api/restore-round', is_authenticated, async (req, res) => {
|
router.post("/api/restore-round", is_authenticated, async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const server_id = req.body.server_id;
|
const server_id = req.body.server_id;
|
||||||
let round_number = req.body.round_number.toString()
|
let round_number = req.body.round_number.toString();
|
||||||
if (round_number.length == 1) {
|
if (round_number.length == 1) {
|
||||||
round_number = "0" + round_number;
|
round_number = "0" + round_number;
|
||||||
}
|
}
|
||||||
console.log(`SENDING mp_backup_restore_load_file backup_round${round_number}.txt`)
|
console.log(
|
||||||
await rcon.execute_command(server_id, `mp_backup_restore_load_file backup_round${round_number}.txt`);
|
`SENDING mp_backup_restore_load_file backup_round${round_number}.txt`,
|
||||||
|
);
|
||||||
|
await rcon.execute_command(
|
||||||
|
server_id,
|
||||||
|
`mp_backup_restore_load_file backup_round${round_number}.txt`,
|
||||||
|
);
|
||||||
await rcon.execute_command(server_id, `mp_pause_match`);
|
await rcon.execute_command(server_id, `mp_pause_match`);
|
||||||
return res.status(200).json({ message: 'Round Restored!' });
|
return res.status(200).json({ message: "Round Restored!" });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
res.status(500).json({ error: 'Internal server error' });
|
res.status(500).json({ error: "Internal server error" });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
router.post('/api/restore-latest-backup', is_authenticated, async (req, res) => {
|
router.post(
|
||||||
|
"/api/restore-latest-backup",
|
||||||
|
is_authenticated,
|
||||||
|
async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const server_id = req.body.server_id;
|
const server_id = req.body.server_id;
|
||||||
const response = await rcon.execute_command(server_id, `mp_backup_round_file_last`);
|
const response = await rcon.execute_command(
|
||||||
|
server_id,
|
||||||
|
`mp_backup_round_file_last`,
|
||||||
|
);
|
||||||
const last_round_file = response.split("=")[1].trim().toString();
|
const last_round_file = response.split("=")[1].trim().toString();
|
||||||
if (last_round_file.includes('.txt')) {
|
if (last_round_file.includes(".txt")) {
|
||||||
await rcon.execute_command(server_id, `mp_backup_restore_load_file ${last_round_file}`);
|
await rcon.execute_command(
|
||||||
|
server_id,
|
||||||
|
`mp_backup_restore_load_file ${last_round_file}`,
|
||||||
|
);
|
||||||
await rcon.execute_command(server_id, `mp_pause_match`);
|
await rcon.execute_command(server_id, `mp_pause_match`);
|
||||||
return res.status(200).json({ message: `Latest Round Restored! (${last_round_file})` });
|
return res
|
||||||
|
.status(200)
|
||||||
|
.json({ message: `Latest Round Restored! (${last_round_file})` });
|
||||||
} else {
|
} else {
|
||||||
return res.status(200).json({ message: 'No latest backup found!' });
|
return res.status(200).json({ message: "No latest backup found!" });
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
res.status(500).json({ error: 'Internal server error' });
|
res.status(500).json({ error: "Internal server error" });
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
// Pause Game API
|
// Pause Game API
|
||||||
router.post('/api/pause', is_authenticated, async (req, res) => {
|
router.post("/api/pause", is_authenticated, async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const server_id = req.body.server_id;
|
const server_id = req.body.server_id;
|
||||||
const response = await rcon.execute_command(server_id, 'mp_pause_match');
|
const response = await rcon.execute_command(server_id, "mp_pause_match");
|
||||||
return res.status(200).json({ message: 'Game paused' });
|
return res.status(200).json({ message: "Game paused" });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
res.status(500).json({ error: 'Internal server error' });
|
res.status(500).json({ error: "Internal server error" });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Unpause Game API
|
// Unpause Game API
|
||||||
router.post('/api/unpause', is_authenticated, async (req, res) => {
|
router.post("/api/unpause", is_authenticated, async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const server_id = req.body.server_id;
|
const server_id = req.body.server_id;
|
||||||
const response = await rcon.execute_command(server_id, 'mp_unpause_match');
|
const response = await rcon.execute_command(server_id, "mp_unpause_match");
|
||||||
return res.status(200).json({ message: 'Game unpaused' });
|
return res.status(200).json({ message: "Game unpaused" });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
res.status(500).json({ error: 'Internal server error' });
|
res.status(500).json({ error: "Internal server error" });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
router.post('/api/rcon', is_authenticated, async (req, res) => {
|
router.post("/api/rcon", is_authenticated, async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const server_id = req.body.server_id;
|
const server_id = req.body.server_id;
|
||||||
const command = req.body.command;
|
const command = req.body.command;
|
||||||
@@ -303,37 +332,46 @@ router.post('/api/rcon', is_authenticated, async (req, res) => {
|
|||||||
const response = await rcon.execute_command(server_id, command);
|
const response = await rcon.execute_command(server_id, command);
|
||||||
|
|
||||||
if (response == 200) {
|
if (response == 200) {
|
||||||
return res.status(200).json({ message: 'Command sent!' });
|
return res.status(200).json({ message: "Command sent!" });
|
||||||
}
|
}
|
||||||
|
|
||||||
return res.status(200).json({ message: 'Command sent! Response received:\n' + response.toString() });
|
return res
|
||||||
|
.status(200)
|
||||||
|
.json({
|
||||||
|
message: "Command sent! Response received:\n" + response.toString(),
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
res.status(500).json({ error: 'Internal server error' });
|
res.status(500).json({ error: "Internal server error" });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
router.post('/api/say-admin', is_authenticated, async (req, res) => {
|
router.post("/api/say-admin", is_authenticated, async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const server_id = req.body.server_id;
|
const server_id = req.body.server_id;
|
||||||
const message = req.body.message;
|
const message = req.body.message;
|
||||||
const message_to_send = "say " + message;
|
const message_to_send = "say " + message;
|
||||||
await rcon.execute_command(server_id, message_to_send);
|
await rcon.execute_command(server_id, message_to_send);
|
||||||
return res.status(200).json({ message: 'Message sent!' });
|
return res.status(200).json({ message: "Message sent!" });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
res.status(500).json({ error: 'Internal server error' });
|
res.status(500).json({ error: "Internal server error" });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function check_whitelisted_players() {
|
function check_whitelisted_players() {
|
||||||
rcon.rcons[server_id].execute('status_json')
|
rcon.rcons[server_id]
|
||||||
|
.execute("status_json")
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log(response)
|
console.log(response);
|
||||||
const server_status = JSON.parse(response)
|
const server_status = JSON.parse(response);
|
||||||
const players = server_status['server']['clients']
|
const players = server_status["server"]["clients"];
|
||||||
for (var i = 0; i < players.length; i++) {
|
for (var i = 0; i < players.length; i++) {
|
||||||
let player = players[i]
|
let player = players[i];
|
||||||
if (!player.bot && player.steamid64.includes('7656') && !ALLOWED_STEAM_IDS.includes(player.steamid64)) {
|
if (
|
||||||
console.log(`kick ${player.name}`)
|
!player.bot &&
|
||||||
|
player.steamid64.includes("7656") &&
|
||||||
|
!ALLOWED_STEAM_IDS.includes(player.steamid64)
|
||||||
|
) {
|
||||||
|
console.log(`kick ${player.name}`);
|
||||||
rcon.rcons[server_id].execute(`kick ${player.name}`);
|
rcon.rcons[server_id].execute(`kick ${player.name}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -342,11 +380,10 @@ function check_whitelisted_players() {
|
|||||||
.catch(console.error);
|
.catch(console.error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function splitByByteLength(data, length) {
|
function splitByByteLength(data, length) {
|
||||||
const lines = data;
|
const lines = data;
|
||||||
const exportedLines = [];
|
const exportedLines = [];
|
||||||
const lineEndChar = '; '
|
const lineEndChar = "; ";
|
||||||
let index = 0;
|
let index = 0;
|
||||||
|
|
||||||
for (let item = 0; item < lines.length; item++) {
|
for (let item = 0; item < lines.length; item++) {
|
||||||
@@ -355,10 +392,10 @@ function splitByByteLength(data, length) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const lineFormatted = `${lines[item]}${lineEndChar}`;
|
const lineFormatted = `${lines[item]}${lineEndChar}`;
|
||||||
const lineBytes = Buffer.byteLength(lineFormatted, 'utf8');
|
const lineBytes = Buffer.byteLength(lineFormatted, "utf8");
|
||||||
const bufferBytes = Buffer.byteLength(exportedLines[index], 'utf8');
|
const bufferBytes = Buffer.byteLength(exportedLines[index], "utf8");
|
||||||
|
|
||||||
if((bufferBytes + lineBytes) < length) {
|
if (bufferBytes + lineBytes < length) {
|
||||||
exportedLines[index] += lineFormatted;
|
exportedLines[index] += lineFormatted;
|
||||||
} else {
|
} else {
|
||||||
index++;
|
index++;
|
||||||
@@ -369,26 +406,25 @@ function splitByByteLength(data, length) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function execute_cfg_on_server(server_id, cfg_path) {
|
async function execute_cfg_on_server(server_id, cfg_path) {
|
||||||
|
fs.readFile(cfg_path, "utf8", (err, data) => {
|
||||||
fs.readFile(cfg_path, 'utf8', (err, data) => {
|
|
||||||
if (err) {
|
if (err) {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|
||||||
data = data.replace(/^\/\/.*$/m, '');
|
data = data.replace(/^\/\/.*$/m, "");
|
||||||
data = data.split("\n");
|
data = data.split("\n");
|
||||||
const new_data = [];
|
const new_data = [];
|
||||||
for (let i = 0; i < data.length; i += 1) {
|
for (let i = 0; i < data.length; i += 1) {
|
||||||
const line = data[i].trim();
|
const line = data[i].trim();
|
||||||
const segments = line.split(' ');
|
const segments = line.split(" ");
|
||||||
|
|
||||||
if(segments[0] === 'say' || segments.length == 1) {
|
if (segments[0] === "say" || segments.length == 1) {
|
||||||
new_data.push(line);
|
new_data.push(line);
|
||||||
} else if (segments[0] !== '' && segments[0] !== '//') {
|
} else if (segments[0] !== "" && segments[0] !== "//") {
|
||||||
new_data.push(`${segments[0]} ${segments[1].split('\t')[0]}`);
|
new_data.push(`${segments[0]} ${segments[1].split("\t")[0]}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const exported_lines = splitByByteLength(data, 512)
|
const exported_lines = splitByByteLength(data, 512);
|
||||||
|
|
||||||
async function execute_next_item(item) {
|
async function execute_next_item(item) {
|
||||||
try {
|
try {
|
||||||
@@ -402,7 +438,7 @@ async function execute_cfg_on_server(server_id, cfg_path) {
|
|||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("[execute_next_item] Error:", error)
|
console.log("[execute_next_item] Error:", error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
execute_next_item(0);
|
execute_next_item(0);
|
||||||
@@ -410,5 +446,5 @@ async function execute_cfg_on_server(server_id, cfg_path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
router
|
router,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user