aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* | util.datamanager: Fix indexing first item if not at the very startKim Alvefur2023-07-101-2/+2
| | | | | | | | | | | | | | | | If the first item does not start at position 0 then the index function produces a phantom first entry covering position zero until where the real first item starts. When using the index, this would make it either appear as the first item was missing or cause an off-by-one issue with remaining items.
* | util.datamanager: Reduce log level of left over debug messages to debug ↵Kim Alvefur2023-07-121-2/+2
| | | | | | | | | | | | (thanks Trung) These were mostly 'warn' to make them stand out from the debug noise
* | util.datamanager: Fix missing separator in log lineKim Alvefur2023-07-101-1/+1
| |
* | Merge 0.12->trunkKim Alvefur2023-07-102-2/+3
|\|
| * core.certmanager: Update Mozilla TLS config to version 5.7Kim Alvefur2023-07-091-1/+2
| | | | | | | | Ref https://github.com/mozilla/server-side-tls/issues/285
| * mod_pubsub: Send correct jid attribute in disco#itemsKim Alvefur2023-07-081-1/+1
| | | | | | | | Fixes use in PEP where the JID does not equal the bare domain.
* | mod_http_file_share: Put 'expires' back, thought it was unusedKim Alvefur2023-07-021-0/+1
| | | | | | | | | | | | Removed in 536055476912 because it was not used anywhere else in the file, but per the documentation it is meant to inform external upload services of the expiry time of the upload itself.
* | util.cache: Pass cache itself to eviction callbackKim Alvefur2023-06-302-4/+3
| | | | | | | | | | | | | | Simplifies access to the cache without moving code around a lot given the currently common pattern of local some_cache = cache.new(size, function(k,v) end)
* | util.cache: Keep eviction candidate if callback resized to make roomKim Alvefur2023-06-302-3/+29
| | | | | | | | | | Previously either the old or the new values would be rejected, even if the cache was resized to allow more items.
* | util.serialization: Teach Teal about the new "pretty" presetKim Alvefur2023-06-301-0/+1
| |
* | util.jsonpointer: Change function prototype to allow anythingKim Alvefur2023-06-301-1/+1
| | | | | | | | | | But anything that's not a table can't be resolved into, which could happen in the middle, so eh.
* | util.jsonpointer: Silence Teal warningKim Alvefur2023-06-301-1/+1
| | | | | | | | It seems to think 'table' never has array items, but we don't know that.
* | core, plugins: Split prosody:user role into prosody:{guest,registered,member}Matthew Wild2023-06-298-44/+52
| | | | | | | | | | | | | | This gives us more granular control over different types of user account. Accounts registered by IBR get assigned prosody:registered by default, while accounts provisioned by an admin (e.g. via prosodyctl shell) will receive prosody:member by default.
* | usermanager: Add create_user_with_role() method to atomically set initial roleMatthew Wild2023-06-291-0/+26
| |
* | mod_http_file_share: Set slot token TTL so util.jwt validates expiryKim Alvefur2023-06-281-2/+1
| | | | | | | | | | | | Overrides the util.jwt default of 1h with the intended TTL of 10 minutes. Because util.jwt now has its own expiry checks, so the 'expiry' field is no longer used and can thus be removed.
* | prosodyctl: Add experimental way to reload specific modules directlyKim Alvefur2023-06-251-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | Mostly thinking out loud about how various actions may use the shell This enables the following sequence of commands: prosodyctl install mod_example prosodyctl reload mod_example which is simpler than prosodyctl shell module reload example
* | net.server: Handle loading from outside Prosody (e.g. Verse)Kim Alvefur2023-05-201-15/+20
| | | | | | | | | | server_select only depending on LuaSocket generally makes it more portable, so fall back to that if util.poll can't be found.
* | renamening: Fix newly added imports to use the new namespaceKim Alvefur2023-06-185-6/+6
| |
* | util.jsonschema: Remove wrapper functionKim Alvefur2023-06-172-14/+0
| | | | | | | | This was to silence some Teal warning that seems to have gone away.
* | util.jsonschema: Silence Teal warnings about utf8 libraryKim Alvefur2023-06-172-4/+4
| | | | | | | | | | | | Teal worries that we redefine the global. Also that the fallback was missing type information.
* | util.jsonschema: Silence Teal warnings about counting items in tablesKim Alvefur2023-06-172-8/+8
| | | | | | | | | | Teal thinks that these are key-value maps which are always of length zero, but that is not the case.
* | mod_invites: Refactor argument handling using util.argparseKim Alvefur2022-01-121-63/+59
| | | | | | | | | | | | | | | | | | | | This makes it so that --admin and --role are no longer mutually exclusive, they the former is simply treated as another --role. This was likely a leftover from when only a single role was possible. It does however become unclear which should be the primary, since the order is not preserved by argparse. Bonus: Loading of modules is avoided with only the --help is shown.
* | util.argparse: Add support for repeatable parametersKim Alvefur2022-01-052-2/+16
| | | | | | | | These are gathered into arrays
* | mod_storage_sql: Fix column name in index check for PostgreSQLKim Alvefur2023-06-171-1/+1
| | | | | | | | Forgot to change the column name in 9a7523ea45cb
* | mod_storage_sql: Adjust indentation to align with surrounding codeKim Alvefur2023-06-171-3/+3
| |
* | mod_storage_sql: Only remove old index if it existsKim Alvefur2023-06-171-9/+11
| | | | | | | | Avoids an error if the upgrade is performed twice..
* | mod_storage_sql: Be more specific when checking for old index in SQLite3Kim Alvefur2023-06-171-1/+1
| | | | | | | | | | Prevents false positives in the odd case where something other than an index with this name might exist.
* | mod_storage_sql: Improve check for old table index on PostgreSQLKim Alvefur2023-06-161-1/+1
| | | | | | | | The "pg_indexes" view is much simpler to inspect than "pg_class"
* | mod_storage_sql: Enable UPSERT with PostgreSQLKim Alvefur2023-06-161-1/+1
| | | | | | | | Tested. Works.
* | doap: Fix typo in attribute nameKim Alvefur2023-06-161-1/+1
| |
* | util.pposix: Use Lua enum API for resource limit name argumentKim Alvefur2023-06-141-47/+33
| | | | | | | | Because diffstat.
* | mod_storage_sql: Add some TODO comments for future UPSERT workKim Alvefur2023-06-111-0/+2
| |
* | mod_storage_sql: Do not keep track of quota when no quota is setKim Alvefur2023-06-111-20/+29
| | | | | | | | | | | | | | | | | | No point in doing this expensive O(n) query if the result is not used for anything. Will still cache the total item count if an explicit query for this is performed, then try to keep it updated with new items added. Will likely forget eventually tho.
* | mod_storage_sql: Add setting to tune SQLite3 performance vs safetyKim Alvefur2023-06-111-0/+38
| | | | | | | | | | Notably the default journal_mode of DELETE is somewhat slow, some users might want to catch up to the amazing performance of internal storage.
* | mod_storage_sql: Record all SQLite3 compile options for potential useKim Alvefur2023-06-101-4/+6
| | | | | | | | | | Knowing what features are available could be useful for future experiments. For example, with the JSON module or full text search.
* | util.sqlite3: Don't cache prepared statements for one-off queriesKim Alvefur2023-06-101-10/+8
| | | | | | | | | | | | | | | | | | The :execute method is mainly used for one-off queries such as creating tables and indices. There is no need to cache this prepared statement, as those queries are only done on startup. Further, prepared statements can't be reused without being reset, so this was likely broken anyway.
* | util.sqlite3: Deduplicate query methodsKim Alvefur2023-06-101-34/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | There were 3 very similar methods: - :execute() - :execute_query() - :execute_update() The first one returns the prepared statement and is mainly used internally in the library for CREATE statements. The later two only really differ in how the results are returned. Those two are one main method and one small one that only picks out the iterator.
* | util.sqlite3: Fix indentationKim Alvefur2023-06-101-5/+7
| |
* | mod_storage_sql: Compose a keyval+ store out of keyval and map store methodsKim Alvefur2023-06-101-0/+17
| | | | | | | | | | | | | | Removes the need for the shim in storagemanager. The methods only really access the 'store' property of the first (self) argument, so this is safe.
* | mod_storage_sql: Add UPSERT supportKim Alvefur2023-06-101-7/+41
| | | | | | | | | | | | | | Currently limited to SQLite3 for lack of testing on other databases. Adds a migration to replace the non-UNIQUE prosody_index, renaming it prosody_unique_index since ALTER INDEX does not seem to be portable.
* | tools: Update imports to use new prosody.* namespaceKim Alvefur2023-06-089-29/+59
| |
* | Merge 0.12->trunkKim Alvefur2023-06-102-1/+3
|\|
| * mod_http: Fix error if 'access_control_allow_origins' is setKim Alvefur2023-06-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | Because it changes the type of the 'opt_origins' variable from util.set to the internal _items table so next time an http app is added an error "attempt to call a nil value (method 'empty')" is triggered. The value is not used anywhere else. Noticed when reviewing uses of the '_items' set property. Not reported by any users, implying this setting is rarely used.
| * util.array: Expose new() on module tableKim Alvefur2023-06-101-0/+2
| | | | | | | | | | | | For consistency with other utils. Consistency is good.
* | mod_http: Simplify conversion of Set to ArrayKim Alvefur2023-06-101-1/+1
| | | | | | | | | | Avoids the _items semi-private value, that is used everywhere for some reason.
* | util.datamanager: Halve size of list indexKim Alvefur2021-05-141-11/+15
| | | | | | | | | | Instead of storing (start, length) tuples, store the offset to the end of items and derive length using the previous entry.
* | mod_storage_internal: Use a binary search for time based rangesKim Alvefur2021-05-121-8/+55
| | | | | | | | | | | | | | | | | | Iterating over an entire archive to find a few items in the far end from where iteration started is expensive, and probably more expensive with the lazy-loading of items added in the previous commit. Since we can now efficiently read items in random order, we can now use a binary search to find a better starting point for iteration.
* | mod_storage_internal: Lazy-load archive items while iteratingKim Alvefur2021-05-121-59/+57
| | | | | | | | | | | | | | | | | | | | Very large list files previously ran into limits of the Lua parser, or just caused Prosody to freeze while parsing. Using the new index we can parse individual items one at a time. This probably won't reduce overall CPU usage, probably the opposite, but it will reduce the number of items in memory at once and allow collection of items after we iterated past them.
* | util.datamanager: Add O(1) list indexing with on-disk indexKim Alvefur2021-05-111-0/+191
| | | | | | | | | | | | | | | | | | | | | | | | Index file contains offsets and lengths of each item() which allows seeking directly to each item and reading it without parsing the entire file. Also allows tricks like binary search, assuming items have some defined order. We take advantage of the 1-based indexing in tables to store a magic header in the 0 position, so that table index 1 ends up at file index 1.
* | storagemanager tests: Reorder test data in chronological orderKim Alvefur2021-05-111-13/+13
| | | | | | | | | | | | | | Why was the test data not in chronological order? Altho, maybe that was the point? Except for MAM, the data might *not* be in chronological order!