@lordbex/thelounge 4.4.4-blowfish → 4.5.1-blowfish

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.
Files changed (140) hide show
  1. package/README.md +2 -2
  2. package/dist/defaults/config.js +31 -2
  3. package/dist/package.json +93 -91
  4. package/dist/server/client.js +188 -194
  5. package/dist/server/clientManager.js +65 -63
  6. package/dist/server/command-line/index.js +44 -43
  7. package/dist/server/command-line/install.js +37 -70
  8. package/dist/server/command-line/outdated.js +12 -17
  9. package/dist/server/command-line/start.js +25 -26
  10. package/dist/server/command-line/storage.js +26 -31
  11. package/dist/server/command-line/uninstall.js +16 -23
  12. package/dist/server/command-line/upgrade.js +20 -26
  13. package/dist/server/command-line/users/add.js +33 -40
  14. package/dist/server/command-line/users/edit.js +18 -24
  15. package/dist/server/command-line/users/index.js +12 -16
  16. package/dist/server/command-line/users/list.js +11 -39
  17. package/dist/server/command-line/users/remove.js +16 -22
  18. package/dist/server/command-line/users/reset.js +34 -35
  19. package/dist/server/command-line/utils.js +231 -87
  20. package/dist/server/config.js +61 -52
  21. package/dist/server/helper.js +29 -28
  22. package/dist/server/identification.js +39 -34
  23. package/dist/server/index.js +1 -3
  24. package/dist/server/log.js +19 -16
  25. package/dist/server/models/chan.js +36 -33
  26. package/dist/server/models/msg.js +15 -19
  27. package/dist/server/models/network.js +88 -86
  28. package/dist/server/models/prefix.js +4 -7
  29. package/dist/server/models/user.js +5 -10
  30. package/dist/server/path-helper.js +8 -0
  31. package/dist/server/plugins/auth/ldap.js +177 -112
  32. package/dist/server/plugins/auth/local.js +10 -15
  33. package/dist/server/plugins/auth.js +6 -35
  34. package/dist/server/plugins/changelog.js +30 -27
  35. package/dist/server/plugins/clientCertificate.js +33 -37
  36. package/dist/server/plugins/dev-server.js +15 -21
  37. package/dist/server/plugins/inputs/action.js +9 -14
  38. package/dist/server/plugins/inputs/away.js +1 -3
  39. package/dist/server/plugins/inputs/ban.js +9 -14
  40. package/dist/server/plugins/inputs/blow.js +9 -14
  41. package/dist/server/plugins/inputs/connect.js +5 -10
  42. package/dist/server/plugins/inputs/ctcp.js +7 -12
  43. package/dist/server/plugins/inputs/disconnect.js +1 -3
  44. package/dist/server/plugins/inputs/ignore.js +23 -29
  45. package/dist/server/plugins/inputs/ignorelist.js +12 -18
  46. package/dist/server/plugins/inputs/index.js +8 -34
  47. package/dist/server/plugins/inputs/invite.js +7 -12
  48. package/dist/server/plugins/inputs/kick.js +7 -12
  49. package/dist/server/plugins/inputs/kill.js +1 -3
  50. package/dist/server/plugins/inputs/list.js +1 -3
  51. package/dist/server/plugins/inputs/mode.js +10 -15
  52. package/dist/server/plugins/inputs/msg.js +13 -18
  53. package/dist/server/plugins/inputs/mute.js +9 -15
  54. package/dist/server/plugins/inputs/nick.js +9 -14
  55. package/dist/server/plugins/inputs/notice.js +5 -7
  56. package/dist/server/plugins/inputs/part.js +11 -16
  57. package/dist/server/plugins/inputs/quit.js +7 -13
  58. package/dist/server/plugins/inputs/rainbow.js +55 -0
  59. package/dist/server/plugins/inputs/raw.js +1 -3
  60. package/dist/server/plugins/inputs/rejoin.js +7 -12
  61. package/dist/server/plugins/inputs/topic.js +7 -12
  62. package/dist/server/plugins/inputs/whois.js +1 -3
  63. package/dist/server/plugins/irc-events/away.js +14 -20
  64. package/dist/server/plugins/irc-events/cap.js +16 -22
  65. package/dist/server/plugins/irc-events/chghost.js +14 -13
  66. package/dist/server/plugins/irc-events/connection.js +61 -63
  67. package/dist/server/plugins/irc-events/ctcp.js +22 -28
  68. package/dist/server/plugins/irc-events/error.js +20 -26
  69. package/dist/server/plugins/irc-events/help.js +7 -13
  70. package/dist/server/plugins/irc-events/info.js +7 -13
  71. package/dist/server/plugins/irc-events/invite.js +7 -13
  72. package/dist/server/plugins/irc-events/join.js +30 -27
  73. package/dist/server/plugins/irc-events/kick.js +21 -17
  74. package/dist/server/plugins/irc-events/link.js +75 -96
  75. package/dist/server/plugins/irc-events/list.js +23 -26
  76. package/dist/server/plugins/irc-events/message.js +46 -52
  77. package/dist/server/plugins/irc-events/mode.js +66 -63
  78. package/dist/server/plugins/irc-events/modelist.js +29 -35
  79. package/dist/server/plugins/irc-events/motd.js +10 -16
  80. package/dist/server/plugins/irc-events/names.js +3 -6
  81. package/dist/server/plugins/irc-events/nick.js +26 -23
  82. package/dist/server/plugins/irc-events/part.js +19 -15
  83. package/dist/server/plugins/irc-events/quit.js +17 -14
  84. package/dist/server/plugins/irc-events/sasl.js +9 -15
  85. package/dist/server/plugins/irc-events/spgroups.js +38 -0
  86. package/dist/server/plugins/irc-events/spjoin.js +52 -0
  87. package/dist/server/plugins/irc-events/topic.js +12 -18
  88. package/dist/server/plugins/irc-events/unhandled.js +12 -12
  89. package/dist/server/plugins/irc-events/welcome.js +7 -13
  90. package/dist/server/plugins/irc-events/whois.js +20 -24
  91. package/dist/server/plugins/massEventAggregator.js +214 -0
  92. package/dist/server/plugins/messageStorage/sqlite.js +322 -141
  93. package/dist/server/plugins/messageStorage/text.js +21 -26
  94. package/dist/server/plugins/packages/index.js +105 -74
  95. package/dist/server/plugins/packages/publicClient.js +7 -16
  96. package/dist/server/plugins/packages/themes.js +11 -16
  97. package/dist/server/plugins/storage.js +28 -33
  98. package/dist/server/plugins/sts.js +12 -17
  99. package/dist/server/plugins/uploader.js +40 -43
  100. package/dist/server/plugins/webpush.js +23 -51
  101. package/dist/server/server.js +318 -271
  102. package/dist/server/storageCleaner.js +29 -37
  103. package/dist/server/utils/fish.js +7 -14
  104. package/dist/shared/irc.js +3 -6
  105. package/dist/shared/linkify.js +7 -14
  106. package/dist/shared/types/chan.js +6 -9
  107. package/dist/shared/types/changelog.js +1 -2
  108. package/dist/shared/types/config.js +1 -2
  109. package/dist/shared/types/mention.js +1 -2
  110. package/dist/shared/types/msg.js +3 -5
  111. package/dist/shared/types/network.js +1 -2
  112. package/dist/shared/types/storage.js +1 -2
  113. package/dist/shared/types/user.js +1 -2
  114. package/index.js +14 -10
  115. package/package.json +93 -91
  116. package/public/css/style.css +9 -6
  117. package/public/css/style.css.map +1 -1
  118. package/public/fonts/font-awesome/fa-brands-400.ttf +0 -0
  119. package/public/fonts/font-awesome/fa-brands-400.woff2 +0 -0
  120. package/public/fonts/font-awesome/fa-duotone-900.ttf +0 -0
  121. package/public/fonts/font-awesome/fa-duotone-900.woff2 +0 -0
  122. package/public/fonts/font-awesome/fa-light-300.ttf +0 -0
  123. package/public/fonts/font-awesome/fa-light-300.woff2 +0 -0
  124. package/public/fonts/font-awesome/fa-regular-400.ttf +0 -0
  125. package/public/fonts/font-awesome/fa-regular-400.woff2 +0 -0
  126. package/public/fonts/font-awesome/fa-solid-900.ttf +0 -0
  127. package/public/fonts/font-awesome/fa-solid-900.woff2 +0 -0
  128. package/public/fonts/font-awesome/fa-thin-100.ttf +0 -0
  129. package/public/fonts/font-awesome/fa-thin-100.woff2 +0 -0
  130. package/public/fonts/font-awesome/fa-v4compatibility.ttf +0 -0
  131. package/public/fonts/font-awesome/fa-v4compatibility.woff2 +0 -0
  132. package/public/js/bundle.js +1 -1
  133. package/public/js/bundle.js.map +1 -1
  134. package/public/js/bundle.vendor.js +1 -1
  135. package/public/js/bundle.vendor.js.LICENSE.txt +24 -6
  136. package/public/js/bundle.vendor.js.map +1 -1
  137. package/public/service-worker.js +1 -1
  138. package/public/themes/default.css +1 -1
  139. package/public/themes/morning.css +1 -1
  140. package/dist/webpack.config.js +0 -224
@@ -1,77 +1,73 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const path_1 = __importDefault(require("path"));
7
- const fs_1 = __importDefault(require("fs"));
8
- const crypto_1 = __importDefault(require("crypto"));
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 (config_1.default.values.public) {
13
+ if (Config.values.public) {
18
14
  return null;
19
15
  }
20
- const folderPath = config_1.default.getClientCertificatesPath();
16
+ const folderPath = Config.getClientCertificatesPath();
21
17
  const paths = getPaths(folderPath, uuid);
22
- if (!fs_1.default.existsSync(paths.privateKeyPath) || !fs_1.default.existsSync(paths.certificatePath)) {
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: fs_1.default.readFileSync(paths.privateKeyPath, "utf-8"),
28
- certificate: fs_1.default.readFileSync(paths.certificatePath, "utf-8"),
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
- log_1.default.error("Unable to get certificate", e);
28
+ log.error("Unable to get certificate", String(e));
33
29
  }
34
30
  return null;
35
31
  }
36
32
  function remove(uuid) {
37
- if (config_1.default.values.public) {
33
+ if (Config.values.public) {
38
34
  return null;
39
35
  }
40
- const paths = getPaths(config_1.default.getClientCertificatesPath(), uuid);
36
+ const paths = getPaths(Config.getClientCertificatesPath(), uuid);
41
37
  try {
42
- if (fs_1.default.existsSync(paths.privateKeyPath)) {
43
- fs_1.default.unlinkSync(paths.privateKeyPath);
38
+ if (fs.existsSync(paths.privateKeyPath)) {
39
+ fs.unlinkSync(paths.privateKeyPath);
44
40
  }
45
- if (fs_1.default.existsSync(paths.certificatePath)) {
46
- fs_1.default.unlinkSync(paths.certificatePath);
41
+ if (fs.existsSync(paths.certificatePath)) {
42
+ fs.unlinkSync(paths.certificatePath);
47
43
  }
48
44
  }
49
45
  catch (e) {
50
- log_1.default.error("Unable to remove certificate", e);
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
- fs_1.default.mkdirSync(folderPath, { recursive: true });
57
- fs_1.default.writeFileSync(paths.privateKeyPath, certificate.private_key, {
52
+ fs.mkdirSync(folderPath, { recursive: true });
53
+ fs.writeFileSync(paths.privateKeyPath, certificate.private_key, {
58
54
  mode: 0o600,
59
55
  });
60
- fs_1.default.writeFileSync(paths.certificatePath, certificate.certificate, {
56
+ fs.writeFileSync(paths.certificatePath, certificate.certificate, {
61
57
  mode: 0o600,
62
58
  });
63
59
  return certificate;
64
60
  }
65
61
  catch (e) {
66
- log_1.default.error("Unable to write certificate", String(e));
62
+ log.error("Unable to write certificate", String(e));
67
63
  }
68
64
  return null;
69
65
  }
70
66
  function generate() {
71
- const keys = node_forge_1.pki.rsa.generateKeyPair(2048);
72
- const cert = node_forge_1.pki.createCertificate();
67
+ const keys = pki.rsa.generateKeyPair(2048);
68
+ const cert = pki.createCertificate();
73
69
  cert.publicKey = keys.publicKey;
74
- cert.serialNumber = crypto_1.default.randomBytes(16).toString("hex").toUpperCase();
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, node_forge_1.md.sha256.create());
99
+ cert.sign(keys.privateKey, md.sha256.create());
104
100
  const pem = {
105
- private_key: node_forge_1.pki.privateKeyToPem(keys.privateKey),
106
- certificate: node_forge_1.pki.certificateToPem(cert),
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: path_1.default.join(folderPath, `${uuid}.pem`),
113
- certificatePath: path_1.default.join(folderPath, `${uuid}.crt`),
108
+ privateKeyPath: path.join(folderPath, `${uuid}.pem`),
109
+ certificatePath: path.join(folderPath, `${uuid}.crt`),
114
110
  };
115
111
  }
@@ -1,33 +1,27 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const webpack_dev_middleware_1 = __importDefault(require("webpack-dev-middleware"));
7
- const webpack_hot_middleware_1 = __importDefault(require("webpack-hot-middleware"));
8
- const log_1 = __importDefault(require("../log"));
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 webpack_1.default.HotModuleReplacementPlugin());
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 = (0, webpack_1.default)(webpackConfig);
23
- app.use(
24
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
25
- (0, webpack_dev_middleware_1.default)(compiler, {
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
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
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");
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 !== chan_1.ChanType.CHANNEL && chan.type !== chan_1.ChanType.QUERY) {
13
- chan.pushMessage(this, new msg_1.default({
14
- type: msg_2.MessageType.ERROR,
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 = (0, fish_1.createFishMessage)(ctcp, chan.blowfishKey);
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
- exports.default = {
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
- exports.default = {
15
+ export default {
18
16
  commands,
19
17
  input,
20
18
  };
@@ -1,24 +1,19 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
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");
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 !== chan_1.ChanType.CHANNEL) {
12
- chan.pushMessage(this, new msg_1.default({
13
- type: msg_2.MessageType.ERROR,
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 msg_1.default({
21
- type: msg_2.MessageType.ERROR,
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
- exports.default = {
37
+ export default {
43
38
  commands,
44
39
  input,
45
40
  };
@@ -1,18 +1,13 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
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 msg_1.default({
15
- type: msg_2.MessageType.NOTICE,
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 msg_1.default({
29
- type: msg_2.MessageType.NOTICE,
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 msg_1.default({
36
- type: msg_2.MessageType.NOTICE,
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
- exports.default = {
36
+ export default {
42
37
  commands,
43
38
  input,
44
39
  };
@@ -1,10 +1,5 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
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 msg_1.default({
20
- type: msg_2.MessageType.ERROR,
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
- exports.default = {
32
+ export default {
38
33
  commands,
39
34
  input,
40
35
  allowDisconnected,
@@ -1,29 +1,24 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
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 msg_1.default({
12
- type: msg_2.MessageType.ERROR,
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 msg_1.default({
20
- type: msg_2.MessageType.CTCP_REQUEST,
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
- exports.default = {
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
- exports.default = {
9
+ export default {
12
10
  commands,
13
11
  input,
14
12
  allowDisconnected,
@@ -1,38 +1,32 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
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 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(client, new msg_1.default({
14
- type: msg_2.MessageType.ERROR,
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 = helper_1.default.parseHostmask(target);
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(client, new msg_1.default({
26
- type: msg_2.MessageType.ERROR,
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(function (entry) {
32
- return helper_1.default.compareHostmask(entry, hostmask);
25
+ if (network.ignoreList.some((entry) => {
26
+ return Helper.compareHostmask(entry, hostmask);
33
27
  })) {
34
- chan.pushMessage(client, new msg_1.default({
35
- type: msg_2.MessageType.ERROR,
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
- client.save();
45
- chan.pushMessage(client, new msg_1.default({
46
- type: msg_2.MessageType.ERROR, // TODO: Successfully added via type.Error 🤔 ?
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(function (entry) {
53
- return helper_1.default.compareHostmask(entry, hostmask);
46
+ const idx = network.ignoreList.findIndex((entry) => {
47
+ return Helper.compareHostmask(entry, hostmask);
54
48
  });
55
49
  if (idx === -1) {
56
- chan.pushMessage(client, new msg_1.default({
57
- type: msg_2.MessageType.ERROR,
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
- client.save();
64
- chan.pushMessage(client, new msg_1.default({
65
- type: msg_2.MessageType.ERROR, // TODO: Successfully removed via type.Error 🤔 ?
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
- exports.default = {
65
+ export default {
72
66
  commands,
73
67
  input,
74
68
  };
@@ -1,17 +1,11 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
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 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, _cmd, _args) {
11
- const client = this;
5
+ const input = function (network, chan) {
12
6
  if (network.ignoreList.length === 0) {
13
- chan.pushMessage(client, new msg_1.default({
14
- type: msg_2.MessageType.ERROR,
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 = client.createChannel({
27
- type: chan_1.ChanType.SPECIAL,
28
- special: chan_1.SpecialChanType.IGNORELIST,
20
+ newChan = this.createChannel({
21
+ type: ChanType.SPECIAL,
22
+ special: SpecialChanType.IGNORELIST,
29
23
  name: chanName,
30
24
  data: ignored,
31
25
  });
32
- client.emit("join", {
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
- client.emit("msg:special", {
36
+ this.emit("msg:special", {
43
37
  chan: newChan.id,
44
38
  data: ignored,
45
39
  });
46
40
  };
47
- exports.default = {
41
+ export default {
48
42
  commands,
49
43
  input,
50
44
  };
@@ -1,32 +1,4 @@
1
- "use strict";
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
- Promise.resolve(`${`./${input}`}`).then(s => __importStar(require(s))).then((plugin) => {
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
- log_1.default.error(err);
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
- log_1.default.error(`plugin {packageInfo.packageName} tried to register a bad command`);
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
- log_1.default.error(`plugin ${packageInfo.packageName} tried to register command "${command} without a callback"`);
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
- exports.default = {
74
+ export default {
101
75
  addPluginCommand,
102
76
  getCommands,
103
77
  pluginCommands,