mirror of
				https://github.com/louislam/uptime-kuma.git
				synced 2025-10-31 11:29:20 +08:00 
			
		
		
		
	show version in the footer
This commit is contained in:
		| @@ -14,9 +14,7 @@ const {getSettings} = require("./util-server"); | ||||
| const {Notification} = require("./notification") | ||||
| const args = require('args-parser')(process.argv); | ||||
|  | ||||
| console.log("args:") | ||||
| console.log(args) | ||||
|  | ||||
| const version = require('../package.json').version; | ||||
| const hostname = args.host || "0.0.0.0" | ||||
| const port = args.port || 3001 | ||||
|  | ||||
| @@ -32,18 +30,16 @@ let needSetup = false; | ||||
|  | ||||
|     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) { | ||||
|         response.sendFile(process.cwd() + '/dist/index.html'); | ||||
|     }); | ||||
|  | ||||
|     io.on('connection', async (socket) => { | ||||
|  | ||||
|         socket.emit("info", { | ||||
|             version, | ||||
|         }) | ||||
|  | ||||
|         console.log('a user connected'); | ||||
|         totalClient++; | ||||
|  | ||||
|   | ||||
| @@ -33,6 +33,14 @@ | ||||
|         <Login v-if="! $root.loggedIn && $root.allowLoginDialog" /> | ||||
|     </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 --> | ||||
|     <div style="width: 100%;height: 60px;" v-if="$root.isMobile"></div> | ||||
|     <nav class="bottom-nav" v-if="$root.isMobile"> | ||||
| @@ -130,6 +138,14 @@ export default { | ||||
| } | ||||
|  | ||||
| main { | ||||
|     margin-bottom: 30px; | ||||
|  | ||||
| } | ||||
|  | ||||
| footer { | ||||
|     color: #AAA; | ||||
|     font-size: 13px; | ||||
|     margin-bottom: 30px; | ||||
|     margin-left: 10px; | ||||
| } | ||||
|  | ||||
| </style> | ||||
|   | ||||
| @@ -9,6 +9,7 @@ export default { | ||||
|  | ||||
|     data() { | ||||
|         return { | ||||
|             info: { }, | ||||
|             socket: { | ||||
|                 token: null, | ||||
|                 firstConnect: true, | ||||
| @@ -44,6 +45,10 @@ export default { | ||||
|             transports: ['websocket'] | ||||
|         }); | ||||
|  | ||||
|         socket.on('info', (info) => { | ||||
|             this.info = info; | ||||
|         }); | ||||
|  | ||||
|         socket.on('setup', (monitorID, data) => { | ||||
|             this.$router.push("/setup") | ||||
|         }); | ||||
| @@ -280,6 +285,13 @@ export default { | ||||
|  | ||||
|     watch: { | ||||
|  | ||||
|         // Reload the SPA if the server version is changed. | ||||
|         "info.version"(to, from) { | ||||
|               if (from && from !== to) { | ||||
|                   window.location.reload() | ||||
|               } | ||||
|         }, | ||||
|  | ||||
|         remember() { | ||||
|             localStorage.remember = (this.remember) ? "1" : "0" | ||||
|         } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user