diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f0699ec..b49acad8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## --- [4.3.3] - 2024/TBD ### Refactor - Refactor API keys "super user" to "full access" ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/731)) +- Refactor SBuilder to use Big Bucket Svc ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/755)) ### New features TBD ### Bug fixes diff --git a/app/classes/minecraft/bigbucket.py b/app/classes/minecraft/bigbucket.py new file mode 100644 index 00000000..591aa6d8 --- /dev/null +++ b/app/classes/minecraft/bigbucket.py @@ -0,0 +1,236 @@ +import os +import json +import threading +import time +import logging +from datetime import datetime +import requests + +from app.classes.controllers.servers_controller import ServersController +from app.classes.models.server_permissions import PermissionsServers +from app.classes.shared.file_helpers import FileHelpers +from app.classes.shared.websocket_manager import WebSocketManager + +logger = logging.getLogger(__name__) +# Temp type var until sjars restores generic fetchTypes0 + + +class BigBucket: + def __init__(self, helper): + self.helper = helper + # remove any trailing slash from config.json + # url since we add it on all the calls + self.base_url = str( + self.helper.get_setting("big_bucket_repo", "https://jars.arcadiatech.org") + ).rstrip("/") + + def _read_cache(self) -> dict: + cache_file = self.helper.big_bucket_cache + cache = {} + try: + with open(cache_file, "r", encoding="utf-8") as f: + cache = json.load(f) + + except Exception as e: + logger.error(f"Unable to read big_bucket cache file: {e}") + + return cache + + def get_bucket_data(self): + data = self._read_cache() + return data.get("categories") + + def _check_bucket_alive(self) -> bool: + logger.info("Checking Big Bucket status") + + check_url = f"{self.base_url}/healthcheck" + try: + response = requests.get(check_url, timeout=2) + response_json = response.json() + if ( + response.status_code in [200, 201] + and response_json.get("status") == "ok" + ): + logger.info("Big bucket is alive and responding as expected") + return True + except Exception as e: + logger.error(f"Unable to connect to big bucket due to error: {e}") + return False + + logger.error( + "Big bucket manifest is not available as expected or unable to contact" + ) + return False + + def _get_big_bucket(self) -> dict: + logger.debug("Calling for big bucket manifest.") + try: + response = requests.get(f"{self.base_url}/manifest.json", timeout=5) + if response.status_code in [200, 201]: + data = response.json() + del data["manifest_version"] + return data + return {} + except TimeoutError as e: + logger.error(f"Unable to get jars from remote with error {e}") + return {} + + def _refresh_cache(self): + """ + Contains the shared logic for refreshing the cache. + This method is called by both manual_refresh_cache and refresh_cache methods. + """ + if not self._check_bucket_alive(): + logger.error("big bucket API is not available.") + return False + + cache_data = { + "last_refreshed": datetime.now().strftime("%m/%d/%Y, %H:%M:%S"), + "categories": self._get_big_bucket(), + } + try: + with open( + self.helper.big_bucket_cache, "w", encoding="utf-8" + ) as cache_file: + json.dump(cache_data, cache_file, indent=4) + logger.info("Cache file successfully refreshed manually.") + except Exception as e: + logger.error(f"Failed to update cache file manually: {e}") + + def manual_refresh_cache(self): + """ + Manually triggers the cache refresh process. + """ + logger.info("Manual bucket cache refresh initiated.") + self._refresh_cache() + logger.info("Manual refresh completed.") + + def refresh_cache(self): + """ + Automatically trigger cache refresh process based age. + + This method checks if the cache file is older than a specified number of days + before deciding to refresh. + """ + cache_file_path = self.helper.big_bucket_cache + + # Determine if the cache is old and needs refreshing + cache_old = self.helper.is_file_older_than_x_days(cache_file_path) + + # debug override + # cache_old = True + + if not self._check_bucket_alive(): + logger.error("big bucket API is not available.") + return False + + if not cache_old: + logger.info("Cache file is not old enough to require automatic refresh.") + return False + + logger.info("Automatic cache refresh initiated due to old cache.") + self._refresh_cache() + + def get_fetch_url(self, jar, server, version) -> str: + """ + Constructs the URL for downloading a server JAR file based on the server type. + Parameters: + jar (str): The category of the JAR file to download. + server (str): Server software name (e.g., "paper"). + version (str): Server version. + + Returns: + str or None: URL for downloading the JAR file, or None if URL cannot be + constructed or an error occurs. + """ + try: + # Read cache file for URL that is in a list of one item + return self.get_bucket_data()[jar]["types"][server]["versions"][version][ + "url" + ][0] + except Exception as e: + logger.error(f"An error occurred while constructing fetch URL: {e}") + return None + + def download_jar(self, jar, server, version, path, server_id): + update_thread = threading.Thread( + name=f"server_download-{server_id}-{server}-{version}", + target=self.a_download_jar, + daemon=True, + args=(jar, server, version, path, server_id), + ) + update_thread.start() + + def a_download_jar(self, jar, server, version, path, server_id): + """ + Downloads a server JAR file and performs post-download actions including + notifying users and setting import status. + + This method waits for the server registration to complete, retrieves the + download URL for the specified server JAR file. + + Upon successful download, it either runs the installer for + Forge servers or simply finishes the import process for other types. It + notifies server users about the completion of the download. + + Parameters: + - jar (str): The category of the JAR file to download. + - server (str): The type of server software (e.g., 'forge', 'paper'). + - version (str): The version of the server software. + - path (str): The local filesystem path where the JAR file will be saved. + - server_id (str): The unique identifier for the server being updated or + imported, used for notifying users and setting the import status. + + Returns: + - bool: True if the JAR file was successfully downloaded and saved; + False otherwise. + + The method ensures that the server is properly registered before proceeding + with the download and handles exceptions by logging errors and reverting + the import status if necessary. + """ + # delaying download for server register to finish + time.sleep(3) + + fetch_url = self.get_fetch_url(jar, server, version) + if not fetch_url: + return False + + server_users = PermissionsServers.get_server_user_list(server_id) + + # Make sure the server is registered before updating its stats + while True: + try: + ServersController.set_import(server_id) + for user in server_users: + WebSocketManager().broadcast_user(user, "send_start_reload", {}) + break + except Exception as ex: + logger.debug(f"Server not registered yet. Delaying download - {ex}") + + # Initiate Download + jar_dir = os.path.dirname(path) + jar_name = os.path.basename(path) + logger.info(fetch_url) + success = FileHelpers.ssl_get_file(fetch_url, jar_dir, jar_name) + + # Post-download actions + if success: + if server == "forge-installer": + # If this is the newer Forge version, run the installer + ServersController.finish_import(server_id, True) + else: + ServersController.finish_import(server_id) + + # Notify users + for user in server_users: + WebSocketManager().broadcast_user( + user, "notification", "Executable download finished" + ) + time.sleep(3) # Delay for user notification + WebSocketManager().broadcast_user(user, "send_start_reload", {}) + else: + logger.error(f"Unable to save jar to {path} due to download failure.") + ServersController.finish_import(server_id) + + return success diff --git a/app/classes/minecraft/serverjars.py b/app/classes/minecraft/serverjars.py deleted file mode 100644 index 944ec382..00000000 --- a/app/classes/minecraft/serverjars.py +++ /dev/null @@ -1,395 +0,0 @@ -import os -import json -import threading -import time -import logging -from datetime import datetime -import requests - -from app.classes.controllers.servers_controller import ServersController -from app.classes.models.server_permissions import PermissionsServers -from app.classes.shared.file_helpers import FileHelpers -from app.classes.shared.websocket_manager import WebSocketManager - -logger = logging.getLogger(__name__) -# Temp type var until sjars restores generic fetchTypes0 -SERVERJARS_TYPES = ["modded", "proxies", "servers", "vanilla"] -PAPERJARS = ["paper", "folia"] - - -class ServerJars: - def __init__(self, helper): - self.helper = helper - self.base_url = "https://api.serverjars.com" - self.paper_base = "https://api.papermc.io" - - @staticmethod - def get_paper_jars(): - return PAPERJARS - - def get_paper_versions(self, project): - """ - Retrieves a list of versions for a specified project from the PaperMC API. - - Parameters: - project (str): The project name to query for available versions. - - Returns: - list: A list of version strings available for the project. Returns an empty - list if the API call fails or if no versions are found. - - This function makes a GET request to the PaperMC API to fetch available project - versions, The versions are returned in reverse order, with the most recent - version first. - """ - try: - response = requests.get( - f"{self.paper_base}/v2/projects/{project}/", timeout=2 - ) - response.raise_for_status() - api_data = response.json() - except Exception as e: - logger.error(f"Error loading project versions for {project}: {e}") - return [] - - versions = api_data.get("versions", []) - versions.reverse() # Ensure the most recent version comes first - return versions - - def get_paper_build(self, project, version): - """ - Fetches the latest build for a specified project and version from PaperMC API. - - Parameters: - project (str): Project name, typically a server software like 'paper'. - version (str): Project version to fetch the build number for. - - Returns: - int or None: Latest build number if successful, None if not or on error. - - This method attempts to query the PaperMC API for the latest build and - handles exceptions by logging errors and returning None. - """ - try: - response = requests.get( - f"{self.paper_base}/v2/projects/{project}/versions/{version}/builds/", - timeout=2, - ) - response.raise_for_status() - api_data = response.json() - except Exception as e: - logger.error(f"Error fetching build for {project} {version}: {e}") - return None - - builds = api_data.get("builds", []) - return builds[-1] if builds else None - - def _read_cache(self): - cache_file = self.helper.serverjar_cache - cache = {} - try: - with open(cache_file, "r", encoding="utf-8") as f: - cache = json.load(f) - - except Exception as e: - logger.error(f"Unable to read serverjars.com cache file: {e}") - - return cache - - def get_serverjar_data(self): - data = self._read_cache() - return data.get("types") - - def _check_sjars_api_alive(self): - logger.info("Checking serverjars.com API status") - - check_url = f"{self.base_url}" - try: - response = requests.get(check_url, timeout=2) - response_json = response.json() - - if ( - response.status_code in [200, 201] - and response_json.get("status") == "success" - and response_json.get("response", {}).get("status") == "ok" - ): - logger.info("Serverjars.com API is alive and responding as expected") - return True - except Exception as e: - logger.error(f"Unable to connect to serverjar.com API due to error: {e}") - return False - - logger.error( - "Serverjars.com API is not responding as expected or unable to contact" - ) - return False - - def _fetch_projects_for_type(self, server_type): - """ - Fetches projects for a given server type from the ServerJars API. - """ - try: - response = requests.get( - f"{self.base_url}/api/fetchTypes/{server_type}", timeout=5 - ) - response.raise_for_status() # Ensure HTTP errors are caught - data = response.json() - if data.get("status") == "success": - return data["response"].get("servers", []) - except requests.RequestException as e: - print(f"Error fetching projects for type {server_type}: {e}") - return [] - - def _get_server_type_list(self): - """ - Builds the type structure with projects fetched for each type. - """ - type_structure = {} - for server_type in SERVERJARS_TYPES: - projects = self._fetch_projects_for_type(server_type) - type_structure[server_type] = {project: [] for project in projects} - return type_structure - - def _get_jar_versions(self, server_type, project_name, max_ver=50): - """ - Grabs available versions for specified project - - Args: - server_type (str): Server Type Category (modded, servers, etc) - project_name (str): Target project (paper, forge, magma, etc) - max (int, optional): Max versions returned. Defaults to 50. - - Returns: - list: An array of versions - """ - url = f"{self.base_url}/api/fetchAll/{server_type}/{project_name}?max={max_ver}" - try: - response = requests.get(url, timeout=5) - response.raise_for_status() # Ensure HTTP errors are caught - data = response.json() - logger.debug(f"Received data for {server_type}/{project_name}: {data}") - - if data.get("status") == "success": - versions = [ - item.get("version") - for item in data.get("response", []) - if "version" in item - ] - versions.reverse() # Reverse so versions are newest -> oldest - logger.debug(f"Versions extracted: {versions}") - return versions - except requests.RequestException as e: - logger.error( - f"Error fetching jar versions for {server_type}/{project_name}: {e}" - ) - - return [] - - def _refresh_cache(self): - """ - Contains the shared logic for refreshing the cache. - This method is called by both manual_refresh_cache and refresh_cache methods. - """ - now = datetime.now() - cache_data = { - "last_refreshed": now.strftime("%m/%d/%Y, %H:%M:%S"), - "types": self._get_server_type_list(), - } - - for server_type, projects in cache_data["types"].items(): - for project_name in projects: - versions = self._get_jar_versions(server_type, project_name) - cache_data["types"][server_type][project_name] = versions - - for paper_project in PAPERJARS: - cache_data["types"]["servers"][paper_project] = self.get_paper_versions( - paper_project - ) - - return cache_data - - def manual_refresh_cache(self): - """ - Manually triggers the cache refresh process. - """ - if not self._check_sjars_api_alive(): - logger.error("ServerJars API is not available.") - return False - - logger.info("Manual cache refresh requested.") - cache_data = self._refresh_cache() - - # Save the updated cache data - try: - with open(self.helper.serverjar_cache, "w", encoding="utf-8") as cache_file: - json.dump(cache_data, cache_file, indent=4) - logger.info("Cache file successfully refreshed manually.") - except Exception as e: - logger.error(f"Failed to update cache file manually: {e}") - - def refresh_cache(self): - """ - Automatically trigger cache refresh process based age. - - This method checks if the cache file is older than a specified number of days - before deciding to refresh. - """ - cache_file_path = self.helper.serverjar_cache - - # Determine if the cache is old and needs refreshing - cache_old = self.helper.is_file_older_than_x_days(cache_file_path) - - # debug override - # cache_old = True - - if not self._check_sjars_api_alive(): - logger.error("ServerJars API is not available.") - return False - - if not cache_old: - logger.info("Cache file is not old enough to require automatic refresh.") - return False - - logger.info("Automatic cache refresh initiated due to old cache.") - cache_data = self._refresh_cache() - - # Save the updated cache data - try: - with open(cache_file_path, "w", encoding="utf-8") as cache_file: - json.dump(cache_data, cache_file, indent=4) - logger.info("Cache file successfully refreshed automatically.") - except Exception as e: - logger.error(f"Failed to update cache file automatically: {e}") - - def get_fetch_url(self, jar, server, version): - """ - Constructs the URL for downloading a server JAR file based on the server type. - - Supports two main types of server JAR sources: - - ServerJars API for servers not in PAPERJARS. - - Paper API for servers available through the Paper project. - - Parameters: - jar (str): Name of the JAR file. - server (str): Server software name (e.g., "paper"). - version (str): Server version. - - Returns: - str or None: URL for downloading the JAR file, or None if URL cannot be - constructed or an error occurs. - """ - try: - # Check if the server type is not specifically handled by Paper. - if server not in PAPERJARS: - return f"{self.base_url}/api/fetchJar/{jar}/{server}/{version}" - - # For Paper servers, attempt to get the build for the specified version. - paper_build_info = self.get_paper_build(server, version) - if paper_build_info is None: - # Log an error or handle the case where paper_build_info is None - logger.error( - "Error: Unable to get build information for server:" - f" {server}, version: {version}" - ) - return None - - build = paper_build_info.get("build") - if not build: - # Log an error or handle the case where build is None or not found - logger.error( - f"Error: Build number not found for server:" - f" {server}, version: {version}" - ) - return None - - # Construct and return the URL for downloading the Paper server JAR. - return ( - f"{self.paper_base}/v2/projects/{server}/versions/{version}/" - f"builds/{build}/downloads/{server}-{version}-{build}.jar" - ) - except Exception as e: - logger.error(f"An error occurred while constructing fetch URL: {e}") - return None - - def download_jar(self, jar, server, version, path, server_id): - update_thread = threading.Thread( - name=f"server_download-{server_id}-{server}-{version}", - target=self.a_download_jar, - daemon=True, - args=(jar, server, version, path, server_id), - ) - update_thread.start() - - def a_download_jar(self, jar, server, version, path, server_id): - """ - Downloads a server JAR file and performs post-download actions including - notifying users and setting import status. - - This method waits for the server registration to complete, retrieves the - download URL for the specified server JAR file. - - Upon successful download, it either runs the installer for - Forge servers or simply finishes the import process for other types. It - notifies server users about the completion of the download. - - Parameters: - - jar (str): The name of the JAR file to download. - - server (str): The type of server software (e.g., 'forge', 'paper'). - - version (str): The version of the server software. - - path (str): The local filesystem path where the JAR file will be saved. - - server_id (str): The unique identifier for the server being updated or - imported, used for notifying users and setting the import status. - - Returns: - - bool: True if the JAR file was successfully downloaded and saved; - False otherwise. - - The method ensures that the server is properly registered before proceeding - with the download and handles exceptions by logging errors and reverting - the import status if necessary. - """ - # delaying download for server register to finish - time.sleep(3) - - fetch_url = self.get_fetch_url(jar, server, version) - if not fetch_url: - return False - - server_users = PermissionsServers.get_server_user_list(server_id) - - # Make sure the server is registered before updating its stats - while True: - try: - ServersController.set_import(server_id) - for user in server_users: - WebSocketManager().broadcast_user(user, "send_start_reload", {}) - break - except Exception as ex: - logger.debug(f"Server not registered yet. Delaying download - {ex}") - - # Initiate Download - jar_dir = os.path.dirname(path) - jar_name = os.path.basename(path) - logger.info(fetch_url) - success = FileHelpers.ssl_get_file(fetch_url, jar_dir, jar_name) - - # Post-download actions - if success: - if server == "forge": - # If this is the newer Forge version, run the installer - ServersController.finish_import(server_id, True) - else: - ServersController.finish_import(server_id) - - # Notify users - for user in server_users: - WebSocketManager().broadcast_user( - user, "notification", "Executable download finished" - ) - time.sleep(3) # Delay for user notification - WebSocketManager().broadcast_user(user, "send_start_reload", {}) - else: - logger.error(f"Unable to save jar to {path} due to download failure.") - ServersController.finish_import(server_id) - - return success diff --git a/app/classes/shared/helpers.py b/app/classes/shared/helpers.py index 0427da11..55a588fc 100644 --- a/app/classes/shared/helpers.py +++ b/app/classes/shared/helpers.py @@ -72,7 +72,7 @@ class Helpers: self.db_path = os.path.join( self.root_dir, "app", "config", "db", "crafty.sqlite" ) - self.serverjar_cache = os.path.join(self.config_dir, "serverjars.json") + self.big_bucket_cache = os.path.join(self.config_dir, "bigbucket.json") self.credits_cache = os.path.join(self.config_dir, "credits.json") self.passhasher = PasswordHasher() self.exiting = False @@ -516,6 +516,7 @@ class Helpers: "monitored_mounts": mounts, "dir_size_poll_freq_minutes": 5, "crafty_logs_delete_after_days": 0, + "big_bucket_repo": "https://jars.arcadiatech.org", } def get_all_settings(self): diff --git a/app/classes/shared/main_controller.py b/app/classes/shared/main_controller.py index 9c3219ff..66feff91 100644 --- a/app/classes/shared/main_controller.py +++ b/app/classes/shared/main_controller.py @@ -32,7 +32,7 @@ from app.classes.shared.console import Console from app.classes.shared.helpers import Helpers from app.classes.shared.file_helpers import FileHelpers from app.classes.shared.import_helper import ImportHelpers -from app.classes.minecraft.serverjars import ServerJars +from app.classes.minecraft.bigbucket import BigBucket from app.classes.shared.websocket_manager import WebSocketManager logger = logging.getLogger(__name__) @@ -43,7 +43,7 @@ class Controller: self.helper: Helpers = helper self.file_helper: FileHelpers = file_helper self.import_helper: ImportHelpers = import_helper - self.server_jars: ServerJars = ServerJars(helper) + self.big_bucket: BigBucket = BigBucket(helper) self.users_helper: HelperUsers = HelperUsers(database, self.helper) self.roles_helper: HelperRoles = HelperRoles(database) self.servers_helper: HelperServers = HelperServers(database) @@ -436,7 +436,7 @@ class Controller: if root_create_data["create_type"] == "download_jar": if Helpers.is_os_windows(): # Let's check for and setup for install server commands - if create_data["type"] == "forge": + if create_data["type"] == "forge-installer": server_command = ( f"java -Xms{Helpers.float_to_string(min_mem)}M " f"-Xmx{Helpers.float_to_string(max_mem)}M " @@ -449,7 +449,7 @@ class Controller: f'-jar "{server_file}" nogui' ) else: - if create_data["type"] == "forge": + if create_data["type"] == "forge-installer": server_command = ( f"java -Xms{Helpers.float_to_string(min_mem)}M " f"-Xmx{Helpers.float_to_string(max_mem)}M " @@ -569,19 +569,16 @@ class Controller: if data["create_type"] == "minecraft_java": if root_create_data["create_type"] == "download_jar": # modded update urls from server jars will only update the installer - if ( - create_data["category"] != "modded" - and create_data["type"] not in ServerJars.get_paper_jars() - ): + if create_data["type"] != "forge-installer": server_obj = self.servers.get_server_obj(new_server_id) - url = ( - "https://api.serverjars.com/api/fetchJar/" - f"{create_data['category']}" - f"/{create_data['type']}/{create_data['version']}" + url = self.big_bucket.get_fetch_url( + create_data["category"], + create_data["type"], + create_data["version"], ) server_obj.executable_update_url = url self.servers.update_server(server_obj) - self.server_jars.download_jar( + self.big_bucket.download_jar( create_data["category"], create_data["type"], create_data["version"], diff --git a/app/classes/shared/server.py b/app/classes/shared/server.py index a31cc891..a6c98b89 100644 --- a/app/classes/shared/server.py +++ b/app/classes/shared/server.py @@ -690,7 +690,8 @@ class ServerInstance: try: # Getting the forge version from the executable command version = re.findall( - r"forge-([0-9\.]+)((?:)|(?:-([0-9\.]+)-[a-zA-Z]+)).jar", + r"forge-installer-([0-9\.]+)((?:)|" + r"(?:-([0-9\.]+)-[a-zA-Z]+)).jar", server_obj.execution_command, ) version_param = version[0][0].split(".") diff --git a/app/classes/shared/tasks.py b/app/classes/shared/tasks.py index d1b786b9..b9513441 100644 --- a/app/classes/shared/tasks.py +++ b/app/classes/shared/tasks.py @@ -685,16 +685,16 @@ class TasksManager: id="stats", ) - def serverjar_cache_refresher(self): - logger.info("Refreshing serverjars.com cache on start") - self.controller.server_jars.refresh_cache() + def big_bucket_cache_refresher(self): + logger.info("Refreshing big bucket cache on start") + self.controller.big_bucket.refresh_cache() - logger.info("Scheduling Serverjars.com cache refresh service every 12 hours") + logger.info("Scheduling big bucket cache refresh service every 12 hours") self.scheduler.add_job( - self.controller.server_jars.refresh_cache, + self.controller.big_bucket.refresh_cache, "interval", hours=12, - id="serverjars", + id="big_bucket", ) def realtime(self): diff --git a/app/classes/web/routes/api/crafty/config/index.py b/app/classes/web/routes/api/crafty/config/index.py index 40504d76..0c2f196c 100644 --- a/app/classes/web/routes/api/crafty/config/index.py +++ b/app/classes/web/routes/api/crafty/config/index.py @@ -31,6 +31,7 @@ config_json_schema = { "monitored_mounts": {"type": "array"}, "dir_size_poll_freq_minutes": {"type": "integer"}, "crafty_logs_delete_after_days": {"type": "integer"}, + "big_bucket_repo": {"type": "string"}, }, "additionalProperties": False, "minProperties": 1, diff --git a/app/classes/web/routes/api/crafty/exe_cache.py b/app/classes/web/routes/api/crafty/exe_cache.py index 8836aef8..93162279 100644 --- a/app/classes/web/routes/api/crafty/exe_cache.py +++ b/app/classes/web/routes/api/crafty/exe_cache.py @@ -17,11 +17,11 @@ class ApiCraftyJarCacheIndexHandler(BaseApiHandler): if not auth_data[4]["superuser"]: return self.finish_json(400, {"status": "error", "error": "NOT_AUTHORIZED"}) - self.controller.server_jars.manual_refresh_cache() + self.controller.big_bucket.manual_refresh_cache() self.finish_json( 200, { "status": "ok", - "data": self.controller.server_jars.get_serverjar_data(), + "data": self.controller.big_bucket.get_bucket_data(), }, ) diff --git a/app/classes/web/routes/api/servers/index.py b/app/classes/web/routes/api/servers/index.py index 3c14f604..ea632c68 100644 --- a/app/classes/web/routes/api/servers/index.py +++ b/app/classes/web/routes/api/servers/index.py @@ -139,7 +139,7 @@ new_server_schema = { "category": { "title": "Jar Category", "type": "string", - "examples": ["modded", "vanilla"], + "examples": ["Mc_java_servers", "Mc_java_proxies"], }, "properties": { "type": { diff --git a/app/classes/web/server_handler.py b/app/classes/web/server_handler.py index 11853a47..a8e278b2 100644 --- a/app/classes/web/server_handler.py +++ b/app/classes/web/server_handler.py @@ -146,12 +146,12 @@ class ServerHandler(BaseHandler): return page_data["server_api"] = False if page_data["online"]: - page_data["server_api"] = self.helper.check_address_status( - "https://api.serverjars.com" + page_data["server_api"] = ( + self.controller.big_bucket._check_bucket_alive() ) - page_data["server_types"] = self.controller.server_jars.get_serverjar_data() + page_data["server_types"] = self.controller.big_bucket.get_bucket_data() page_data["js_server_types"] = json.dumps( - self.controller.server_jars.get_serverjar_data() + self.controller.big_bucket.get_bucket_data() ) if page_data["server_types"] is None: page_data["server_types"] = [] diff --git a/app/frontend/static/assets/images/serverjars/FULL-WHITE.svg b/app/frontend/static/assets/images/serverjars/FULL-WHITE.svg deleted file mode 100644 index d5036723..00000000 --- a/app/frontend/static/assets/images/serverjars/FULL-WHITE.svg +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/frontend/static/assets/images/serverjars/ICON.svg b/app/frontend/static/assets/images/serverjars/ICON.svg deleted file mode 100644 index 2adc4cff..00000000 --- a/app/frontend/static/assets/images/serverjars/ICON.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/frontend/templates/panel/loading.html b/app/frontend/templates/panel/loading.html index a56a75ee..15396071 100644 --- a/app/frontend/templates/panel/loading.html +++ b/app/frontend/templates/panel/loading.html @@ -20,7 +20,8 @@ data-internet="{{ translate('startup', 'internet', data['lang']) }}" data-tasks="{{ translate('startup', 'tasks', data['lang']) }}" data-internals="{{ translate('startup', 'internals', data['lang']) }}" - data-almost="{{ translate('startup', 'almost', data['lang']) }}"> + data-almost="{{ translate('startup', 'almost', data['lang']) }}" + data-cache="{{ translate('startup', 'cache', data['lang'])}}"> {{ translate('startup', 'starting', data['lang']) }} @@ -70,4 +71,4 @@ }); -{% end %} +{% end %} \ No newline at end of file diff --git a/app/frontend/templates/server/wizard.html b/app/frontend/templates/server/wizard.html index d6d64da3..fd079343 100644 --- a/app/frontend/templates/server/wizard.html +++ b/app/frontend/templates/server/wizard.html @@ -20,11 +20,6 @@
- {% if data["server_api"] and data["online"] %} - - {% end %}

{{ translate('serverWizard', 'newServer', data['lang']) }}


@@ -67,16 +62,19 @@ {% end %} {% raw xsrf_form_html() %}
+
- +
- + {% for s in data['server_types'] %} - + {% if data['server_types'][s].get("enabled", False) %} + {% end %} {% if data['super_user'] %} @@ -108,7 +106,8 @@
+ data-content="⚠️ {{ translate('serverWizard', 'unsupported', data['lang']) }} ⚠️" , + data-placement="right">
@@ -191,10 +190,12 @@ {% if not data["server_api"] and data["online"] %}

 {{ - translate('error', 'serverJars1', data['lang']) }} {{ translate('error', + translate('error', 'bigBucket1', data['lang']) }} {{ + translate('error', 'craftyStatus', data['lang']) }} -  {{ translate('error', 'serverJars2', data['lang']) }}

+  {{ translate('error', 'bigBucket2', data['lang']) }}

{{ translate('error', 'selfHost', + data['lang'])}}

{% end %} {% if not data["online"] %} @@ -827,7 +828,7 @@ message: '

Please wait while we gather your files...

', closeButton: false }); - setTimeout(function(){ + setTimeout(function () { getDirView(); }, 2000); } else { @@ -845,9 +846,9 @@ message: '

Please wait while we gather your files...

', closeButton: false }); - setTimeout(function(){ - getDirView(); - }, 2000); + setTimeout(function () { + getDirView(); + }, 2000); }); var upload = false; var file; @@ -1137,7 +1138,7 @@ function wait_msg(importing) { bootbox.alert({ title: importing ? '{% raw translate("serverWizard", "importing", data["lang"]) %}' : '{% raw translate("serverWizard", "downloading", data["lang"]) %}', - message: importing ? ' {% raw translate("serverWizard", "bePatient", data["lang"]) %}' : ' {% raw translate("serverWizard", "bePatient", data["lang"]) %}

Powered by serverjars.com', + message: importing ? ' {% raw translate("serverWizard", "bePatient", data["lang"]) %}' : ' {% raw translate("serverWizard", "bePatient", data["lang"]) %}', }); } @@ -1197,33 +1198,28 @@ */ function serverTypeChange(selectObj) { // get the index of the selected option - let idx = document.getElementById('server_type').selectedIndex; + let idx = document.getElementById('server_type').value; + let idx_list = idx.split("|"); // get the value of the selected option let cSelect = document.getElementById("server"); let which = {}; try { - which = document.getElementById('server_type').options[idx].value; + versions = Object.keys(serverTypesLists[idx_list[0]]["types"][idx_list[1]]["versions"]); } catch { while (cSelect.options.length > 0) { cSelect.remove(0); } return; } - let server_type = which.split('|')[0]; - let server = which.split('|')[1]; - // use the selected option value to retrieve the list of items from the serverTypesLists array - let cList = serverTypesLists[server_type]; - // get the country select element via its known id - cSelect = document.getElementById("server"); - // remove the current options from the country select - while (cSelect.options.length > 0) { - cSelect.remove(0); - } - let newOption; + + $("#server option").each(function () { + $(this).remove() + }) + // create new options ordered by ascending - cList[server].forEach(type => { + versions.forEach(type => { newOption = document.createElement("option"); - newOption.value = which + "|" + type; // assumes option string and value are the same + newOption.value = idx + "|" + type; // assumes option string and value are the same newOption.text = type; // add the new option try { @@ -1234,17 +1230,18 @@ } }) } - $("#server").change(function (){ + + $("#server").change(function () { let selected_version = $("#server :selected").text().split("."); - if(parseInt(selected_version[0]) === 1 && parseInt(selected_version[1]) < 8 ){ + if (parseInt(selected_version[0]) === 1 && parseInt(selected_version[1]) < 8) { $('[data-toggle="popover"]').popover(); - if ($(window).width() < 1000) { - $('.version-hint').attr("data-placement", "top") + if ($(window).width() < 1000) { + $('.version-hint').attr("data-placement", "top") + } else { + $('.version-hint').attr("data-placement", "right") + } + $('.version-hint').popover("show"); } else { - $('.version-hint').attr("data-placement", "right") - } - $('.version-hint').popover("show"); - }else{ $('.version-hint').popover("hide"); } }); @@ -1253,6 +1250,15 @@ const type_select = document.getElementById('server_jar') const tidx = type_select.selectedIndex; const val = type_select.options[tidx].value; + if (!val) { + $("#server_type option").each(function () { + $(this).remove() + }) + $("#server option").each(function () { + $(this).remove() + }) + return; + } let jcSelect = {}; if (val == 'None') { jcSelect = document.getElementById("server_type"); @@ -1267,7 +1273,7 @@ // get the value of the selected option let jwhich = selectObj.options[jidx].value; // use the selected option value to retrieve the list of items from the serverTypesLists array - let jcList = Object.keys(serverTypesLists[jwhich]); + let jcList = Object.keys(serverTypesLists[jwhich]["types"]); // get the country select element via its known id jcSelect = document.getElementById("server_type"); // remove the current options from the country select diff --git a/app/translations/cs_CS.json b/app/translations/cs_CS.json index 79026d51..4d496e2a 100644 --- a/app/translations/cs_CS.json +++ b/app/translations/cs_CS.json @@ -117,7 +117,6 @@ "welcome": "Vítejte v Crafty Controlleru" }, "datatables": { - "loadingRecords": "Načítání...", "i18n": { "aria": { "sortAscending": ": aktivace řazení sloupce vzestupně", @@ -194,11 +193,14 @@ }, "thousands": " ", "zeroRecords": "Nebyly nalezeny žádné odpovídající záznamy" - } + }, + "loadingRecords": "Načítání..." }, "error": { "agree": "Souhlasím", "bedrockError": "Stažení Bedrocku není dostupné. Prosím zkontrolujte", + "bigBucket1": "Big Bucket Kontrola stavu selhala. Prosím zkontrolujte jej", + "bigBucket2": "pro nejnovější informace.", "cancel": "Zrušit", "contact": "Kontaktujte podporu Crafty přes Discord", "craftyStatus": "Crafty stav systémů", @@ -221,6 +223,7 @@ "portReminder": "Zjistili jsme, že server {} byl spuštěn poprvé. Ujistěte se, že jste přesměrovali port {} přes váš směrovač/firewall, aby byl tento port vzdáleně přístupný z internetu.", "privMsg": "a ", "return": "vrátit se na hlavní stránku", + "selfHost": "Pokud Hostujete sami toto uložiště prosím zkontrolujte adresu nebo si přečtěte náš průvodce odstraňováním problémů.", "serverJars1": "Server JAR api je nepřístupná. Prosím zkontrolujte", "serverJars2": "pro aktualní informace.", "start-error": "Server {} se nepodařilo spustit s kódem chyby: {}", @@ -622,6 +625,7 @@ }, "startup": { "almost": "Dokončuji. Držte se...", + "cache": "Znovu načítam mezipaměť Big Bucket", "internals": "Nastavuji a startuji Crafty interní komponenty", "internet": "Kontroluju připojení k internetu", "server": "Konfigurace ", @@ -694,4 +698,4 @@ "webhook_body": "Webhook Body", "webhooks": "Webhooky" } -} \ No newline at end of file +} diff --git a/app/translations/de_DE.json b/app/translations/de_DE.json index c8358427..adeb7f4c 100644 --- a/app/translations/de_DE.json +++ b/app/translations/de_DE.json @@ -117,7 +117,6 @@ "welcome": "Willkommen bei Crafty Controller" }, "datatables": { - "loadingRecords": "Laden...", "i18n": { "aria": { "sortAscending": ": Aktivieren, um die Spalte aufsteigend zu sortieren", @@ -179,11 +178,14 @@ }, "thousands": ".", "zeroRecords": "Keine passenden Einträge gefunden" - } + }, + "loadingRecords": "Laden..." }, "error": { "agree": "Zustimmen", "bedrockError": "Bedrock-Downloads sind nicht verfügbar. Bitte überprüfen Sie", + "bigBucket1": "Big Bucket Zustandsprüfung fehlgeschlagen. Bitte Überprüfen", + "bigBucket2": "für die aktuellsten Informationen.", "cancel": "Abbrechen", "contact": "Kontaktieren Sie den Crafty Control Support über Discord", "craftyStatus": "Crafty-Statusseite", @@ -206,6 +208,7 @@ "portReminder": "Wir haben festgestellt, dass dies das erste Mal ist, dass {} ausgeführt wurde. Stellen Sie sicher, dass Sie Port {} durch Ihren Router/Firewall weiterleiten, um den Fernzugriff aus dem Internet zu ermöglichen.", "privMsg": "und der/die/das ", "return": "Zurück zum Dashboard", + "selfHost": "Wenn Sie dieses Repo selbst hosten, überprüfen Sie bitte Ihre Adresse oder konsultieren Sie unsere Anleitung zur Fehlerbehebung.", "serverJars1": "Server-JAR-API nicht erreichbar. Bitte überprüfen Sie ", "serverJars2": "um die aktuellsten Informationen zu erhalten.", "start-error": "Der Server {} konnte wegen dem Fehlercode: {} nicht gestartet werden", @@ -603,6 +606,7 @@ }, "startup": { "almost": "Nur noch einen Moment, fast geschafft", + "cache": "Aktualisieren der Big Bucket-Cache-Datei", "internals": "Crafty's interne Komponneten initialisieren und starten", "internet": "Verbindung zum Internet überprüfen", "server": "initialisieren ", @@ -675,4 +679,4 @@ "webhook_body": "Webhook-Inhalt", "webhooks": "Webhooks" } -} \ No newline at end of file +} diff --git a/app/translations/en_EN.json b/app/translations/en_EN.json index a0723002..38d1fc74 100644 --- a/app/translations/en_EN.json +++ b/app/translations/en_EN.json @@ -116,7 +116,6 @@ "welcome": "Welcome to Crafty Controller" }, "datatables": { - "loadingRecords": "Loading...", "i18n": { "aria": { "sortAscending": ": activate to sort column ascending", @@ -178,11 +177,14 @@ }, "thousands": ",", "zeroRecords": "No matching records found" - } + }, + "loadingRecords": "Loading..." }, "error": { "agree": "Agree", "bedrockError": "Bedrock downloads unavailable. Please check", + "bigBucket1": "Big Bucket Health Check Failed. Please check", + "bigBucket2": "for the most up to date information.", "cancel": "Cancel", "contact": "Contact Crafty Control Support via Discord", "craftyStatus": "Crafty's status page", @@ -205,8 +207,7 @@ "portReminder": "We have detected this is the first time {} has been run. Make sure to forward port {} through your router/firewall to make this remotely accessible from the internet.", "privMsg": "and the ", "return": "Return to Dashboard", - "serverJars1": "Server JARs API unreachable. Please check", - "serverJars2": "for the most up to date information.", + "selfHost": "If you are self-hosting this repo please check your address or consult our troubleshooting guide.", "start-error": "Server {} failed to start with error code: {}", "superError": "You must be a super user to complete this action.", "terribleFailure": "What a Terrible Failure!" @@ -601,6 +602,7 @@ }, "startup": { "almost": "Finishing up. Hang on tight...", + "cache": "Refreshing Big Bucket cache file", "internals": "Configuring and starting Crafty's internal components", "internet": "Checking for internet connection", "server": "Initializing ", @@ -673,4 +675,4 @@ "webhook_body": "Webhook Body", "webhooks": "Webhooks" } -} \ No newline at end of file +} diff --git a/app/translations/es_ES.json b/app/translations/es_ES.json index 7531ed1c..69ae9d18 100644 --- a/app/translations/es_ES.json +++ b/app/translations/es_ES.json @@ -117,7 +117,6 @@ "welcome": "Bienvenido a Crafty Controller" }, "datatables": { - "loadingRecords": "Cargando...", "i18n": { "aria": { "sortAscending": ": activar para ordenar las columnas de manera ascendente", @@ -179,7 +178,8 @@ }, "thousands": ",", "zeroRecords": "No se encontraron registros que coincidan" - } + }, + "loadingRecords": "Cargando..." }, "error": { "agree": "Aceptar", @@ -675,4 +675,4 @@ "webhook_body": "Cuerpo del Webhook", "webhooks": "Webhooks" } -} \ No newline at end of file +} diff --git a/app/translations/fr_FR.json b/app/translations/fr_FR.json index 739ed9d9..6e1e4ad5 100644 --- a/app/translations/fr_FR.json +++ b/app/translations/fr_FR.json @@ -117,7 +117,6 @@ "welcome": "Bienvenue sur Crafty Controller" }, "datatables": { - "loadingRecords": "Chargement ...", "i18n": { "aria": { "sortAscending": ": activer pour trier les colonnes dans l'ordre croissant", @@ -179,11 +178,14 @@ }, "thousands": ",", "zeroRecords": "Aucun enregistrement correspondant trouvcé" - } + }, + "loadingRecords": "Chargement ..." }, "error": { "agree": "Agree", "bedrockError": "Téléchargement Bedrock non disponible. Merci de vérifier", + "bigBucket1": "Echec de vérification de l'état de Big Bucket. Veuillez vérifier", + "bigBucket2": " pour l'information la plus à jour.", "cancel": "Annuler", "contact": "Contacter le Support de Crafty Control via Discord", "craftyStatus": "Page de statut de Crafty", @@ -206,6 +208,7 @@ "portReminder": "Nous avons détecté que c'est la première fois que {} est exécuté. Assurez-vous de transférer le port {} via votre routeur/pare-feu pour le rendre accessible à distance depuis Internet.", "privMsg": "et le ", "return": "Revenir au Tableau de Bord", + "selfHost": "Si vous hébergez vous-même ce repo, veuillez vérifier votre adresse et votre guide de dépannage.", "serverJars1": "l'API Server JARs est inaccessible. Merci de vérifier", "serverJars2": "pour les informations les plus à jour.", "start-error": "Le serveur {} n'a pas pu démarrer avec le code d'erreur : {}", @@ -603,6 +606,7 @@ }, "startup": { "almost": "Finalisation. Patienter ...", + "cache": "Mise à jour du fichier cache de Big Bucket", "internals": "Configuration et Démarrage des composants internes de Crafty", "internet": "Vérification de la connexion à Internet", "server": "Initialisation ", @@ -675,4 +679,4 @@ "webhook_body": "Corps du Webhook", "webhooks": "Webhooks" } -} \ No newline at end of file +} diff --git a/app/translations/he_IL.json b/app/translations/he_IL.json index 6c552ab0..865222cd 100644 --- a/app/translations/he_IL.json +++ b/app/translations/he_IL.json @@ -117,7 +117,6 @@ "welcome": "ברוכים הבאים ל-פאנל קראפטי" }, "datatables": { - "loadingRecords": "...טוען", "i18n": { "aria": { "sortAscending": ": הפעילו כדי למיין עמודות בסדר עולה", @@ -179,7 +178,8 @@ }, "thousands": ",", "zeroRecords": "לא נמצאו תוצאות תואמות" - } + }, + "loadingRecords": "...טוען" }, "error": { "agree": "מסכים", @@ -675,4 +675,4 @@ "webhook_body": "גוף ה-Webhook", "webhooks": "Webhooks" } -} \ No newline at end of file +} diff --git a/app/translations/it_IT.json b/app/translations/it_IT.json index e93b4828..84b7e39a 100644 --- a/app/translations/it_IT.json +++ b/app/translations/it_IT.json @@ -117,7 +117,6 @@ "welcome": "Benvenuto su Crafty Controller" }, "datatables": { - "loadingRecords": "Carico...", "i18n": { "aria": { "sortAscending": ": attiva per ordinare le colonne in modo ascendente", @@ -179,11 +178,14 @@ }, "thousands": ",", "zeroRecords": "Nessun record corrispondente trovato" - } + }, + "loadingRecords": "Carico..." }, "error": { "agree": "Conferma", "bedrockError": "I download di Bedrock non sono disponibili. Si prega di controllare", + "bigBucket1": "Controllo integrità di Big Bucket fallito. Controlla nuovamente", + "bigBucket2": "per informazioni più aggiornate.", "cancel": "Annulla", "contact": "Contact Crafty Control Support via Discord", "craftyStatus": "Stato di Crafty", @@ -206,6 +208,7 @@ "portReminder": "We have detected this is the first time {} has been run. Make sure to forward port {} through your router/firewall to make this remotely accessible from the internet.", "privMsg": "e il ", "return": "Torna alla pagina iniziale", + "selfHost": "se stai ospitando te questo repo, controlla il tuo indirizzo o consulta la nostra guida di risoluzione dei problemi.", "serverJars1": "API JAR del server non raggiungibile. Si prega di controllare", "serverJars2": "per informazioni più aggiornate.", "start-error": "Server {} failed to start with error code: {}", @@ -603,6 +606,7 @@ }, "startup": { "almost": "Finalizzazione. Tieniti forte...", + "cache": "Aggiornamento cache di Big Bucket", "internals": "Configurazione e avvio dei componenti interni di Crafty", "internet": "Controllo connessione a internet", "server": "Inizializzazione ", @@ -675,4 +679,4 @@ "webhook_body": "Corpo del Webhook", "webhooks": "Webhook" } -} \ No newline at end of file +} diff --git a/app/translations/lol_EN.json b/app/translations/lol_EN.json index 2a0450ca..387be725 100644 --- a/app/translations/lol_EN.json +++ b/app/translations/lol_EN.json @@ -117,7 +117,6 @@ "welcome": "WELCOM 2 CWAFTY CONTROLLR" }, "datatables": { - "loadingRecords": "Loading...", "i18n": { "aria": { "sortAscending": ": activate to sort column ascending", @@ -179,11 +178,14 @@ }, "thousands": ",", "zeroRecords": "No matching records found" - } + }, + "loadingRecords": "Loading..." }, "error": { "agree": "YESH PLS", "bedrockError": "BEDROCKZ DOWNLOADZ NO WORKY. CHECK PLZ.", + "bigBucket1": "Big Bucket No Worky. Plz check", + "bigBucket2": "for da freshest nooz.", "cancel": "NOPEZ", "contact": "CONTACK CWAFTY CONTROLLR SUPORT ON DA DIZORD", "craftyStatus": "CWAFTY'S STATUSZ", @@ -206,6 +208,7 @@ "portReminder": "WE HAS DETECTD DIS AR TEH FURST TIEM {} IZ BEAN RUN. IF U WANTS IT ACESIBLE TO NEIGHBORHOOD CATS PLZ UNLOCK CAT_FLAP, {}, THRU UR ROUTR IF U HAS NOT DUN SO.", "privMsg": "AND THEEZ ", "return": "Go Bak to Dashbored", + "selfHost": "If u iz self-hostin' dis repo, check ur addy or peep our fix-it guide.", "serverJars1": "CAN'T TALK TO SERVER JARS API. CHECKZ", "serverJars2": "TO SEE NEWZ STUFFZ.", "start-error": "CHAIR {} FAILD 2 START WIF OOF CODE: {}", @@ -603,6 +606,7 @@ }, "startup": { "almost": "ALMOST DUN. HOLD ON TO YER WHISKERS...", + "cache": "Fightin' for a Big Bucket o Fish", "internals": "SETTIN' UP AN' STARTIN' CWAFTY'S INSIDE BITZ", "internet": "LOOKIN' FOR OUTER SPACE TALKY", "server": "WAKIN' UPZ ", @@ -675,4 +679,4 @@ "webhook_body": "WEBHOOK FISH", "webhooks": "WEBHOOKZ" } -} \ No newline at end of file +} diff --git a/app/translations/lv_LV.json b/app/translations/lv_LV.json index 43501f47..a80fee2d 100644 --- a/app/translations/lv_LV.json +++ b/app/translations/lv_LV.json @@ -118,7 +118,6 @@ "welcome": "Esiet sveicināts Crafty Controller" }, "datatables": { - "loadingRecords": "Ielādē...", "i18n": { "aria": { "sortAscending": ": aktivizēt lai kārotu kolonnu augoši", @@ -180,11 +179,14 @@ }, "thousands": ",", "zeroRecords": "Nav atrasti atbilstoši ieraksti" - } + }, + "loadingRecords": "Ielādē..." }, "error": { "agree": "Piekrītu", "bedrockError": "Bedrock lejupielādes nav pieejamas. Lūdzu pārbaudi", + "bigBucket1": "Big Bucket stāvokļa pārbaude neizdevās. Lūdzu izpētiet", + "bigBucket2": "priekš jaunākās informācijas.", "cancel": "Atcelt", "contact": "Sazinies ar Crafty Control Atbalstu izmantojot Discord", "craftyStatus": "Crafty statusa lapa", @@ -207,6 +209,7 @@ "portReminder": "Mēs noteicām ka šī ir pirmā reize, kad {} ir ticis palaists. Pārliecinies izlaist portu {} cauri savam rūterim/ugunsmūrim lai padarītu šo attāli pieejamu no interneta.", "privMsg": "un ", "return": "Atgriezties uz pārskatu", + "selfHost": "Ja jūs paši uzturat šo repozitoriju, pārbaudiet savu adresi vai apskatiet mūsu kļūdu novēršanas dokumentāciju.", "serverJars1": "Serveru JAR API nav sasniedzams. Lūdzu pārbaudiet", "serverJars2": "priekš jaunākās informācijas.", "start-error": "Serveris {} neveiskmīgi startējās ar kļūdas kodu: {}", @@ -604,6 +607,7 @@ }, "startup": { "almost": "Pabeidz. Vēl tik nedaudz...", + "cache": "Atjauno Big Bucket keša failu", "internals": "Konfigurē un Startē Crafty iekšējās komponenetes", "internet": "Pārbauda interneta savienojumu", "server": "Inicializē ", @@ -676,4 +680,4 @@ "webhook_body": "Webhook Saturs", "webhooks": "Webhooki" } -} \ No newline at end of file +} diff --git a/app/translations/nl_BE.json b/app/translations/nl_BE.json index ba2d792b..a29287cb 100644 --- a/app/translations/nl_BE.json +++ b/app/translations/nl_BE.json @@ -117,7 +117,6 @@ "welcome": "Welkom bij Crafty Controller " }, "datatables": { - "loadingRecords": "Bezig met laden...", "i18n": { "aria": { "sortAscending": ": activeren om kolom oplopend te sorteren", @@ -179,11 +178,14 @@ }, "thousands": ",", "zeroRecords": "Geen overeenkomende records gevonden" - } + }, + "loadingRecords": "Bezig met laden..." }, "error": { "agree": "Akkoord", "bedrockError": "Bedrock-downloads niet beschikbaar. Controleer alstublieft", + "bigBucket1": "Big Bucket-gezondheidscontrole mislukt. Controleer alstublieft", + "bigBucket2": "voor de meest recente informatie.", "cancel": "Annuleren", "contact": "Neem contact op met Crafty Control ondersteuning via Discord", "craftyStatus": "Crafty's statuspagina", @@ -206,6 +208,7 @@ "portReminder": "We hebben ontdekt dat dit de eerste keer is dat {} wordt uitgevoerd. Zorg ervoor dat u poort {} doorstuurt via uw router/firewall om deze op afstand toegankelijk te maken vanaf het internet.", "privMsg": "en de ", "return": "Terug naar Dashboard", + "selfHost": "Als u deze repository zelf host, controleer dan uw adres of raadpleeg onze handleiding voor probleemoplossing.", "serverJars1": "Server JARs API niet bereikbaar. Controleer alstublieft", "serverJars2": "voor de meest recente informatie.", "start-error": "Server {} kan niet starten met foutcode: {}", @@ -603,6 +606,7 @@ }, "startup": { "almost": "De laatste hand leggen. Houd je vast...", + "cache": "Big Bucket-cachebestand vernieuwen", "internals": "Crafty's interne componenten configureren en starten", "internet": "Controleren op internetverbinding", "server": "Initialiseren ", @@ -675,4 +679,4 @@ "webhook_body": "Webhook-body", "webhooks": "Webhooks" } -} \ No newline at end of file +} diff --git a/app/translations/pl_PL.json b/app/translations/pl_PL.json index c0b5c0f4..fdb3d892 100644 --- a/app/translations/pl_PL.json +++ b/app/translations/pl_PL.json @@ -117,7 +117,6 @@ "welcome": "Witamy w Crafty Controller" }, "datatables": { - "loadingRecords": "Wczytywanie...", "i18n": { "aria": { "sortAscending": ": aktywuj, aby sortować kolumny w góre", @@ -179,11 +178,14 @@ }, "thousands": ",", "zeroRecords": "Nie znaleziono pasujacego wyniku" - } + }, + "loadingRecords": "Wczytywanie..." }, "error": { "agree": "Zgadzam się", "bedrockError": "Pobieranie serwera bedrock jest teraz niedostępne. Proszę sprawdź", + "bigBucket1": "Odświeżanie Big Bucket nie powiodło się. Sprawdź", + "bigBucket2": "dla najnowszych informacji.", "cancel": "Anuluj", "contact": "Podrzebujesz pomocy? Zapraszamy na serwer discord Crafty Controler", "craftyStatus": "Status strony Craftyiego", @@ -206,6 +208,7 @@ "portReminder": "Zauważyliśmy że to jest pierwszy raz {} kiedy był włączony. Upewnij się że otworzyłeś port {} na swoim routerze/firewallu aby korzystać z tego poza domem.", "privMsg": "i także ", "return": "Powrót do panelu", + "selfHost": "Jeśli zarządasz tą repozytorią upewnij się że adres hest poprawny, w innym przypadku odwiedź strone rozwiązywania problemów.", "serverJars1": "API Server Jars jest niedostępne. Proszę sprawdź", "serverJars2": "dla najnowzsych informacji.", "start-error": "Serwer {} nie mógł się odpalić z powodu: {}", @@ -602,6 +605,7 @@ }, "startup": { "almost": "Prawie gotowe! Jeszcze tylko chwilka...", + "cache": "Odświeżanie pamięci podręcznej Big Bucket", "internals": "Konfigurowanie i włączanie backendu...", "internet": "Sprawdzam połączenie z internetem", "server": "Włączanie ", @@ -674,4 +678,4 @@ "webhook_body": "Treść Webhooka", "webhooks": "Webhooki" } -} \ No newline at end of file +} diff --git a/app/translations/th_TH.json b/app/translations/th_TH.json index 96a1a0e5..8c9d014e 100644 --- a/app/translations/th_TH.json +++ b/app/translations/th_TH.json @@ -117,7 +117,6 @@ "welcome": "ยินดีต้อนรับสู่ Crafty Controller" }, "datatables": { - "loadingRecords": "กำลังโหลด...", "i18n": { "aria": { "sortAscending": ": เปิดใช้งานเพื่อเรียงลำดับคอลัมน์จากน้อยไปมาก", @@ -179,7 +178,8 @@ }, "thousands": ",", "zeroRecords": "ไม่พบรายการที่ตรงกัน" - } + }, + "loadingRecords": "กำลังโหลด..." }, "error": { "agree": "ยอมรับ", @@ -674,4 +674,4 @@ "webhook_body": "ภายใน Webhook", "webhooks": "Webhooks" } -} \ No newline at end of file +} diff --git a/app/translations/tr_TR.json b/app/translations/tr_TR.json index 789c7dc9..c05c6d66 100644 --- a/app/translations/tr_TR.json +++ b/app/translations/tr_TR.json @@ -117,7 +117,6 @@ "welcome": "Crafty Controller'a Hoşgeldiniz!" }, "datatables": { - "loadingRecords": "Yükleniyor...", "i18n": { "aria": { "sortAscending": ": artan sütun sıralamasını aktifleştir", @@ -179,11 +178,14 @@ }, "thousands": ".", "zeroRecords": "Eşleşen kayıt bulunamadı" - } + }, + "loadingRecords": "Yükleniyor..." }, "error": { "agree": "Kabul Et", "bedrockError": "Bedrock indirmeleri kullanılamıyor. Lütfen kontrol edin", + "bigBucket1": "Big Bucket sağlık kontrolü yapılamadı. En güncel bilgileri burada bulabilirsiniz:", + "bigBucket2": ".", "cancel": "İptal", "contact": "Crafty Control Destek Discord Sunucusu", "craftyStatus": "Crafty'nin durum sayfası", @@ -206,6 +208,7 @@ "portReminder": "{} ilk kez çalıştırılıyor olduğunu tespit ettik. Bunu internetten uzaktan erişilebilir kılmak için {} bağlantı noktasını yönlendiriciniz/güvenlik duvarınız üzerinden ilettiğinizden emin olun.", "privMsg": "ve ", "return": "Arayüze Geri Dön", + "selfHost": "Bu depoyu kendiniz barındırıyorsanız lütfen adresinizi kontrol ediniz veya sorun giderme kılavuzumuza bakınız.", "serverJars1": "Sunucu JARs API'ına erişilemiyor.", "serverJars2": "en güncel bilgilere sahiptir", "start-error": "{} sunucusu başlamatılamadı. Hata kodu: {}", @@ -602,6 +605,7 @@ }, "startup": { "almost": "Bitiriliyor. Sıkı tutun...", + "cache": "Big Bucket önbellek dosyası yenileniyor", "internals": "Crafty'nin dahili bileşenlerini konfigüre etme ve başlatma", "internet": "İnternet bağlantısı kontrol ediliyor", "server": "Başlatılıyor ", @@ -674,4 +678,4 @@ "webhook_body": "Webhook Gövdesi", "webhooks": "Webhooklar" } -} \ No newline at end of file +} diff --git a/app/translations/uk_UA.json b/app/translations/uk_UA.json index 56f02b6c..ed614e59 100644 --- a/app/translations/uk_UA.json +++ b/app/translations/uk_UA.json @@ -117,7 +117,6 @@ "welcome": "Ласкаво просимо у Crafty Controller" }, "datatables": { - "loadingRecords": "Завантаження...", "i18n": { "aria": { "sortAscending": ": активуйте, щоб сортувати стовпці за зростанням", @@ -179,11 +178,14 @@ }, "thousands": ",", "zeroRecords": "Не знайдено збігів в базі" - } + }, + "loadingRecords": "Завантаження..." }, "error": { "agree": "Згодний", "bedrockError": "Bedrock недоступний для скачування. Перевірте будь ласка", + "bigBucket1": "Перевірка Big Bucket не пройдено. Будь ласка, перевірте", + "bigBucket2": "для найактуальнішої інформації.", "cancel": "Відміна", "contact": "Зв'язатись з Crafty Control підтримкою через Discord", "craftyStatus": "Crafty's статус", @@ -206,6 +208,7 @@ "portReminder": "Ми виявили це вперше {} був запущений. Обов’язково перенаправте порт {} через ваш маршрутизатор/брандмауер, щоб зробити це доступним з Інтернету.", "privMsg": "і ", "return": "Повернутись до панелі", + "selfHost": "Якщо ви самостійно розміщуєте цей репозеторій, перевірте свою адресу або зверніться до нашого посібника з усунення несправностей.", "serverJars1": "API сервера JAR недоступний. Будь ласка, перевірте", "serverJars2": "для найактуальнішої інформації.", "start-error": "Сервер {} не запустився через помилку: {}", @@ -602,6 +605,7 @@ }, "startup": { "almost": "Закінчуємо. Тримайся міцніше...", + "cache": "Оновлення файлу кешу Big Bucket", "internals": "Налаштування та запуск внутрішніх компонентів Crafty ", "internet": "Перевірка доступу до інтернету", "server": "Ініціалізація ", @@ -674,4 +678,4 @@ "webhook_body": "Код Вебхука", "webhooks": "Вебхуки" } -} \ No newline at end of file +} diff --git a/app/translations/zh_CN.json b/app/translations/zh_CN.json index c9283d8d..6b488382 100644 --- a/app/translations/zh_CN.json +++ b/app/translations/zh_CN.json @@ -117,7 +117,6 @@ "welcome": "欢迎来到 Crafty Controller" }, "datatables": { - "loadingRecords": "正在加载……", "i18n": { "aria": { "sortAscending": ":激活对队列的升序排列", @@ -179,11 +178,14 @@ }, "thousands": ",", "zeroRecords": "没有找到匹配的记录" - } + }, + "loadingRecords": "正在加载……" }, "error": { "agree": "同意", "bedrockError": "基岩版下载不可用。请检查", + "bigBucket1": "Big Bucket 查活失败。请检查", + "bigBucket2": "以获取最新信息。", "cancel": "取消", "contact": "通过 Discord 联系 Crafty Control 支持", "craftyStatus": "Crafty 的状态页面", @@ -206,6 +208,7 @@ "portReminder": "我们检测到这是你首次运行 {}。请确保从您的路由器/防火墙转发 {} 端口,以使程序可以从公网远程访问。", "privMsg": "以及", "return": "返回仪表板", + "selfHost": "如果您自托管此仓库,请检查您的地址或参考我们的故障排除指南。", "serverJars1": "无法访问服务器 JAR API。请检查", "serverJars2": "以获取最新信息。", "start-error": "服务器 {} 启动失败,错误代码为:{}", @@ -603,6 +606,7 @@ }, "startup": { "almost": "即将完成。请稍候……", + "cache": "正在刷新 Big Bucket 缓存文件", "internals": "正在配置并启动 Crafty 的内部组件", "internet": "正在检查网络连接", "server": "正在初始化 ", @@ -675,4 +679,4 @@ "webhook_body": "Webhook 消息体(Body)", "webhooks": "Webhook" } -} \ No newline at end of file +} diff --git a/main.py b/main.py index f8a4aab1..fd84328b 100644 --- a/main.py +++ b/main.py @@ -118,7 +118,7 @@ def controller_setup(): def tasks_starter(): """ Method starts stats recording, app scheduler, and - serverjars/steamCMD cache refreshers + big bucket/steamCMD cache refreshers """ # start stats logging tasks_manager.start_stats_recording() @@ -128,8 +128,8 @@ def tasks_starter(): tasks_manager.start_scheduler() # refresh our cache and schedule for every 12 hoursour cache refresh - # for serverjars.com - tasks_manager.serverjar_cache_refresher() + # for big bucket.com + tasks_manager.big_bucket_cache_refresher() def signal_handler(signum, _frame): @@ -213,6 +213,8 @@ def setup_starter(): time.sleep(2) controller_setup_thread.start() + web_sock.broadcast("update", {"section": "cache"}) + controller.big_bucket.manual_refresh_cache() # Wait for the setup threads to finish web_sock.broadcast( "update",