Mercurial > prosody-modules
annotate mod_pastebin/README.md @ 6556:7477e97a9045
mod_firewall: Apply pre-reload state before re-reading config
This change makes load/reload a bit more robust. module.load() runs before
module.restore() and it reads from the config and updates the state (if
needed).
However, after this, module.restore() could run and apply the old state again.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sun, 24 May 2026 20:03:20 +0100 |
| parents | c819b1b5a775 |
| children |
| rev | line source |
|---|---|
|
1803
4d73a1a6ba68
Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents:
1782
diff
changeset
|
1 --- |
|
4d73a1a6ba68
Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents:
1782
diff
changeset
|
2 labels: |
|
4315
87e250409998
mod_pastebin: Normalize markdown
Kim Alvefur <zash@zash.se>
parents:
3484
diff
changeset
|
3 - Stage-Stable |
|
87e250409998
mod_pastebin: Normalize markdown
Kim Alvefur <zash@zash.se>
parents:
3484
diff
changeset
|
4 summary: Redirect long messages to built-in pastebin |
|
87e250409998
mod_pastebin: Normalize markdown
Kim Alvefur <zash@zash.se>
parents:
3484
diff
changeset
|
5 --- |
| 1782 | 6 |
|
4315
87e250409998
mod_pastebin: Normalize markdown
Kim Alvefur <zash@zash.se>
parents:
3484
diff
changeset
|
7 # Introduction |
| 1782 | 8 |
|
1803
4d73a1a6ba68
Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents:
1782
diff
changeset
|
9 Pastebins are used very often in IM, especially in chat rooms. You have |
|
4d73a1a6ba68
Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents:
1782
diff
changeset
|
10 a long log or command output which you need to send to someone over IM, |
|
4d73a1a6ba68
Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents:
1782
diff
changeset
|
11 and don't want to fill their message window with it. Put it on a |
|
4d73a1a6ba68
Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents:
1782
diff
changeset
|
12 pastebin site, and give them the URL instead, simple. |
| 1782 | 13 |
|
1803
4d73a1a6ba68
Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents:
1782
diff
changeset
|
14 Not for everyone... no matter how hard you try, people will be unaware, |
|
4d73a1a6ba68
Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents:
1782
diff
changeset
|
15 or not care. They may also be too lazy to visit a pastebin. This is |
|
4315
87e250409998
mod_pastebin: Normalize markdown
Kim Alvefur <zash@zash.se>
parents:
3484
diff
changeset
|
16 where mod_pastebin comes in! |
| 1782 | 17 |
|
4315
87e250409998
mod_pastebin: Normalize markdown
Kim Alvefur <zash@zash.se>
parents:
3484
diff
changeset
|
18 # Details |
| 1782 | 19 |
|
1803
4d73a1a6ba68
Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents:
1782
diff
changeset
|
20 When someone posts to a room a "large" (the actual limit is |
|
4d73a1a6ba68
Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents:
1782
diff
changeset
|
21 configurable) message, Prosody will intercept the message and convert it |
|
4d73a1a6ba68
Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents:
1782
diff
changeset
|
22 to a URL pointing to a built-in pastebin server. The URLs are randomly |
|
4d73a1a6ba68
Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents:
1782
diff
changeset
|
23 generated, so they can be considered for most purposes to be private, |
|
4d73a1a6ba68
Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents:
1782
diff
changeset
|
24 and cannot be discovered by people who are not in the room. |
| 1782 | 25 |
|
6336
c819b1b5a775
mod_pastebin: Clarify that mod_pastebin cannot process encrypted messages
Matthew Wild <mwild1@gmail.com>
parents:
6335
diff
changeset
|
26 **Note:** mod_pastebin cannot read, and therefore does not act on, end-to-end |
|
c819b1b5a775
mod_pastebin: Clarify that mod_pastebin cannot process encrypted messages
Matthew Wild <mwild1@gmail.com>
parents:
6335
diff
changeset
|
27 encrypted messages (e.g. messages using OMEMO). |
|
c819b1b5a775
mod_pastebin: Clarify that mod_pastebin cannot process encrypted messages
Matthew Wild <mwild1@gmail.com>
parents:
6335
diff
changeset
|
28 |
|
4315
87e250409998
mod_pastebin: Normalize markdown
Kim Alvefur <zash@zash.se>
parents:
3484
diff
changeset
|
29 # Usage |
| 1782 | 30 |
|
4315
87e250409998
mod_pastebin: Normalize markdown
Kim Alvefur <zash@zash.se>
parents:
3484
diff
changeset
|
31 To set up mod_pastebin for MUC rooms it **must** be explicitly loaded, |
|
1803
4d73a1a6ba68
Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents:
1782
diff
changeset
|
32 as in the example below - it won't work when loaded globally, as that |
|
4d73a1a6ba68
Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents:
1782
diff
changeset
|
33 will only load it onto normal virtual hosts. |
| 1782 | 34 |
| 35 For example: | |
|
1803
4d73a1a6ba68
Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents:
1782
diff
changeset
|
36 |
|
4d73a1a6ba68
Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents:
1782
diff
changeset
|
37 Component "conference.example.com" "muc" |
|
4d73a1a6ba68
Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents:
1782
diff
changeset
|
38 modules_enabled = { "pastebin" } |
| 1782 | 39 |
|
1803
4d73a1a6ba68
Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents:
1782
diff
changeset
|
40 Pastes will be available by default at |
|
1834
7bb2f149f8ec
mod_pastebin/README: Try to clarify the config differences in 0.9+
Kim Alvefur <zash@zash.se>
parents:
1803
diff
changeset
|
41 `http://<your-prosody>:5280/pastebin/` by default. |
|
7bb2f149f8ec
mod_pastebin/README: Try to clarify the config differences in 0.9+
Kim Alvefur <zash@zash.se>
parents:
1803
diff
changeset
|
42 |
| 6261 | 43 Ports and path can be changed with [HTTP |
| 44 settings](https://prosody.im/doc/http), for example like: | |
|
1834
7bb2f149f8ec
mod_pastebin/README: Try to clarify the config differences in 0.9+
Kim Alvefur <zash@zash.se>
parents:
1803
diff
changeset
|
45 |
| 6261 | 46 ``` {.lua} |
| 47 http_paths = { | |
| 48 pastebin = "/$host-paste"; | |
| 49 } | |
| 50 ``` | |
|
1803
4d73a1a6ba68
Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents:
1782
diff
changeset
|
51 |
|
4316
4bba01ce2f98
mod_pastebin: Document tresholds inclusion in disco#info
Kim Alvefur <zash@zash.se>
parents:
4315
diff
changeset
|
52 # Discovery |
|
4bba01ce2f98
mod_pastebin: Document tresholds inclusion in disco#info
Kim Alvefur <zash@zash.se>
parents:
4315
diff
changeset
|
53 |
|
4bba01ce2f98
mod_pastebin: Document tresholds inclusion in disco#info
Kim Alvefur <zash@zash.se>
parents:
4315
diff
changeset
|
54 The line and character tresholds are advertised in |
|
4bba01ce2f98
mod_pastebin: Document tresholds inclusion in disco#info
Kim Alvefur <zash@zash.se>
parents:
4315
diff
changeset
|
55 [service discovery][xep-0030] like this: |
|
4bba01ce2f98
mod_pastebin: Document tresholds inclusion in disco#info
Kim Alvefur <zash@zash.se>
parents:
4315
diff
changeset
|
56 |
|
4bba01ce2f98
mod_pastebin: Document tresholds inclusion in disco#info
Kim Alvefur <zash@zash.se>
parents:
4315
diff
changeset
|
57 ``` {.xml} |
|
4bba01ce2f98
mod_pastebin: Document tresholds inclusion in disco#info
Kim Alvefur <zash@zash.se>
parents:
4315
diff
changeset
|
58 <iq id="791d37e8-86d8-45df-adc2-9bcb17c45cb7" type="result" xml:lang="en" from="prosody@conference.prosody.im"> |
|
4bba01ce2f98
mod_pastebin: Document tresholds inclusion in disco#info
Kim Alvefur <zash@zash.se>
parents:
4315
diff
changeset
|
59 <query xmlns="http://jabber.org/protocol/disco#info"> |
|
4bba01ce2f98
mod_pastebin: Document tresholds inclusion in disco#info
Kim Alvefur <zash@zash.se>
parents:
4315
diff
changeset
|
60 <identity type="text" name="Prosŏdy IM Chatroom" category="conference"/> |
|
4bba01ce2f98
mod_pastebin: Document tresholds inclusion in disco#info
Kim Alvefur <zash@zash.se>
parents:
4315
diff
changeset
|
61 <feature var="http://jabber.org/protocol/muc"/> |
|
4bba01ce2f98
mod_pastebin: Document tresholds inclusion in disco#info
Kim Alvefur <zash@zash.se>
parents:
4315
diff
changeset
|
62 <feature var="https://modules.prosody.im/mod_pastebin"/> |
|
4bba01ce2f98
mod_pastebin: Document tresholds inclusion in disco#info
Kim Alvefur <zash@zash.se>
parents:
4315
diff
changeset
|
63 <x xmlns="jabber:x:data" type="result"> |
|
4bba01ce2f98
mod_pastebin: Document tresholds inclusion in disco#info
Kim Alvefur <zash@zash.se>
parents:
4315
diff
changeset
|
64 <field type="hidden" var="FORM_TYPE"> |
|
4bba01ce2f98
mod_pastebin: Document tresholds inclusion in disco#info
Kim Alvefur <zash@zash.se>
parents:
4315
diff
changeset
|
65 <value>http://jabber.org/protocol/muc#roominfo</value> |
|
4bba01ce2f98
mod_pastebin: Document tresholds inclusion in disco#info
Kim Alvefur <zash@zash.se>
parents:
4315
diff
changeset
|
66 </field> |
|
4bba01ce2f98
mod_pastebin: Document tresholds inclusion in disco#info
Kim Alvefur <zash@zash.se>
parents:
4315
diff
changeset
|
67 <field label="Title" type="text-single" var="muc#roomconfig_roomname"> |
|
4bba01ce2f98
mod_pastebin: Document tresholds inclusion in disco#info
Kim Alvefur <zash@zash.se>
parents:
4315
diff
changeset
|
68 <value>Prosŏdy IM Chatroom</value> |
|
4bba01ce2f98
mod_pastebin: Document tresholds inclusion in disco#info
Kim Alvefur <zash@zash.se>
parents:
4315
diff
changeset
|
69 </field> |
|
4bba01ce2f98
mod_pastebin: Document tresholds inclusion in disco#info
Kim Alvefur <zash@zash.se>
parents:
4315
diff
changeset
|
70 <!-- etc... --> |
|
4bba01ce2f98
mod_pastebin: Document tresholds inclusion in disco#info
Kim Alvefur <zash@zash.se>
parents:
4315
diff
changeset
|
71 <field type="text-single" var="{https://modules.prosody.im/mod_pastebin}max_lines"> |
|
4bba01ce2f98
mod_pastebin: Document tresholds inclusion in disco#info
Kim Alvefur <zash@zash.se>
parents:
4315
diff
changeset
|
72 <value>12</value> |
|
4bba01ce2f98
mod_pastebin: Document tresholds inclusion in disco#info
Kim Alvefur <zash@zash.se>
parents:
4315
diff
changeset
|
73 </field> |
|
4bba01ce2f98
mod_pastebin: Document tresholds inclusion in disco#info
Kim Alvefur <zash@zash.se>
parents:
4315
diff
changeset
|
74 <field type="text-single" var="{https://modules.prosody.im/mod_pastebin}max_characters"> |
|
4bba01ce2f98
mod_pastebin: Document tresholds inclusion in disco#info
Kim Alvefur <zash@zash.se>
parents:
4315
diff
changeset
|
75 <value>1584</value> |
|
4bba01ce2f98
mod_pastebin: Document tresholds inclusion in disco#info
Kim Alvefur <zash@zash.se>
parents:
4315
diff
changeset
|
76 </field> |
|
4bba01ce2f98
mod_pastebin: Document tresholds inclusion in disco#info
Kim Alvefur <zash@zash.se>
parents:
4315
diff
changeset
|
77 </x> |
|
4bba01ce2f98
mod_pastebin: Document tresholds inclusion in disco#info
Kim Alvefur <zash@zash.se>
parents:
4315
diff
changeset
|
78 </query> |
|
4bba01ce2f98
mod_pastebin: Document tresholds inclusion in disco#info
Kim Alvefur <zash@zash.se>
parents:
4315
diff
changeset
|
79 </iq> |
|
4bba01ce2f98
mod_pastebin: Document tresholds inclusion in disco#info
Kim Alvefur <zash@zash.se>
parents:
4315
diff
changeset
|
80 ``` |
|
4bba01ce2f98
mod_pastebin: Document tresholds inclusion in disco#info
Kim Alvefur <zash@zash.se>
parents:
4315
diff
changeset
|
81 |
|
4315
87e250409998
mod_pastebin: Normalize markdown
Kim Alvefur <zash@zash.se>
parents:
3484
diff
changeset
|
82 # Configuration |
| 1782 | 83 |
|
4315
87e250409998
mod_pastebin: Normalize markdown
Kim Alvefur <zash@zash.se>
parents:
3484
diff
changeset
|
84 Option Description |
|
87e250409998
mod_pastebin: Normalize markdown
Kim Alvefur <zash@zash.se>
parents:
3484
diff
changeset
|
85 ------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
87e250409998
mod_pastebin: Normalize markdown
Kim Alvefur <zash@zash.se>
parents:
3484
diff
changeset
|
86 pastebin_threshold Maximum length (in characters) of a message that is allowed to skip the pastebin. (default 500 characters) |
|
87e250409998
mod_pastebin: Normalize markdown
Kim Alvefur <zash@zash.se>
parents:
3484
diff
changeset
|
87 pastebin_line_threshold The maximum number of lines a message may have before it is sent to the pastebin. (default 4 lines) |
|
87e250409998
mod_pastebin: Normalize markdown
Kim Alvefur <zash@zash.se>
parents:
3484
diff
changeset
|
88 pastebin_trigger A string of characters (e.g. "!paste ") which if detected at the start of a message, always sends the message to the pastebin, regardless of length. (default: not set) |
|
6334
ad9026b6a714
mod_pastebin: Add pastebin_ignore option, to allow suppressing pastebin behaviour (thanks Zaak)
Matthew Wild <mwild1@gmail.com>
parents:
6262
diff
changeset
|
89 pastebin_ignore A string of characters (e.g. "!nopaste") which if detected **anywhere** within a message, won't send the message to the pastebin |
|
4315
87e250409998
mod_pastebin: Normalize markdown
Kim Alvefur <zash@zash.se>
parents:
3484
diff
changeset
|
90 pastebin_expire_after Number of hours after which to expire (remove) a paste, defaults to 24. Set to 0 to store pastes permanently on disk. |
|
6335
1f00618ad3be
mod_pastebin: Document pastebin_html_preview setting (thanks Zaak)
Matthew Wild <mwild1@gmail.com>
parents:
6334
diff
changeset
|
91 pastebin_html_preview Whether to include a formatted preview in pastes (default: true) |
|
1803
4d73a1a6ba68
Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents:
1782
diff
changeset
|
92 |
|
4315
87e250409998
mod_pastebin: Normalize markdown
Kim Alvefur <zash@zash.se>
parents:
3484
diff
changeset
|
93 # Compatibility |
| 1782 | 94 |
| 6262 | 95 ------- ---------------------- |
| 96 trunk Works as of 25-06-13 | |
| 97 13.0 Works | |
| 98 0.12 Works | |
| 99 ------- ---------------------- | |
| 1782 | 100 |
|
4315
87e250409998
mod_pastebin: Normalize markdown
Kim Alvefur <zash@zash.se>
parents:
3484
diff
changeset
|
101 # Todo |
| 1782 | 102 |
|
1803
4d73a1a6ba68
Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents:
1782
diff
changeset
|
103 - Maximum paste length |
|
4d73a1a6ba68
Convert all wiki pages to Markdown
Kim Alvefur <zash@zash.se>
parents:
1782
diff
changeset
|
104 - Web interface to submit pastes? |
