mirror of
https://github.com/thelounge/thelounge.git
synced 2024-06-04 14:52:19 +02:00
feat: support custom CTCP VERSION responses
This commit is contained in:
parent
9f05a75c39
commit
02e735aa25
|
@ -218,6 +218,19 @@ module.exports = {
|
|||
// default.
|
||||
leaveMessage: "The Lounge - https://thelounge.chat",
|
||||
|
||||
// ### `versionResponse`
|
||||
//
|
||||
// A template string to format thelounge's response to CTCP VERSION requests. The
|
||||
// tokens `%product-name%`, `%version%`, and `%url%` will be replaced by the
|
||||
// appropriate values for the currently running version of The Lounge.
|
||||
//
|
||||
// You can use this to remove version information from the CTCP VERSION response
|
||||
// for hardening.
|
||||
//
|
||||
// The default template string results in a response of
|
||||
// `thelounge vX.Y.Z -- https://thelounge.chat`.
|
||||
versionResponse: "%product-name% %version% -- %url%",
|
||||
|
||||
// ## Default network
|
||||
|
||||
// ### `defaults`
|
||||
|
|
|
@ -94,6 +94,7 @@ export type ConfigType = {
|
|||
fileUpload: FileUpload;
|
||||
transports: string[];
|
||||
leaveMessage: string;
|
||||
versionResponse: string;
|
||||
defaults: Defaults;
|
||||
lockNetwork: boolean;
|
||||
messageStorage: string[];
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import _ from "lodash";
|
||||
import Config from "../../config";
|
||||
import {IrcEventHandler} from "../../client";
|
||||
import Helper from "../../helper";
|
||||
import Msg, {MessageType} from "../../models/msg";
|
||||
|
@ -12,7 +13,11 @@ const ctcpResponses = {
|
|||
.join(" "),
|
||||
PING: ({message}: {message: string}) => message.substring(5),
|
||||
SOURCE: () => pkg.repository.url,
|
||||
VERSION: () => pkg.name + " " + Helper.getVersion() + " -- " + pkg.homepage,
|
||||
VERSION: () =>
|
||||
Config.values.versionResponse
|
||||
.replace("%product-name%", pkg.name)
|
||||
.replace("%version%", Helper.getVersion())
|
||||
.replace("%url%", pkg.homepage),
|
||||
};
|
||||
|
||||
export default <IrcEventHandler>function (irc, network) {
|
||||
|
|
Loading…
Reference in a new issue