Merge remote-tracking branch 'origin/master' into pull/122

This commit is contained in:
Fabian Dill 2020-07-12 19:16:45 +02:00
commit ba4226ab1d
22 changed files with 19 additions and 20 deletions

View File

@ -19,7 +19,7 @@ def update():
update_ran = True update_ran = True
path = os.path.join(os.path.dirname(sys.argv[0]), 'requirements.txt') path = os.path.join(os.path.dirname(sys.argv[0]), 'requirements.txt')
if not os.path.exists(path): if not os.path.exists(path):
os.path.join(os.path.dirname(__file__), 'requirements.txt') path = os.path.join(os.path.dirname(__file__), 'requirements.txt')
with open(path) as requirementsfile: with open(path) as requirementsfile:
for line in requirementsfile.readlines(): for line in requirementsfile.readlines():
module, remote_version = line.split(">=") module, remote_version = line.split(">=")

View File

@ -647,7 +647,7 @@ class CommonCommandProcessor(CommandProcessor):
for option in self.simple_options: for option in self.simple_options:
self.output(f"Option {option} is set to {getattr(self.ctx, option)}") self.output(f"Option {option} is set to {getattr(self.ctx, option)}")
class ClientMessageProcessor(CommandProcessor): class ClientMessageProcessor(CommonCommandProcessor):
marker = "!" marker = "!"
def __init__(self, ctx: Context, client: Client): def __init__(self, ctx: Context, client: Client):

View File

@ -281,7 +281,6 @@ junk_texts = [
"{C:GREEN}\nThe gnome asks\nyou to guess\nhis name. >", "{C:GREEN}\nThe gnome asks\nyou to guess\nhis name. >",
"{C:GREEN}\nI heard beans\non toast is a\ngreat meal. >", "{C:GREEN}\nI heard beans\non toast is a\ngreat meal. >",
"{C:GREEN}\n> Sweetcorn\non pizza is a\ngreat choice.", "{C:GREEN}\n> Sweetcorn\non pizza is a\ngreat choice.",
"{C:GREEN}\n> race roms\ndont have\nspoiler logs",
"{C:GREEN}\nI bet a nice\ncup of tea\nwould help! >", "{C:GREEN}\nI bet a nice\ncup of tea\nwould help! >",
"{C:GREEN}\nI bet you\nexpected help,\ndidn't you? >", "{C:GREEN}\nI bet you\nexpected help,\ndidn't you? >",
"{C:GREEN}\nLearn to make\nplogues, easy\nand yummy! >", "{C:GREEN}\nLearn to make\nplogues, easy\nand yummy! >",
@ -297,7 +296,7 @@ junk_texts = [
"{C:GREEN}\n> READ\nor the owl\nwill eat you.", "{C:GREEN}\n> READ\nor the owl\nwill eat you.",
"{C:GREEN}\n> Bunnies\nare cute.", "{C:GREEN}\n> Bunnies\nare cute.",
"{C:GREEN}\nPugs are the\nsuperior dog\nbreed. >", "{C:GREEN}\nPugs are the\nsuperior dog\nbreed. >",
"{C:GREEN}\nYou are\nplaying\nALTTPR. >", "{C:GREEN}\nThis is\nBerserker's\nMultiworld.>",
"{C:GREEN}\nOther randos\nexist too!\nTry some! >", "{C:GREEN}\nOther randos\nexist too!\nTry some! >",
] ]

View File

@ -2,11 +2,11 @@ import os
import multiprocessing import multiprocessing
import logging import logging
from WebHost import app as raw_app from WebHostLib import app as raw_app
from waitress import serve from waitress import serve
from WebHost.models import db from WebHostLib.models import db
from WebHost.autolauncher import autohost from WebHostLib.autolauncher import autohost
configpath = "config.yaml" configpath = "config.yaml"

View File

@ -108,5 +108,5 @@ def host_room(room: UUID):
return render_template("host_room.html", room=room) return render_template("host_room.html", room=room)
from WebHost.customserver import run_server_process from WebHostLib.customserver import run_server_process
from . import tracker, upload, landing # to trigger app routing picking up on it from . import tracker, upload, landing # to trigger app routing picking up on it

View File

@ -45,8 +45,8 @@ else: # unix
class Locker(CommonLocker): class Locker(CommonLocker):
def __enter__(self): def __enter__(self):
self.fp = open(self.lockfile, "rb")
try: try:
self.fp = open(self.lockfile, "wb")
fcntl.flock(self.fp.fileno(), fcntl.LOCK_EX) fcntl.flock(self.fp.fileno(), fcntl.LOCK_EX)
except OSError as e: except OSError as e:
raise AlreadyRunningException() from e raise AlreadyRunningException() from e
@ -72,6 +72,7 @@ def autohost(config: dict):
def keep_running(): def keep_running():
try: try:
with Locker("autohost"): with Locker("autohost"):
logging.info("Starting autohost service")
# db.bind(**config["PONY"]) # db.bind(**config["PONY"])
# db.generate_mapping(check_tables=False) # db.generate_mapping(check_tables=False)
while 1: while 1:

View File

@ -20,7 +20,7 @@ from Utils import get_public_ipv4, get_public_ipv6
class CustomClientMessageProcessor(ClientMessageProcessor): class CustomClientMessageProcessor(ClientMessageProcessor):
ctx: WebHostContext ctx: WebHostContext
def _cmd_video(self, platform, user): def _cmd_video(self, platform, user):
"""Set a link for your name in the WebHost tracker pointing to a video stream""" """Set a link for your name in the WebHostLib tracker pointing to a video stream"""
if platform.lower().startswith("t"): # twitch if platform.lower().startswith("t"): # twitch
self.ctx.video[self.client.team, self.client.slot] = "Twitch", user self.ctx.video[self.client.team, self.client.slot] = "Twitch", user
self.ctx.save() self.ctx.save()
@ -139,4 +139,4 @@ def run_server_process(room_id, ponyconfig: dict):
asyncio.run(main()) asyncio.run(main())
from WebHost import LOGS_FOLDER from WebHostLib import LOGS_FOLDER

View File

@ -1,5 +1,5 @@
from flask import render_template from flask import render_template
from WebHost import app, cache from WebHostLib import app, cache
@cache.memoize(timeout=300) @cache.memoize(timeout=300)

View File

@ -4,5 +4,3 @@ waitress>=1.4.4
flask-caching>=1.9.0 flask-caching>=1.9.0
Flask-Autoversion>=0.2.0 Flask-Autoversion>=0.2.0
Flask-Compress>=1.5.0 Flask-Compress>=1.5.0
redis>=3.5.3
rq>=1.4.3

View File

@ -7,7 +7,7 @@ import logging
from uuid import UUID from uuid import UUID
import Items import Items
from WebHost import app, cache, Room from WebHostLib import app, cache, Room
def get_id(item_name): def get_id(item_name):

View File

@ -6,7 +6,7 @@ import logging
from flask import request, flash, redirect, url_for, session, render_template from flask import request, flash, redirect, url_for, session, render_template
from pony.orm import commit, select from pony.orm import commit, select
from WebHost import app, allowed_file, Seed, Room, Patch from WebHostLib import app, allowed_file, Seed, Room, Patch
accepted_zip_contents = {"patches": ".bmbp", accepted_zip_contents = {"patches": ".bmbp",
"spoiler": ".txt", "spoiler": ".txt",

View File

@ -185,9 +185,10 @@ timer:
glitch_boots: glitch_boots:
on: 1 # enables that you start with Pegasus Boots in any glitched logic mode on: 1 # enables that you start with Pegasus Boots in any glitched logic mode
off: 0 off: 0
remote_items: # Warning: currently broken. Stores all your items on the server, effectively sending them to you as if another player picked it up door_shuffle: # Only available if the host uses the doors branch, it is ignored otherwise
on: 0 # intended for racing, as the item information is missing from the ROM vanilla: 1 # everything should be like in vanilla
off: 1 basic: 0 # dungeons are shuffled within themselves.
crossed: 0 # dungeons are shuffled across each other.
linked_options: linked_options:
- name: crosskeys - name: crosskeys
options: # these overwrite earlier options if the percentage chance triggers options: # these overwrite earlier options if the percentage chance triggers