From cdee9e5a3a3f9fb7f0ec0a8f6caecd4ac788f204 Mon Sep 17 00:00:00 2001 From: Berserker66 Date: Sat, 11 Jul 2020 16:59:37 +0200 Subject: [PATCH] WebHost: Move module into WebHostLib to prevent shadowing WebHost.py --- WebHost.py | 6 +++--- {WebHost => WebHostLib}/__init__.py | 2 +- {WebHost => WebHostLib}/autolauncher.py | 0 {WebHost => WebHostLib}/customserver.py | 6 +++--- {WebHost => WebHostLib}/landing.py | 2 +- {WebHost => WebHostLib}/models.py | 0 {WebHost => WebHostLib}/requirements.txt | 0 {WebHost => WebHostLib}/static/jquery.scrollsync.js | 0 {WebHost => WebHostLib}/static/static.css | 0 {WebHost => WebHostLib}/templates/host_room.html | 0 {WebHost => WebHostLib}/templates/landing.html | 0 {WebHost => WebHostLib}/templates/layout.html | 0 {WebHost => WebHostLib}/templates/macros.html | 0 {WebHost => WebHostLib}/templates/tracker.html | 0 {WebHost => WebHostLib}/templates/uploads.html | 0 {WebHost => WebHostLib}/templates/view_seed.html | 0 {WebHost => WebHostLib}/tracker.py | 2 +- {WebHost => WebHostLib}/upload.py | 2 +- 18 files changed, 10 insertions(+), 10 deletions(-) rename {WebHost => WebHostLib}/__init__.py (98%) rename {WebHost => WebHostLib}/autolauncher.py (100%) rename {WebHost => WebHostLib}/customserver.py (96%) rename {WebHost => WebHostLib}/landing.py (82%) rename {WebHost => WebHostLib}/models.py (100%) rename {WebHost => WebHostLib}/requirements.txt (100%) rename {WebHost => WebHostLib}/static/jquery.scrollsync.js (100%) rename {WebHost => WebHostLib}/static/static.css (100%) rename {WebHost => WebHostLib}/templates/host_room.html (100%) rename {WebHost => WebHostLib}/templates/landing.html (100%) rename {WebHost => WebHostLib}/templates/layout.html (100%) rename {WebHost => WebHostLib}/templates/macros.html (100%) rename {WebHost => WebHostLib}/templates/tracker.html (100%) rename {WebHost => WebHostLib}/templates/uploads.html (100%) rename {WebHost => WebHostLib}/templates/view_seed.html (100%) rename {WebHost => WebHostLib}/tracker.py (99%) rename {WebHost => WebHostLib}/upload.py (98%) diff --git a/WebHost.py b/WebHost.py index 88e994bf..ce42fcd8 100644 --- a/WebHost.py +++ b/WebHost.py @@ -2,11 +2,11 @@ import os import multiprocessing import logging -from WebHost import app as raw_app +from WebHostLib import app as raw_app from waitress import serve -from WebHost.models import db -from WebHost.autolauncher import autohost +from WebHostLib.models import db +from WebHostLib.autolauncher import autohost configpath = "config.yaml" diff --git a/WebHost/__init__.py b/WebHostLib/__init__.py similarity index 98% rename from WebHost/__init__.py rename to WebHostLib/__init__.py index be56d2f7..07a571ca 100644 --- a/WebHost/__init__.py +++ b/WebHostLib/__init__.py @@ -108,5 +108,5 @@ def host_room(room: UUID): 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 diff --git a/WebHost/autolauncher.py b/WebHostLib/autolauncher.py similarity index 100% rename from WebHost/autolauncher.py rename to WebHostLib/autolauncher.py diff --git a/WebHost/customserver.py b/WebHostLib/customserver.py similarity index 96% rename from WebHost/customserver.py rename to WebHostLib/customserver.py index 7dc845b4..3cd7df02 100644 --- a/WebHost/customserver.py +++ b/WebHostLib/customserver.py @@ -20,7 +20,7 @@ from Utils import get_public_ipv4, get_public_ipv6 class CustomClientMessageProcessor(ClientMessageProcessor): ctx: WebHostContext 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 self.ctx.video[self.client.team, self.client.slot] = "Twitch", user self.ctx.save() @@ -45,7 +45,7 @@ class WebHostContext(Context): super(WebHostContext, self).__init__("", 0, "", 1, 40, True, "enabled", "enabled", 0) self.main_loop = asyncio.get_running_loop() self.video = {} - self.tags = ["Berserker", "WebHost"] + self.tags = ["Berserker", "WebHostLib"] def listen_to_db_commands(self): cmdprocessor = DBCommandProcessor(self) @@ -139,4 +139,4 @@ def run_server_process(room_id, ponyconfig: dict): asyncio.run(main()) -from WebHost import LOGS_FOLDER +from WebHostLib import LOGS_FOLDER diff --git a/WebHost/landing.py b/WebHostLib/landing.py similarity index 82% rename from WebHost/landing.py rename to WebHostLib/landing.py index 8a8eca26..3bc3488b 100644 --- a/WebHost/landing.py +++ b/WebHostLib/landing.py @@ -1,5 +1,5 @@ from flask import render_template -from WebHost import app, cache +from WebHostLib import app, cache @cache.memoize(timeout=300) diff --git a/WebHost/models.py b/WebHostLib/models.py similarity index 100% rename from WebHost/models.py rename to WebHostLib/models.py diff --git a/WebHost/requirements.txt b/WebHostLib/requirements.txt similarity index 100% rename from WebHost/requirements.txt rename to WebHostLib/requirements.txt diff --git a/WebHost/static/jquery.scrollsync.js b/WebHostLib/static/jquery.scrollsync.js similarity index 100% rename from WebHost/static/jquery.scrollsync.js rename to WebHostLib/static/jquery.scrollsync.js diff --git a/WebHost/static/static.css b/WebHostLib/static/static.css similarity index 100% rename from WebHost/static/static.css rename to WebHostLib/static/static.css diff --git a/WebHost/templates/host_room.html b/WebHostLib/templates/host_room.html similarity index 100% rename from WebHost/templates/host_room.html rename to WebHostLib/templates/host_room.html diff --git a/WebHost/templates/landing.html b/WebHostLib/templates/landing.html similarity index 100% rename from WebHost/templates/landing.html rename to WebHostLib/templates/landing.html diff --git a/WebHost/templates/layout.html b/WebHostLib/templates/layout.html similarity index 100% rename from WebHost/templates/layout.html rename to WebHostLib/templates/layout.html diff --git a/WebHost/templates/macros.html b/WebHostLib/templates/macros.html similarity index 100% rename from WebHost/templates/macros.html rename to WebHostLib/templates/macros.html diff --git a/WebHost/templates/tracker.html b/WebHostLib/templates/tracker.html similarity index 100% rename from WebHost/templates/tracker.html rename to WebHostLib/templates/tracker.html diff --git a/WebHost/templates/uploads.html b/WebHostLib/templates/uploads.html similarity index 100% rename from WebHost/templates/uploads.html rename to WebHostLib/templates/uploads.html diff --git a/WebHost/templates/view_seed.html b/WebHostLib/templates/view_seed.html similarity index 100% rename from WebHost/templates/view_seed.html rename to WebHostLib/templates/view_seed.html diff --git a/WebHost/tracker.py b/WebHostLib/tracker.py similarity index 99% rename from WebHost/tracker.py rename to WebHostLib/tracker.py index d0d18b66..385b7bef 100644 --- a/WebHost/tracker.py +++ b/WebHostLib/tracker.py @@ -7,7 +7,7 @@ import logging from uuid import UUID import Items -from WebHost import app, cache, Room +from WebHostLib import app, cache, Room def get_id(item_name): diff --git a/WebHost/upload.py b/WebHostLib/upload.py similarity index 98% rename from WebHost/upload.py rename to WebHostLib/upload.py index 890e027e..547665d7 100644 --- a/WebHost/upload.py +++ b/WebHostLib/upload.py @@ -6,7 +6,7 @@ import logging from flask import request, flash, redirect, url_for, session, render_template 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", "spoiler": ".txt",