show version in the footer

pull/38/head
LouisLam 4 years ago
parent b3a5d868a7
commit 010ebea210

@ -14,9 +14,7 @@ const {getSettings} = require("./util-server");
const {Notification} = require("./notification") const {Notification} = require("./notification")
const args = require('args-parser')(process.argv); const args = require('args-parser')(process.argv);
console.log("args:") const version = require('../package.json').version;
console.log(args)
const hostname = args.host || "0.0.0.0" const hostname = args.host || "0.0.0.0"
const port = args.port || 3001 const port = args.port || 3001
@ -32,18 +30,16 @@ let needSetup = false;
app.use('/', express.static("dist")); app.use('/', express.static("dist"));
app.post('/test-webhook', function(request, response, next) {
console.log("Test Webhook (application/json only)")
console.log("Content-Type: " + request.header("Content-Type"))
console.log(request.body)
response.end();
});
app.get('*', function(request, response, next) { app.get('*', function(request, response, next) {
response.sendFile(process.cwd() + '/dist/index.html'); response.sendFile(process.cwd() + '/dist/index.html');
}); });
io.on('connection', async (socket) => { io.on('connection', async (socket) => {
socket.emit("info", {
version,
})
console.log('a user connected'); console.log('a user connected');
totalClient++; totalClient++;

@ -33,6 +33,14 @@
<Login v-if="! $root.loggedIn && $root.allowLoginDialog" /> <Login v-if="! $root.loggedIn && $root.allowLoginDialog" />
</main> </main>
<footer>
<div class="container-fluid">
Uptime Kuma -
Version: {{ $root.info.version }} -
<a href="https://github.com/louislam/uptime-kuma/releases" target="_blank">Check Update On GitHub</a>
</div>
</footer>
<!-- Mobile Only --> <!-- Mobile Only -->
<div style="width: 100%;height: 60px;" v-if="$root.isMobile"></div> <div style="width: 100%;height: 60px;" v-if="$root.isMobile"></div>
<nav class="bottom-nav" v-if="$root.isMobile"> <nav class="bottom-nav" v-if="$root.isMobile">
@ -130,6 +138,14 @@ export default {
} }
main { main {
}
footer {
color: #AAA;
font-size: 13px;
margin-bottom: 30px; margin-bottom: 30px;
margin-left: 10px;
} }
</style> </style>

@ -9,6 +9,7 @@ export default {
data() { data() {
return { return {
info: { },
socket: { socket: {
token: null, token: null,
firstConnect: true, firstConnect: true,
@ -44,6 +45,10 @@ export default {
transports: ['websocket'] transports: ['websocket']
}); });
socket.on('info', (info) => {
this.info = info;
});
socket.on('setup', (monitorID, data) => { socket.on('setup', (monitorID, data) => {
this.$router.push("/setup") this.$router.push("/setup")
}); });
@ -280,6 +285,13 @@ export default {
watch: { watch: {
// Reload the SPA if the server version is changed.
"info.version"(to, from) {
if (from && from !== to) {
window.location.reload()
}
},
remember() { remember() {
localStorage.remember = (this.remember) ? "1" : "0" localStorage.remember = (this.remember) ? "1" : "0"
} }

Loading…
Cancel
Save