@lordbex/thelounge 4.4.3-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 +31 -7
- package/dist/defaults/config.js +31 -2
- package/dist/package.json +94 -91
- package/dist/server/client.js +188 -194
- package/dist/server/clientManager.js +75 -72
- 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 +102 -104
- 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 +122 -109
- 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 +349 -389
- 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 +94 -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/js/loading-error-handlers.js +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,16 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const user_1 = __importDefault(require("./user"));
|
|
10
|
-
const storage_1 = __importDefault(require("../plugins/storage"));
|
|
11
|
-
const prefix_1 = __importDefault(require("./prefix"));
|
|
12
|
-
const msg_1 = require("../../shared/types/msg");
|
|
13
|
-
const chan_1 = require("../../shared/types/chan");
|
|
1
|
+
import _ from "lodash";
|
|
2
|
+
import log from "../log.js";
|
|
3
|
+
import Config from "../config.js";
|
|
4
|
+
import User from "./user.js";
|
|
5
|
+
import storage from "../plugins/storage.js";
|
|
6
|
+
import Prefix from "./prefix.js";
|
|
7
|
+
import { MessageType } from "../../shared/types/msg.js";
|
|
8
|
+
import { ChanType, ChanState } from "../../shared/types/chan.js";
|
|
14
9
|
class Chan {
|
|
15
10
|
// TODO: don't force existence, figure out how to make TS infer it.
|
|
16
11
|
id;
|
|
@@ -25,6 +20,7 @@ class Chan {
|
|
|
25
20
|
muted;
|
|
26
21
|
type;
|
|
27
22
|
state;
|
|
23
|
+
pinned;
|
|
28
24
|
// mIRC FiSH Blowfish key, stored server-side only
|
|
29
25
|
blowfishKey;
|
|
30
26
|
userAway;
|
|
@@ -32,20 +28,22 @@ class Chan {
|
|
|
32
28
|
data;
|
|
33
29
|
closed;
|
|
34
30
|
num_users;
|
|
31
|
+
groups;
|
|
35
32
|
constructor(attr) {
|
|
36
|
-
|
|
33
|
+
_.defaults(this, attr, {
|
|
37
34
|
id: 0,
|
|
38
35
|
messages: [],
|
|
39
36
|
name: "",
|
|
40
37
|
key: "",
|
|
41
38
|
topic: "",
|
|
42
|
-
type:
|
|
43
|
-
state:
|
|
39
|
+
type: ChanType.CHANNEL,
|
|
40
|
+
state: ChanState.PARTED,
|
|
44
41
|
firstUnread: 0,
|
|
45
42
|
unread: 0,
|
|
46
43
|
highlight: 0,
|
|
47
44
|
users: new Map(),
|
|
48
45
|
muted: false,
|
|
46
|
+
pinned: false,
|
|
49
47
|
});
|
|
50
48
|
}
|
|
51
49
|
destroy() {
|
|
@@ -55,7 +53,7 @@ class Chan {
|
|
|
55
53
|
const chanId = this.id;
|
|
56
54
|
msg.id = client.idMsg++;
|
|
57
55
|
// If this channel is open in any of the clients, do not increase unread counter
|
|
58
|
-
const isOpen =
|
|
56
|
+
const isOpen = _.find(client.attachedClients, { openChannel: chanId }) !== undefined;
|
|
59
57
|
if (msg.self) {
|
|
60
58
|
// reset counters/markers when receiving self-/echo-message
|
|
61
59
|
this.unread = 0;
|
|
@@ -76,7 +74,7 @@ class Chan {
|
|
|
76
74
|
client.emit("msg", { chan: chanId, msg, unread: this.unread, highlight: this.highlight });
|
|
77
75
|
// Never store messages in public mode as the session
|
|
78
76
|
// is completely destroyed when the page gets closed
|
|
79
|
-
if (
|
|
77
|
+
if (Config.values.public) {
|
|
80
78
|
return;
|
|
81
79
|
}
|
|
82
80
|
// showInActive is only processed on "msg", don't need it on page reload
|
|
@@ -84,24 +82,24 @@ class Chan {
|
|
|
84
82
|
delete msg.showInActive;
|
|
85
83
|
}
|
|
86
84
|
this.writeUserLog(client, msg);
|
|
87
|
-
if (
|
|
88
|
-
const deleted = this.messages.splice(0, this.messages.length -
|
|
85
|
+
if (Config.values.maxHistory >= 0 && this.messages.length > Config.values.maxHistory) {
|
|
86
|
+
const deleted = this.messages.splice(0, this.messages.length - Config.values.maxHistory);
|
|
89
87
|
// If maxHistory is 0, image would be dereferenced before client had a chance to retrieve it,
|
|
90
88
|
// so for now, just don't implement dereferencing for this edge case.
|
|
91
|
-
if (
|
|
89
|
+
if (Config.values.maxHistory > 0) {
|
|
92
90
|
this.dereferencePreviews(deleted);
|
|
93
91
|
}
|
|
94
92
|
}
|
|
95
93
|
}
|
|
96
94
|
dereferencePreviews(messages) {
|
|
97
|
-
if (!
|
|
95
|
+
if (!Config.values.prefetch || !Config.values.prefetchStorage) {
|
|
98
96
|
return;
|
|
99
97
|
}
|
|
100
98
|
messages.forEach((message) => {
|
|
101
99
|
if (message.previews) {
|
|
102
100
|
message.previews.forEach((preview) => {
|
|
103
101
|
if (preview.thumb) {
|
|
104
|
-
|
|
102
|
+
storage.dereference(preview.thumb);
|
|
105
103
|
preview.thumb = "";
|
|
106
104
|
}
|
|
107
105
|
});
|
|
@@ -132,7 +130,7 @@ class Chan {
|
|
|
132
130
|
return this.users.get(nick.toLowerCase());
|
|
133
131
|
}
|
|
134
132
|
getUser(nick) {
|
|
135
|
-
return this.findUser(nick) || new
|
|
133
|
+
return this.findUser(nick) || new User({ nick }, new Prefix([]));
|
|
136
134
|
}
|
|
137
135
|
setUser(user) {
|
|
138
136
|
this.users.set(user.nick.toLowerCase(), user);
|
|
@@ -176,10 +174,12 @@ class Chan {
|
|
|
176
174
|
muted: this.muted,
|
|
177
175
|
type: this.type,
|
|
178
176
|
state: this.state,
|
|
177
|
+
pinned: this.pinned,
|
|
179
178
|
special: this.special,
|
|
180
179
|
data: this.data,
|
|
181
180
|
closed: this.closed,
|
|
182
181
|
num_users: this.num_users,
|
|
182
|
+
groups: this.groups,
|
|
183
183
|
};
|
|
184
184
|
// TODO: funny array mutation below might need to be reproduced
|
|
185
185
|
// static optionalProperties = ["userAway", "special", "data", "closed", "num_users"];
|
|
@@ -196,13 +196,12 @@ class Chan {
|
|
|
196
196
|
if (client.messageStorage.length === 0) {
|
|
197
197
|
return;
|
|
198
198
|
}
|
|
199
|
-
const targetChannel = this;
|
|
200
199
|
// Is this particular message or channel loggable
|
|
201
200
|
if (!msg.isLoggable() || !this.isLoggable()) {
|
|
202
201
|
// Because notices are nasty and can be shown in active channel on the client
|
|
203
202
|
// if there is no open query, we want to always log notices in the sender's name
|
|
204
|
-
if (msg.type ===
|
|
205
|
-
|
|
203
|
+
if (msg.type === MessageType.NOTICE && msg.showInActive) {
|
|
204
|
+
this.name = msg.from.nick || ""; // TODO: check if || works
|
|
206
205
|
}
|
|
207
206
|
else {
|
|
208
207
|
return;
|
|
@@ -214,7 +213,7 @@ class Chan {
|
|
|
214
213
|
return;
|
|
215
214
|
}
|
|
216
215
|
for (const messageStorage of client.messageStorage) {
|
|
217
|
-
messageStorage.index(target.network,
|
|
216
|
+
messageStorage.index(target.network, this, msg).catch((e) => log.error(e));
|
|
218
217
|
}
|
|
219
218
|
}
|
|
220
219
|
loadMessages(client, network) {
|
|
@@ -223,7 +222,7 @@ class Chan {
|
|
|
223
222
|
}
|
|
224
223
|
if (!network.irc) {
|
|
225
224
|
// Network created, but misconfigured
|
|
226
|
-
|
|
225
|
+
log.warn(`Failed to load messages for ${client.name}, network ${network.name} is not initialized.`);
|
|
227
226
|
return;
|
|
228
227
|
}
|
|
229
228
|
if (!client.messageProvider) {
|
|
@@ -247,9 +246,13 @@ class Chan {
|
|
|
247
246
|
if (!this.firstUnread) {
|
|
248
247
|
this.firstUnread = messages[messages.length - 1].id;
|
|
249
248
|
}
|
|
249
|
+
const enhancedSearch = Boolean(client.config.clientSettings.searchEnabled &&
|
|
250
|
+
client.config.clientSettings.enableEnhancedSearch);
|
|
251
|
+
// if enhancedSearchEnabled = true send all loaded messages to the client
|
|
252
|
+
// otherwise only send 100
|
|
250
253
|
client.emit("more", {
|
|
251
254
|
chan: this.id,
|
|
252
|
-
messages: messages.slice(-100),
|
|
255
|
+
messages: enhancedSearch ? messages : messages.slice(-100),
|
|
253
256
|
totalMessages: messages.length,
|
|
254
257
|
});
|
|
255
258
|
if (network.irc.network.cap.isEnabled("znc.in/playback")) {
|
|
@@ -257,10 +260,10 @@ class Chan {
|
|
|
257
260
|
requestZncPlayback(this, network, from);
|
|
258
261
|
}
|
|
259
262
|
})
|
|
260
|
-
.catch((err) =>
|
|
263
|
+
.catch((err) => log.error(`Failed to load messages for ${client.name}: ${err.toString()}`));
|
|
261
264
|
}
|
|
262
265
|
isLoggable() {
|
|
263
|
-
return this.type ===
|
|
266
|
+
return this.type === ChanType.CHANNEL || this.type === ChanType.QUERY;
|
|
264
267
|
}
|
|
265
268
|
setMuteStatus(muted) {
|
|
266
269
|
this.muted = !!muted;
|
|
@@ -272,4 +275,4 @@ function requestZncPlayback(channel, network, from) {
|
|
|
272
275
|
}
|
|
273
276
|
network.irc.raw("ZNC", "*playback", "PLAY", channel.name, from.toString());
|
|
274
277
|
}
|
|
275
|
-
|
|
278
|
+
export default Chan;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
7
|
-
const msg_1 = require("../../shared/types/msg");
|
|
1
|
+
import _ from "lodash";
|
|
2
|
+
import { MessageType, } from "../../shared/types/msg.js";
|
|
8
3
|
class Msg {
|
|
9
4
|
from;
|
|
10
5
|
id;
|
|
@@ -39,6 +34,7 @@ class Msg {
|
|
|
39
34
|
users;
|
|
40
35
|
statusmsgGroup;
|
|
41
36
|
params;
|
|
37
|
+
massEventSummary;
|
|
42
38
|
constructor(attr) {
|
|
43
39
|
// Some properties need to be copied in the Msg object instead of referenced
|
|
44
40
|
if (attr) {
|
|
@@ -51,12 +47,12 @@ class Msg {
|
|
|
51
47
|
}
|
|
52
48
|
});
|
|
53
49
|
}
|
|
54
|
-
|
|
50
|
+
_.defaults(this, attr, {
|
|
55
51
|
from: {},
|
|
56
52
|
id: 0,
|
|
57
53
|
previews: [],
|
|
58
54
|
text: "",
|
|
59
|
-
type:
|
|
55
|
+
type: MessageType.MESSAGE,
|
|
60
56
|
self: false,
|
|
61
57
|
});
|
|
62
58
|
if (this.time) {
|
|
@@ -70,23 +66,23 @@ class Msg {
|
|
|
70
66
|
return this.previews.find((preview) => preview.link === link);
|
|
71
67
|
}
|
|
72
68
|
isLoggable() {
|
|
73
|
-
if (this.type ===
|
|
69
|
+
if (this.type === MessageType.TOPIC) {
|
|
74
70
|
// Do not log topic that is sent on channel join
|
|
75
71
|
return !!this.from.nick;
|
|
76
72
|
}
|
|
77
73
|
switch (this.type) {
|
|
78
|
-
case
|
|
79
|
-
case
|
|
80
|
-
case
|
|
81
|
-
case
|
|
82
|
-
case
|
|
83
|
-
case
|
|
84
|
-
case
|
|
85
|
-
case
|
|
74
|
+
case MessageType.MONOSPACE_BLOCK:
|
|
75
|
+
case MessageType.ERROR:
|
|
76
|
+
case MessageType.TOPIC_SET_BY:
|
|
77
|
+
case MessageType.MODE_CHANNEL:
|
|
78
|
+
case MessageType.MODE_USER:
|
|
79
|
+
case MessageType.RAW:
|
|
80
|
+
case MessageType.WHOIS:
|
|
81
|
+
case MessageType.PLUGIN:
|
|
86
82
|
return false;
|
|
87
83
|
default:
|
|
88
84
|
return true;
|
|
89
85
|
}
|
|
90
86
|
}
|
|
91
87
|
}
|
|
92
|
-
|
|
88
|
+
export default Msg;
|