Compare commits
10 Commits
815fe04636
...
5cdfaa8019
Author | SHA1 | Date | |
---|---|---|---|
5cdfaa8019 | |||
bd0da6df13 | |||
3e3ab257a5 | |||
a3e00c95f5 | |||
f922d783e0 | |||
e456afa6c4 | |||
ef48c54cb3 | |||
a0f0dae3f7 | |||
e6ab6ae8ca | |||
80c378961a |
7
.github/workflows/build.yml
vendored
7
.github/workflows/build.yml
vendored
@ -12,9 +12,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
# EOL: April 2024
|
# EOL: April 2025
|
||||||
- os: ubuntu-latest
|
|
||||||
node_version: 16.x
|
|
||||||
- os: macOS-latest
|
- os: macOS-latest
|
||||||
node_version: 18.x
|
node_version: 18.x
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
@ -25,6 +23,9 @@ jobs:
|
|||||||
# EOL: April 2026
|
# EOL: April 2026
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
node_version: 20.x
|
node_version: 20.x
|
||||||
|
# EOL: April/June 2024
|
||||||
|
- os: ubuntu-latest
|
||||||
|
node_version: 21.x
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
@ -110,26 +110,23 @@ router.beforeEach((to, from, next) => {
|
|||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from) => {
|
||||||
// Disallow navigating to non-existing routes
|
// Disallow navigating to non-existing routes
|
||||||
if (!to.matched.length) {
|
if (!to.matched.length) {
|
||||||
next(false);
|
return false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disallow navigating to invalid channels
|
// Disallow navigating to invalid channels
|
||||||
if (to.name === "RoutedChat" && !store.getters.findChannel(Number(to.params.id))) {
|
if (to.name === "RoutedChat" && !store.getters.findChannel(Number(to.params.id))) {
|
||||||
next(false);
|
return false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disallow navigating to invalid networks
|
// Disallow navigating to invalid networks
|
||||||
if (to.name === "NetworkEdit" && !store.getters.findNetwork(String(to.params.uuid))) {
|
if (to.name === "NetworkEdit" && !store.getters.findNetwork(String(to.params.uuid))) {
|
||||||
next(false);
|
return false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
next();
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
router.afterEach((to) => {
|
router.afterEach((to) => {
|
||||||
|
@ -24,8 +24,9 @@
|
|||||||
"lint:stylelint": "stylelint --color \"client/**/*.css\"",
|
"lint:stylelint": "stylelint --color \"client/**/*.css\"",
|
||||||
"lint": "run-p --aggregate-output --continue-on-error lint:*",
|
"lint": "run-p --aggregate-output --continue-on-error lint:*",
|
||||||
"start": "node index start",
|
"start": "node index start",
|
||||||
"test": "run-p --aggregate-output --continue-on-error lint:* test:*",
|
"test": "run-p --aggregate-output --continue-on-error lint:* test:mocha",
|
||||||
"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: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"
|
"watch": "webpack --watch"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
@ -40,7 +41,7 @@
|
|||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.0.0"
|
"node": ">=18.0.0"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"./.thelounge_home",
|
"./.thelounge_home",
|
||||||
|
@ -18,6 +18,7 @@ import TextFileMessageStorage from "./plugins/messageStorage/text";
|
|||||||
import Network, {IgnoreListItem, NetworkConfig, NetworkWithIrcFramework} from "./models/network";
|
import Network, {IgnoreListItem, NetworkConfig, NetworkWithIrcFramework} from "./models/network";
|
||||||
import ClientManager from "./clientManager";
|
import ClientManager from "./clientManager";
|
||||||
import {MessageStorage, SearchQuery, SearchResponse} from "./plugins/messageStorage/types";
|
import {MessageStorage, SearchQuery, SearchResponse} from "./plugins/messageStorage/types";
|
||||||
|
import { StorageCleaner } from "./storageCleaner";
|
||||||
|
|
||||||
type OrderItem = Chan["id"] | Network["uuid"];
|
type OrderItem = Chan["id"] | Network["uuid"];
|
||||||
type Order = OrderItem[];
|
type Order = OrderItem[];
|
||||||
@ -138,6 +139,13 @@ class Client {
|
|||||||
if (!Config.values.public && client.config.log) {
|
if (!Config.values.public && client.config.log) {
|
||||||
if (Config.values.messageStorage.includes("sqlite")) {
|
if (Config.values.messageStorage.includes("sqlite")) {
|
||||||
client.messageProvider = new SqliteMessageStorage(client.name);
|
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);
|
client.messageStorage.push(client.messageProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ type Rollback = {
|
|||||||
stmts: string[];
|
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
|
// Desired schema, adapt to the newest version and add migrations to the array below
|
||||||
const schema = [
|
const schema = [
|
||||||
@ -57,6 +57,7 @@ const schema = [
|
|||||||
)`,
|
)`,
|
||||||
"CREATE INDEX network_channel ON messages (network, channel)",
|
"CREATE INDEX network_channel ON messages (network, channel)",
|
||||||
"CREATE INDEX time ON messages (time)",
|
"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
|
// 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.
|
// down migrations need to restore the state of the prior version.
|
||||||
@ -103,6 +108,10 @@ export const rollbacks: Rollback[] = [
|
|||||||
version: 1679743888000,
|
version: 1679743888000,
|
||||||
stmts: [], // here we can't drop the tables, as we use them in the code, so just leave those in
|
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 {
|
class Deferred {
|
||||||
|
@ -2,8 +2,6 @@ color: true
|
|||||||
check-leaks: true
|
check-leaks: true
|
||||||
recursive: true
|
recursive: true
|
||||||
reporter: dot
|
reporter: dot
|
||||||
interactive: false
|
|
||||||
spec: "test/**/*.ts"
|
|
||||||
ignore: "test/client/**"
|
ignore: "test/client/**"
|
||||||
extension: ["ts", "js"]
|
extension: ["ts", "js"]
|
||||||
require:
|
require:
|
||||||
|
Loading…
Reference in New Issue
Block a user