diff --git a/.gitlab/release.yml b/.gitlab/release.yml index 1b04c2e7..f1ed61da 100644 --- a/.gitlab/release.yml +++ b/.gitlab/release.yml @@ -11,13 +11,15 @@ release: script: - echo "Build Job $JOB_ID" - echo "Running release job for tag $CI_COMMIT_TAG" - release: - name: Crafty $CI_COMMIT_TAG - tag_name: $CI_COMMIT_TAG - description: ./CHANGELOG.md - ref: $CI_COMMIT_TAG - assets: - links: - - name: Windows Package - url: "$CI_PROJECT_URL/-/jobs/$JOB_ID/artifacts/download" - link_type: package + - | + full_changelog=$(cat CHANGELOG.md) + trimmed_changelog="${full_changelog%%

*}" + echo "$trimmed_changelog" + - release-cli create + --name "Crafty $CI_COMMIT_TAG" + --description "$trimmed_changelog" + --tag-name "$CI_COMMIT_TAG" + --ref "$CI_COMMIT_TAG" + --assets-link "{\"url\":\"$CI_PROJECT_URL/-/jobs/$JOB_ID/artifacts/download\",\"name\":\"Windows Package\",\"link_type\":\"package\"}" +# Having to use raw release-cli instead of yaml syntax because variables are not expanding +# https://gitlab.com/gitlab-org/gitlab/-/issues/237893#note_403465700 diff --git a/CHANGELOG.md b/CHANGELOG.md index cc322796..ba8d0a20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,16 @@ # Changelog +## --- [4.0.10] - 2022/08/14 +### Bug fixes +- Fix reaction tasks not firing ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/423)) +- QOL task delay offset not following over on task edit ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/423)) +- Fix Fresh Install Detection Logic issues ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/425)) +- Fix reload issue on backup panel - on certain browsers ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/431)) +- Fix '&' in backup paths ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/431)) +### Tweaks +- Session Handling | Logout on browser close ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/424)) +- Backups Panel | Only display zips ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/426)) +- User creation | Fix page browser title ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/427)) +

## --- [4.0.9] - 2022/08/06 ### Bug fixes diff --git a/README.md b/README.md index 9d88505a..1cd41069 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![Supported Python Versions](https://shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20-blue)](https://www.python.org) -[![Version(temp-hardcoded)](https://img.shields.io/badge/release-v4.0.9--beta-orange)](https://gitlab.com/crafty-controller/crafty-4/-/releases) +[![Version(temp-hardcoded)](https://img.shields.io/badge/release-v4.0.10--beta-orange)](https://gitlab.com/crafty-controller/crafty-4/-/releases) [![Code Quality(temp-hardcoded)](https://img.shields.io/badge/code%20quality-10-brightgreen)](https://gitlab.com/crafty-controller/crafty-4) [![Build Status](https://gitlab.com/crafty-controller/crafty-4/badges/master/pipeline.svg)](https://gitlab.com/crafty-controller/crafty-4/-/commits/master) -# Crafty Controller 4.0.9-beta +# Crafty Controller 4.0.10-beta > Python based Control Panel for your Minecraft Server ## What is Crafty Controller? diff --git a/app/classes/models/users.py b/app/classes/models/users.py index 3b19e906..ac204e3c 100644 --- a/app/classes/models/users.py +++ b/app/classes/models/users.py @@ -107,6 +107,12 @@ class HelperUsers: usernames.append(user.username) return usernames + @staticmethod + def get_user_total(): + count = Users.select().where(Users.username != "system").count() + print(count) + return count + @staticmethod def get_all_user_ids() -> t.List[int]: return [ diff --git a/app/classes/shared/main_models.py b/app/classes/shared/main_models.py index ae4636c2..73d1d484 100644 --- a/app/classes/shared/main_models.py +++ b/app/classes/shared/main_models.py @@ -30,9 +30,8 @@ class DatabaseBuilder: def is_fresh_install(self): try: - user = self.users_helper.get_by_id(1) - if user: - return False + num_user = self.users_helper.get_user_total() + return num_user <= 0 except: return True diff --git a/app/classes/shared/server.py b/app/classes/shared/server.py index 008fe989..499a0080 100644 --- a/app/classes/shared/server.py +++ b/app/classes/shared/server.py @@ -1023,6 +1023,7 @@ class ServerInstance: "size": f["size"], } for f in files + if f["path"].endswith(".zip") ] def jar_update(self): diff --git a/app/classes/shared/tasks.py b/app/classes/shared/tasks.py index 7055d1cb..a654df6d 100644 --- a/app/classes/shared/tasks.py +++ b/app/classes/shared/tasks.py @@ -3,7 +3,7 @@ import time import logging import threading import asyncio -from datetime import datetime +import datetime from tzlocal import get_localzone from tzlocal.utils import ZoneInfoNotFoundError @@ -199,7 +199,7 @@ class TasksManager: "interval", hours=12, id="update_watcher", - start_date=datetime.now(), + start_date=datetime.datetime.now(), ) # self.scheduler.add_job( # self.scheduler.print_jobs, "interval", seconds=10, id="-1" diff --git a/app/classes/web/panel_handler.py b/app/classes/web/panel_handler.py index 2334c862..a5e56029 100644 --- a/app/classes/web/panel_handler.py +++ b/app/classes/web/panel_handler.py @@ -962,6 +962,7 @@ class PanelHandler(BaseHandler): page_data["schedule"]["command"] = "" page_data["schedule"]["one_time"] = False page_data["schedule"]["cron_string"] = "" + page_data["schedule"]["delay"] = 0 page_data["schedule"]["time"] = "" page_data["schedule"]["interval"] = "" # we don't need to check difficulty here. @@ -1041,6 +1042,7 @@ class PanelHandler(BaseHandler): page_data["schedule"]["command"] = schedule.command else: page_data["schedule"]["command"] = "" + page_data["schedule"]["delay"] = schedule.delay page_data["schedule"]["enabled"] = schedule.enabled page_data["schedule"]["one_time"] = schedule.one_time page_data["schedule"]["cron_string"] = schedule.cron_string @@ -1574,7 +1576,7 @@ class PanelHandler(BaseHandler): else: checked = self.controller.management.get_excluded_backup_dirs(server_id) if superuser: - backup_path = bleach.clean(self.get_argument("backup_path", None)) + backup_path = self.get_argument("backup_path", None) if Helpers.is_os_windows(): backup_path.replace(" ", "^ ") backup_path = Helpers.wtol_path(backup_path) diff --git a/app/config/credits.json b/app/config/credits.json index ae2017d9..fac21fdb 100644 --- a/app/config/credits.json +++ b/app/config/credits.json @@ -105,21 +105,6 @@ ], "blurb": "Developer at work and at home, testing his own code is a pain, so his coding precept is \"Testing is Doubting\"", "pic": "/static/assets/images/credits/silversthorn.png" - }, - { - "name": "ThatOneLukas", - "title": "Software Engineer", - "loc": "Helsinki, FI", - "tags": [ - "Staff", - [ - "Developer", - "https://gitlab.com/LukasDoesDev" - ], - null - ], - "blurb": "Arch Linux enthusiast who likes 80s/90s music, Rust (The programming language) and light distros like Arch Linux btw. Dislikes C, C++, Go, and Microsoft. Also doesn't like Finnish weather that freezes molten snow to (deadly) ice.", - "pic": "/static/assets/images/credits/lukas.png" } ], "support": [ @@ -217,6 +202,21 @@ ], "blurb": "His interests include learning, Linux, and programming. He loves pentesting apps and gaming.", "pic": "/static/assets/images/credits/mcgaming.png" + }, + { + "name": "ThatOneLukas", + "title": "Software Engineer", + "loc": "Helsinki, FI", + "tags": [ + "Staff", + [ + "Developer", + "https://gitlab.com/LukasDoesDev" + ], + null + ], + "blurb": "Arch Linux enthusiast who likes 80s/90s music, Rust (The programming language) and light distros like Arch Linux btw. Dislikes C, C++, Go, and Microsoft. Also doesn't like Finnish weather that freezes molten snow to (deadly) ice.", + "pic": "/static/assets/images/credits/lukas.png" } ] }, diff --git a/app/config/version.json b/app/config/version.json index 02c1e04c..a10889cc 100644 --- a/app/config/version.json +++ b/app/config/version.json @@ -1,6 +1,6 @@ { "major": 4, "minor": 0, - "sub": 9, + "sub": 10, "meta": "beta" } diff --git a/app/frontend/templates/base.html b/app/frontend/templates/base.html index 4133dfac..46b6e622 100755 --- a/app/frontend/templates/base.html +++ b/app/frontend/templates/base.html @@ -15,7 +15,7 @@ + href="https://cdn.datatables.net/v/bs4/dt-1.10.22/fh-3.1.7/r-2.2.6/sc-2.0.3/sp-1.2.2/datatables.min.css" /> @@ -72,7 +72,7 @@ {% include notify.html %} @@ -163,7 +163,7 @@ + src="https://cdn.datatables.net/v/bs4/dt-1.10.22/fh-3.1.7/r-2.2.6/sc-2.0.3/sp-1.2.2/datatables.min.js"> @@ -191,7 +191,7 @@ $.extend($.fn.dataTable.defaults, { // {{ '\nlanguage:' }} {% raw translate('datatables', 'i18n', data['lang']) %} - }) + }) //used to get cookies from browser - this is part of tornados xsrf protection - it's for extra security function getCookie(name) { @@ -516,6 +516,9 @@ }); }); + $(window).unload(function () { + jQuery.get("/public/logout") + }); {% block js %} @@ -525,4 +528,4 @@ - + \ No newline at end of file diff --git a/app/frontend/templates/panel/panel_edit_user.html b/app/frontend/templates/panel/panel_edit_user.html index 68424e2e..7286f4a0 100644 --- a/app/frontend/templates/panel/panel_edit_user.html +++ b/app/frontend/templates/panel/panel_edit_user.html @@ -3,7 +3,9 @@ {% block meta %} {% end %} -{% block title %}Crafty Controller - Edit User{% end %} +{% block title %}Crafty Controller - {{ translate('userConfig', 'userSettings', +data['lang']) }}{% end %} + {% block content %} diff --git a/app/frontend/templates/panel/server_backup.html b/app/frontend/templates/panel/server_backup.html index d97c2d14..72c37576 100644 --- a/app/frontend/templates/panel/server_backup.html +++ b/app/frontend/templates/panel/server_backup.html @@ -294,6 +294,7 @@ headers: { 'X-XSRFToken': token }, url: '/ajax/backup_now?id=' + server_id, success: function (data) { + location.reload(); }, }); } @@ -505,11 +506,6 @@ } }); } - if (webSocket) { - webSocket.on('backup_reload', function (backup) { - location.reload() - }); - } function getTreeView(path) { path = path diff --git a/app/frontend/templates/panel/server_schedule_edit.html b/app/frontend/templates/panel/server_schedule_edit.html index 34057466..943c233e 100644 --- a/app/frontend/templates/panel/server_schedule_edit.html +++ b/app/frontend/templates/panel/server_schedule_edit.html @@ -136,7 +136,8 @@ - +