-
-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔀Merge pull request #411 from TF2Autobot/development
#411 ## Added - Mainly if you're using generic Unusual buy order feature: - ✨option to not automatically add bought Unusual item to the pricelist (usual because buying with Generic Unusual buy order - #412, [Wiki](https://github.com/TF2Autobot/tf2autobot/wiki/Configure-your-options.json-file#--automatic-add-invalid-unusual--)) - @joekiller - new options added: - `pricelist.autoAddInvalidUnusual.enable` (default is `false`) - `sendAlert.receivedUnusualNotInPricelist` (default if `true`) - ✨HTTP API health check (and others in the future - #413, [Wiki](https://github.com/TF2Autobot/tf2autobot/wiki/Configuring-the-bot#api)) - @rennokki - new env variables: - `ENABLE_HTTP_API` (default is `false`) - `HTTP_API_PORT` (default is `3001`) - ✨option to show proper item name in trade/offer summary (with "The", no short - #415, [Wiki](https://github.com/TF2Autobot/tf2autobot/wiki/Configure-your-options.json-file#-trade-summary-settings-)) - @idinium96 - new options added: - `tradeSummary.showProperName` (default is `false`) ## Updates - Partial price update feature (updated #337): - ⛔ do not partial price Mann Co. Supply Crate Key (#407) - @idinium96 - ✅ add an option to exclude items for partial price update (#408, [Wiki](https://github.com/TF2Autobot/tf2autobot/wiki/Configure-your-options.json-file#--partial-price-update--)) - @idinium96 - new options.json property: `pricelist.partialPriceUpdate.excludeSKU` (default is `[]`) - 💅 include name in partial price update summary (#409) - @idinium96 - ⛔ do not perform usual update if grouped (#410) - @idinium96 - 🔨 refactor Bot.ts (#399) - @arik123 - 🔎🔑 keyPrices verification (2) and 🔨 small refactor on Pricelist.ts (#416) - @idinium96 - 🔕 ignore some error on fail action or to accept mobile confirmation (#419) - @idinium96 - 🔨 refactor: use Map and Set (#420) - @idinium96 - 🎨 show amount offering/offered/taking/taken in overstocked/understocked review/trade summary (#421) - @idinium96
- Loading branch information
Showing
27 changed files
with
1,057 additions
and
406 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* eslint-disable @typescript-eslint/no-unsafe-return */ | ||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ | ||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ | ||
/* eslint-disable @typescript-eslint/no-unsafe-call */ | ||
|
||
import bodyParser from 'body-parser'; | ||
import express from 'express'; | ||
import log from '../lib/logger'; | ||
import Options from './Options'; | ||
|
||
export default class HttpManager { | ||
/** | ||
* The Express.js app. | ||
*/ | ||
protected app: express.Application; | ||
|
||
/** | ||
* Initialize the HTTP manager. | ||
* | ||
* @param options - The options list. | ||
*/ | ||
constructor(protected options: Options) { | ||
this.app = express(); | ||
this.app.use(bodyParser.json()); | ||
this.app.use(bodyParser.urlencoded({ extended: false })); | ||
|
||
this.registerRoutes(); | ||
} | ||
|
||
/** | ||
* Register the routes. | ||
*/ | ||
protected registerRoutes(): void { | ||
this.app.get('/health', (req, res) => res.send('OK')); | ||
this.app.get('/uptime', (req, res) => res.json({ uptime: process.uptime() })); | ||
} | ||
|
||
/** | ||
* Start the server. | ||
*/ | ||
start(): Promise<void> { | ||
return new Promise(resolve => { | ||
this.app.listen(this.options.httpApiPort, () => { | ||
log.debug(`HTTP Server started: http://127.0.0.1:${this.options.httpApiPort}`); | ||
log.info(`This is NOT a HTTP API used to handle data within the bot. | ||
It is solely for managing the bot programatically by providing healthchecks & uptime details.`); | ||
log.info(`Please use the TF2Bot GUI v3+ as the main API source.`); | ||
log.info(`https://github.com/TF2Autobot/tf2autobot-gui`); | ||
resolve(); | ||
}); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.