Skip to content

Commit

Permalink
Merge pull request #30 from Taraman17/dev
Browse files Browse the repository at this point in the history
Add new Standard Maps, update dependencies and fix uncought exceptions
  • Loading branch information
Taraman17 authored Aug 23, 2022
2 parents 73a644b + 5fe02e1 commit e4e21b5
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 119 deletions.
50 changes: 23 additions & 27 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,54 +18,50 @@ jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['javascript']
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

#- run: |
# make bootstrap
# make release
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2

79 changes: 42 additions & 37 deletions OfficialMaps.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,43 @@
{
"ar_baggage": 125440026,
"ar_monastery": 125440154,
"ar_shoots": 125440261,
"cs_agency": 1464919827,
"cs_assault": 125432575,
"cs_climb": 2537983994,
"cs_insertion2": 2650330155,
"cs_italy": 125436057,
"cs_militia": 133256570,
"cs_office": 125444404,
"de_ancient": 2627571649,
"de_crete": 1220681096,
"de_bank": 125440342,
"de_basalt": 2627569615,
"de_cache": 2606407435,
"de_canals": 951287718,
"de_cbble": 205239595,
"de_dust2": 125438255,
"de_extraction": 2650340943,
"de_hive": 2539316567,
"de_inferno": 125438669,
"de_iris": 1591780701,
"de_lake": 125440557,
"de_mirage": 152508932,
"de_nuke": 125439125,
"de_overpass": 205240106,
"de_ravine": 2615546425,
"de_safehouse": 125440714,
"de_shortnuke": 2131550446,
"de_stmarc": 125441004,
"de_sugarcane": 125440847,
"de_train": 125438372,
"de_vertigo": 125439851,
"dz_ember": 2681770529,
"dz_vineyard": 2587298130,
"gd_cbble": 782012846
{
"ar_baggage": 125440026,
"ar_monastery": 125440154,
"ar_shoots": 125440261,
"cs_agency": 1464919827,
"cs_assault": 125432575,
"cs_climb": 2537983994,
"cs_insertion2": 2650330155,
"cs_italy": 125436057,
"cs_militia": 133256570,
"cs_office": 125444404,
"de_ancient": 2627571649,
"de_anubis": 1984883124,
"de_crete": 1220681096,
"de_bank": 125440342,
"de_basalt": 2627569615,
"de_blagai": 2791116183,
"de_breach": 1258599704,
"de_cache": 2606407435,
"de_canals": 951287718,
"de_cbble": 205239595,
"de_dust2": 125438255,
"de_extraction": 2650340943,
"de_hive": 2539316567,
"de_inferno": 125438669,
"de_iris": 1591780701,
"de_lake": 125440557,
"de_mirage": 152508932,
"de_nuke": 125439125,
"de_overpass": 205240106,
"de_prime": 2831565855,
"de_ravine": 2615546425,
"de_safehouse": 125440714,
"de_shortnuke": 2131550446,
"de_stmarc": 125441004,
"de_sugarcane": 125440847,
"de_train": 125438372,
"de_tuscan": 2458920550,
"de_vertigo": 125439851,
"dz_ember": 2681770529,
"dz_vineyard": 2587298130,
"gd_cbble": 782012846
}
2 changes: 2 additions & 0 deletions modules/apiV10.js
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,8 @@ router.get('/control/changemap', (req, res) => {
router.get('/control/reloadMaplist', (req, res) => {
sf.reloadMaplist().then((answer) => {
res.json(answer);
}).catch((err) => {
res.json(err.message);
});
});

Expand Down
12 changes: 7 additions & 5 deletions modules/serverInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,13 @@ class serverInfo {
if (this._mapFilters.length > 0) {
return this._mapsDetails.filter((map) => {
let found = false;
this._mapFilters.forEach((filter) => {
if (map.name.includes(filter)) {
found = true;
}
});
if (map.name) { // sometimes map.name is undefined for some reason.
this._mapFilters.forEach((filter) => {
if (map.name.includes(filter)) {
found = true;
}
});
}
if (this._mapFilterType === 'include') {
return found;
} else {
Expand Down
8 changes: 4 additions & 4 deletions modules/sharedFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,16 @@ function reloadMaplist() {
maplist.sort();
// Only return, if list has at least one item.
if (maplist.length > 0) {
logger.debug("Saving Maplist to ServerInfo");
logger.debug('Saving Maplist to ServerInfo');
serverInfo.mapsAvail = maplist;
serverInfo.mapsDetails = mapdetails;
resolve({ "success": true });
} else {
resolve({ "success": false });
reject({ "success": false });
}
});
}).catch((err) => {
resolve({ "success": false });
reject({ "success": false });
});
});
}
Expand All @@ -168,7 +168,7 @@ function executeRcon(message) {
serverInfo.serverState.serverRcon.execute(message).then((answer) => {
resolve(answer);
}).catch((err) => {
logger.error(`RCON Error: ${err}`);
logger.error(`RCON Error: ${err.message}`);
reject(err.message);
});
});
Expand Down
84 changes: 42 additions & 42 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
{
"dependencies": {
"cors": "^2.8.5",
"express": "^4.17.1",
"express-rate-limit": "^5.2.6",
"express-session": "^1.17.2",
"local-ip": "^2.0.0",
"node-pty": "^0.10.1",
"passport": "^0.4.1",
"passport-http": "^0.3.0",
"passport-steam": "^1.0.15",
"rcon-srcds": "^2.0.1",
"srcds-log-receiver": "^1.0.2",
"winston": "^3.3.3",
"winston-daily-rotate-file": "^4.5.5",
"ws": "^7.4.6"
},
"name": "nodejs-csgo-api",
"description": "## Disclaimer The use of this software is at your own risk. It exposes control of your server and shell functions to the internet. Although I did everything to secure the API, any bugs may lead to security breaches on your server. I strongly adivise to use secure connections to prevent possible man-in-the-middle attacks.",
"version": "0.8.2",
"main": "serverControl.js",
"directories": {
"example": "example"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/taraman17/nodejs-csgo-api.git"
},
"keywords": [
"csgo",
"csgo_ds",
"api"
],
"author": "Taraman17",
"license": "GPL-3.0-or-later",
"bugs": {
"url": "https://github.com/taraman17/nodejs-csgo-api/issues"
},
"homepage": "https://github.com/taraman17/nodejs-csgo-api#readme"
}
"dependencies": {
"cors": ">=2.8.5",
"express": ">=4.17.1",
"express-rate-limit": ">=5.2.6",
"express-session": ">=1.17.2",
"local-ip": ">=2.0.0",
"node-pty": ">=0.10.1",
"passport": ">=0.6.0",
"passport-http": ">=0.3.0",
"passport-steam": ">=1.0.15",
"rcon-srcds": "^2.0.1",
"srcds-log-receiver": "^1.0.2",
"winston": ">=3.3.3",
"winston-daily-rotate-file": ">=4.5.5",
"ws": ">=8.0.0"
},
"name": "nodejs-csgo-api",
"description": "## Disclaimer The use of this software is at your own risk. It exposes control of your server and shell functions to the internet. Although I did everything to secure the API, any bugs may lead to security breaches on your server. I strongly adivise to use secure connections to prevent possible man-in-the-middle attacks.",
"version": "1.1.0",
"main": "serverControl.js",
"directories": {
"example": "example"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/taraman17/nodejs-csgo-api.git"
},
"keywords": [
"csgo",
"csgo_ds",
"api"
],
"author": "Taraman17",
"license": "GPL-3.0-or-later",
"bugs": {
"url": "https://github.com/taraman17/nodejs-csgo-api/issues"
},
"homepage": "https://github.com/taraman17/nodejs-csgo-api#readme"
}
8 changes: 4 additions & 4 deletions serverControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ controlEmitter.on('exec', (operation, action) => {
serverInfo.map = sf.cutMapName(mapstring);
});
sf.reloadMaplist().then((answer) => {
if (answer == '{ "success": false }') {
logger.warn("Maps could not be loaded");
}
logger.info('Maps reloaded');
}).catch((err) => {
logger.warn("Maps could not be loaded");
});
}
});
Expand Down Expand Up @@ -319,7 +319,7 @@ if (cfg.webSockets) {
* @listens ws#message
*/
ws.on('message', (message) => {
if (message.search('infoRequest') != -1) {
if (message.toString().search('infoRequest') != -1) {
sendUpdate();
}
});
Expand Down

0 comments on commit e4e21b5

Please sign in to comment.