Commit graph

7727 commits

Author SHA1 Message Date
Reto Brunner
646bafab99 mocha: move spec to invocation
If we specify the spec in the config file, we can't manually
specify a specific test file from the cli.

This is annoying, as the alternative is copying out the full
package.json blurb into the shell.

Rather, give the spec in the invocation and add a helper
that makes testing a specific file simple.

With this `yarn test:nospec test/plugins/link.ts` will only run
tests within that file
2024-01-27 15:34:13 +01:00
Reto Brunner
d4c77c74f6 test:mocha remove duplicate flags
We already specify color in the config file.
ts-node is already required in the config file
2024-01-27 15:26:37 +01:00
Reto Brunner
eeefeb229c mocharc: Remove interactive
Interactive isn't a thing according to the help output or the
config docs
2024-01-27 15:24:09 +01:00
Reto Brunner
29c5323bfd test:mocha: webpack doesn't switch on NODE_ENV=test
So we might as well not complicate the cli for no reason
2024-01-27 14:11:30 +01:00
Reto Brunner
a12ddc75d8 test:mocha don't run coverage report
Tests should run the tests, not the coverage.
Frequently one is debugging a test, the coverage won't change
between runs but it delays the cycle considerably.

Rather, if one wants to look at the coverage, one should use
the "coverage" command
2024-01-27 14:11:30 +01:00
Reto Brunner
dd24cb1300 linkify: simplify noscheme detection logic
Overriding the built in is poor form, as this prevents adding
a new type handler with its own normalize handler.

We only ever want to override protocol-less URLs to http, so
we just do so explicitly in the "//" schema normalizer.

This also means that we don't need all that type conversion dance,
we simply set the schema to null when we patch it and filter on the
schema directly
2024-01-21 21:18:09 +01:00
SoniEx2
ae6bae69ac linkify: Add web+ schema support
Co-Authored-By: Reto Brunner <reto@slightlybroken.com>
2024-01-21 17:47:32 +01:00
renovate[bot]
b5372e3ed7
chore(deps): update dependency sqlite3 to v5.1.7 2024-01-06 10:39:32 +00:00
Reto Brunner
d15998d919 Merge renovate/content-disposition-0.x 2024-01-04 19:04:00 +01:00
Reto Brunner
436bf6a180 Merge renovate/linkify-it-3.x 2024-01-04 19:03:40 +01:00
renovate[bot]
1d2fdd95b0
chore(deps): update dependency @types/linkify-it to v3.0.5 2024-01-01 03:42:56 +00:00
renovate[bot]
eaa70caad7
chore(deps): update dependency @types/is-utf8 to v0.2.3 2024-01-01 03:42:48 +00:00
renovate[bot]
aa95032760
chore(deps): update dependency @types/content-disposition to v0.5.8 2024-01-01 01:41:48 +00:00
renovate[bot]
e636121d7a
chore(deps): update dependency @textcomplete/textarea to v0.1.13 2024-01-01 01:41:39 +00:00
Max Leiter
083abae750
Merge pull request #4783 from thelounge/router-api
router: don't use next() in router guards
2023-12-26 16:49:37 -08:00
Max Leiter
01cfe3d19d
Merge pull request #4807 from flotwig/fixup-generate-config-docs-script
scripts: fix generate-config-doc, handle usage errors
2023-12-26 16:49:20 -08:00
Reto Brunner
7f0b721790 add storage cleaner
Introduce the ability to clean up old messages from the sqlite db.
The StoragePolicy can be chosen by the user. Currently there's
two versions, delete everything based on age is the obvious.

The other is for the data hoarders among us. It'll only delete
message types which can be considered low value... Types with
a time aspect like away / back... joins / parts etc.

It tries to do that in a sensible way, so that we don't block
all other db writers that are ongoing.
The "periodically" interval is by design not exposed to the user.
2023-12-26 12:00:53 +01:00
Reto Brunner
edb1226b47 sqlite: add msg type index to speed up cleaner 2023-12-24 16:55:45 +01:00
Reto Brunner
b0ca8e51fb wire up storage cleaner upon server start 2023-12-24 16:55:45 +01:00
Reto Brunner
21b1152f53 cleaner: expose cli task to do cleaning + vacuum
Make the cleaner available to users by exposing it as a subcommand
to thelounge storage.

This is recommended to be run whenever the storage policy significantly
changes in a way that makes many messages eligible for deletion.
The cleaner would cope, but it'll be inefficient and can take many hours.
Due to how storage works in sqlite, the space would not actually be
given back to the OS, just marked for future writes.
Hence this also runs a vacuum to compact the DB as much as it can.
2023-12-24 16:55:45 +01:00
Reto Brunner
74aff7ee5a introduce storage cleaner
Once this is getting hooked up, it'll periodically delete old
messages.

The StoragePolicy can be chosen by the user, currently there's
two versions, delete everything based on age is the obvious.

The other is for the data hoarders among us. It'll only delete
message types which can be considered low value... Types with
a time aspect like away / back... joins / parts etc.

It tries to do that in a sensible way, so that we don't block
all other db writers that are ongoing.
The "periodically" interval is by design not exposed to the user.
2023-12-24 16:55:45 +01:00
Reto Brunner
14d9ff247d sqlite: implement deleteMessages
This is laying the foundation to build a cleaning task that's
sort of database agnostic.
All calls are done by acting on a "DeletionRequest" so interpretation
of the config will go through a single point
2023-12-23 21:08:07 +01:00
Reto Brunner
aec8d0b033 sqlite: accept db connection string
This allows us to inject a memory db during testing
2023-12-23 21:08:07 +01:00
Reto Brunner
60ddf17124 sqlite: use variadic function for serialize_run
This makes the usage of the function a bit nicer
2023-12-23 21:08:07 +01:00
dependabot[bot]
20227b174c
build(deps): bump @babel/traverse from 7.18.9 to 7.23.6
Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.18.9 to 7.23.6.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.6/packages/babel-traverse)

---
updated-dependencies:
- dependency-name: "@babel/traverse"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-23 10:07:23 +00:00
Reto Brunner
d18182da8b Merge 'renovate/cheerio-0.x' 2023-12-20 07:40:09 +01:00
Reto Brunner
ea35040b42 Merge renovate/bcryptjs-2.x 2023-12-20 07:38:59 +01:00
Reto Brunner
97f553eea8 cli: don't fail if stderr is not in json format
A user reported in the IRC chan that installing packages fails with

```
2023-12-13 20:02:34 [INFO] Installing thelounge-theme-solarized v1.1.9...
undefined:1
(node:3329) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
^
SyntaxError: Unexpected token '(', "(node:3329"... is not valid JSON
```

Now, this happens as yarn helpfully prints a deprecation warning
that is shown in the stack trace.

Let's assume that we may get non json messages and log them at debug, as we
don't know their severity.
2023-12-13 22:55:53 +01:00
Zach Bloomquist
6603c1a6e6
scripts: fix generate-config-doc, handle usage errors 2023-12-12 11:52:45 -05:00
renovate[bot]
73a529acea
chore(deps): update dependency @types/cheerio to v0.22.35 2023-12-01 01:11:42 +00:00
renovate[bot]
2f40d9dbcc
chore(deps): update dependency @types/bcryptjs to v2.4.6 2023-12-01 01:11:29 +00:00
Reto Brunner
d1561f8ebc sqlite: return new version in downgrade()
We want to give the caller the current version, not the last
version we rolled back, fix that
2023-11-06 07:52:59 +01:00
Reto Brunner
ec75ff00cb sqlite: don't modify global array during tests 2023-11-06 07:52:59 +01:00
Reto Brunner
884a92c74b sqlite: fix typo fetch_rollbacks 2023-11-06 07:52:59 +01:00
Reto Brunner
77b64c546b dont' crash on rDNS failure 2023-11-06 07:36:52 +01:00
Reto Brunner
cc59e6b578 Merge renovate/is-utf8-0.x 2023-11-04 12:22:05 +01:00
Reto Brunner
fb1d79f5fa Merge renovate/bcryptjs-2.x 2023-11-04 12:21:46 +01:00
Reto Brunner
100ff3c198 Merge renovate/actions-setup-node-4.x 2023-11-04 12:19:04 +01:00
Reto Brunner
d893feff1c Merge renovate/mousetrap-1.x 2023-11-04 12:18:47 +01:00
Reto Brunner
88a5fef4ea Merge renovate/lodash-4.x 2023-11-04 12:17:54 +01:00
Reto Brunner
5b64ecbe68 Merge renovate/content-disposition-0.x 2023-11-04 12:11:33 +01:00
Reto Brunner
5024acd7dc Merge renovate/cheerio-0.x 2023-11-04 12:10:14 +01:00
Reto Brunner
bbfada251c Merge renovate/npm-postcss-vulnerability 2023-11-04 12:09:49 +01:00
Reto Brunner
8cec292f2c Merge dependabot/npm_and_yarn/get-func-name-2.0.2 2023-11-04 12:08:42 +01:00
Reto Brunner
22ae594cc3 bump caniuse-lite 2023-11-04 12:04:51 +01:00
Reto Brunner
1c6bec2323 Merge branch 'cliMigrations' 2023-11-04 11:59:41 +01:00
Reto Brunner
9105fbc23a Merge branch 'emoji' 2023-11-04 11:53:30 +01:00
Reto Brunner
8c54cd50d8 don't crash on rDNS failure
Node apparently throws even on valid ipv6 input in certain environments,
probably due to the DNS server returning SERVFAIL.
Guard against it and fallback with the plain IP

Fixes: https://github.com/thelounge/thelounge/issues/4768
2023-11-04 11:45:11 +01:00
renovate[bot]
59de6afd3f
chore(deps): update dependency @types/is-utf8 to v0.2.2 2023-11-01 00:33:46 +00:00
renovate[bot]
b506966b08
chore(deps): update dependency @types/bcryptjs to v2.4.5 2023-11-01 00:33:33 +00:00