mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Add grayscale warning over creation when api down
This commit is contained in:
parent
9611e8539d
commit
3262b5fd15
@ -301,6 +301,16 @@ class Helpers:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def check_address_status(address):
|
||||
try:
|
||||
requests.get(address, timeout=1)
|
||||
time.sleep(1)
|
||||
requests.get(address, timeout=1)
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def check_port(server_port):
|
||||
try:
|
||||
|
@ -143,7 +143,11 @@ class ServerHandler(BaseHandler):
|
||||
"not a server creator or server limit reached"
|
||||
)
|
||||
return
|
||||
|
||||
page_data["server_api"] = False
|
||||
if page_data["online"]:
|
||||
page_data["server_api"] = self.helper.check_address_status(
|
||||
"https://serverjars.com/api/fetchTypes"
|
||||
)
|
||||
page_data["server_types"] = self.controller.server_jars.get_serverjar_data()
|
||||
page_data["js_server_types"] = json.dumps(
|
||||
self.controller.server_jars.get_serverjar_data()
|
||||
|
@ -19,10 +19,6 @@
|
||||
<div class="row">
|
||||
{% if data['online'] %}
|
||||
<div class="col-sm-6 grid-margin stretch-card">
|
||||
<div class="api-alert" style="position: absolute; top: -5px; z-index: 100; opacity: .99;">
|
||||
<p style="color: white !important;"><i class="fas fa-exclamation-triangle" style="color: #d98c20;"></i> Server JARs API unreachable. Please check <a href="https://status.craftycontrol.com/status/craftycontrol"
|
||||
target="_blank">Crafty's status Page</a>
|
||||
for more information.</p></div>
|
||||
<div class="card" id="creation_wizard">
|
||||
<div class="card-body">
|
||||
|
||||
@ -39,6 +35,28 @@
|
||||
#creation_wizard {
|
||||
-webkit-filter: grayscale(1);
|
||||
}
|
||||
.api-alert{
|
||||
position:absolute;
|
||||
top:-5px;
|
||||
left:0;
|
||||
font-size: 50px !important;
|
||||
color:#fff;
|
||||
background:rgb(0,170,170);
|
||||
opacity:.4;
|
||||
width:100%;
|
||||
height:100%;
|
||||
z-index: 100;
|
||||
}
|
||||
.api-alert p {
|
||||
margin: 0;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
text-align: center;
|
||||
font-size: 20px;
|
||||
-ms-transform: translate(-50%, -50%);
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
</style>
|
||||
{% end %}
|
||||
{% raw xsrf_form_html() %}
|
||||
@ -160,10 +178,15 @@
|
||||
<button type="reset" class="btn btn-danger mr-2">{{ translate('serverWizard', 'resetForm', data['lang'])
|
||||
}}</button>
|
||||
</fieldset>
|
||||
</form>
|
||||
</p>
|
||||
{% if not data["server_api"] %}
|
||||
<div class="api-alert" style="position: absolute; top: -5px; z-index: 100; opacity: .99;">
|
||||
<p style="color: white !important;"><i class="fas fa-exclamation-triangle" style="color: white;"></i> Server JARs API unreachable. Please check <a style="color: red;"; href="https://status.craftycontrol.com/status/craftycontrol"
|
||||
target="_blank">Crafty's status Page</a>
|
||||
for more information.</p></div>
|
||||
{% end %}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% end %}
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user