Revert "network: don't force existence of constructor properties"
This reverts commit 429efb0c3c
.
This commit is contained in:
parent
30a3ba489a
commit
c30da27f95
@ -96,96 +96,93 @@ export type NetworkConfig = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class Network {
|
class Network {
|
||||||
nick: string;
|
nick!: string;
|
||||||
name: string;
|
name!: string;
|
||||||
host: string;
|
host!: string;
|
||||||
port: number;
|
port!: number;
|
||||||
tls: boolean;
|
tls!: boolean;
|
||||||
userDisconnected: boolean;
|
userDisconnected!: boolean;
|
||||||
rejectUnauthorized: boolean;
|
rejectUnauthorized!: boolean;
|
||||||
password: string;
|
password!: string;
|
||||||
awayMessage: string;
|
awayMessage!: string;
|
||||||
commands: any[];
|
commands!: any[];
|
||||||
username: string;
|
username!: string;
|
||||||
realname: string;
|
realname!: string;
|
||||||
leaveMessage: string;
|
leaveMessage!: string;
|
||||||
sasl: string;
|
sasl!: string;
|
||||||
saslAccount: string;
|
saslAccount!: string;
|
||||||
saslPassword: string;
|
saslPassword!: string;
|
||||||
channels: Chan[];
|
channels!: Chan[];
|
||||||
uuid: string;
|
uuid!: string;
|
||||||
proxyHost: string;
|
proxyHost!: string;
|
||||||
proxyPort: number;
|
proxyPort!: number;
|
||||||
proxyUsername: string;
|
proxyUsername!: string;
|
||||||
proxyPassword: string;
|
proxyPassword!: string;
|
||||||
proxyEnabled: boolean;
|
proxyEnabled!: boolean;
|
||||||
highlightRegex?: RegExp;
|
highlightRegex?: RegExp;
|
||||||
|
|
||||||
irc?: IrcFramework.Client & {
|
irc?: IrcFramework.Client & {
|
||||||
options?: NetworkIrcOptions;
|
options?: NetworkIrcOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
chanCache: Chan[];
|
chanCache!: Chan[];
|
||||||
ignoreList: IgnoreList;
|
ignoreList!: IgnoreList;
|
||||||
keepNick: string | null;
|
keepNick!: string | null;
|
||||||
|
|
||||||
serverOptions: {
|
status!: NetworkStatus;
|
||||||
|
|
||||||
|
serverOptions!: {
|
||||||
CHANTYPES: string[];
|
CHANTYPES: string[];
|
||||||
PREFIX: Prefix;
|
PREFIX: Prefix;
|
||||||
NETWORK: string;
|
NETWORK: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: this is only available on export
|
// TODO: this is only available on export
|
||||||
hasSTSPolicy: boolean;
|
hasSTSPolicy!: boolean;
|
||||||
status: NetworkStatus;
|
|
||||||
|
|
||||||
constructor(attr?: Partial<Network>) {
|
constructor(attr?: Partial<Network>) {
|
||||||
this.name = "";
|
_.defaults(this, attr, {
|
||||||
this.nick = "";
|
name: "",
|
||||||
this.host = "";
|
nick: "",
|
||||||
this.port = 6667;
|
host: "",
|
||||||
this.tls = false;
|
port: 6667,
|
||||||
this.userDisconnected = false;
|
tls: false,
|
||||||
this.rejectUnauthorized = false;
|
userDisconnected: false,
|
||||||
this.password = "";
|
rejectUnauthorized: false,
|
||||||
this.awayMessage = "";
|
password: "",
|
||||||
this.commands = [];
|
awayMessage: "",
|
||||||
this.username = "";
|
commands: [],
|
||||||
this.realname = "";
|
username: "",
|
||||||
this.leaveMessage = "";
|
realname: "",
|
||||||
this.sasl = "";
|
leaveMessage: "",
|
||||||
this.saslAccount = "";
|
sasl: "",
|
||||||
this.saslPassword = "";
|
saslAccount: "",
|
||||||
this.channels = [];
|
saslPassword: "",
|
||||||
this.serverOptions = {
|
channels: [],
|
||||||
CHANTYPES: ["#", "&"],
|
irc: null,
|
||||||
PREFIX: new Prefix([
|
serverOptions: {
|
||||||
{symbol: "!", mode: "Y"},
|
CHANTYPES: ["#", "&"],
|
||||||
{symbol: "@", mode: "o"},
|
PREFIX: new Prefix([
|
||||||
{symbol: "%", mode: "h"},
|
{symbol: "!", mode: "Y"},
|
||||||
{symbol: "+", mode: "v"},
|
{symbol: "@", mode: "o"},
|
||||||
]),
|
{symbol: "%", mode: "h"},
|
||||||
NETWORK: "",
|
{symbol: "+", mode: "v"},
|
||||||
};
|
]),
|
||||||
this.proxyHost = "";
|
NETWORK: "",
|
||||||
this.proxyPort = 1080;
|
},
|
||||||
this.proxyUsername = "";
|
|
||||||
this.proxyPassword = "";
|
|
||||||
this.proxyEnabled = false;
|
|
||||||
|
|
||||||
this.chanCache = [];
|
proxyHost: "",
|
||||||
this.ignoreList = [];
|
proxyPort: 1080,
|
||||||
this.keepNick = null;
|
proxyUsername: "",
|
||||||
this.hasSTSPolicy = false;
|
proxyPassword: "",
|
||||||
this.uuid = "invalid"; // sentinel value that makes us generate a new one
|
proxyEnabled: false,
|
||||||
|
|
||||||
this.status = {connected: false, secure: false};
|
chanCache: [],
|
||||||
|
ignoreList: [],
|
||||||
|
keepNick: null,
|
||||||
|
});
|
||||||
|
|
||||||
if (attr) {
|
if (!this.uuid) {
|
||||||
Object.assign(this, attr);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.uuid === "invalid" || !this.uuid) {
|
|
||||||
this.uuid = uuidv4();
|
this.uuid = uuidv4();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user