mirror of
https://github.com/thelounge/thelounge.git
synced 2024-05-18 22:26:35 +02:00
ts-node building; for some reason it doesn't read the base config
This commit is contained in:
parent
bed7cc04f5
commit
2693a766f1
|
@ -36,7 +36,6 @@ module.exports = {
|
|||
"no-else-return": "error",
|
||||
"no-implicit-globals": "error",
|
||||
"no-restricted-globals": ["error", "event", "fdescribe"],
|
||||
"no-shadow": "error",
|
||||
"no-template-curly-in-string": "error",
|
||||
"no-unsafe-negation": "error",
|
||||
"no-useless-computed-key": "error",
|
||||
|
@ -90,12 +89,14 @@ module.exports = {
|
|||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
"@typescript-eslint/no-unused-vars": "off",
|
||||
"@typescript-eslint/no-this-alias": "off",
|
||||
"no-shadow": "off",
|
||||
"@typescript-eslint/no-shadow": "error",
|
||||
},
|
||||
|
||||
// TODO: verify
|
||||
overrides: [
|
||||
{
|
||||
files: ["*.vue", "*.d.ts"],
|
||||
files: ["*.vue"],
|
||||
rules: {
|
||||
"import/no-default-export": 0,
|
||||
},
|
||||
|
|
|
@ -35,7 +35,8 @@ import VueApp from "vue";
|
|||
declare module "vue/types/vue" {
|
||||
interface Vue {
|
||||
debouncedResize: () => void;
|
||||
dayChangeTimeout: number;
|
||||
// TODO; type as Timeout
|
||||
dayChangeTimeout: any;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
<script lang="ts">
|
||||
import constants from "../js/constants";
|
||||
import eventbus from "../js/eventbus";
|
||||
import clipboard from "../js/clipboard";
|
||||
|
@ -65,10 +65,18 @@ import socket from "../js/socket";
|
|||
import Message from "./Message.vue";
|
||||
import MessageCondensed from "./MessageCondensed.vue";
|
||||
import DateMarker from "./DateMarker.vue";
|
||||
import Vue, {PropType} from "vue";
|
||||
import type Network from "../../src/types/models/network";
|
||||
import type Channel from "../../src/types/models/channel";
|
||||
|
||||
let unreadMarkerShown = false;
|
||||
|
||||
export default {
|
||||
type CondensedMessage = Message & {
|
||||
// TODO; better type
|
||||
type: "condensed" | string;
|
||||
messages: Message[];
|
||||
};
|
||||
export default Vue.extend({
|
||||
name: "MessageList",
|
||||
components: {
|
||||
Message,
|
||||
|
@ -76,8 +84,8 @@ export default {
|
|||
DateMarker,
|
||||
},
|
||||
props: {
|
||||
network: Object,
|
||||
channel: Object,
|
||||
network: Object as PropType<Network>,
|
||||
channel: Object as PropType<ClientChan>,
|
||||
focused: String,
|
||||
},
|
||||
computed: {
|
||||
|
@ -98,8 +106,8 @@ export default {
|
|||
return this.channel.messages;
|
||||
}
|
||||
|
||||
const condensed = [];
|
||||
let lastCondensedContainer = null;
|
||||
const condensed: CondensedMessage[] = [];
|
||||
let lastCondensedContainer: null | CondensedMessage = null;
|
||||
|
||||
for (const message of this.channel.messages) {
|
||||
// If this message is not condensable, or its an action affecting our user,
|
||||
|
@ -123,14 +131,14 @@ export default {
|
|||
messages: [],
|
||||
};
|
||||
|
||||
condensed.push(lastCondensedContainer);
|
||||
condensed.push(lastCondensedContainer!);
|
||||
}
|
||||
|
||||
lastCondensedContainer.messages.push(message);
|
||||
lastCondensedContainer!.messages.push(message);
|
||||
|
||||
// Set id of the condensed container to last message id,
|
||||
// which is required for the unread marker to work correctly
|
||||
lastCondensedContainer.id = message.id;
|
||||
lastCondensedContainer!.id = message.id;
|
||||
|
||||
// If this message is the unread boundary, create a split condensed container
|
||||
if (message.id === this.channel.firstUnread) {
|
||||
|
@ -354,5 +362,5 @@ export default {
|
|||
el.scrollTop = el.scrollHeight;
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -12,9 +12,10 @@
|
|||
},
|
||||
"homepage": "https://thelounge.chat/",
|
||||
"scripts": {
|
||||
"build": "webpack",
|
||||
"build:client": "webpack",
|
||||
"build:server": "tsc -p src/tsconfig.json index.ts",
|
||||
"coverage": "run-s test:* && nyc --nycrc-path=test/.nycrc-report.json report",
|
||||
"dev": "ts-node index start --dev",
|
||||
"dev": "ts-node --project tsconfig.json index.ts start --dev",
|
||||
"format:prettier": "prettier --write \"**/*.*\"",
|
||||
"lint:check-eslint": "eslint-config-prettier .eslintrc.cjs",
|
||||
"lint:eslint": "eslint . --ext .js,.vue --report-unused-disable-directives --color",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import colors from "chalk";
|
||||
import log from "../../log";
|
||||
import Helper from "../../helper";
|
||||
import {AuthHandler} from "types/plugins/auth";
|
||||
import {AuthHandler} from "../../types/plugins/auth";
|
||||
|
||||
const localAuth: AuthHandler = (manager, client, user, password, callback) => {
|
||||
// If no user is found, or if the client has not provided a password,
|
||||
|
|
|
@ -4,7 +4,7 @@ import got, {Response} from "got";
|
|||
import colors from "chalk";
|
||||
import log from "../log";
|
||||
import pkg from "../../package.json";
|
||||
import ClientManager from "clientManager";
|
||||
import ClientManager from "../clientManager";
|
||||
|
||||
const TIME_TO_LIVE = 15 * 60 * 1000; // 15 minutes, in milliseconds
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import Chan from "models/chan";
|
||||
import Network from "models/network";
|
||||
import Chan from "../../models/chan";
|
||||
import Network from "../../models/network";
|
||||
|
||||
const clientSideCommands = ["/collapse", "/expand", "/search"];
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
import Network from "models/network";
|
||||
import Network from "../../models/network";
|
||||
|
||||
import Chan from "../../models/chan";
|
||||
import Msg from "../../models/msg";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
import Network from "models/network";
|
||||
import Network from "../../models/network";
|
||||
|
||||
import Msg from "../../models/msg";
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
"use strict";
|
||||
import Chan from "models/chan";
|
||||
import Network from "models/network";
|
||||
import Chan from "../../models/chan";
|
||||
import Network from "../../models/network";
|
||||
|
||||
import Msg from "../../models/msg";
|
||||
|
||||
import Client from "client";
|
||||
import Client from "../../client";
|
||||
|
||||
const commands = ["mute", "unmute"];
|
||||
const allowDisconnected = true;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
import Network from "models/network";
|
||||
import Network from "../../models/network";
|
||||
|
||||
import _ from "lodash";
|
||||
import Helper from "../../helper";
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import Msg from "../../models/msg";
|
||||
import Config from "../../config";
|
||||
import Network from "models/network";
|
||||
import Network from "../../models/network";
|
||||
|
||||
export default <IrcEventHandler>function (irc, network) {
|
||||
const client = this;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
import Network from "models/network";
|
||||
import Network from "../../models/network";
|
||||
|
||||
import Msg from "../../models/msg";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
import Network from "models/network";
|
||||
import Network from "../../models/network";
|
||||
|
||||
import Msg from "../../models/msg";
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
"use strict";
|
||||
|
||||
import {ChanState} from "types/models/channel";
|
||||
import {ChanState} from "../../types/models/channel";
|
||||
|
||||
import {Network} from "types/models/network";
|
||||
import {Network} from "../../types/models/network";
|
||||
|
||||
import Chan from "../../models/chan";
|
||||
import Msg from "../../models/msg";
|
||||
|
|
|
@ -5,14 +5,14 @@ import got from "got";
|
|||
import {URL} from "url";
|
||||
import mime from "mime-types";
|
||||
|
||||
import log from "../../log";
|
||||
import Config from "../../config";
|
||||
import {findLinksWithSchema} from "../../../client/js/helpers/ircmessageparser/findLinks";
|
||||
import storage from "../storage";
|
||||
import log from "log";
|
||||
import Client from "client";
|
||||
import Chan from "models/chan";
|
||||
import Client from "../../client";
|
||||
import Chan from "../../models/chan";
|
||||
import Msg from "../../models/msg";
|
||||
import {Preview} from "types/plugins/preview";
|
||||
import {Preview} from "../../types/plugins/preview";
|
||||
|
||||
const currentFetchPromises = new Map();
|
||||
const imageTypeRegex = /^image\/.+/;
|
||||
|
|
|
@ -4,7 +4,7 @@ import Msg from "../../models/msg";
|
|||
import LinkPrefetch from "./link";
|
||||
import cleanIrcMessage from "../../../client/js/helpers/ircmessageparser/cleanIrcMessage";
|
||||
import Helper from "../../helper";
|
||||
import Network from "models/network";
|
||||
import Network from "../../models/network";
|
||||
|
||||
const nickRegExp = /(?:\x03[0-9]{1,2}(?:,[0-9]{1,2})?)?([\w[\]\\`^{|}-]+)/g;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
import _ from "lodash";
|
||||
import Network from "models/network";
|
||||
import Network from "../../models/network";
|
||||
|
||||
import Msg from "../../models/msg";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
import Network from "models/network";
|
||||
import Network from "../../models/network";
|
||||
|
||||
import Chan from "../../models/chan";
|
||||
import Msg from "../../models/msg";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
import Network from "models/network";
|
||||
import Network from "../../models/network";
|
||||
|
||||
import Msg from "../../models/msg";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
import Network from "models/network";
|
||||
import Network from "../../models/network";
|
||||
|
||||
export default <IrcEventHandler>function (irc, network) {
|
||||
const client = this;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
import Network from "models/network";
|
||||
import Network from "../../models/network";
|
||||
|
||||
import Msg from "../../models/msg";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
import Network from "models/network";
|
||||
import Network from "../../models/network";
|
||||
|
||||
import Msg from "../../models/msg";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
import Network from "models/network";
|
||||
import Network from "../../models/network";
|
||||
|
||||
import Msg from "../../models/msg";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
import Network from "models/network";
|
||||
import Network from "../../models/network";
|
||||
|
||||
import Msg from "../../models/msg";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
import Network from "models/network";
|
||||
import Network from "../../models/network";
|
||||
|
||||
import Msg from "../../models/msg";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
import Network from "models/network";
|
||||
import Network from "../../models/network";
|
||||
|
||||
import Msg from "../../models/msg";
|
||||
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
"use strict";
|
||||
|
||||
import type {Database} from "sqlite3";
|
||||
|
||||
import log from "../../log";
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
import Config from "../../config";
|
||||
import Msg from "../../models/msg";
|
||||
import type {Database} from "sqlite3";
|
||||
import Client from "client";
|
||||
import Chan from "models/chan";
|
||||
import Client from "../../client";
|
||||
import Chan from "../../models/chan";
|
||||
import type {SqliteMessageStorage as ISqliteMessageStorage} from "../../types/plugins/messageStorage";
|
||||
|
||||
let sqlite3;
|
||||
// TODO; type
|
||||
let sqlite3: any;
|
||||
|
||||
try {
|
||||
sqlite3 = require("sqlite3");
|
||||
|
@ -31,7 +34,7 @@ const schema = [
|
|||
"CREATE INDEX IF NOT EXISTS time ON messages (time)",
|
||||
];
|
||||
|
||||
class SqliteMessageStorage implements SqliteMessageStorage {
|
||||
class SqliteMessageStorage implements ISqliteMessageStorage {
|
||||
client: Client;
|
||||
isEnabled: boolean;
|
||||
database!: Database;
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
"use strict";
|
||||
|
||||
import log from "../../log";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import filenamify from "filenamify";
|
||||
|
||||
import log from "../../log";
|
||||
import Config from "../../config";
|
||||
import Msg from "../../models/msg";
|
||||
import {MessageStorage} from "types/plugins/messageStorage";
|
||||
import Client from "client";
|
||||
import {MessageStorage} from "../../types/plugins/messageStorage";
|
||||
import Client from "../../client";
|
||||
|
||||
class TextFileMessageStorage implements MessageStorage {
|
||||
client: Client;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import Client from "client";
|
||||
import Chan from "models/chan";
|
||||
import Client from "../../client";
|
||||
import Chan from "../../models/chan";
|
||||
import Msg from "../../models/msg";
|
||||
|
||||
export default class PublicClient {
|
||||
|
|
|
@ -5,7 +5,7 @@ import fs from "fs";
|
|||
import path from "path";
|
||||
import log from "../log";
|
||||
import Config from "../config";
|
||||
import type {PolicyMap, PolicyOption} from "types/plugins/sts";
|
||||
import type {PolicyMap, PolicyOption} from "../types/plugins/sts";
|
||||
|
||||
class STSPolicies {
|
||||
stsFile: string;
|
||||
|
|
|
@ -6,7 +6,7 @@ import fs from "fs";
|
|||
import path from "path";
|
||||
import WebPushAPI from "web-push";
|
||||
import Config from "../config";
|
||||
import Client from "client";
|
||||
import Client from "../client";
|
||||
import * as os from "os";
|
||||
class WebPush {
|
||||
vapidKeys?: {
|
||||
|
|
|
@ -1,20 +1,22 @@
|
|||
"use strict";
|
||||
|
||||
import _ from "lodash";
|
||||
import log from "./log";
|
||||
import pkg from "../package.json";
|
||||
import Client from "./client";
|
||||
import ClientManager from "./clientManager";
|
||||
import {Server as wsServer} from "ws";
|
||||
import express from "express";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import {Server, Socket} from "socket.io";
|
||||
import dns from "dns";
|
||||
import colors from "chalk";
|
||||
import net from "net";
|
||||
|
||||
import log from "./log";
|
||||
import pkg from "../package.json";
|
||||
import Client from "./client";
|
||||
import ClientManager from "./clientManager";
|
||||
import Uploader from "./plugins/uploader";
|
||||
import Helper from "./helper";
|
||||
import Config from "./config";
|
||||
import colors from "chalk";
|
||||
import net from "net";
|
||||
import Identification from "./identification";
|
||||
import changelog from "./plugins/changelog";
|
||||
import inputs from "./plugins/inputs";
|
||||
|
@ -24,15 +26,14 @@ import themes from "./plugins/packages/themes";
|
|||
themes.loadLocalThemes();
|
||||
|
||||
import packages from "./plugins/packages/index";
|
||||
import {
|
||||
import type {
|
||||
ClientConfiguration,
|
||||
Defaults,
|
||||
IndexTemplateConfiguration,
|
||||
ServerConfiguration,
|
||||
} from "./types/config";
|
||||
|
||||
import {Server as wsServer} from "ws";
|
||||
import {ServerOptions} from "types/server";
|
||||
import type {ServerOptions} from "./types/server";
|
||||
|
||||
// A random number that will force clients to reload the page if it differs
|
||||
const serverHash = Math.floor(Date.now() * Math.random());
|
||||
|
@ -699,7 +700,13 @@ function initializeClient(
|
|||
});
|
||||
|
||||
socket.on("mute:change", ({target, setMutedTo}) => {
|
||||
const {chan, network} = client.find(target);
|
||||
const networkAndChan = client.find(target);
|
||||
|
||||
if (!networkAndChan) {
|
||||
return;
|
||||
}
|
||||
|
||||
const {chan, network} = networkAndChan;
|
||||
|
||||
// If the user mutes the lobby, we mute the entire network.
|
||||
if (chan.type === ChanType.LOBBY) {
|
||||
|
@ -756,7 +763,7 @@ function initializeClient(
|
|||
}
|
||||
});
|
||||
|
||||
socket.join(client.id);
|
||||
socket.join(client.id?.toString());
|
||||
|
||||
const sendInitEvent = (tokenToSend) => {
|
||||
socket.emit("init", {
|
||||
|
@ -844,7 +851,7 @@ function performAuthentication(this: Socket, data) {
|
|||
|
||||
const socket = this;
|
||||
let client;
|
||||
let token = null;
|
||||
let token: string;
|
||||
|
||||
const finalInit = () =>
|
||||
initializeClient(socket, client, token, data.lastMessage || -1, data.openChannel);
|
||||
|
|
|
@ -6,11 +6,15 @@
|
|||
"../client/js/helpers/ircmessageparser/findLinks.ts",
|
||||
"../client/js/helpers/ircmessageparser/cleanIrcMessage.ts"
|
||||
],
|
||||
// TODO: these should be imported from the base config,
|
||||
// but ts-node doesn't seem to care.
|
||||
"include": ["**/*"],
|
||||
"typeRoots": ["./src/types/"],
|
||||
|
||||
"compilerOptions": {
|
||||
"types": ["node"],
|
||||
"baseUrl": ".",
|
||||
"noImplicitAny": false
|
||||
},
|
||||
"references": [{"path": "../"}]
|
||||
}
|
||||
// "references": [{"path": "../"}]
|
||||
}
|
||||
|
|
4
src/types/plugins/auth/index.d.ts
vendored
4
src/types/plugins/auth/index.d.ts
vendored
|
@ -1,5 +1,5 @@
|
|||
import Client from "client";
|
||||
import ClientManager from "clientManager";
|
||||
import Client from "../../client";
|
||||
import ClientManager from "../../clientManager";
|
||||
|
||||
type AuthHandler = (
|
||||
manager: ClientManager,
|
||||
|
|
2
src/types/plugins/inputs/index.d.ts
vendored
2
src/types/plugins/inputs/index.d.ts
vendored
|
@ -1,4 +1,4 @@
|
|||
import Client from "client";
|
||||
import Client from "../../../client";
|
||||
|
||||
declare global {
|
||||
type PluginInputHandler = (
|
||||
|
|
2
src/types/plugins/irc-events/index.d.ts
vendored
2
src/types/plugins/irc-events/index.d.ts
vendored
|
@ -1,4 +1,4 @@
|
|||
import Client from "client";
|
||||
import Client from "../../client";
|
||||
|
||||
declare global {
|
||||
type IrcEventHandler = (
|
||||
|
|
9
src/types/plugins/messageStorage/index.d.ts
vendored
9
src/types/plugins/messageStorage/index.d.ts
vendored
|
@ -1,8 +1,9 @@
|
|||
import type {Database} from "sqlite3";
|
||||
|
||||
import {Channel} from "../../models/channel";
|
||||
import {Message} from "../../models/message";
|
||||
import {Network} from "../../models/network";
|
||||
import sqlite from "sqlite3";
|
||||
import Client from "client";
|
||||
import Client from "../../client";
|
||||
|
||||
interface MessageStorage {
|
||||
client: Client;
|
||||
|
@ -21,6 +22,6 @@ interface MessageStorage {
|
|||
canProvideMessages(): boolean;
|
||||
}
|
||||
|
||||
interface SqliteMessageStorage extends MessageStorage {
|
||||
database: sqlite.Database;
|
||||
export interface SqliteMessageStorage extends MessageStorage {
|
||||
database: Database;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"files": ["./webpack.config.ts", "./babel.config.cjs", "./src/helper.ts"],
|
||||
"files": ["index.ts", "./src/index.d.ts", "./webpack.config.ts", "./src/helper.ts"],
|
||||
"compilerOptions": {
|
||||
"types": ["node"],
|
||||
"paths": {
|
||||
|
@ -8,7 +8,11 @@
|
|||
"@client/*": ["client/*"]
|
||||
}
|
||||
},
|
||||
"ts-node": {
|
||||
"files": true
|
||||
},
|
||||
"exclude": ["./node_modules"],
|
||||
"include": ["./src/**/*"],
|
||||
"references": [
|
||||
{
|
||||
"path": "./src"
|
||||
|
|
Loading…
Reference in a new issue