mirror of
https://github.com/thelounge/thelounge.git
synced 2024-05-18 14:16:36 +02:00
wip: msg
This commit is contained in:
parent
f5867c3643
commit
3eb19135f5
|
@ -1,5 +1,5 @@
|
|||
import io, {Socket} from "socket.io-client";
|
||||
import type {ServerToClientEvents, ClientToServerEvents} from "../../server/types/socket-events";
|
||||
import type {ServerToClientEvents, ClientToServerEvents} from "../../shared/types/socket-events";
|
||||
|
||||
const socket: Socket<ServerToClientEvents, ClientToServerEvents> = io({
|
||||
transports: JSON.parse(document.body.dataset.transports || "['polling', 'websocket']"),
|
||||
|
|
|
@ -9,7 +9,6 @@ import {router} from "./router";
|
|||
import socket from "./socket";
|
||||
import eventbus from "./eventbus";
|
||||
|
||||
import "./socket-events";
|
||||
import "./webpush";
|
||||
import "./keybinds";
|
||||
import {LoungeWindow} from "./types";
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
] /* Specifies a list of glob patterns that match files to be included in compilation. If no 'files' or 'include' property is present in a tsconfig.json, the compiler defaults to including all files in the containing directory and subdirectories except those specified by 'exclude'. Requires TypeScript version 2.0 or later. */,
|
||||
"files": [
|
||||
"../package.json",
|
||||
"../server/types/socket-events.d.ts",
|
||||
"../server/helper.ts",
|
||||
"../server/log.ts",
|
||||
"../server/config.ts",
|
||||
|
|
|
@ -7,9 +7,10 @@ import colors from "chalk";
|
|||
|
||||
import log from "./log";
|
||||
import Chan, {ChanConfig, Channel, ChanType} from "./models/chan";
|
||||
import Msg, {MessageType, UserInMessage} from "./models/msg";
|
||||
import Msg from "./models/msg";
|
||||
import Config from "./config";
|
||||
import {condensedTypes} from "../shared/irc";
|
||||
import {MessageType, UserInMessage} from "../shared/types/msg";
|
||||
|
||||
import inputs from "./plugins/inputs";
|
||||
import PublicClient from "./plugins/packages/publicClient";
|
||||
|
|
|
@ -2,11 +2,12 @@ import _ from "lodash";
|
|||
import log from "../log";
|
||||
import Config from "../config";
|
||||
import User from "./user";
|
||||
import Msg, {MessageType} from "./msg";
|
||||
import Msg from "./msg";
|
||||
import storage from "../plugins/storage";
|
||||
import Client from "../client";
|
||||
import Network from "./network";
|
||||
import Prefix from "./prefix";
|
||||
import {MessageType} from "../../shared/types/msg";
|
||||
|
||||
export enum ChanType {
|
||||
CHANNEL = "channel",
|
||||
|
|
|
@ -1,41 +1,5 @@
|
|||
import _ from "lodash";
|
||||
import {LinkPreview} from "../plugins/irc-events/link";
|
||||
import User from "./user";
|
||||
|
||||
export type UserInMessage = Partial<User> & {
|
||||
mode: string;
|
||||
};
|
||||
|
||||
export enum MessageType {
|
||||
UNHANDLED = "unhandled",
|
||||
ACTION = "action",
|
||||
AWAY = "away",
|
||||
BACK = "back",
|
||||
ERROR = "error",
|
||||
INVITE = "invite",
|
||||
JOIN = "join",
|
||||
KICK = "kick",
|
||||
LOGIN = "login",
|
||||
LOGOUT = "logout",
|
||||
MESSAGE = "message",
|
||||
MODE = "mode",
|
||||
MODE_CHANNEL = "mode_channel",
|
||||
MODE_USER = "mode_user", // RPL_UMODEIS
|
||||
MONOSPACE_BLOCK = "monospace_block",
|
||||
NICK = "nick",
|
||||
NOTICE = "notice",
|
||||
PART = "part",
|
||||
QUIT = "quit",
|
||||
CTCP = "ctcp",
|
||||
CTCP_REQUEST = "ctcp_request",
|
||||
CHGHOST = "chghost",
|
||||
TOPIC = "topic",
|
||||
TOPIC_SET_BY = "topic_set_by",
|
||||
WHOIS = "whois",
|
||||
RAW = "raw",
|
||||
PLUGIN = "plugin",
|
||||
WALLOPS = "wallops",
|
||||
}
|
||||
import {MessageType, LinkPreview, UserInMessage} from "../../shared/types/msg";
|
||||
|
||||
class Msg {
|
||||
from!: UserInMessage;
|
||||
|
|
|
@ -2,13 +2,14 @@ import _ from "lodash";
|
|||
import {v4 as uuidv4} from "uuid";
|
||||
import IrcFramework, {Client as IRCClient} from "irc-framework";
|
||||
import Chan, {ChanConfig, Channel, ChanType} from "./chan";
|
||||
import Msg, {MessageType} from "./msg";
|
||||
import Msg from "./msg";
|
||||
import Prefix from "./prefix";
|
||||
import Helper, {Hostmask} from "../helper";
|
||||
import Config, {WebIRC} from "../config";
|
||||
import STSPolicies from "../plugins/sts";
|
||||
import ClientCertificate, {ClientCertificateType} from "../plugins/clientCertificate";
|
||||
import Client from "../client";
|
||||
import {MessageType} from "../../shared/types/msg";
|
||||
|
||||
/**
|
||||
* List of keys which should be sent to the client by default.
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {PluginInputHandler} from "./index";
|
||||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import {ChanType} from "../../models/chan";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
const commands = ["slap", "me"];
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {ChanType} from "../../models/chan";
|
||||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import {PluginInputHandler} from "./index";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
const commands = ["ban", "unban", "banlist", "kickban"];
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import {PluginInputHandler} from "./index";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
const commands = ["connect", "server"];
|
||||
const allowDisconnected = true;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import {PluginInputHandler} from "./index";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
const commands = ["ctcp"];
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import Helper from "../../helper";
|
||||
import {PluginInputHandler} from "./index";
|
||||
import {IgnoreListItem} from "../../models/network";
|
||||
import {ChanType, SpecialChanType} from "../../models/chan";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
const commands = ["ignore", "unignore", "ignorelist"];
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {PluginInputHandler} from "./index";
|
||||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import {ChanType} from "../../models/chan";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
const commands = ["invite", "invitelist"];
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {PluginInputHandler} from "./index";
|
||||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import {ChanType} from "../../models/chan";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
const commands = ["kick"];
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import {PluginInputHandler} from "./index";
|
||||
|
||||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import {ChanType} from "../../models/chan";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
const commands = ["mode", "umode", "op", "deop", "hop", "dehop", "voice", "devoice"];
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {PluginInputHandler} from "./index";
|
||||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import Chan, {ChanType} from "../../models/chan";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
const commands = ["query", "msg", "say"];
|
||||
|
||||
|
|
|
@ -2,9 +2,10 @@ import Chan from "../../models/chan";
|
|||
import Network from "../../models/network";
|
||||
import {PluginInputHandler} from "./index";
|
||||
|
||||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
|
||||
import Client from "../../client";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
const commands = ["mute", "unmute"];
|
||||
const allowDisconnected = true;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {PluginInputHandler} from "./index";
|
||||
|
||||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
const commands = ["nick"];
|
||||
const allowDisconnected = true;
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import {PluginInputHandler} from "./index";
|
||||
|
||||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import Config from "../../config";
|
||||
import {ChanType, ChanState} from "../../models/chan";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
const commands = ["close", "leave", "part"];
|
||||
const allowDisconnected = true;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import {PluginInputHandler} from "./index";
|
||||
|
||||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import {ChanType} from "../../models/chan";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
const commands = ["cycle", "rejoin"];
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import {PluginInputHandler} from "./index";
|
||||
|
||||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import {ChanType} from "../../models/chan";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
const commands = ["topic"];
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {IrcEventHandler} from "../../client";
|
||||
import {ChanType} from "../../models/chan";
|
||||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
export default <IrcEventHandler>function (irc, network) {
|
||||
const client = this;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {IrcEventHandler} from "../../client";
|
||||
|
||||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
export default <IrcEventHandler>function (irc, network) {
|
||||
const client = this;
|
||||
|
|
|
@ -3,10 +3,11 @@ import _ from "lodash";
|
|||
import {IrcEventHandler} from "../../client";
|
||||
|
||||
import log from "../../log";
|
||||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import Helper from "../../helper";
|
||||
import Config from "../../config";
|
||||
import {ChanType, ChanState} from "../../models/chan";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
export default <IrcEventHandler>function (irc, network) {
|
||||
const client = this;
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import _ from "lodash";
|
||||
import {IrcEventHandler} from "../../client";
|
||||
import Helper from "../../helper";
|
||||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import User from "../../models/user";
|
||||
import pkg from "../../../package.json";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
const ctcpResponses = {
|
||||
CLIENTINFO: () =>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import {IrcEventHandler} from "../../client";
|
||||
|
||||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import Config from "../../config";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
export default <IrcEventHandler>function (irc, network) {
|
||||
const client = this;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import {IrcEventHandler} from "../../client";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
export default <IrcEventHandler>function (irc, network) {
|
||||
const client = this;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import {IrcEventHandler} from "../../client";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
export default <IrcEventHandler>function (irc, network) {
|
||||
const client = this;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {IrcEventHandler} from "../../client";
|
||||
|
||||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
export default <IrcEventHandler>function (irc, network) {
|
||||
const client = this;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import User from "../../models/user";
|
||||
import type {IrcEventHandler} from "../../client";
|
||||
import {ChanState} from "../../models/chan";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
export default <IrcEventHandler>function (irc, network) {
|
||||
const client = this;
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import {IrcEventHandler} from "../../client";
|
||||
import {ChanState} from "../../models/chan";
|
||||
|
||||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import User from "../../models/user";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
export default <IrcEventHandler>function (irc, network) {
|
||||
const client = this;
|
||||
|
|
|
@ -6,6 +6,7 @@ import mime from "mime-types";
|
|||
import log from "../../log";
|
||||
import Config from "../../config";
|
||||
import {findLinksWithSchema} from "../../../shared/linkify";
|
||||
import {LinkPreview} from "../../../shared/types/msg";
|
||||
import storage from "../storage";
|
||||
import Client from "../../client";
|
||||
import Chan from "../../models/chan";
|
||||
|
@ -20,23 +21,6 @@ const currentFetchPromises = new Map<string, Promise<FetchRequest>>();
|
|||
const imageTypeRegex = /^image\/.+/;
|
||||
const mediaTypeRegex = /^(audio|video)\/.+/;
|
||||
|
||||
export type LinkPreview = {
|
||||
type: string;
|
||||
head: string;
|
||||
body: string;
|
||||
thumb: string;
|
||||
size: number;
|
||||
link: string; // Send original matched link to the client
|
||||
shown?: boolean | null;
|
||||
error?: string;
|
||||
message?: string;
|
||||
|
||||
media?: string;
|
||||
mediaType?: string;
|
||||
maxSize?: number;
|
||||
thumbActualUrl?: string;
|
||||
};
|
||||
|
||||
export default function (client: Client, chan: Chan, msg: Msg, cleanText: string) {
|
||||
if (!Config.values.prefetch) {
|
||||
return;
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import LinkPrefetch from "./link";
|
||||
import {cleanIrcMessage} from "../../../shared/irc";
|
||||
import Helper from "../../helper";
|
||||
import {IrcEventHandler} from "../../client";
|
||||
import Chan, {ChanType} from "../../models/chan";
|
||||
import User from "../../models/user";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
const nickRegExp = /(?:\x03[0-9]{1,2}(?:,[0-9]{1,2})?)?([\w[\]\\`^{|}-]+)/g;
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import _ from "lodash";
|
||||
import {IrcEventHandler} from "../../client";
|
||||
|
||||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
export default <IrcEventHandler>function (irc, network) {
|
||||
const client = this;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import {IrcEventHandler} from "../../client";
|
||||
import {SpecialChanType, ChanType} from "../../models/chan";
|
||||
|
||||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
export default <IrcEventHandler>function (irc, network) {
|
||||
const client = this;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {IrcEventHandler} from "../../client";
|
||||
|
||||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
export default <IrcEventHandler>function (irc, network) {
|
||||
const client = this;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {IrcEventHandler} from "../../client";
|
||||
|
||||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
export default <IrcEventHandler>function (irc, network) {
|
||||
const client = this;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {IrcEventHandler} from "../../client";
|
||||
|
||||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
export default <IrcEventHandler>function (irc, network) {
|
||||
const client = this;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {IrcEventHandler} from "../../client";
|
||||
|
||||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
export default <IrcEventHandler>function (irc, network) {
|
||||
const client = this;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {IrcEventHandler} from "../../client";
|
||||
|
||||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
export default <IrcEventHandler>function (irc, network) {
|
||||
const client = this;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {IrcEventHandler} from "../../client";
|
||||
|
||||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
export default <IrcEventHandler>function (irc, network) {
|
||||
const client = this;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {IrcEventHandler} from "../../client";
|
||||
|
||||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
export default <IrcEventHandler>function (irc, network) {
|
||||
const client = this;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import {IrcEventHandler} from "../../client";
|
||||
import {ChanType} from "../../models/chan";
|
||||
|
||||
import Msg, {MessageType} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
export default <IrcEventHandler>function (irc, network) {
|
||||
const client = this;
|
||||
|
|
|
@ -6,8 +6,9 @@ import filenamify from "filenamify";
|
|||
import Config from "../../config";
|
||||
import {MessageStorage} from "./types";
|
||||
import Channel from "../../models/chan";
|
||||
import {Message, MessageType} from "../../models/msg";
|
||||
import {Message} from "../../models/msg";
|
||||
import Network from "../../models/network";
|
||||
import {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
class TextFileMessageStorage implements MessageStorage {
|
||||
isEnabled: boolean;
|
||||
|
|
2
server/plugins/messageStorage/types.d.ts
vendored
2
server/plugins/messageStorage/types.d.ts
vendored
|
@ -4,7 +4,7 @@ import {Channel} from "../../models/channel";
|
|||
import {Message} from "../../models/message";
|
||||
import {Network} from "../../models/network";
|
||||
import Client from "../../client";
|
||||
import type {MessageType} from "../../models/msg";
|
||||
import type {MessageType} from "../../../shared/types/msg";
|
||||
|
||||
export type DeletionRequest = {
|
||||
olderThanDays: number;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import {PackageInfo} from "./index";
|
||||
import Client from "../../client";
|
||||
import Chan from "../../models/chan";
|
||||
import Msg, {MessageType, UserInMessage} from "../../models/msg";
|
||||
import Msg from "../../models/msg";
|
||||
import {MessageType, UserInMessage} from "../../../shared/types/msg";
|
||||
|
||||
export default class PublicClient {
|
||||
private client: Client;
|
||||
|
|
|
@ -31,7 +31,7 @@ import type {
|
|||
ServerToClientEvents,
|
||||
InterServerEvents,
|
||||
SocketData,
|
||||
} from "./types/socket-events";
|
||||
} from "../shared/types/socket-events";
|
||||
|
||||
type ServerOptions = {
|
||||
dev: boolean;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import SqliteMessageStorage from "./plugins/messageStorage/sqlite";
|
||||
import {MessageType} from "./models/msg";
|
||||
import Config from "./config";
|
||||
import {DeletionRequest} from "./plugins/messageStorage/types";
|
||||
import log from "./log";
|
||||
import {MessageType} from "../shared/types/msg";
|
||||
|
||||
const status_types = [
|
||||
MessageType.AWAY,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"extends": "../tsconfig.base.json" /* Path to base configuration file to inherit from. Requires TypeScript version 2.1 or later. */,
|
||||
"include": [
|
||||
"**/*",
|
||||
".",
|
||||
"../shared/"
|
||||
] /* Specifies a list of glob patterns that match files to be included in compilation. If no 'files' or 'include' property is present in a tsconfig.json, the compiler defaults to including all files in the containing directory and subdirectories except those specified by 'exclude'. Requires TypeScript version 2.0 or later. */,
|
||||
"files": [
|
||||
|
|
1
server/types/index.d.ts
vendored
1
server/types/index.d.ts
vendored
|
@ -1,2 +1 @@
|
|||
import "./modules";
|
||||
import "./socket-events";
|
||||
|
|
98
shared/types/msg.ts
Normal file
98
shared/types/msg.ts
Normal file
|
@ -0,0 +1,98 @@
|
|||
export enum MessageType {
|
||||
UNHANDLED = "unhandled",
|
||||
ACTION = "action",
|
||||
AWAY = "away",
|
||||
BACK = "back",
|
||||
ERROR = "error",
|
||||
INVITE = "invite",
|
||||
JOIN = "join",
|
||||
KICK = "kick",
|
||||
LOGIN = "login",
|
||||
LOGOUT = "logout",
|
||||
MESSAGE = "message",
|
||||
MODE = "mode",
|
||||
MODE_CHANNEL = "mode_channel",
|
||||
MODE_USER = "mode_user", // RPL_UMODEIS
|
||||
MONOSPACE_BLOCK = "monospace_block",
|
||||
NICK = "nick",
|
||||
NOTICE = "notice",
|
||||
PART = "part",
|
||||
QUIT = "quit",
|
||||
CTCP = "ctcp",
|
||||
CTCP_REQUEST = "ctcp_request",
|
||||
CHGHOST = "chghost",
|
||||
TOPIC = "topic",
|
||||
TOPIC_SET_BY = "topic_set_by",
|
||||
WHOIS = "whois",
|
||||
RAW = "raw",
|
||||
PLUGIN = "plugin",
|
||||
WALLOPS = "wallops",
|
||||
}
|
||||
|
||||
export type SharedUser = {
|
||||
modes: string[];
|
||||
// Users in the channel have only one mode assigned
|
||||
mode: string;
|
||||
away: string;
|
||||
nick: string;
|
||||
lastMessage: number;
|
||||
};
|
||||
|
||||
export type UserInMessage = Partial<SharedUser> & {
|
||||
mode: string;
|
||||
};
|
||||
|
||||
export type LinkPreview = {
|
||||
type: string;
|
||||
head: string;
|
||||
body: string;
|
||||
thumb: string;
|
||||
size: number;
|
||||
link: string; // Send original matched link to the client
|
||||
shown?: boolean | null;
|
||||
error?: string;
|
||||
message?: string;
|
||||
|
||||
media?: string;
|
||||
mediaType?: string;
|
||||
maxSize?: number;
|
||||
thumbActualUrl?: string;
|
||||
};
|
||||
|
||||
export type SharedMsg = {
|
||||
from?: UserInMessage;
|
||||
id?: number;
|
||||
previews?: LinkPreview[];
|
||||
text?: string;
|
||||
type?: MessageType;
|
||||
self?: boolean;
|
||||
time?: Date;
|
||||
hostmask?: string;
|
||||
target?: UserInMessage;
|
||||
// TODO: new_nick is only on MessageType.NICK,
|
||||
// we should probably make Msgs that extend this class and use those
|
||||
// throughout. I'll leave any similar fields below.
|
||||
new_nick?: string;
|
||||
highlight?: boolean;
|
||||
showInActive?: boolean;
|
||||
new_ident?: string;
|
||||
new_host?: string;
|
||||
ctcpMessage?: string;
|
||||
command?: string;
|
||||
invitedYou?: boolean;
|
||||
gecos?: string;
|
||||
account?: boolean;
|
||||
|
||||
// these are all just for error:
|
||||
error?: string;
|
||||
nick?: string;
|
||||
channel?: string;
|
||||
reason?: string;
|
||||
|
||||
raw_modes?: any;
|
||||
when?: Date;
|
||||
whois?: any;
|
||||
users?: UserInMessage[] | string[];
|
||||
statusmsgGroup?: string;
|
||||
params?: string[];
|
||||
};
|
Loading…
Reference in a new issue