mirror of
https://github.com/thelounge/thelounge
synced 2025-02-16 13:18:24 +00:00
changelog data type
This commit is contained in:
parent
4d237600d5
commit
7bc184b252
3 changed files with 21 additions and 19 deletions
|
@ -4,6 +4,7 @@ import log from "../log";
|
|||
import pkg from "../../package.json";
|
||||
import ClientManager from "../clientManager";
|
||||
import Config from "../config";
|
||||
import {SharedChangelogData} from "../../shared/types/changelog";
|
||||
|
||||
const TIME_TO_LIVE = 15 * 60 * 1000; // 15 minutes, in milliseconds
|
||||
|
||||
|
@ -12,23 +13,7 @@ export default {
|
|||
fetch,
|
||||
checkForUpdates,
|
||||
};
|
||||
export type ChangelogData = {
|
||||
current: {
|
||||
prerelease: boolean;
|
||||
version: string;
|
||||
changelog?: string;
|
||||
url: string;
|
||||
};
|
||||
expiresAt: number;
|
||||
latest?: {
|
||||
prerelease: boolean;
|
||||
version: string;
|
||||
url: string;
|
||||
};
|
||||
packages?: boolean;
|
||||
};
|
||||
|
||||
const versions: ChangelogData = {
|
||||
const versions: SharedChangelogData = {
|
||||
current: {
|
||||
prerelease: false,
|
||||
version: `v${pkg.version}`,
|
||||
|
@ -36,6 +21,8 @@ const versions: ChangelogData = {
|
|||
url: "", // TODO: properly init
|
||||
},
|
||||
expiresAt: -1,
|
||||
latest: undefined,
|
||||
packages: undefined,
|
||||
};
|
||||
|
||||
async function fetch() {
|
||||
|
|
15
shared/types/changelog.ts
Normal file
15
shared/types/changelog.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
export type SharedChangelogData = {
|
||||
current: {
|
||||
prerelease: boolean;
|
||||
version: string;
|
||||
changelog?: string;
|
||||
url: string;
|
||||
};
|
||||
expiresAt: number;
|
||||
latest?: {
|
||||
prerelease: boolean;
|
||||
version: string;
|
||||
url: string;
|
||||
};
|
||||
packages?: boolean;
|
||||
};
|
4
shared/types/socket-events.d.ts
vendored
4
shared/types/socket-events.d.ts
vendored
|
@ -3,7 +3,7 @@ import {SharedMention} from "../../shared/types/mention";
|
|||
import {ChanState} from "../../shared/types/chan";
|
||||
import {SharedMsg, ClientMessage} from "../../shared/types/msg";
|
||||
import {SharedUser} from "../../shared/types/user";
|
||||
import {ChangelogData} from "../plugins/changelog";
|
||||
import {SharedChangelogData} from "../../shared/types/changelog";
|
||||
import {LinkPreview} from "../plugins/irc-events/link";
|
||||
import {ClientConfiguration} from "../server";
|
||||
|
||||
|
@ -23,7 +23,7 @@ interface ServerToClientEvents {
|
|||
|
||||
"upload:auth": (token: string) => void;
|
||||
|
||||
changelog: (data: ChangelogData) => void;
|
||||
changelog: (data: SharedChangelogData) => void;
|
||||
"changelog:newversion": () => void;
|
||||
|
||||
"channel:state": (data: {chan: number; state: ChanState}) => void;
|
||||
|
|
Loading…
Add table
Reference in a new issue