* Added ability to define custom port ranges the WebHost will use for game servers, instead of pure random.
* - Added better fallback to default port range when a custom range fails
- Updated config to be clearer
* Added ability to define custom port ranges the WebHost will use for game servers, instead of pure random.
* - Added better fallback to default port range when a custom range fails
- Updated config to be clearer
* Updated soft-fail message
* Removed dead import from customserver.py
* Update requirements.txt
Settings requirements to main core branch
* fix what reviewers said and add some improvements
* remove unused argument
* try fixing test with try
* use yaml lists instead of string for config
* fix value type bug on ephemeral type
* reuse sockets with websockets api instead of opening and closing them
* add used ports cache and filter used ports when looking for ports
* fix port randomizer
* Apply suggestions from code review
Co-authored-by: Duck <31627079+duckboycool@users.noreply.github.com>
* fix some reviews
* use weights for random port and remove more-itertools
* fix net_connections not working on macOS
* rename variables and functions
* lazy init `get_used_ports`
* change `game_ports` to be `tuple`
* fix last_used_ports not being updated locally
* fix random choices and move game_port conversion into tuple
* Apply suggestions from code review
Co-authored-by: Duck <31627079+duckboycool@users.noreply.github.com>
* use a named tuple on parse_game_ports
* only use ranges
* do it the duck way
* this should check all usable ports before failing
* fix while loop
* add return type to weighted random
* Update WebHostLib/customserver.py
Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com>
* simplify tuple conversion check
* add tests
* reformat file and change `create_random_port_socket` test
* add more test cases for parse_game_ports
* try to prevent busy-looping on create random port socket when doing test
* simplify parse game port tests to one assertListEqual
* make the range lesser for port test
* reduce range on macOS
* Apply suggestions from code review
Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com>
* Update WebHostLib/customserver.py
Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com>
* Apply suggestions from code review
Co-authored-by: Doug Hoskisson <beauxq@users.noreply.github.com>
* remove unused import
* Update WebHostLib/customserver.py
Co-authored-by: Doug Hoskisson <beauxq@users.noreply.github.com>
* use generator expressions
* check for 0-tuple
* use some kind of shuffled queue
* update tests
* refactor new port handling into a class (#1)
* change time to monotonic
* Update docs/webhost configuration sample.yaml
Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com>
* add psutil 7.2.2 as requirement
* Update WebHostLib/requirements.txt
Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com>
---------
Co-authored-by: Lexipherous <jasonnlelong@gmail.com>
Co-authored-by: Duck <31627079+duckboycool@users.noreply.github.com>
Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com>
Co-authored-by: Doug Hoskisson <beauxq@users.noreply.github.com>
* WebHost: disallow '=' and whitespace in SUUID and append the correct number of '='
This makes Room IDs unambiguous and avoids breaking if b64decode ever becomes strict.
* Tests, WebHost: add SUUID tests
* Tests, WebHost: add edge cases to SUUID tests
* Multiple: resize FR RA network commands screenshot
This is now more in line with the text (and the english version).
* Multiple: optimize EN RA network commands screenshot
The URL has changed, so it's a good time to optimize.
* WebHost, Worlds: fix retroarch images not showing
Implements a src/url replacement for relative paths.
Moves the RA screenshots to worlds/generic since they are shared.
Also now uses the FR version in ffmq.
Also fixes the formatting that resultet in the list breaking.
Also moves imports in render_markdown.
Guides now also properly render on Github.
* Factorio: optimize screenshots
The URL has changed, so it's a good time to optimize.
* Factorio: change guide screenshots to use relative URL
* Test: markdown: fix tests on Windows
We also can't use delete=True, delete_on_close=False
because that's not supported in Py3.11.
* Test: markdown: fix typo
I hope that's it now. *sigh*
* Landstalker: fix doc images not showing
Change to relative img urls.
* Landstalker: optimize doc PNGs
The URL has changed, so it's a good time to optimize.
* CounterOption
* bring back the negative exception for ItemDict
* Backwards compatibility
* ruff on witness
* fix in calls
* move the contains
* comment
* comment
* Add option min and max values for CounterOption
* Use min 0 for TrapWeights
* This is safe now
* ruff
* This fits on one line again now
* OptionCounter
* Update Options.py
* Couple more typing things
* Update Options.py
* Make StartInventory work again, also make LocationCounter theoretically work
* Docs
* more forceful wording
* forced line break
* Fix unit test (that wasn't breaking?)
* Add trapweights to witness option presets to 'prove' that the unit test passes
* Make it so you can order stuff
* Update macros.html
* WebHost: use new safe yaml template filename
this mirrors the change in ArchipelagoMW/#4106 in WebHost
* WebHost: install docs into safe filename and require docs to be named safe
* Test: update doc test for safe name
* WebHost: fix import order to not break ModuleUpdate
* WebHost: add spinner to room command
and show error message if fetch fails due to NetworkError
* WebHost: don't update room log while tab is inactive
* WebHost: don't include log for automated requests
* WebHost: refresh room also for re-spinups
and do that from javascript
* Test, WebHost: send fake user-agent where required
* WebHost: remove wrong comment in host room
* Tests, WebHost: move out setUp and fix typing in api_generate
Also fixes a typo
and changes client to be per-test rather than a ClassVar
* Tests, WebHost: add tests for display_log endpoint
* Tests, WebHost: add tests for host_room endpoint
* Tests, WebHost: enable Flask DEBUG mode for tests
This provides the actual error if a test raised an exception on the server.
* Tests, WebHost: use user_path for logs
This is what custom_server does now.
* Tests, WebHost: avoid triggering security scans
* Core: lazy-load worlds in unpickler
this should hopefully fix customserver's memory consumption
* WebHost: move imports around to save memory in MP
* MultiServer: prefer loading _speedups without pyximport
This saves ~15MB per MP and speeds up module import if it was built in-place.
* Tests: fix tests for changed WebHost imports
* CustomServer: run GC after setup
* CustomServer: cleanup exception handling