mirror of
https://github.com/thelounge/thelounge.git
synced 2024-05-19 22:56:37 +02:00
Fix UserConfig type in clientManager
This commit is contained in:
parent
3d4d29bca4
commit
c682550e1f
|
@ -55,7 +55,7 @@ type ClientPushSubscription = {
|
|||
};
|
||||
};
|
||||
|
||||
type ClientConfig = {
|
||||
export type UserConfig = {
|
||||
log: boolean;
|
||||
password: string;
|
||||
sessions: {
|
||||
|
@ -92,7 +92,7 @@ class Client {
|
|||
attachedClients!: {
|
||||
[socketId: string]: {token: string; openChannel: number};
|
||||
};
|
||||
config!: ClientConfig & {
|
||||
config!: UserConfig & {
|
||||
networks?: Network[];
|
||||
};
|
||||
id!: number;
|
||||
|
@ -109,7 +109,7 @@ class Client {
|
|||
|
||||
fileHash!: string;
|
||||
|
||||
constructor(manager: ClientManager, name?: string, config = {} as ClientConfig) {
|
||||
constructor(manager: ClientManager, name?: string, config = {} as UserConfig) {
|
||||
_.merge(this, {
|
||||
awayMessage: "",
|
||||
lastActiveChannel: -1,
|
||||
|
|
|
@ -5,7 +5,7 @@ import fs from "fs";
|
|||
import path from "path";
|
||||
|
||||
import Auth from "./plugins/auth";
|
||||
import Client from "./client";
|
||||
import Client, {UserConfig} from "./client";
|
||||
import Config from "./config";
|
||||
import WebPush from "./plugins/webpush";
|
||||
import log from "./log";
|
||||
|
@ -183,6 +183,7 @@ class ClientManager {
|
|||
mode: 0o600,
|
||||
});
|
||||
} catch (e: any) {
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
log.error(`Failed to create user ${colors.green(name)} (${e})`);
|
||||
throw e;
|
||||
}
|
||||
|
@ -250,6 +251,7 @@ class ClientManager {
|
|||
|
||||
return callback ? callback() : true;
|
||||
} catch (e: any) {
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
log.error(`Failed to update user ${colors.green(client.name)} (${e})`);
|
||||
|
||||
if (callback) {
|
||||
|
@ -281,8 +283,9 @@ class ClientManager {
|
|||
|
||||
try {
|
||||
const data = fs.readFileSync(userPath, "utf-8");
|
||||
return JSON.parse(data);
|
||||
return JSON.parse(data) as UserConfig;
|
||||
} catch (e: any) {
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
log.error(`Failed to read user ${colors.bold(name)}: ${e}`);
|
||||
}
|
||||
|
||||
|
|
|
@ -79,20 +79,6 @@ for (const input of builtInInputs) {
|
|||
});
|
||||
}
|
||||
|
||||
// .reduce(async function (plugins, name) {
|
||||
// return import(`./${name}`).then(
|
||||
// (plugin: {
|
||||
// default: {
|
||||
// commands: string[];
|
||||
// input: (network: Network, chan: Chan, cmd: string, args: string[]) => void;
|
||||
// allowDisconnected?: boolean;
|
||||
// };
|
||||
// }) => {
|
||||
// plugin.default.commands.forEach((command: string) => plugins.set(command, plugin));
|
||||
// }
|
||||
// );
|
||||
// }, Promise.resolve(new Map()));
|
||||
|
||||
const pluginCommands = new Map();
|
||||
|
||||
const getCommands = () =>
|
||||
|
|
2
test/fixtures/.thelounge/sts-policies.json
vendored
2
test/fixtures/.thelounge/sts-policies.json
vendored
|
@ -3,6 +3,6 @@
|
|||
"host": "irc.example.com",
|
||||
"port": 7000,
|
||||
"duration": 3600,
|
||||
"expires": 1654033745673
|
||||
"expires": 1654034227268
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue