Commit Graph

309 Commits

Author SHA1 Message Date
Val Lorentz
0c7cc85184 Fix load of channels from user config
Network.export() only writes the "type" key if it's a ChanType.QUERY;
so the config on disk has no "type".

This causes it to be undefined when loading, which breaks various other
checks, and then drops it the next time the config is saved.
2023-04-08 12:38:06 +02:00
Reto Brunner
eb509f7100 Fix config typing and make Client easier to test 2023-03-17 11:03:50 +01:00
Reto Brunner
845dabad53 Fix sqlite query invocation in test
46da1abba4
changed the types of the db functions... fix our code to deal with it.
2023-03-17 10:57:21 +01:00
Val Lorentz
d58fb84565 Fix test wording 2023-03-15 08:40:53 +01:00
Val Lorentz
a049a01aeb Client: move socket connection out of the constructor
It will make it easier to write tests for what used to be in
the connect() method
2023-03-15 08:40:53 +01:00
Reto Brunner
b7540b5827 Move condensedTypes to shared/
This decouples the rest of the server from the client
2023-01-30 09:14:40 +01:00
Reto Brunner
60bb561e49 Extract tests to shared/ 2023-01-30 09:14:40 +01:00
Reto Brunner
958a948456 sqlite: Remove client from sqlitestorage
The only reason we accepted a client was that so we have access
to the next message id when we need it.
So let's accept an id provider function instead.
2022-12-30 16:52:04 +01:00
Reto Brunner
2d4143b779 sqlite: synchronize enable() internally
TL is stupid and doesn't wait for message{Provider,Storage} to
settle before it starts using the store.

While this should be fixed globally, we can hack around the problem
by pushing everything onto the call stack and hope that we'll eventually
finish the setup before we blow the stack.
2022-11-30 10:28:26 +01:00
Reto Brunner
deeea274da Merge branch 'sqlite_cleanup'
Converts sqlite to async, providing a way forward
for migrations to actually happen
2022-11-24 09:45:01 +01:00
Reto Brunner
8095d9e88a SearchQuery: offset is always a number
Fix type confusion that specified offset to be a string, it is
always a number.
2022-11-15 18:50:52 +01:00
Reto Brunner
d62dd3e62d messageStorage: convert to async
Message stores are more complicated that a sync "fire and forget"
API allows for.
For starters, non trivial stores (say sqlite) can fail during init
and we want to be able to catch that.
Second, we really need to be able to run migrations and such, which
may block (and fail) the activation of the store.

On the plus side, this pushes error handling to the caller rather
than the stores, which is a good thing as that allows us to eventually
push this to the client in the UI, rather than just logging it in the
server on stdout
2022-11-02 00:01:36 +01:00
Reto Brunner
30e9f45fac Use nick as a realname fallback
Currently the realname is set to an advertisement if it isn't explicitly
set by the user.
Some clients started to show the realname as a display name in their
UI, which makes this tedious as you'll end up with gazillion "The Lounge
User" entries.

To avoid this, set the realname to the nick on first connect, so that
it is useful.
Note that this isn't done on nick changes, but only on the initial
connect step.

Fixes: https://github.com/thelounge/thelounge/issues/4527
2022-08-28 11:21:54 +02:00
Reto Brunner
d6e1af0e7d Fix regex escape for prefix patterns
Our regex escape function escapes proper regexes, however
it isn't meant to be shoved into a char class via string interpolation.

We need to also escape '-' if we do so.
2022-07-04 10:08:23 +02:00
Max Leiter
dd05ee3a65
TypeScript and Vue 3 (#4559)
Co-authored-by: Eric Nemchik <eric@nemchik.com>
Co-authored-by: Pavel Djundik <xPaw@users.noreply.github.com>
2022-06-18 17:25:21 -07:00
Reto
d4cc2dd361
Refactor config out of Helper (#4558)
* Remove config from Helper

Helper is the usual util grab bag of useful stuff.
Somehow the config ended up there historically but
structurally that doesn't make any sense.

* Add cert folder to prettier ignore file
2022-05-01 12:12:39 -07:00
Reto Brunner
c9c8cadb1a Merge pull/4477 Preserve client certificate 2022-04-27 17:58:09 +02:00
Val Lorentz
20ed3e6dc5
sqlite: Escape '%' and '_' in search queries. (#4487)
I picked '@' arbitrarily, it doesn't matter much.
I just don't like '\' because it needs to be escaped itself in the JS code,
which is annoying.
2022-04-11 17:49:13 -07:00
Val Lorentz
ae7020f569 Do not remove client certificate, even when TLS is disabled
It does not really make sense to remove it, as it can lock someone out of
their account, just by temporarily disabling TLS.
2022-03-05 11:20:57 +01:00
Val Lorentz
53b4d00732 Preserve client certificate when TLS is indirectly enabled by a STS policy
Closes GH-4152.
2022-02-13 14:43:04 +01:00
Val Lorentz
ba210e853b test/models/network.js: Add tests for automatic client certificate creation/deletion 2022-02-13 14:42:38 +01:00
Val Lorentz
bd2a6cc5be test/models/network.js: Add a simple test for STS policies 2022-02-13 14:42:01 +01:00
Val Lorentz
bcd4a060ec test/models/network.js: Reorder tests 2022-02-13 13:24:38 +01:00
Val Lorentz
ed3ec6a560 test/models/network.js: Fix test groupping 2022-02-13 13:24:06 +01:00
Max Leiter
4be9a282fa
Add the option to mute channels, queries, and networks (#4282)
Co-authored-by: Reto <reto@labrat.space>
2022-02-10 17:56:17 -08:00
Reto
d228a8c4f4
Bump most deps (#4453) 2022-02-09 15:27:34 -08:00
Max Leiter
186f8f68cd
Merge pull request #4351 from brunnre8/glob
Allow wildcards in hostmask
2021-11-04 14:36:27 -07:00
Reto Brunner
67503efd21 Allow wildcards in hostmask
According to https://modern.ircdocs.horse/#wildcard-expressions
masks should support "*" and "?" wildcards.
Within TL this only impacts the /ignore functionality.

The reasoning for doing this is to ignore say GuestNNNN!*@* with
guest*!*@* and be done with it if someone spams a gateway.
2021-11-04 20:16:20 +01:00
itsjohncs
044cd2403b Small cleanup of messageStorage/sqlite.
* Extend test coverage to the `search` function.
* Test sort order of messages from `getMessages` and `search`
* Move reversal of `search` results from Vue to messageStorage.
* Remove unnecessary uses of `sqlite.serialize` in tests.
* Return promises from test functions where possible.
2021-10-28 00:48:11 -07:00
Nachtalb
206d554ce1
Save the proxy password so you don't have to reenter it after restart 2021-10-24 21:27:43 +02:00
Reto
8fcd079204
Properly track user modes for context menu (#4267)
* properly track user modes for context menu

The RPL_ISUPPORT response contains a PREFIX element, which not only tracks the
prefix chars ("@", "+" etc) but also their corresponding mode chars (+O, +v)
This commit changes the context menu to not rely on a hardcoded list but rather
user the one given in the prefix response by the server.

Co-authored-by: Max Leiter <maxwell.leiter@gmail.com>
2021-07-21 00:30:07 -07:00
JeDaYoshi
35fcacb767
Add firstCommand and do further checks on mode tests 2021-07-06 18:15:37 +00:00
JeDaYoshi
d96704835a
Send all modes in case of no ISUPPORT 2021-07-06 15:48:01 +00:00
JeDaYoshi
23f6886cc1
Add test for ISUPPORT-less networks on /mode shorthands 2021-07-04 01:01:45 +00:00
JeDaYoshi
e0e12c1960
Fix tests for mode shorthand commands 2021-07-03 21:20:28 +00:00
Max Leiter
d106889127
Merge branch 'master' into feature/socks-support 2021-06-29 22:48:00 -07:00
Mateusz Hajder
6f7fd80044
Fix length of the link in tests 2021-05-26 13:59:04 +02:00
Mateusz Hajder
28c413319f
Change IRC server and channels in tests to more generic 2021-05-26 13:43:06 +02:00
Mateusz Hajder
af236dd280
Add the default IRC network for tests 2021-05-26 13:41:33 +02:00
Mary Strodl
3f984fad4b
network: fix test 2021-05-05 20:37:54 -04:00
Nachtalb
877e4acf7d
Add network specific leave message 2020-12-18 10:53:37 +01:00
Pavel Djundik
c2e8eaf9df Fix test for production build
Webpack 5 minifies it now
2020-10-30 23:02:40 +02:00
Jay2k1
b97b145df1 add highlight exceptions 2020-08-19 00:00:56 +02:00
Pavel Djundik
67e4a4bbb2 Sync changed network name to open clients 2020-08-17 12:57:37 +03:00
Pavel Djundik
8c6460b58a Disable link prefetching for urls with no schema specified 2020-08-04 20:21:12 +03:00
Dexter Chua
2f434be75d Add option to disable media preview.
This disables image previews iff prefetchStorage is disabled. This
stops the client from making any requests to third-party sites.
2020-07-21 08:52:02 +08:00
Pavel Djundik
bc7bf9870c Update CopyPlugin options 2020-05-16 21:33:25 +03:00
Pavel Djundik
6ee71779d1 Combine displayNetwork into lockNetwork 2020-04-15 10:56:05 +03:00
Pavel Djundik
8a281bacd8 Preliminary SASL UI 2020-04-15 10:56:04 +03:00
Pavel Djundik
f8f692af05 Generate client certificates and automatically do SASL EXTERNAL 2020-04-15 10:56:04 +03:00