API - Adding current version to 'System Information' endpoint, bumping API docs, Re #1429

pull/1430/head
dgtlmoon 2 years ago
parent aaad71fc19
commit 3e98c8ae4b

@ -264,6 +264,22 @@ class SystemInfo(Resource):
@auth.check_token @auth.check_token
def get(self): def get(self):
"""
@api {get} /api/v1/systeminfo Return system info
@apiDescription Return some info about the current system state
@apiExample {curl} Example usage:
curl http://localhost:4000/api/v1/systeminfo -H"x-api-key:813031b16330fe25e3780cf0325daa45"
HTTP/1.0 200
{
'queue_size': 10 ,
'overdue_watches': ["watch-uuid-list"],
'uptime': 38344.55,
'watch_count': 800,
'version': "0.40.1"
}
@apiName Get Info
@apiGroup System Information
"""
import time import time
overdue_watches = [] overdue_watches = []
@ -282,10 +298,11 @@ class SystemInfo(Resource):
# Allow 5 minutes of grace time before we decide it's overdue # Allow 5 minutes of grace time before we decide it's overdue
if time_since_check - (5 * 60) > t: if time_since_check - (5 * 60) > t:
overdue_watches.append(uuid) overdue_watches.append(uuid)
from changedetectionio import __version__ as main_version
return { return {
'queue_size': self.update_q.qsize(), 'queue_size': self.update_q.qsize(),
'overdue_watches': overdue_watches, 'overdue_watches': overdue_watches,
'uptime': round(time.time() - self.datastore.start_time, 2), 'uptime': round(time.time() - self.datastore.start_time, 2),
'watch_count': len(self.datastore.data.get('watching', {})) 'watch_count': len(self.datastore.data.get('watching', {})),
'version': main_version
}, 200 }, 200

File diff suppressed because one or more lines are too long

@ -5,13 +5,13 @@
<meta name="description" content="Manage your changedetection.io watches via API, requires the `x-api-key` header which is found in the settings UI."> <meta name="description" content="Manage your changedetection.io watches via API, requires the `x-api-key` header which is found in the settings UI.">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="assets/bootstrap.min.css?v=1677097735733" rel="stylesheet" media="screen"> <link href="assets/bootstrap.min.css?v=1677105273196" rel="stylesheet" media="screen">
<link href="assets/prism.css?v=1677097735733" rel="stylesheet" /> <link href="assets/prism.css?v=1677105273196" rel="stylesheet" />
<link href="assets/main.css?v=1677097735733" rel="stylesheet" media="screen, print"> <link href="assets/main.css?v=1677105273196" rel="stylesheet" media="screen, print">
<link href="assets/favicon.ico?v=1677097735733" rel="icon" type="image/x-icon"> <link href="assets/favicon.ico?v=1677105273196" rel="icon" type="image/x-icon">
<link href="assets/apple-touch-icon.png?v=1677097735733" rel="apple-touch-icon" sizes="180x180"> <link href="assets/apple-touch-icon.png?v=1677105273196" rel="apple-touch-icon" sizes="180x180">
<link href="assets/favicon-32x32.png?v=1677097735733" rel="icon" type="image/png" sizes="32x32"> <link href="assets/favicon-32x32.png?v=1677105273196" rel="icon" type="image/png" sizes="32x32">
<link href="assets/favicon-16x16.png?v=1677097735733" rel="icon" type="image/png" sizes="16x16"> <link href="assets/favicon-16x16.png?v=1677105273196" rel="icon" type="image/png" sizes="16x16">
</head> </head>
<body class="container-fluid"> <body class="container-fluid">
@ -928,6 +928,6 @@
</div> </div>
</div> </div>
<script src="assets/main.bundle.js?v=1677097735733"></script> <script src="assets/main.bundle.js?v=1677105273196"></script>
</body> </body>
</html> </html>

Loading…
Cancel
Save