Merge branch 'master' of github.com:naiba/nezha

This commit is contained in:
naiba
2021-03-02 23:09:00 +08:00
4 changed files with 251 additions and 7 deletions

View File

@@ -42,12 +42,30 @@
$('#settingForm').submit(function () {
$.post('/api/setting', $('#settingForm').serialize()).then((resp) => {
if (resp.code == 200) {
alert("保存成功")
$.suiAlert({
title: '',
description: '修改成功',
type: 'success',
time: '3',
position: 'top-center',
});
} else {
alert(resp.message)
$.suiAlert({
title: '',
description:resp.message,
type: 'error',
time: '3',
position: 'top-center',
});
}
}).error(err => {
alert(err)
$.suiAlert({
title: '',
description:err,
type: 'error',
time: '3',
position: 'top-center',
});
})
return false;
})

View File

@@ -15,10 +15,11 @@
<!-- Styles -->
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.bootcdn.net/ajax/libs/font-awesome/5.15.1/css/all.min.css">
<link rel="stylesheet" type="text/css" href="/static/semantic-ui-alerts.min.css">
<link rel="stylesheet" href="/static/theme-hotaru/css/core.css?v202012121912" type="text/css">
<link rel="stylesheet" href="/static/theme-hotaru/css/main.css?v202101171153" type="text/css">
<link rel="stylesheet" href="/static/theme-hotaru/css/darkmode.css?v202012121912" type="text/css">
<link rel="stylesheet" href="/static/theme-hotaru/css/darkmode.css?v202103021121" type="text/css">
{{if ts .CustomCode}}
{{.CustomCode|safe}}
{{end}}
@@ -132,6 +133,12 @@
</div>
</div>
</div>
<div class="sidebar-container">
<ul>
<li id='sun'><i class="fas fa-sun" title="白昼模式"></i><span>白昼模式</span></li>
<li id='moon'><i class="fas fa-moon" title="暗黑模式"></i><span>暗黑模式</span></li>
</ul>
</div>
<footer>
<p style="text-align:center;padding: 15px;">Powered by <a href="https://github.com/naiba/nezha">哪吒监控</a> build ·
{{.Version}}
@@ -226,6 +233,17 @@
}
}
})
$(function(){
$('#sun').click(function(){
$('body').removeClass('dark');
});
$('#moon').click(function(){
$('body').addClass('dark');
})
})
const wsProtocol = window.location.protocol == "https:" ? "wss" : "ws"
const ws = new WebSocket(wsProtocol + '://' + window.location.host + '/ws');
ws.onopen = function (evt) {