Commit graph

20 commits

Author SHA1 Message Date
Reto Brunner 8eb398c5cc server: don't throw in async callback from index requests
This was flagged as an issue by codeQL

> Server crash [High]
> The server of this route handler will terminate when an
> uncaught exception from this location escapes an
> asynchronous callback.
2024-04-21 15:49:51 +02:00
Reto Brunner 82e4150cc8 server: remove type cast from change pw 2024-04-21 15:11:52 +02:00
Reto Brunner e61e356f1e server: somewhat type fix auth related functions
The auth functions are a bloody mess and need to be cleaned up.
using various callback functions and using variables as pointers makes the logic
hard to follow and hence idiotic to type too, as multiple orthogonal logic paths
are mixed up into one function.

This really needs to be untangled
2024-04-21 15:11:52 +02:00
Reto Brunner 5001d607b1 server: mark req params as unused 2024-04-21 15:11:52 +02:00
Reto Brunner 5ee9c2b338 type Server 2024-04-21 15:11:51 +02:00
Reto Brunner 60486bf5e3 server: fix init client 2024-04-21 15:11:51 +02:00
Reto Brunner f5c691f37b wip: unbork init progress 2024-04-21 15:11:51 +02:00
Reto Brunner 0067c30273 Split sort event
The sort event bundled networks and channels for no reason at all.
They share none of the actual logic, so combining them just makes
the typing poor but serves no benefit.
2024-04-21 15:11:51 +02:00
Reto Brunner 843db1727b server: actually type the socket 2024-04-21 15:11:51 +02:00
Reto Brunner b89b0cad53 client: id is always a string, not a number 2024-04-21 15:11:51 +02:00
Reto Brunner 8e6920af1d configuration 2024-04-21 15:11:51 +02:00
Reto Brunner 3f0ee6a961 move chan enums 2024-04-21 15:10:45 +02:00
Reto Brunner 3eb19135f5 wip: msg 2024-04-21 15:10:41 +02: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
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
Pavel Djundik 2f04150461 Fix git commit not being available in dist build 2023-02-15 12:03:08 +02:00
Reto Brunner 0ebc3a574c search: ignore searchResults if it isn't the active query
Prior to this, the search is still racy but one tends to notice
this only when the DB is large or network is involved.
The user can initiate a search, get bored, navigate to another chan
issue a different search.

Now however, the results of the first search come back in and
hilarity ensues as we are now confused with the state.

To avoid this, keep track of the last search done and any result
that comes in that isn't equal to the active query is garbage and
can be dropped.
2023-01-08 11:41:09 +01:00
Reto Brunner fd14b4a172 make getClientConfiguration type safe
TS type assertions need to be avoided.

The following trivial example demonstrates why

```
type Person = {
	name: string;
	isBad: boolean;
};

function makePerson(): Person {
	const p: Person = {name: 'whatever'} as Person
	p.isBad = false
	return p // theoretically we are now good, p is a Person
}
```

Should the type ever change though, TS will happily trot along

```
type Person = {
	name: string;
	isBad: boolean;
	omgHowCouldYou: number;
};

function makePerson(): Person {
	const p: Person = {name: 'whatever'} as Person
	p.isBad = true
	return p // p is *not* a Person, omgHowCouldYou is missing
}
```

But we pinky swore to the compiler that p is in fact a Person.
In other words, the types are now wrong and you will fail during
runtime.
2022-11-22 03:07:29 +01:00
Reto Brunner 1597c2c56e server: the http{,s} server can't be null 2022-11-22 02:21:27 +01: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
Renamed from src/server.js (Browse further)