Mercurial > prosody-modules
comparison mod_register_apps/mod_register_apps.lua @ 4111:ae2699f1cba9
mod_register_apps: Don't duplicate client entries on module reload
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sat, 12 Sep 2020 08:23:09 +0100 |
| parents | 354dc1e7977a |
| children | c85af57e82e0 |
comparison
equal
deleted
inserted
replaced
| 4110:fdc84741258d | 4111:ae2699f1cba9 |
|---|---|
| 88 image = "assets/logos/gajim.svg"; | 88 image = "assets/logos/gajim.svg"; |
| 89 link = "https://gajim.org/"; | 89 link = "https://gajim.org/"; |
| 90 platforms = { "Windows", "Linux" }; | 90 platforms = { "Windows", "Linux" }; |
| 91 download = { | 91 download = { |
| 92 buttons = { | 92 buttons = { |
| 93 { | 93 { |
| 94 text = "Download Gajim"; | 94 text = "Download Gajim"; |
| 95 url = "https://gajim.org/download/"; | 95 url = "https://gajim.org/download/"; |
| 96 target = "_blank"; | 96 target = "_blank"; |
| 97 }; | 97 }; |
| 98 }; | 98 }; |
| 108 return base_url.."/"..s; | 108 return base_url.."/"..s; |
| 109 end | 109 end |
| 110 | 110 |
| 111 local site_apps = module:shared("apps"); | 111 local site_apps = module:shared("apps"); |
| 112 | 112 |
| 113 for k, v in pairs(site_apps) do | |
| 114 if v._source == module.name then | |
| 115 site_apps[k] = nil; | |
| 116 end | |
| 117 end | |
| 118 | |
| 113 for _, app_info in ipairs(app_config) do | 119 for _, app_info in ipairs(app_config) do |
| 114 local app_id = app_info.id or app_info.name:gsub("%W+", "-"):lower(); | 120 local app_id = app_info.id or app_info.name:gsub("%W+", "-"):lower(); |
| 115 app_info.id = app_id; | 121 app_info.id = app_id; |
| 116 app_info.image = relurl(app_info.image); | 122 app_info.image = relurl(app_info.image); |
| 117 site_apps[app_id] = app_info; | 123 site_apps[app_id] = app_info; |
| 124 app_info._source = module.name; | |
| 118 table.insert(site_apps, app_info); | 125 table.insert(site_apps, app_info); |
| 119 end | 126 end |
| 120 | 127 |
| 121 local mime_map = { | 128 local mime_map = { |
| 122 png = "image/png"; | 129 png = "image/png"; |
