mobius icon indicating copy to clipboard operation
mobius copied to clipboard

Mobius API

Open aptonline opened this issue 3 years ago • 6 comments

I appreciate this may be way out of the scope of what you are trying to achieve with Mobius but it occurred to me it would be useful for the sever to have its own API that you could use to query activity on the server. For example, to find out how many users are online, the status of the server, any new posts, messages or files that have been uploaded. This could then be used in other , more modern, enviroments such as home assistant or as an alternative to having to trawl the logs for data.

From an iPhone users perspective, having a widget/shortcut combo that shows me stats of the server when away from home would be a great addition. This is only scratching the surface of what an API could do.

aptonline avatar Jun 08 '22 17:06 aptonline

Thanks for the suggestion. I've intended to do something like this for my own use and plan to work on it after I get through more of the feature parity tasks.

My thought is to add an optional command line argument like --stat-port=5503 that will expose an HTTP endpoint that returns JSON with whatever info seems useful.

jhalter avatar Jun 08 '22 20:06 jhalter

For reference here are the stats that are shown within the official 1.9.1 server: Screenshot 2022-06-09 at 21 38 36

aptonline avatar Jun 09 '22 20:06 aptonline

I'm hoping to render exactly that window on my Pi server, so I'll definitely collect those stats in addition to others:

IMG_6113

The text is a bit too small on a 1.54" display though, may need to upgrade.

jhalter avatar Jun 09 '22 22:06 jhalter

I've added a couple of new HTTP API endpoint in #143 that provide missing functionality to reload the configuration and send shutdown messages, but I think I'll leave it at that for now.

jhalter avatar Jul 18 '24 23:07 jhalter

Great stuff, would be helpful to be able to see via the API the server version as well if thats easy to implement :)

EDIT: turns out I'm running 0.12.3 and didn't realise it 👎🏼

aptonline avatar Aug 05 '24 16:08 aptonline

All up-to-date now :)

aptonline avatar Aug 09 '24 15:08 aptonline