Compare commits

...

10 Commits

6 changed files with 31 additions and 17 deletions

View File

@ -12,9 +12,7 @@ jobs:
strategy:
matrix:
include:
# EOL: April 2024
- os: ubuntu-latest
node_version: 16.x
# EOL: April 2025
- os: macOS-latest
node_version: 18.x
- os: windows-latest
@ -25,6 +23,9 @@ jobs:
# EOL: April 2026
- os: ubuntu-latest
node_version: 20.x
# EOL: April/June 2024
- os: ubuntu-latest
node_version: 21.x
runs-on: ${{ matrix.os }}

View File

@ -110,26 +110,23 @@ router.beforeEach((to, from, next) => {
next();
});
router.beforeEach((to, from, next) => {
router.beforeEach((to, from) => {
// Disallow navigating to non-existing routes
if (!to.matched.length) {
next(false);
return;
return false;
}
// Disallow navigating to invalid channels
if (to.name === "RoutedChat" && !store.getters.findChannel(Number(to.params.id))) {
next(false);
return;
return false;
}
// Disallow navigating to invalid networks
if (to.name === "NetworkEdit" && !store.getters.findNetwork(String(to.params.uuid))) {
next(false);
return;
return false;
}
next();
return true;
});
router.afterEach((to) => {

View File

@ -24,8 +24,9 @@
"lint:stylelint": "stylelint --color \"client/**/*.css\"",
"lint": "run-p --aggregate-output --continue-on-error lint:*",
"start": "node index start",
"test": "run-p --aggregate-output --continue-on-error lint:* test:*",
"test:mocha": "cross-env NODE_ENV=test webpack --mode=development && cross-env NODE_ENV=test TS_NODE_PROJECT='./test/tsconfig.json' nyc --nycrc-path=test/.nycrc-mocha.json mocha --require ts-node/register --colors --config=test/.mocharc.yml",
"test": "run-p --aggregate-output --continue-on-error lint:* test:mocha",
"test:mocha": "webpack --mode=development && cross-env NODE_ENV=test TS_NODE_PROJECT='./test/tsconfig.json' mocha --config=test/.mocharc.yml 'test/**/*.ts'",
"test:nospec": "webpack --mode=development && cross-env NODE_ENV=test TS_NODE_PROJECT='./test/tsconfig.json' mocha --config=test/.mocharc.yml",
"watch": "webpack --watch"
},
"keywords": [
@ -40,7 +41,7 @@
],
"license": "MIT",
"engines": {
"node": ">=16.0.0"
"node": ">=18.0.0"
},
"files": [
"./.thelounge_home",

View File

@ -18,6 +18,7 @@ import TextFileMessageStorage from "./plugins/messageStorage/text";
import Network, {IgnoreListItem, NetworkConfig, NetworkWithIrcFramework} from "./models/network";
import ClientManager from "./clientManager";
import {MessageStorage, SearchQuery, SearchResponse} from "./plugins/messageStorage/types";
import { StorageCleaner } from "./storageCleaner";
type OrderItem = Chan["id"] | Network["uuid"];
type Order = OrderItem[];
@ -138,6 +139,13 @@ class Client {
if (!Config.values.public && client.config.log) {
if (Config.values.messageStorage.includes("sqlite")) {
client.messageProvider = new SqliteMessageStorage(client.name);
if (Config.values.storagePolicy.enabled) {
log.info(
`Activating storage cleaner. Policy: ${Config.values.storagePolicy.deletionPolicy}. MaxAge: ${Config.values.storagePolicy.maxAgeDays} days`
);
const cleaner = new StorageCleaner(client.messageProvider);
cleaner.start();
}
client.messageStorage.push(client.messageProvider);
}

View File

@ -38,7 +38,7 @@ type Rollback = {
stmts: string[];
};
export const currentSchemaVersion = 1679743888000; // use `new Date().getTime()`
export const currentSchemaVersion = 1703322560448; // use `new Date().getTime()`
// Desired schema, adapt to the newest version and add migrations to the array below
const schema = [
@ -57,6 +57,7 @@ const schema = [
)`,
"CREATE INDEX network_channel ON messages (network, channel)",
"CREATE INDEX time ON messages (time)",
"CREATE INDEX msg_type_idx on messages (type)",
];
// the migrations will be executed in an exclusive transaction as a whole
@ -90,6 +91,10 @@ export const migrations: Migration[] = [
)`,
],
},
{
version: 1703322560448,
stmts: ["CREATE INDEX msg_type_idx on messages (type)"]
}
];
// down migrations need to restore the state of the prior version.
@ -103,6 +108,10 @@ export const rollbacks: Rollback[] = [
version: 1679743888000,
stmts: [], // here we can't drop the tables, as we use them in the code, so just leave those in
},
{
version: 1703322560448,
stmts: ["drop INDEX msg_type_idx"]
}
];
class Deferred {

View File

@ -2,8 +2,6 @@ color: true
check-leaks: true
recursive: true
reporter: dot
interactive: false
spec: "test/**/*.ts"
ignore: "test/client/**"
extension: ["ts", "js"]
require: