mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Merge branch 'dev' into bugfix/server-stats
This commit is contained in:
commit
8569fb6f20
@ -3,9 +3,10 @@
|
||||
### New features
|
||||
TBD
|
||||
### Bug fixes
|
||||
TBD
|
||||
- PWA: Removed the custom offline page in favour of browser default ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/607))
|
||||
- Fix hidden servers appearing visible on public mobile status page ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/612))
|
||||
### Tweaks
|
||||
TBD
|
||||
- Polish/Enhance display for InApp Documentation ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/613))
|
||||
### Lang
|
||||
TBD
|
||||
<br><br>
|
||||
|
@ -1,6 +1,8 @@
|
||||
// This is the "Offline page" service worker
|
||||
|
||||
importScripts('https://storage.googleapis.com/workbox-cdn/releases/5.1.2/workbox-sw.js');
|
||||
importScripts(
|
||||
"https://storage.googleapis.com/workbox-cdn/releases/5.1.2/workbox-sw.js"
|
||||
);
|
||||
|
||||
const CACHE = "crafty-controller";
|
||||
|
||||
@ -13,34 +15,27 @@ self.addEventListener("message", (event) => {
|
||||
}
|
||||
});
|
||||
|
||||
self.addEventListener('install', async (event) => {
|
||||
event.waitUntil(
|
||||
caches.open(CACHE)
|
||||
.then((cache) => cache.add(offlineFallbackPage))
|
||||
);
|
||||
});
|
||||
|
||||
if (workbox.navigationPreload.isSupported()) {
|
||||
workbox.navigationPreload.enable();
|
||||
}
|
||||
|
||||
self.addEventListener('fetch', (event) => {
|
||||
if (event.request.mode === 'navigate') {
|
||||
event.respondWith((async () => {
|
||||
try {
|
||||
const preloadResp = await event.preloadResponse;
|
||||
// self.addEventListener('fetch', (event) => {
|
||||
// if (event.request.mode === 'navigate') {
|
||||
// event.respondWith((async () => {
|
||||
// try {
|
||||
// const preloadResp = await event.preloadResponse;
|
||||
|
||||
if (preloadResp) {
|
||||
return preloadResp;
|
||||
}
|
||||
const networkResp = await fetch(event.request);
|
||||
return networkResp;
|
||||
} catch (error) {
|
||||
// if (preloadResp) {
|
||||
// return preloadResp;
|
||||
// }
|
||||
// const networkResp = await fetch(event.request);
|
||||
// return networkResp;
|
||||
// } catch (error) {
|
||||
|
||||
const cache = await caches.open(CACHE);
|
||||
const cachedResp = await cache.match(offlineFallbackPage);
|
||||
return cachedResp;
|
||||
}
|
||||
})());
|
||||
}
|
||||
});
|
||||
// const cache = await caches.open(CACHE);
|
||||
// const cachedResp = await cache.match(offlineFallbackPage);
|
||||
// return cachedResp;
|
||||
// }
|
||||
// })());
|
||||
// }
|
||||
// });
|
||||
|
@ -1,33 +1,30 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<!-- Required meta tags -->
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
||||
<title>Crafty Controller</title>
|
||||
<!-- plugins:css -->
|
||||
<link rel="stylesheet" href="/static/assets/vendors/mdi/css/materialdesignicons.min.css">
|
||||
<link rel="stylesheet" href="/static/assets/vendors/flag-icon-css/css/flag-icon.min.css">
|
||||
<link rel="stylesheet" href="/static/assets/vendors/ti-icons/css/themify-icons.css">
|
||||
<link rel="stylesheet" href="/static/assets/vendors/typicons/typicons.css">
|
||||
<link rel="stylesheet" href="/static/assets/vendors/css/vendor.bundle.base.css">
|
||||
<link rel="stylesheet" href="/static/assets/vendors/mdi/css/materialdesignicons.min.css" />
|
||||
<link rel="stylesheet" href="/static/assets/vendors/flag-icon-css/css/flag-icon.min.css" />
|
||||
<link rel="stylesheet" href="/static/assets/vendors/ti-icons/css/themify-icons.css" />
|
||||
<link rel="stylesheet" href="/static/assets/vendors/typicons/typicons.css" />
|
||||
<link rel="stylesheet" href="/static/assets/vendors/css/vendor.bundle.base.css" />
|
||||
|
||||
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<meta name="apple-mobile-web-app-title" content="Crafty">
|
||||
<link rel="apple-touch-icon" href="../static/assets/images/Crafty_4-0.png">
|
||||
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||
<meta name="apple-mobile-web-app-title" content="Crafty" />
|
||||
<link rel="apple-touch-icon" href="../static/assets/images/Crafty_4-0.png" />
|
||||
|
||||
<!-- endinject -->
|
||||
<!-- Plugin css for this page -->
|
||||
<!-- End Plugin css for this page -->
|
||||
<!-- Layout styles -->
|
||||
<link rel="stylesheet" href="/static/assets/css/dark/style.css">
|
||||
<link rel="stylesheet" href="/static/assets/css/dark/style.css" />
|
||||
<!-- End Layout styles -->
|
||||
<link rel="shortcut icon" type="image/svg+xml" href="/static/assets/images/logo_small.svg">
|
||||
<link rel="shortcut icon" type="image/svg+xml" href="/static/assets/images/logo_small.svg" />
|
||||
<link rel="alternate icon" href="/static/assets/images/favicon.png" />
|
||||
</head>
|
||||
<style>
|
||||
@ -44,30 +41,28 @@
|
||||
<div class="content-wrapper d-flex align-items-center auth auth-bg-1 theme-one" >
|
||||
<div class="row w-100">
|
||||
<div class="col-lg-4 mx-auto">
|
||||
|
||||
<div class="auto-form-wrapper">
|
||||
<div class="text-center">
|
||||
<img src="/static/assets/images/logo_long.svg"><br /><br />
|
||||
<img alt="Crafty Logo" src="/static/assets/images/logo_long.svg" /><br /><br />
|
||||
<div class="col-sm-12 grid-margin stretch-card">
|
||||
<div class="card card-statistics social-card google-card card-colored" >
|
||||
<div class="card-body">
|
||||
<h4 class="platform-name mb-3 mt-4 font-weight-semibold user-name">{{ translate('accessDenied',
|
||||
'accessDenied', data['lang']) }}</h4>
|
||||
<h5 class="headline font-weight-medium">{{ translate('accessDenied', 'noAccess', data['lang']) }}
|
||||
<h4 class="platform-name mb-3 mt-4 font-weight-semibold user-name" >
|
||||
{{ translate('accessDenied', 'accessDenied', data['lang']) }}
|
||||
</h4>
|
||||
<h5 class="headline font-weight-medium">
|
||||
{{ translate('accessDenied', 'noAccess', data['lang']) }}
|
||||
</h5>
|
||||
<p class="mb-2 comment font-weight-light">
|
||||
{{ translate('accessDenied', 'contactAdmin', data['lang']) }}<br /><br />
|
||||
<a class="d-inline font-weight-medium" href="https://discord.gg/9VJPhCE"> {{
|
||||
translate('accessDenied', 'contact', data['lang']) }}</a>
|
||||
{{ translate('accessDenied', 'contactAdmin',
|
||||
data['lang']) }}<br /><br />
|
||||
<a class="d-inline font-weight-medium" href="https://discord.gg/9VJPhCE" > {{ translate('accessDenied', 'contact', data['lang']) }}</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -88,19 +83,21 @@
|
||||
<!-- endinject -->
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
let login_opacity_div = document.getElementById('login_opacity');
|
||||
let opacity = login_opacity_div.getAttribute('data-value');
|
||||
document.getElementById('login-form-background').style.background = 'rgb(34, 36, 55, ' + (opacity / 100) + ')';
|
||||
let login_opacity_div = document.getElementById("login_opacity");
|
||||
let opacity = login_opacity_div.getAttribute("data-value");
|
||||
document.getElementById("login-form-background").style.background =
|
||||
"rgb(34, 36, 55, " + opacity / 100 + ")";
|
||||
//Register Service worker for mobile app
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register('/static/assets/js/shared/service-worker.js', {scope: '/'})
|
||||
if ("serviceWorker" in navigator) {
|
||||
navigator.serviceWorker
|
||||
.register("/static/assets/js/shared/service-worker.js", {
|
||||
scope: "/",
|
||||
})
|
||||
.then(function (registration) {
|
||||
console.error('Service Worker Registered');
|
||||
console.log("Service Worker Registered");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -7,8 +7,8 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="content-wrapper">
|
||||
|
||||
<!-- Desktop View -->
|
||||
<div class="d-none d-sm-block content-wrapper">
|
||||
<!-- Page Title Header Starts-->
|
||||
<div class="row page-title-header">
|
||||
<div class="col-12">
|
||||
@ -16,33 +16,43 @@
|
||||
<h4 class="page-title">{{ translate('sidebar', 'documentation', data['lang']) }}</h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12 grid-margin">
|
||||
<iframe src="https://docs.craftycontrol.com/" width=100% height=1100px title="crafty's docs"></iframe>
|
||||
<div class="row iframe-row">
|
||||
<div class="col-12 iframe-col">
|
||||
<div class="iframe-wrapper">
|
||||
<iframe title="crafty's docs" src="https://docs.craftycontrol.com/" class="iframe-item"></iframe>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Mobile View -->
|
||||
<div class="d-sm-none content-wrapper mobile-content-wrapper">
|
||||
<iframe title="crafty's docs" src="https://docs.craftycontrol.com/" class="iframe-item"></iframe>
|
||||
</div>
|
||||
<!-- content-wrapper ends -->
|
||||
<style>
|
||||
.popover-body {
|
||||
color: white !important;
|
||||
;
|
||||
.iframe-item {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
border: none;
|
||||
}
|
||||
|
||||
#desc_id {
|
||||
-ms-overflow-style: none;
|
||||
/* for Internet Explorer, Edge */
|
||||
scrollbar-width: none;
|
||||
/* for Firefox */
|
||||
overflow-y: scroll;
|
||||
.iframe-wrapper {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#desc_id::-webkit-scrollbar {
|
||||
display: none;
|
||||
/* for Chrome, Safari, and Opera */
|
||||
.iframe-col {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.iframe-row {
|
||||
height: 100%;
|
||||
max-height: calc(100% - 63px);
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
|
||||
.mobile-content-wrapper {
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
@ -156,7 +156,7 @@
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register('/static/assets/js/shared/service-worker.js', {scope: '/'})
|
||||
.then(function (registration) {
|
||||
console.error('Service Worker Registered');
|
||||
console.log('Service Worker Registered');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -97,6 +97,7 @@
|
||||
{% end %}
|
||||
<div class="accordion" id="accordionServers">
|
||||
{% for server in data['servers'] %}
|
||||
{% if server['server_data']['show_status'] %}
|
||||
<div class="card mb-0">
|
||||
<div class="card-header" id="heading-{{server['server_data']['server_id']}}">
|
||||
<h2 class="mb-0 container overflow-hidden">
|
||||
@ -167,6 +168,7 @@
|
||||
</div>
|
||||
</div>
|
||||
{% end %}
|
||||
{% end %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,45 +1,71 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ data['lang_page'] }}" class="default">
|
||||
|
||||
<head>
|
||||
<!-- Required meta tags -->
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta charset="utf-8" />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1, shrink-to-fit=no"
|
||||
/>
|
||||
{% block meta %}{% end %}
|
||||
<title>{% block title %}{{ _('Default') }}{% end %}</title>
|
||||
<!-- plugins:css -->
|
||||
<link rel="stylesheet" href="/static/assets/vendors/mdi/css/materialdesignicons.min.css">
|
||||
<link rel="stylesheet" href="/static/assets/vendors/flag-icon-css/css/flag-icon.min.css">
|
||||
<link rel="stylesheet" href="/static/assets/vendors/ti-icons/css/themify-icons.css">
|
||||
<link rel="stylesheet" href="/static/assets/vendors/typicons/typicons.css">
|
||||
<link rel="stylesheet" href="/static/assets/vendors/css/vendor.bundle.base.css">
|
||||
<link rel="stylesheet" href="/static/assets/vendors/fontawesome6/css/all.css">
|
||||
<link rel="manifest" href="/static/assets/crafty.webmanifest">
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="/static/assets/vendors/mdi/css/materialdesignicons.min.css"
|
||||
/>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="/static/assets/vendors/flag-icon-css/css/flag-icon.min.css"
|
||||
/>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="/static/assets/vendors/ti-icons/css/themify-icons.css"
|
||||
/>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="/static/assets/vendors/typicons/typicons.css"
|
||||
/>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="/static/assets/vendors/css/vendor.bundle.base.css"
|
||||
/>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="/static/assets/vendors/fontawesome6/css/all.css"
|
||||
/>
|
||||
<link rel="manifest" href="/static/assets/crafty.webmanifest" />
|
||||
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<meta name="apple-mobile-web-app-title" content="Crafty">
|
||||
<link rel="apple-touch-icon" href="../static/assets/images/Crafty_4-0.png">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||
<meta name="apple-mobile-web-app-title" content="Crafty" />
|
||||
<link
|
||||
rel="apple-touch-icon"
|
||||
href="../static/assets/images/Crafty_4-0.png"
|
||||
/>
|
||||
<!-- endinject -->
|
||||
<!-- Plugin css for this page -->
|
||||
<!-- End Plugin css for this page -->
|
||||
<!-- Layout styles -->
|
||||
<link rel="stylesheet" href="/static/assets/css/dark/style.css">
|
||||
<link rel="stylesheet" href="/static/assets/css/dark/style.css" />
|
||||
<!-- End Layout styles -->
|
||||
<link rel="shortcut icon" type="image/svg+xml" href="/static/assets/images/logo_small.svg">
|
||||
<link
|
||||
rel="shortcut icon"
|
||||
type="image/svg+xml"
|
||||
href="/static/assets/images/logo_small.svg"
|
||||
/>
|
||||
<link rel="alternate icon" href="/static/assets/images/favicon.png" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container-scroller">
|
||||
<div class="container-fluid page-body-wrapper full-page-wrapper">
|
||||
<div class="content-wrapper d-flex align-items-sm-center auth auth-bg-1 theme-one">
|
||||
<div
|
||||
class="content-wrapper d-flex align-items-sm-center auth auth-bg-1 theme-one"
|
||||
>
|
||||
<div class="mx-auto">
|
||||
<div class="auto-form-wrapper">
|
||||
{% block content %}
|
||||
{% end %}
|
||||
</div>
|
||||
<div class="auto-form-wrapper">{% block content %} {% end %}</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- content-wrapper ends -->
|
||||
@ -56,81 +82,86 @@
|
||||
<script src="/static/assets/js/shared/misc.js"></script>
|
||||
<!-- endinject -->
|
||||
<script>
|
||||
|
||||
// {% if request.protocol == 'https' %}
|
||||
let usingWebSockets = true;
|
||||
|
||||
let listenEvents = [];
|
||||
|
||||
let pageQueryParams, page;
|
||||
|
||||
try {
|
||||
pageQueryParams = 'page_query_params=' + encodeURIComponent(location.search)
|
||||
page = 'page=' + encodeURIComponent(location.pathname)
|
||||
var wsInternal = new WebSocket('wss://' + location.host + '/ws?' + page + '&' + pageQueryParams);
|
||||
pageQueryParams =
|
||||
"page_query_params=" + encodeURIComponent(location.search);
|
||||
page = "page=" + encodeURIComponent(location.pathname);
|
||||
var wsInternal = new WebSocket(
|
||||
"wss://" + location.host + "/ws?" + page + "&" + pageQueryParams
|
||||
);
|
||||
wsInternal.onopen = function () {
|
||||
console.log('opened WebSocket connection:', wsInternal)
|
||||
console.log("opened WebSocket connection:", wsInternal);
|
||||
};
|
||||
wsInternal.onmessage = function (rawMessage) {
|
||||
var message = JSON.parse(rawMessage.data);
|
||||
|
||||
console.log('got message: ', message)
|
||||
console.log("got message: ", message);
|
||||
|
||||
listenEvents
|
||||
.filter(listenedEvent => listenedEvent.event == message.event)
|
||||
.forEach(listenedEvent => listenedEvent.callback(message.data))
|
||||
.filter((listenedEvent) => listenedEvent.event == message.event)
|
||||
.forEach((listenedEvent) => listenedEvent.callback(message.data));
|
||||
};
|
||||
wsInternal.onerror = function (errorEvent) {
|
||||
console.error('WebSocket Error', errorEvent);
|
||||
console.error("WebSocket Error", errorEvent);
|
||||
};
|
||||
wsInternal.onclose = function (closeEvent) {
|
||||
console.log('Closed WebSocket', closeEvent);
|
||||
console.log("Closed WebSocket", closeEvent);
|
||||
};
|
||||
|
||||
|
||||
webSocket = {
|
||||
on: function (event, callback) {
|
||||
console.log('registered ' + event + ' event');
|
||||
listenEvents.push({ event: event, callback: callback })
|
||||
console.log("registered " + event + " event");
|
||||
listenEvents.push({ event: event, callback: callback });
|
||||
},
|
||||
emit: function (event, data) {
|
||||
var message = {
|
||||
event: event,
|
||||
data: data
|
||||
}
|
||||
data: data,
|
||||
};
|
||||
|
||||
wsInternal.send(JSON.stringify(message));
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('Error while making websocket helpers', error);
|
||||
console.error("Error while making websocket helpers", error);
|
||||
usingWebSockets = false;
|
||||
}
|
||||
// {% else %}
|
||||
usingWebSockets = false;
|
||||
warn('WebSockets are not supported in Crafty if not using the https protocol')
|
||||
warn(
|
||||
"WebSockets are not supported in Crafty if not using the https protocol"
|
||||
);
|
||||
var webSocket;
|
||||
// {% end%}
|
||||
|
||||
</script>
|
||||
{% block js %}
|
||||
<!-- Custom js for this page -->
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
let login_opacity_div = document.getElementById('login_opacity');
|
||||
let opacity = login_opacity_div.getAttribute('data-value');
|
||||
document.getElementById('login-form-background').style.background = 'rgb(34, 36, 55, ' + (opacity / 100) + ')';
|
||||
let login_opacity_div = document.getElementById("login_opacity");
|
||||
let opacity = login_opacity_div.getAttribute("data-value");
|
||||
document.getElementById("login-form-background").style.background =
|
||||
"rgb(34, 36, 55, " + opacity / 100 + ")";
|
||||
//Register Service worker for mobile app
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register('/static/assets/js/shared/service-worker.js', {scope: '/'})
|
||||
if ("serviceWorker" in navigator) {
|
||||
navigator.serviceWorker
|
||||
.register("/static/assets/js/shared/service-worker.js", {
|
||||
scope: "/",
|
||||
})
|
||||
.then(function (registration) {
|
||||
console.error('Service Worker Registered');
|
||||
console.log("Service Worker Registered");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
<!-- End custom js for this page -->
|
||||
{% end %}
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user