Mercurial > prosody-modules
annotate mod_invites_tracking/mod_invites_tracking.lua @ 6171:fe8222112cf4
mod_conversejs: Serve base app at /
This makes things slightly less awkward for the browser to figure out which
URLs belong to a PWA. The app's "start URL" was previously without the '/' and
therefore was not considered within the scope of the PWA. Now the canonical
app URL will always have a '/'.
Prosody/mod_http should take care of redirecting existing links without the
trailing / to the new URL.
If you have an installation at https://prosody/conversejs then it is now at
https://prosody/conversejs/ (the first URL will now redirect to the second
URL if you use it).
The alternative would be to make the PWA scope include the parent, i.e.
the whole of https://prosody/ in this case. This might get messy if other
PWAs are provided by the same site or Prosody installation, however.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Tue, 11 Feb 2025 13:18:38 +0000 |
| parents | 9ed02a4f6ff4 |
| children |
| rev | line source |
|---|---|
|
4394
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
1 local tracking_store = module:open_store("invites_tracking"); |
|
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
2 |
|
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
3 module:hook("user-registered", function(event) |
|
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
4 local validated_invite = event.validated_invite or (event.session and event.session.validated_invite); |
|
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
5 local new_username = event.username; |
|
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
6 |
|
5901
9ed02a4f6ff4
mod_invites_tracking: Don't bother storing anything for non-invite IBR
Matthew Wild <mwild1@gmail.com>
parents:
5900
diff
changeset
|
7 if not validated_invite then |
|
9ed02a4f6ff4
mod_invites_tracking: Don't bother storing anything for non-invite IBR
Matthew Wild <mwild1@gmail.com>
parents:
5900
diff
changeset
|
8 module:log("debug", "No invitation found for registration of %s", new_username); |
|
9ed02a4f6ff4
mod_invites_tracking: Don't bother storing anything for non-invite IBR
Matthew Wild <mwild1@gmail.com>
parents:
5900
diff
changeset
|
9 return; |
|
9ed02a4f6ff4
mod_invites_tracking: Don't bother storing anything for non-invite IBR
Matthew Wild <mwild1@gmail.com>
parents:
5900
diff
changeset
|
10 end |
|
9ed02a4f6ff4
mod_invites_tracking: Don't bother storing anything for non-invite IBR
Matthew Wild <mwild1@gmail.com>
parents:
5900
diff
changeset
|
11 |
|
4394
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
12 local invite_id = nil; |
|
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
13 local invite_source = nil; |
|
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
14 if validated_invite then |
|
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
15 invite_source = validated_invite.additional_data and validated_invite.additional_data.source; |
|
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
16 invite_id = validated_invite.token; |
|
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
17 end |
|
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
18 |
|
5900
cb3b2fbf57e7
mod_invites_tracking: Fix traceback when not registering via invite (thanks Link Mauve)
Matthew Wild <mwild1@gmail.com>
parents:
4394
diff
changeset
|
19 tracking_store:set(new_username, {invite_id = invite_id, invite_source = invite_source}); |
|
4394
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
20 module:log("debug", "recorded that invite from %s was used to create %s", invite_source, new_username) |
|
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
21 end); |
|
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
22 |
|
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
23 -- " " is an invalid localpart -> we can safely use it for store metadata |
|
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
24 tracking_store:set(" ", {version="1"}); |
