Software / code / prosody-modules
Comparison
mod_nodeinfo2/mod_nodeinfo2.lua @ 3706:36b645e94325
mod_nodeinfo2: Add some TODOs
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 10 Oct 2019 16:55:54 +0200 |
| parent | 3705:5d3d8b75dee9 |
| child | 3707:3248295e1b16 |
comparison
equal
deleted
inserted
replaced
| 3705:5d3d8b75dee9 | 3706:36b645e94325 |
|---|---|
| 2 local array = require "util.array"; | 2 local array = require "util.array"; |
| 3 | 3 |
| 4 module:depends("http"); | 4 module:depends("http"); |
| 5 | 5 |
| 6 local total_users = 0; | 6 local total_users = 0; |
| 7 for _ in require "core.usermanager".users(module.host) do | 7 for _ in require "core.usermanager".users(module.host) do -- TODO refresh at some interval? |
| 8 total_users = total_users + 1; | 8 total_users = total_users + 1; |
| 9 end | 9 end |
| 10 | 10 |
| 11 module:provides("http", { | 11 module:provides("http", { |
| 12 default_path = "/.well-known/x-nodeinfo2"; | 12 default_path = "/.well-known/x-nodeinfo2"; |
| 19 baseUrl = module:http_url("","/"); | 19 baseUrl = module:http_url("","/"); |
| 20 name = module.host; | 20 name = module.host; |
| 21 software = "Prosody"; | 21 software = "Prosody"; |
| 22 version = prosody.version; | 22 version = prosody.version; |
| 23 }; | 23 }; |
| 24 --[[ | 24 --[[ TODO re-use data from mod_server_contact_info ? |
| 25 organization = { | 25 organization = { |
| 26 name = ""; | 26 name = ""; |
| 27 contact = ""; | 27 contact = ""; |
| 28 account = ""; | 28 account = ""; |
| 29 }; | 29 }; |
| 30 --]] | 30 --]] |
| 31 protocols = array { | 31 protocols = array { |
| 32 "xmpp", | 32 "xmpp", |
| 33 }; | 33 }; |
| 34 --[[ | 34 --[[ TODO would be cool to identify local transports |
| 35 services = { | 35 services = { |
| 36 inbound = array { | 36 inbound = array { |
| 37 "irc"; | 37 "irc"; |
| 38 }; | 38 }; |
| 39 outbound = array { | 39 outbound = array { |
| 42 --]] | 42 --]] |
| 43 openRegistrations = module:get_option_boolean("allow_registration", false); | 43 openRegistrations = module:get_option_boolean("allow_registration", false); |
| 44 usage = { | 44 usage = { |
| 45 users = { | 45 users = { |
| 46 total = total_users; | 46 total = total_users; |
| 47 -- TODO how would one calculate these? | |
| 47 -- activeHalfyear = 1; | 48 -- activeHalfyear = 1; |
| 48 -- activeMonth = 1; | 49 -- activeMonth = 1; |
| 49 -- activeWeek = 1; | 50 -- activeWeek = 1; |
| 50 }; | 51 }; |
| 51 -- localPosts = 0; | 52 -- localPosts = 0; |