comparison mod_register_apps/mod_register_apps.lua @ 4091:354dc1e7977a

mod_register_apps: Provides a configurable list of XMPP apps
author Matthew Wild <mwild1@gmail.com>
date Thu, 10 Sep 2020 16:47:59 +0100
parents
children ae2699f1cba9
comparison
equal deleted inserted replaced
4090:e77122025080 4091:354dc1e7977a
1 module:depends("http");
2 local http_files = module:depends("http_files");
3
4 local app_config = module:get_option("site_apps", {
5 {
6 name = "Conversations";
7 text = [[Conversations is a Jabber/XMPP client for Android 4.0+ smartphones that has been optimized to provide a unique mobile experience.]];
8 image = "assets/logos/conversations.svg";
9 link = "https://play.google.com/store/apps/details?id=eu.siacs.conversations";
10 platforms = { "Android" };
11 supports_preauth_uri = true;
12 magic_link_format = "{app.link!}&referrer={invite.uri}";
13 download = {
14 buttons = {
15 {
16 image = "https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png";
17 url = "https://play.google.com/store/apps/details?id=eu.siacs.conversations";
18 };
19 };
20 };
21 };
22 {
23 name = "yaxim";
24 text = [[A lean Jabber/XMPP client for Android. It aims at usability, low overhead and security, and works on low-end Android devices starting with Android 4.0.]];
25 image = "assets/logos/yaxim.svg";
26 link = "https://play.google.com/store/apps/details?id=org.yaxim.androidclient";
27 platforms = { "Android" };
28 supports_preauth_uri = true;
29 magic_link_format = "{app.link!}&referrer={invite.uri}";
30 download = {
31 buttons = {
32 {
33 image = "https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png";
34 url = "https://play.google.com/store/apps/details?id=org.yaxim.androidclient";
35 };
36 };
37 };
38 };
39 {
40 name = "Siskin IM";
41 text = [[A lightweight and powerful XMPP client for iPhone and iPad. It provides an easy way to talk and share moments with your friends.]];
42 image = "assets/logos/siskin-im.png";
43 link = "https://apps.apple.com/us/app/siskin-im/id1153516838";
44 platforms = { "iOS" };
45 supports_preauth_uri = true;
46 download = {
47 buttons = {
48 {
49 image = "https://linkmaker.itunes.apple.com/en-us/badge-lrg.svg?releaseDate=2017-05-31&kind=iossoftware&bubble=ios_apps";
50 url = "https://apps.apple.com/us/app/siskin-im/id1153516838";
51 target = "_blank";
52 };
53 };
54 };
55 };
56 {
57 name = "Beagle IM";
58 text = [[Beagle IM by Tigase, Inc. is a lightweight and powerful XMPP client for macOS.]];
59 image = "assets/logos/beagle-im.png";
60 link = "https://apps.apple.com/us/app/beagle-im/id1445349494";
61 platforms = { "macOS" };
62 download = {
63 buttons = {
64 {
65 text = "Download from Mac App Store";
66 url = "https://apps.apple.com/us/app/beagle-im/id1445349494";
67 target = "_blank";
68 };
69 };
70 };
71 };
72 {
73 name = "Dino";
74 text = [[A modern open-source chat client for the desktop. It focuses on providing a clean and reliable Jabber/XMPP experience while having your privacy in mind.]];
75 image = "assets/logos/dino.svg";
76 link = "https://dino.im/";
77 platforms = { "Linux" };
78 download = {
79 text = "Click the button to open the Dino website where you can download and install it on your PC.";
80 buttons = {
81 { text = "Download Dino for Linux", url = "https://dino.im/#download", target="_blank" };
82 };
83 };
84 };
85 {
86 name = "Gajim";
87 text = [[A fully-featured desktop chat client for Windows and Linux.]];
88 image = "assets/logos/gajim.svg";
89 link = "https://gajim.org/";
90 platforms = { "Windows", "Linux" };
91 download = {
92 buttons = {
93 {
94 text = "Download Gajim";
95 url = "https://gajim.org/download/";
96 target = "_blank";
97 };
98 };
99 };
100 };
101 });
102
103 local base_url = module.http_url and module:http_url();
104 local function relurl(s)
105 if s:match("^%w+://") then
106 return s;
107 end
108 return base_url.."/"..s;
109 end
110
111 local site_apps = module:shared("apps");
112
113 for _, app_info in ipairs(app_config) do
114 local app_id = app_info.id or app_info.name:gsub("%W+", "-"):lower();
115 app_info.id = app_id;
116 app_info.image = relurl(app_info.image);
117 site_apps[app_id] = app_info;
118 table.insert(site_apps, app_info);
119 end
120
121 local mime_map = {
122 png = "image/png";
123 svg = "image/svg+xml";
124 };
125
126 module:provides("http", {
127 route = {
128 ["GET /assets/*"] = http_files and http_files.serve({
129 path = module:get_directory().."/assets";
130 mime_map = mime_map;
131 });
132 };
133 });