@lordbex/thelounge 4.4.4-blowfish → 4.5.0-blowfish-pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/defaults/config.js +31 -2
- package/dist/package.json +93 -91
- package/dist/server/client.js +188 -194
- package/dist/server/clientManager.js +65 -63
- package/dist/server/command-line/index.js +44 -43
- package/dist/server/command-line/install.js +37 -70
- package/dist/server/command-line/outdated.js +12 -17
- package/dist/server/command-line/start.js +25 -26
- package/dist/server/command-line/storage.js +26 -31
- package/dist/server/command-line/uninstall.js +16 -23
- package/dist/server/command-line/upgrade.js +20 -26
- package/dist/server/command-line/users/add.js +33 -40
- package/dist/server/command-line/users/edit.js +18 -24
- package/dist/server/command-line/users/index.js +12 -16
- package/dist/server/command-line/users/list.js +11 -39
- package/dist/server/command-line/users/remove.js +16 -22
- package/dist/server/command-line/users/reset.js +34 -35
- package/dist/server/command-line/utils.js +231 -87
- package/dist/server/config.js +61 -52
- package/dist/server/helper.js +29 -28
- package/dist/server/identification.js +39 -34
- package/dist/server/index.js +1 -3
- package/dist/server/log.js +19 -16
- package/dist/server/models/chan.js +36 -33
- package/dist/server/models/msg.js +15 -19
- package/dist/server/models/network.js +88 -86
- package/dist/server/models/prefix.js +4 -7
- package/dist/server/models/user.js +5 -10
- package/dist/server/path-helper.js +8 -0
- package/dist/server/plugins/auth/ldap.js +177 -112
- package/dist/server/plugins/auth/local.js +10 -15
- package/dist/server/plugins/auth.js +6 -35
- package/dist/server/plugins/changelog.js +30 -27
- package/dist/server/plugins/clientCertificate.js +33 -37
- package/dist/server/plugins/dev-server.js +15 -21
- package/dist/server/plugins/inputs/action.js +9 -14
- package/dist/server/plugins/inputs/away.js +1 -3
- package/dist/server/plugins/inputs/ban.js +9 -14
- package/dist/server/plugins/inputs/blow.js +9 -14
- package/dist/server/plugins/inputs/connect.js +5 -10
- package/dist/server/plugins/inputs/ctcp.js +7 -12
- package/dist/server/plugins/inputs/disconnect.js +1 -3
- package/dist/server/plugins/inputs/ignore.js +23 -29
- package/dist/server/plugins/inputs/ignorelist.js +12 -18
- package/dist/server/plugins/inputs/index.js +8 -34
- package/dist/server/plugins/inputs/invite.js +7 -12
- package/dist/server/plugins/inputs/kick.js +7 -12
- package/dist/server/plugins/inputs/kill.js +1 -3
- package/dist/server/plugins/inputs/list.js +1 -3
- package/dist/server/plugins/inputs/mode.js +10 -15
- package/dist/server/plugins/inputs/msg.js +13 -18
- package/dist/server/plugins/inputs/mute.js +9 -15
- package/dist/server/plugins/inputs/nick.js +9 -14
- package/dist/server/plugins/inputs/notice.js +5 -7
- package/dist/server/plugins/inputs/part.js +11 -16
- package/dist/server/plugins/inputs/quit.js +7 -13
- package/dist/server/plugins/inputs/rainbow.js +55 -0
- package/dist/server/plugins/inputs/raw.js +1 -3
- package/dist/server/plugins/inputs/rejoin.js +7 -12
- package/dist/server/plugins/inputs/topic.js +7 -12
- package/dist/server/plugins/inputs/whois.js +1 -3
- package/dist/server/plugins/irc-events/away.js +14 -20
- package/dist/server/plugins/irc-events/cap.js +16 -22
- package/dist/server/plugins/irc-events/chghost.js +14 -13
- package/dist/server/plugins/irc-events/connection.js +61 -63
- package/dist/server/plugins/irc-events/ctcp.js +22 -28
- package/dist/server/plugins/irc-events/error.js +20 -26
- package/dist/server/plugins/irc-events/help.js +7 -13
- package/dist/server/plugins/irc-events/info.js +7 -13
- package/dist/server/plugins/irc-events/invite.js +7 -13
- package/dist/server/plugins/irc-events/join.js +30 -27
- package/dist/server/plugins/irc-events/kick.js +21 -17
- package/dist/server/plugins/irc-events/link.js +75 -96
- package/dist/server/plugins/irc-events/list.js +23 -26
- package/dist/server/plugins/irc-events/message.js +46 -52
- package/dist/server/plugins/irc-events/mode.js +66 -63
- package/dist/server/plugins/irc-events/modelist.js +29 -35
- package/dist/server/plugins/irc-events/motd.js +10 -16
- package/dist/server/plugins/irc-events/names.js +3 -6
- package/dist/server/plugins/irc-events/nick.js +26 -23
- package/dist/server/plugins/irc-events/part.js +19 -15
- package/dist/server/plugins/irc-events/quit.js +17 -14
- package/dist/server/plugins/irc-events/sasl.js +9 -15
- package/dist/server/plugins/irc-events/spgroups.js +38 -0
- package/dist/server/plugins/irc-events/spjoin.js +52 -0
- package/dist/server/plugins/irc-events/topic.js +12 -18
- package/dist/server/plugins/irc-events/unhandled.js +12 -12
- package/dist/server/plugins/irc-events/welcome.js +7 -13
- package/dist/server/plugins/irc-events/whois.js +20 -24
- package/dist/server/plugins/massEventAggregator.js +214 -0
- package/dist/server/plugins/messageStorage/sqlite.js +322 -141
- package/dist/server/plugins/messageStorage/text.js +21 -26
- package/dist/server/plugins/packages/index.js +105 -74
- package/dist/server/plugins/packages/publicClient.js +7 -16
- package/dist/server/plugins/packages/themes.js +11 -16
- package/dist/server/plugins/storage.js +28 -33
- package/dist/server/plugins/sts.js +12 -17
- package/dist/server/plugins/uploader.js +40 -43
- package/dist/server/plugins/webpush.js +23 -51
- package/dist/server/server.js +318 -271
- package/dist/server/storageCleaner.js +29 -37
- package/dist/server/utils/fish.js +7 -14
- package/dist/shared/irc.js +3 -6
- package/dist/shared/linkify.js +7 -14
- package/dist/shared/types/chan.js +6 -9
- package/dist/shared/types/changelog.js +1 -2
- package/dist/shared/types/config.js +1 -2
- package/dist/shared/types/mention.js +1 -2
- package/dist/shared/types/msg.js +3 -5
- package/dist/shared/types/network.js +1 -2
- package/dist/shared/types/storage.js +1 -2
- package/dist/shared/types/user.js +1 -2
- package/index.js +14 -10
- package/package.json +93 -91
- package/public/css/style.css +9 -6
- package/public/css/style.css.map +1 -1
- package/public/fonts/font-awesome/fa-brands-400.ttf +0 -0
- package/public/fonts/font-awesome/fa-brands-400.woff2 +0 -0
- package/public/fonts/font-awesome/fa-duotone-900.ttf +0 -0
- package/public/fonts/font-awesome/fa-duotone-900.woff2 +0 -0
- package/public/fonts/font-awesome/fa-light-300.ttf +0 -0
- package/public/fonts/font-awesome/fa-light-300.woff2 +0 -0
- package/public/fonts/font-awesome/fa-regular-400.ttf +0 -0
- package/public/fonts/font-awesome/fa-regular-400.woff2 +0 -0
- package/public/fonts/font-awesome/fa-solid-900.ttf +0 -0
- package/public/fonts/font-awesome/fa-solid-900.woff2 +0 -0
- package/public/fonts/font-awesome/fa-thin-100.ttf +0 -0
- package/public/fonts/font-awesome/fa-thin-100.woff2 +0 -0
- package/public/fonts/font-awesome/fa-v4compatibility.ttf +0 -0
- package/public/fonts/font-awesome/fa-v4compatibility.woff2 +0 -0
- package/public/js/bundle.js +1 -1
- package/public/js/bundle.js.map +1 -1
- package/public/js/bundle.vendor.js +1 -1
- package/public/js/bundle.vendor.js.LICENSE.txt +24 -6
- package/public/js/bundle.vendor.js.map +1 -1
- package/public/service-worker.js +1 -1
- package/public/themes/default.css +1 -1
- package/public/themes/morning.css +1 -1
- package/dist/webpack.config.js +0 -224
|
@@ -1,77 +1,73 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const node_forge_1 = require("node-forge");
|
|
10
|
-
const log_1 = __importDefault(require("../log"));
|
|
11
|
-
const config_1 = __importDefault(require("../config"));
|
|
12
|
-
exports.default = {
|
|
1
|
+
import path from "path";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import crypto from "crypto";
|
|
4
|
+
import forge from "node-forge";
|
|
5
|
+
import log from "../log.js";
|
|
6
|
+
import Config from "../config.js";
|
|
7
|
+
const { md, pki } = forge;
|
|
8
|
+
export default {
|
|
13
9
|
get,
|
|
14
10
|
remove,
|
|
15
11
|
};
|
|
16
12
|
function get(uuid) {
|
|
17
|
-
if (
|
|
13
|
+
if (Config.values.public) {
|
|
18
14
|
return null;
|
|
19
15
|
}
|
|
20
|
-
const folderPath =
|
|
16
|
+
const folderPath = Config.getClientCertificatesPath();
|
|
21
17
|
const paths = getPaths(folderPath, uuid);
|
|
22
|
-
if (!
|
|
18
|
+
if (!fs.existsSync(paths.privateKeyPath) || !fs.existsSync(paths.certificatePath)) {
|
|
23
19
|
return generateAndWrite(folderPath, paths);
|
|
24
20
|
}
|
|
25
21
|
try {
|
|
26
22
|
return {
|
|
27
|
-
private_key:
|
|
28
|
-
certificate:
|
|
23
|
+
private_key: fs.readFileSync(paths.privateKeyPath, "utf-8"),
|
|
24
|
+
certificate: fs.readFileSync(paths.certificatePath, "utf-8"),
|
|
29
25
|
};
|
|
30
26
|
}
|
|
31
27
|
catch (e) {
|
|
32
|
-
|
|
28
|
+
log.error("Unable to get certificate", String(e));
|
|
33
29
|
}
|
|
34
30
|
return null;
|
|
35
31
|
}
|
|
36
32
|
function remove(uuid) {
|
|
37
|
-
if (
|
|
33
|
+
if (Config.values.public) {
|
|
38
34
|
return null;
|
|
39
35
|
}
|
|
40
|
-
const paths = getPaths(
|
|
36
|
+
const paths = getPaths(Config.getClientCertificatesPath(), uuid);
|
|
41
37
|
try {
|
|
42
|
-
if (
|
|
43
|
-
|
|
38
|
+
if (fs.existsSync(paths.privateKeyPath)) {
|
|
39
|
+
fs.unlinkSync(paths.privateKeyPath);
|
|
44
40
|
}
|
|
45
|
-
if (
|
|
46
|
-
|
|
41
|
+
if (fs.existsSync(paths.certificatePath)) {
|
|
42
|
+
fs.unlinkSync(paths.certificatePath);
|
|
47
43
|
}
|
|
48
44
|
}
|
|
49
45
|
catch (e) {
|
|
50
|
-
|
|
46
|
+
log.error("Unable to remove certificate", String(e));
|
|
51
47
|
}
|
|
52
48
|
}
|
|
53
49
|
function generateAndWrite(folderPath, paths) {
|
|
54
50
|
const certificate = generate();
|
|
55
51
|
try {
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
fs.mkdirSync(folderPath, { recursive: true });
|
|
53
|
+
fs.writeFileSync(paths.privateKeyPath, certificate.private_key, {
|
|
58
54
|
mode: 0o600,
|
|
59
55
|
});
|
|
60
|
-
|
|
56
|
+
fs.writeFileSync(paths.certificatePath, certificate.certificate, {
|
|
61
57
|
mode: 0o600,
|
|
62
58
|
});
|
|
63
59
|
return certificate;
|
|
64
60
|
}
|
|
65
61
|
catch (e) {
|
|
66
|
-
|
|
62
|
+
log.error("Unable to write certificate", String(e));
|
|
67
63
|
}
|
|
68
64
|
return null;
|
|
69
65
|
}
|
|
70
66
|
function generate() {
|
|
71
|
-
const keys =
|
|
72
|
-
const cert =
|
|
67
|
+
const keys = pki.rsa.generateKeyPair(2048);
|
|
68
|
+
const cert = pki.createCertificate();
|
|
73
69
|
cert.publicKey = keys.publicKey;
|
|
74
|
-
cert.serialNumber =
|
|
70
|
+
cert.serialNumber = crypto.randomBytes(16).toString("hex").toUpperCase();
|
|
75
71
|
// Set notBefore a day earlier just in case the time between
|
|
76
72
|
// the client and server is not perfectly in sync
|
|
77
73
|
cert.validity.notBefore = new Date();
|
|
@@ -100,16 +96,16 @@ function generate() {
|
|
|
100
96
|
},
|
|
101
97
|
]);
|
|
102
98
|
// Sign this certificate with a SHA256 signature
|
|
103
|
-
cert.sign(keys.privateKey,
|
|
99
|
+
cert.sign(keys.privateKey, md.sha256.create());
|
|
104
100
|
const pem = {
|
|
105
|
-
private_key:
|
|
106
|
-
certificate:
|
|
101
|
+
private_key: pki.privateKeyToPem(keys.privateKey),
|
|
102
|
+
certificate: pki.certificateToPem(cert),
|
|
107
103
|
};
|
|
108
104
|
return pem;
|
|
109
105
|
}
|
|
110
106
|
function getPaths(folderPath, uuid) {
|
|
111
107
|
return {
|
|
112
|
-
privateKeyPath:
|
|
113
|
-
certificatePath:
|
|
108
|
+
privateKeyPath: path.join(folderPath, `${uuid}.pem`),
|
|
109
|
+
certificatePath: path.join(folderPath, `${uuid}.crt`),
|
|
114
110
|
};
|
|
115
111
|
}
|
|
@@ -1,33 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const webpack_1 = __importDefault(require("webpack"));
|
|
10
|
-
const webpack_config_1 = __importDefault(require("../../webpack.config"));
|
|
11
|
-
exports.default = (app) => {
|
|
12
|
-
log_1.default.debug("Starting server in development mode");
|
|
13
|
-
const webpackConfig = (0, webpack_config_1.default)(undefined, { mode: "production" });
|
|
1
|
+
import webpackDevMiddleware from "webpack-dev-middleware";
|
|
2
|
+
import webpackHotMiddleware from "webpack-hot-middleware";
|
|
3
|
+
import log from "../log.js";
|
|
4
|
+
import webpack from "webpack";
|
|
5
|
+
import config from "../../webpack.config.mjs";
|
|
6
|
+
export default (app) => {
|
|
7
|
+
log.debug("Starting server in development mode");
|
|
8
|
+
const webpackConfig = config(undefined, { mode: "production" });
|
|
14
9
|
if (!webpackConfig ||
|
|
15
10
|
!webpackConfig.plugins?.length ||
|
|
16
11
|
!webpackConfig.entry ||
|
|
17
12
|
!webpackConfig.entry["js/bundle.js"]) {
|
|
18
13
|
throw new Error("No valid production webpack config found");
|
|
19
14
|
}
|
|
20
|
-
webpackConfig.plugins.push(new
|
|
15
|
+
webpackConfig.plugins.push(new webpack.HotModuleReplacementPlugin());
|
|
21
16
|
webpackConfig.entry["js/bundle.js"].push("webpack-hot-middleware/client?path=storage/__webpack_hmr");
|
|
22
|
-
const compiler = (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
const compiler = webpack(webpackConfig);
|
|
18
|
+
if (!compiler) {
|
|
19
|
+
throw new Error("Failed to create webpack compiler");
|
|
20
|
+
}
|
|
21
|
+
app.use(webpackDevMiddleware(compiler, {
|
|
26
22
|
index: "/",
|
|
27
23
|
publicPath: webpackConfig.output?.publicPath,
|
|
28
|
-
})).use(
|
|
29
|
-
// TODO: Fix compiler type
|
|
30
|
-
(0, webpack_hot_middleware_1.default)(compiler, {
|
|
24
|
+
})).use(webpackHotMiddleware(compiler, {
|
|
31
25
|
path: "/storage/__webpack_hmr",
|
|
32
26
|
}));
|
|
33
27
|
};
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const msg_1 = __importDefault(require("../../models/msg"));
|
|
7
|
-
const msg_2 = require("../../../shared/types/msg");
|
|
8
|
-
const chan_1 = require("../../../shared/types/chan");
|
|
9
|
-
const fish_1 = require("../../utils/fish");
|
|
1
|
+
import Msg from "../../models/msg.js";
|
|
2
|
+
import { MessageType } from "../../../shared/types/msg.js";
|
|
3
|
+
import { ChanType } from "../../../shared/types/chan.js";
|
|
4
|
+
import { createFishMessage } from "../../utils/fish.js";
|
|
10
5
|
const commands = ["slap", "me"];
|
|
11
6
|
const input = function ({ irc }, chan, cmd, args) {
|
|
12
|
-
if (chan.type !==
|
|
13
|
-
chan.pushMessage(this, new
|
|
14
|
-
type:
|
|
7
|
+
if (chan.type !== ChanType.CHANNEL && chan.type !== ChanType.QUERY) {
|
|
8
|
+
chan.pushMessage(this, new Msg({
|
|
9
|
+
type: MessageType.ERROR,
|
|
15
10
|
text: `${cmd} command can only be used in channels and queries.`,
|
|
16
11
|
}));
|
|
17
12
|
return;
|
|
@@ -29,7 +24,7 @@ const input = function ({ irc }, chan, cmd, args) {
|
|
|
29
24
|
// If FiSH key is set, encrypt CTCP ACTION and send as normal PRIVMSG with +OK
|
|
30
25
|
if (chan.blowfishKey) {
|
|
31
26
|
const ctcp = "\x01ACTION " + text + "\x01";
|
|
32
|
-
const toSend =
|
|
27
|
+
const toSend = createFishMessage(ctcp, chan.blowfishKey);
|
|
33
28
|
irc.say(chan.name, toSend);
|
|
34
29
|
}
|
|
35
30
|
else {
|
|
@@ -48,7 +43,7 @@ const input = function ({ irc }, chan, cmd, args) {
|
|
|
48
43
|
}
|
|
49
44
|
return true;
|
|
50
45
|
};
|
|
51
|
-
|
|
46
|
+
export default {
|
|
52
47
|
commands,
|
|
53
48
|
input,
|
|
54
49
|
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
const commands = ["away", "back"];
|
|
4
2
|
const input = function (network, chan, cmd, args) {
|
|
5
3
|
let reason = "";
|
|
@@ -14,7 +12,7 @@ const input = function (network, chan, cmd, args) {
|
|
|
14
12
|
network.awayMessage = reason;
|
|
15
13
|
this.save();
|
|
16
14
|
};
|
|
17
|
-
|
|
15
|
+
export default {
|
|
18
16
|
commands,
|
|
19
17
|
input,
|
|
20
18
|
};
|
|
@@ -1,24 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const msg_1 = __importDefault(require("../../models/msg"));
|
|
7
|
-
const msg_2 = require("../../../shared/types/msg");
|
|
8
|
-
const chan_1 = require("../../../shared/types/chan");
|
|
1
|
+
import Msg from "../../models/msg.js";
|
|
2
|
+
import { MessageType } from "../../../shared/types/msg.js";
|
|
3
|
+
import { ChanType } from "../../../shared/types/chan.js";
|
|
9
4
|
const commands = ["ban", "unban", "banlist", "kickban"];
|
|
10
5
|
const input = function ({ irc }, chan, cmd, args) {
|
|
11
|
-
if (chan.type !==
|
|
12
|
-
chan.pushMessage(this, new
|
|
13
|
-
type:
|
|
6
|
+
if (chan.type !== ChanType.CHANNEL) {
|
|
7
|
+
chan.pushMessage(this, new Msg({
|
|
8
|
+
type: MessageType.ERROR,
|
|
14
9
|
text: `${cmd} command can only be used in channels.`,
|
|
15
10
|
}));
|
|
16
11
|
return;
|
|
17
12
|
}
|
|
18
13
|
if (cmd !== "banlist" && args.length === 0) {
|
|
19
14
|
if (args.length === 0) {
|
|
20
|
-
chan.pushMessage(this, new
|
|
21
|
-
type:
|
|
15
|
+
chan.pushMessage(this, new Msg({
|
|
16
|
+
type: MessageType.ERROR,
|
|
22
17
|
text: `Usage: /${cmd} <nick>`,
|
|
23
18
|
}));
|
|
24
19
|
return;
|
|
@@ -39,7 +34,7 @@ const input = function ({ irc }, chan, cmd, args) {
|
|
|
39
34
|
break;
|
|
40
35
|
}
|
|
41
36
|
};
|
|
42
|
-
|
|
37
|
+
export default {
|
|
43
38
|
commands,
|
|
44
39
|
input,
|
|
45
40
|
};
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const msg_1 = __importDefault(require("../../models/msg"));
|
|
7
|
-
const msg_2 = require("../../../shared/types/msg");
|
|
1
|
+
import Msg from "../../models/msg";
|
|
2
|
+
import { MessageType } from "../../../shared/types/msg";
|
|
8
3
|
const commands = ["blow"];
|
|
9
4
|
const input = function (network, chan, _cmd, args) {
|
|
10
5
|
if (!chan) {
|
|
11
6
|
return true;
|
|
12
7
|
}
|
|
13
8
|
if (args.length === 0) {
|
|
14
|
-
chan.pushMessage(this, new
|
|
15
|
-
type:
|
|
9
|
+
chan.pushMessage(this, new Msg({
|
|
10
|
+
type: MessageType.NOTICE,
|
|
16
11
|
text: chan.blowfishKey
|
|
17
12
|
? `FiSH: Key is set for ${chan.name}. Use /blow off to clear.`
|
|
18
13
|
: `FiSH: No key set for ${chan.name}. Use /blow <key> to set.`,
|
|
@@ -25,20 +20,20 @@ const input = function (network, chan, _cmd, args) {
|
|
|
25
20
|
}
|
|
26
21
|
if (sub.toLowerCase() === "off" || sub.toLowerCase() === "clear") {
|
|
27
22
|
chan.blowfishKey = undefined;
|
|
28
|
-
chan.pushMessage(this, new
|
|
29
|
-
type:
|
|
23
|
+
chan.pushMessage(this, new Msg({
|
|
24
|
+
type: MessageType.NOTICE,
|
|
30
25
|
text: `FiSH: Key cleared for ${chan.name}.`,
|
|
31
26
|
}));
|
|
32
27
|
return true;
|
|
33
28
|
}
|
|
34
29
|
chan.blowfishKey = sub;
|
|
35
|
-
chan.pushMessage(this, new
|
|
36
|
-
type:
|
|
30
|
+
chan.pushMessage(this, new Msg({
|
|
31
|
+
type: MessageType.NOTICE,
|
|
37
32
|
text: `FiSH: Key set for ${chan.name}.`,
|
|
38
33
|
}));
|
|
39
34
|
return true;
|
|
40
35
|
};
|
|
41
|
-
|
|
36
|
+
export default {
|
|
42
37
|
commands,
|
|
43
38
|
input,
|
|
44
39
|
};
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const msg_1 = __importDefault(require("../../models/msg"));
|
|
7
|
-
const msg_2 = require("../../../shared/types/msg");
|
|
1
|
+
import Msg from "../../models/msg.js";
|
|
2
|
+
import { MessageType } from "../../../shared/types/msg.js";
|
|
8
3
|
const commands = ["connect", "server"];
|
|
9
4
|
const allowDisconnected = true;
|
|
10
5
|
const input = function (network, chan, cmd, args) {
|
|
@@ -16,8 +11,8 @@ const input = function (network, chan, cmd, args) {
|
|
|
16
11
|
return;
|
|
17
12
|
}
|
|
18
13
|
if (irc.connected) {
|
|
19
|
-
chan.pushMessage(this, new
|
|
20
|
-
type:
|
|
14
|
+
chan.pushMessage(this, new Msg({
|
|
15
|
+
type: MessageType.ERROR,
|
|
21
16
|
text: "You are already connected.",
|
|
22
17
|
}));
|
|
23
18
|
return;
|
|
@@ -34,7 +29,7 @@ const input = function (network, chan, cmd, args) {
|
|
|
34
29
|
this.connectToNetwork({ host, port, tls });
|
|
35
30
|
return true;
|
|
36
31
|
};
|
|
37
|
-
|
|
32
|
+
export default {
|
|
38
33
|
commands,
|
|
39
34
|
input,
|
|
40
35
|
allowDisconnected,
|
|
@@ -1,29 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const msg_1 = __importDefault(require("../../models/msg"));
|
|
7
|
-
const msg_2 = require("../../../shared/types/msg");
|
|
1
|
+
import Msg from "../../models/msg.js";
|
|
2
|
+
import { MessageType } from "../../../shared/types/msg.js";
|
|
8
3
|
const commands = ["ctcp"];
|
|
9
4
|
const input = function ({ irc }, chan, cmd, args) {
|
|
10
5
|
if (args.length < 2) {
|
|
11
|
-
chan.pushMessage(this, new
|
|
12
|
-
type:
|
|
6
|
+
chan.pushMessage(this, new Msg({
|
|
7
|
+
type: MessageType.ERROR,
|
|
13
8
|
text: "Usage: /ctcp <nick> <ctcp_type>",
|
|
14
9
|
}));
|
|
15
10
|
return;
|
|
16
11
|
}
|
|
17
12
|
const target = args.shift();
|
|
18
13
|
const type = args.shift();
|
|
19
|
-
chan.pushMessage(this, new
|
|
20
|
-
type:
|
|
14
|
+
chan.pushMessage(this, new Msg({
|
|
15
|
+
type: MessageType.CTCP_REQUEST,
|
|
21
16
|
ctcpMessage: `"${type}" to ${target}`,
|
|
22
17
|
from: chan.getUser(irc.user.nick),
|
|
23
18
|
}));
|
|
24
19
|
irc.ctcpRequest(target, type, ...args);
|
|
25
20
|
};
|
|
26
|
-
|
|
21
|
+
export default {
|
|
27
22
|
commands,
|
|
28
23
|
input,
|
|
29
24
|
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
const commands = ["disconnect"];
|
|
4
2
|
const allowDisconnected = true;
|
|
5
3
|
const input = function (network, chan, cmd, args) {
|
|
@@ -8,7 +6,7 @@ const input = function (network, chan, cmd, args) {
|
|
|
8
6
|
network.userDisconnected = true;
|
|
9
7
|
this.save();
|
|
10
8
|
};
|
|
11
|
-
|
|
9
|
+
export default {
|
|
12
10
|
commands,
|
|
13
11
|
input,
|
|
14
12
|
allowDisconnected,
|
|
@@ -1,38 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const msg_1 = __importDefault(require("../../models/msg"));
|
|
7
|
-
const helper_1 = __importDefault(require("../../helper"));
|
|
8
|
-
const msg_2 = require("../../../shared/types/msg");
|
|
1
|
+
import Msg from "../../models/msg.js";
|
|
2
|
+
import Helper from "../../helper.js";
|
|
3
|
+
import { MessageType } from "../../../shared/types/msg.js";
|
|
9
4
|
const commands = ["ignore", "unignore"];
|
|
10
5
|
const input = function (network, chan, cmd, args) {
|
|
11
|
-
const client = this;
|
|
12
6
|
if (args.length === 0 || args[0].trim().length === 0) {
|
|
13
|
-
chan.pushMessage(
|
|
14
|
-
type:
|
|
7
|
+
chan.pushMessage(this, new Msg({
|
|
8
|
+
type: MessageType.ERROR,
|
|
15
9
|
text: `Usage: /${cmd} <nick>[!ident][@host]`,
|
|
16
10
|
}));
|
|
17
11
|
return;
|
|
18
12
|
}
|
|
19
13
|
const target = args[0].trim();
|
|
20
|
-
const hostmask =
|
|
14
|
+
const hostmask = Helper.parseHostmask(target);
|
|
21
15
|
switch (cmd) {
|
|
22
16
|
case "ignore": {
|
|
23
17
|
// IRC nicks are case insensitive
|
|
24
18
|
if (hostmask.nick.toLowerCase() === network.nick.toLowerCase()) {
|
|
25
|
-
chan.pushMessage(
|
|
26
|
-
type:
|
|
19
|
+
chan.pushMessage(this, new Msg({
|
|
20
|
+
type: MessageType.ERROR,
|
|
27
21
|
text: "You can't ignore yourself",
|
|
28
22
|
}));
|
|
29
23
|
return;
|
|
30
24
|
}
|
|
31
|
-
if (network.ignoreList.some(
|
|
32
|
-
return
|
|
25
|
+
if (network.ignoreList.some((entry) => {
|
|
26
|
+
return Helper.compareHostmask(entry, hostmask);
|
|
33
27
|
})) {
|
|
34
|
-
chan.pushMessage(
|
|
35
|
-
type:
|
|
28
|
+
chan.pushMessage(this, new Msg({
|
|
29
|
+
type: MessageType.ERROR,
|
|
36
30
|
text: "The specified user/hostmask is already ignored",
|
|
37
31
|
}));
|
|
38
32
|
return;
|
|
@@ -41,34 +35,34 @@ const input = function (network, chan, cmd, args) {
|
|
|
41
35
|
...hostmask,
|
|
42
36
|
when: Date.now(),
|
|
43
37
|
});
|
|
44
|
-
|
|
45
|
-
chan.pushMessage(
|
|
46
|
-
type:
|
|
38
|
+
this.save();
|
|
39
|
+
chan.pushMessage(this, new Msg({
|
|
40
|
+
type: MessageType.ERROR, // TODO: Successfully added via type.Error 🤔 ?
|
|
47
41
|
text: `\u0002${hostmask.nick}!${hostmask.ident}@${hostmask.hostname}\u000f added to ignorelist`,
|
|
48
42
|
}));
|
|
49
43
|
return;
|
|
50
44
|
}
|
|
51
45
|
case "unignore": {
|
|
52
|
-
const idx = network.ignoreList.findIndex(
|
|
53
|
-
return
|
|
46
|
+
const idx = network.ignoreList.findIndex((entry) => {
|
|
47
|
+
return Helper.compareHostmask(entry, hostmask);
|
|
54
48
|
});
|
|
55
49
|
if (idx === -1) {
|
|
56
|
-
chan.pushMessage(
|
|
57
|
-
type:
|
|
50
|
+
chan.pushMessage(this, new Msg({
|
|
51
|
+
type: MessageType.ERROR,
|
|
58
52
|
text: "The specified user/hostmask is not ignored",
|
|
59
53
|
}));
|
|
60
54
|
return;
|
|
61
55
|
}
|
|
62
56
|
network.ignoreList.splice(idx, 1);
|
|
63
|
-
|
|
64
|
-
chan.pushMessage(
|
|
65
|
-
type:
|
|
57
|
+
this.save();
|
|
58
|
+
chan.pushMessage(this, new Msg({
|
|
59
|
+
type: MessageType.ERROR, // TODO: Successfully removed via type.Error 🤔 ?
|
|
66
60
|
text: `Successfully removed \u0002${hostmask.nick}!${hostmask.ident}@${hostmask.hostname}\u000f from ignorelist`,
|
|
67
61
|
}));
|
|
68
62
|
}
|
|
69
63
|
}
|
|
70
64
|
};
|
|
71
|
-
|
|
65
|
+
export default {
|
|
72
66
|
commands,
|
|
73
67
|
input,
|
|
74
68
|
};
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const msg_1 = __importDefault(require("../../models/msg"));
|
|
7
|
-
const chan_1 = require("../../../shared/types/chan");
|
|
8
|
-
const msg_2 = require("../../../shared/types/msg");
|
|
1
|
+
import Msg from "../../models/msg.js";
|
|
2
|
+
import { ChanType, SpecialChanType } from "../../../shared/types/chan.js";
|
|
3
|
+
import { MessageType } from "../../../shared/types/msg.js";
|
|
9
4
|
const commands = ["ignorelist"];
|
|
10
|
-
const input = function (network, chan
|
|
11
|
-
const client = this;
|
|
5
|
+
const input = function (network, chan) {
|
|
12
6
|
if (network.ignoreList.length === 0) {
|
|
13
|
-
chan.pushMessage(
|
|
14
|
-
type:
|
|
7
|
+
chan.pushMessage(this, new Msg({
|
|
8
|
+
type: MessageType.ERROR,
|
|
15
9
|
text: "Ignorelist is empty",
|
|
16
10
|
}));
|
|
17
11
|
return;
|
|
@@ -23,13 +17,13 @@ const input = function (network, chan, _cmd, _args) {
|
|
|
23
17
|
}));
|
|
24
18
|
let newChan = network.getChannel(chanName);
|
|
25
19
|
if (typeof newChan === "undefined") {
|
|
26
|
-
newChan =
|
|
27
|
-
type:
|
|
28
|
-
special:
|
|
20
|
+
newChan = this.createChannel({
|
|
21
|
+
type: ChanType.SPECIAL,
|
|
22
|
+
special: SpecialChanType.IGNORELIST,
|
|
29
23
|
name: chanName,
|
|
30
24
|
data: ignored,
|
|
31
25
|
});
|
|
32
|
-
|
|
26
|
+
this.emit("join", {
|
|
33
27
|
network: network.uuid,
|
|
34
28
|
chan: newChan.getFilteredClone(true),
|
|
35
29
|
shouldOpen: false,
|
|
@@ -39,12 +33,12 @@ const input = function (network, chan, _cmd, _args) {
|
|
|
39
33
|
}
|
|
40
34
|
// TODO: add type for this chan/event
|
|
41
35
|
newChan.data = ignored;
|
|
42
|
-
|
|
36
|
+
this.emit("msg:special", {
|
|
43
37
|
chan: newChan.id,
|
|
44
38
|
data: ignored,
|
|
45
39
|
});
|
|
46
40
|
};
|
|
47
|
-
|
|
41
|
+
export default {
|
|
48
42
|
commands,
|
|
49
43
|
input,
|
|
50
44
|
};
|
|
@@ -1,32 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const log_1 = __importDefault(require("../../log"));
|
|
1
|
+
import log from "../../log.js";
|
|
30
2
|
const clientSideCommands = ["/collapse", "/expand", "/search"];
|
|
31
3
|
const passThroughCommands = [
|
|
32
4
|
"/as",
|
|
@@ -60,6 +32,7 @@ const builtInInputs = [
|
|
|
60
32
|
"notice",
|
|
61
33
|
"part",
|
|
62
34
|
"quit",
|
|
35
|
+
"rainbow",
|
|
63
36
|
"raw",
|
|
64
37
|
"rejoin",
|
|
65
38
|
"topic",
|
|
@@ -68,11 +41,12 @@ const builtInInputs = [
|
|
|
68
41
|
"blow",
|
|
69
42
|
];
|
|
70
43
|
for (const input of builtInInputs) {
|
|
71
|
-
|
|
44
|
+
import(`./${input}.js`)
|
|
45
|
+
.then((plugin) => {
|
|
72
46
|
plugin.default.commands.forEach((command) => userInputs.set(command, plugin.default));
|
|
73
47
|
})
|
|
74
48
|
.catch((err) => {
|
|
75
|
-
|
|
49
|
+
log.error(err);
|
|
76
50
|
});
|
|
77
51
|
}
|
|
78
52
|
const pluginCommands = new Map();
|
|
@@ -84,11 +58,11 @@ const getCommands = () => Array.from(userInputs.keys())
|
|
|
84
58
|
.sort();
|
|
85
59
|
const addPluginCommand = (packageInfo, command, obj) => {
|
|
86
60
|
if (typeof command !== "string") {
|
|
87
|
-
|
|
61
|
+
log.error(`plugin {packageInfo.packageName} tried to register a bad command`);
|
|
88
62
|
return;
|
|
89
63
|
}
|
|
90
64
|
else if (!obj || typeof obj.input !== "function") {
|
|
91
|
-
|
|
65
|
+
log.error(`plugin ${packageInfo.packageName} tried to register command "${command}" without a callback`);
|
|
92
66
|
return;
|
|
93
67
|
}
|
|
94
68
|
pluginCommands.set(command, {
|
|
@@ -97,7 +71,7 @@ const addPluginCommand = (packageInfo, command, obj) => {
|
|
|
97
71
|
allowDisconnected: obj.allowDisconnected,
|
|
98
72
|
});
|
|
99
73
|
};
|
|
100
|
-
|
|
74
|
+
export default {
|
|
101
75
|
addPluginCommand,
|
|
102
76
|
getCommands,
|
|
103
77
|
pluginCommands,
|