feat: add setting to see pre-release versions in dashboard
This commit is contained in:
parent
7eb90831b1
commit
aba1781d65
3 changed files with 17 additions and 0 deletions
|
@ -43,6 +43,14 @@ export const envSchema = z.object({
|
|||
if (typeof value === 'boolean') return value;
|
||||
return value === 'true';
|
||||
}),
|
||||
seePreReleaseVersions: z
|
||||
.string()
|
||||
.or(z.boolean())
|
||||
.optional()
|
||||
.transform((value) => {
|
||||
if (typeof value === 'boolean') return value;
|
||||
return value === 'true';
|
||||
}),
|
||||
});
|
||||
|
||||
export const settingsSchema = envSchema
|
||||
|
|
|
@ -42,6 +42,7 @@ export class TipiConfig {
|
|||
status: 'RUNNING',
|
||||
storagePath: conf.STORAGE_PATH,
|
||||
demoMode: conf.DEMO_MODE,
|
||||
seePreReleaseVersions: false,
|
||||
};
|
||||
|
||||
const fileConfig = readJsonFile('/runtipi/state/settings.json') || {};
|
||||
|
|
|
@ -44,6 +44,14 @@ export class SystemServiceClass {
|
|||
*/
|
||||
public getVersion = async () => {
|
||||
try {
|
||||
const { seePreReleaseVersions } = TipiConfig.getConfig();
|
||||
|
||||
if (seePreReleaseVersions) {
|
||||
const { data } = await axios.get<{ tag_name: string; body: string }[]>('https://api.github.com/repos/meienberger/runtipi/releases');
|
||||
|
||||
return { current: TipiConfig.getConfig().version, latest: data[0]?.tag_name, body: data[0]?.body };
|
||||
}
|
||||
|
||||
let version = await this.cache.get('latestVersion');
|
||||
let body = await this.cache.get('latestVersionBody');
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue