ui - better wizard user experience, fix duplicate logs, remove useless print, rename version section and force recheck of pro license when updated

This commit is contained in:
florian 2024-03-17 00:42:10 +01:00
parent a729b2a191
commit a8f62da8db
No known key found for this signature in database
GPG key ID: 93EE47CC3D061500
3 changed files with 25 additions and 17 deletions

View file

@ -88,10 +88,9 @@ app.config["SECRET_KEY"] = getenv("FLASK_SECRET", urandom(32))
PROXY_NUMBERS = int(getenv("PROXY_NUMBERS", "1"))
app.wsgi_app = ReverseProxied(app.wsgi_app, x_for=PROXY_NUMBERS, x_proto=PROXY_NUMBERS, x_host=PROXY_NUMBERS, x_prefix=PROXY_NUMBERS)
gunicorn_logger = getLogger("gunicorn.error")
app.logger.handlers = gunicorn_logger.handlers
app.logger = gunicorn_logger
app.logger.setLevel(gunicorn_logger.level)
login_manager = LoginManager()
login_manager.init_app(app)
login_manager.login_view = "login"
@ -686,6 +685,12 @@ def account():
if error:
return redirect_flash_error("The license key variable checks returned error", "account", True)
# Force job to contact PRO API
# by setting the last check to None
metadata = db.get_metadata()
metadata["last_pro_check"] = None
db.set_pro_metadata(metadata)
# Reload instances
app.config["RELOADING"] = True
app.config["LAST_RELOAD"] = time()
@ -988,7 +993,6 @@ def global_config():
if request.method == "POST":
# Check variables
variables = request.form.to_dict().copy()
print(variables, flush=True)
del variables["csrf_token"]
# Edit check fields and remove already existing ones

View file

@ -5,9 +5,9 @@
<h5 class="my-2 font-bold dark:text-white/90 mx-2">SETTINGS</h5>
{% set tabs = [
{
"name": "Version",
"id": "version",
"description": "Version informations"
"name": "PRO",
"id": "pro",
"description": "BunkerWeb PRO"
},
{
"name": "Username",
@ -55,23 +55,23 @@
<!--end tabs-->
</div>
</div>
{% set version_info = {
{% set pro_info = {
"message" : "Pro version" if is_pro_version else "Pro version but exceeding services" if pro_status == "active" and pro_overlapped else "Pro version is expired" if pro_status == "expired" else "Pro version suspended" if pro_status == "suspended" else "You are using free version",
"link_message" : "All features available" if is_pro_version else "Awaiting compliance" if pro_status == "active" and pro_overlapped else "Renew license" if pro_status == "expired" else "Talk to team" if pro_status == "suspended" else "Upgrade to pro",
"icon" : "pro" if is_pro_version else "free"
} %}
<div data-tab-item="version"
<div data-tab-item="pro"
class="grid grid-cols-12 w-full justify-items-center">
<div class="col-span-12">
<h5 class="text-xl my-1 text-center transition duration-300 ease-in-out font-bold m-0 mb-4 dark:text-gray-200">
VERSION
PRO
</h5>
<div class="flex justify-center items-center">
<p class="mb-0 mr-2 dark:text-gray-300">{{ version_info['message'] }}</p>
<p class="mb-0 mr-2 dark:text-gray-300">{{ pro_info['message'] }}</p>
<div role="img"
aria-label="version"
aria-label="pro"
class="dark:brightness-90 inline-block w-8 h-8 text-center rounded-circle bg-yellow-500">
{% if version_info['icon'] == 'pro' %}
{% if pro_info['icon'] == 'pro' %}
<svg class="leading-none text-lg relative scale-[0.6]"
viewBox="0 0 48 46"
fill="none"
@ -91,10 +91,10 @@
{% endif %}
</div>
</div>
{% if version_info['link_message'] %}
{% if pro_info['link_message'] %}
<div class="flex justify-center mt-2">
<a class="text-center font-semibold text-yellow-500 underline"
href="https://panel.bunkerweb.io/?utm_campaign=self&utm_source=ui#pro">{{ version_info['link_message'] }}</a>
href="https://panel.bunkerweb.io/?utm_campaign=self&utm_source=ui#pro">{{ pro_info['link_message'] }}</a>
</div>
{% endif %}
@ -139,7 +139,7 @@
id="license"
name="license"
class="col-span-12 regular-input"
placeholder="key from panel"
placeholder="enter new license key"
value=""
pattern="^.*$"
required />

View file

@ -414,9 +414,13 @@
}
updateResume() {
this.servInp.value = this.servInp.value.replace('https://', '').replace('http://', '');
if (!this.urlInp.value.startsWith("/")) {
this.urlInp.value = "/" + this.urlInp.value;
}
this.resumeEl.textContent = `http${
this.sslCheck.getAttribute("data-checked") === "true" ? "s" : ""
}://${this.servInp.value.replace('https://', '').replace('http://', '')}${this.urlInp.value}`;
}://${this.servInp.value}${this.urlInp.value}`;
}
}
@ -562,7 +566,7 @@
const api = `http${
this.sslCheck.getAttribute("data-checked") === "true" ? "s" : ""
}://${this.servInp.value.replace('https://', '').replace('http://', '')}${this.urlInp.value}`;
}://${this.servInp.value}${this.urlInp.value}`;
fetch(window.location.href, {
method: "POST",