From eecae24e830599dcbe27cacd7b9e5f42531a00d6 Mon Sep 17 00:00:00 2001 From: Alex Macocian Date: Sun, 11 Aug 2024 12:10:52 +0200 Subject: [PATCH] Update READMEs --- .../GuildWarsPartySearch.Server.csproj | 2 +- GuildWarsPartySearch/README.md | 40 ++++++++++ README.md | 80 ++----------------- 3 files changed, 47 insertions(+), 75 deletions(-) create mode 100644 GuildWarsPartySearch/README.md diff --git a/GuildWarsPartySearch/GuildWarsPartySearch.Server.csproj b/GuildWarsPartySearch/GuildWarsPartySearch.Server.csproj index 69df062..1d239d4 100644 --- a/GuildWarsPartySearch/GuildWarsPartySearch.Server.csproj +++ b/GuildWarsPartySearch/GuildWarsPartySearch.Server.csproj @@ -9,7 +9,7 @@ - + diff --git a/GuildWarsPartySearch/README.md b/GuildWarsPartySearch/README.md new file mode 100644 index 0000000..ddc570a --- /dev/null +++ b/GuildWarsPartySearch/README.md @@ -0,0 +1,40 @@ +# GuildWarsPartySeach.Server + +## Building + +### Local +- Install [.NET 8 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) +- Restore project +- Build and Launch Debug configuration + +### Docker +#### Build +- `docker build -t guildwarspartysearch.server .` +- `docker create --name partysearch -p 8080:80 guildwarspartysearch.server.latest` + - For a custom configuration: `docker cp [PATH_TO_CUSTOM_CONFIG].json partysearch:/app/Config.json` +- `docker start partysearch` + +#### Change configuration +- `docker stop partysearch` +- `docker cp [PATH_TO_CUSTOM_CONFIG].json partysearch:/app/Config.json` +- `docker start partysearch` + +#### Change static content +- `docker stop partysearch` +- `docker cp [PATH_TO_CONTENT_DIR] partysearch:/app` +- `docker start partysearch` + +#### Manually modify SQLite db +- `docker stop partysearch` +- `docker cp partysearch:/app/partysearches.db [LOCAL_PATH_FOR_DB]/partysearches.db` +- Use something like [DB4S](https://sqlitebrowser.org/) to browse and modify the database file +- `docker cp [LOCAL_PATH_FOR_DB]/partysearches.db partysearch:/app/partysearches.db` +- `docker start partysearch` + +## Configuration +Found in Config.[ENV].json +- `ServerOptions.Port` dictates the port on which the server will accept connections +- `PartySearchDatabaseOptions.TableName` is the name of the party searches table in the SQLite db +- `BotHistoryDatabaseOptions.TableName` is the name of the bot actions history table in the SQLite db +- `IpWhitelistOptions.Addresses` is an array of addresses that are whitelisted by IP. These are the addresses that are allowed to open bot connections and push updates +- `ContentOptions.StagingFolder` is the relative path of the static content that is served by the server \ No newline at end of file diff --git a/README.md b/README.md index c4379d1..224a29d 100644 --- a/README.md +++ b/README.md @@ -1,78 +1,10 @@ # GuildWarsPartySearch Party Search Aggregator -## GuildWarsPartySearch.Server +## Build & Launch +Check the README files in each subproject -### Usage -- Bots connect with websocket to `party-search/update` where they push the current state of their map. Sample payload: -```json -{ - "map_id": 857, - "district_region": -2, - "district_number": 1, - "district_language": 0, - "parties": [ - { - "party_id": 1, - "district_number": 1, - "district_language": 0, - "message": "", - "sender": "Gaile Gray", - "party_size": 4, - "hero_count": 3, - "hard_mode": 1, - "search_type": 1, - "primary": 3, - "secondary": 10, - "level": 20 - } - ] -} -``` -- Bots need to have `User-Agent` header set and have their IP whitelisted. `User-Agent` identifies the bot. -- The client/user connects with websocket to `party-search/live-feed` -- When the client first connects, it receives a json with all the party searches currently in the database (all the snapshots). Sample payload: -```json -{ - "Searches": - [ - { - "map_id":857, - "district_region":-2, - "district_number":1, - "district_language":0, - "parties": - [ - { - "party_id":1, - "district_number":1, - "district_language":0, - "message":"", - "sender":"Gaile Gray", - "party_size":4, - "hero_count":3, - "hard_mode":1, - "search_type":1, - "primary":3, - "secondary":10, - "level":20 - } - ] - } - ] -} -``` -- Whenever a bot posts an update, all clients receive that update in the same json format as the first message -- There's a status page `/status/bots` where you can see a list of all the currently connected bots. You need to have your IP whitelisted set to see the page -- Check https://guildwarspartysearch.azurewebsites.net/swagger for the swagger docs and examples of the server - -## GuildWarsPartySearch.BotUploader -The resulting dll needs to be injected into a running Guild Wars process. - -When injecting, the dll needs a file called config.txt in the same folder. - -### Config.txt -Config file that contains 3 lines. -1. Uri of the party service (guildwarspartysearch.northeurope.azurecontainer.io) -2. The API Key necesarry for the bot to access the upload endpoint -3. Bot name. This is an identifier of the bot. This appears on /status/bots when the bot is connected +## Usage +- Launch GuildWarsPartySearch.Server +- Build and run a bot from GuildWarsPartySearch.Bot +- Go to http://localhost