mirror of
https://github.com/pockethost/pockethost.git
synced 2025-11-28 16:13:29 +00:00
enh: limit allowed pocketbase versions
This commit is contained in:
parent
91ed5a59b9
commit
02f2f6e818
@ -1,7 +1,9 @@
|
||||
import { writeFileSync } from 'fs'
|
||||
import { lte, prerelease } from 'semver'
|
||||
import {
|
||||
LoggerService,
|
||||
MOTHERSHIP_DATA_ROOT,
|
||||
PH_ALLOWED_POCKETBASE_SEMVER,
|
||||
stringify,
|
||||
} from '../../../../../core'
|
||||
import { GobotService } from '../../../../services/GobotService'
|
||||
@ -63,7 +65,10 @@ export async function freshenPocketbaseVersions() {
|
||||
await bot.update()
|
||||
await bot.download()
|
||||
const rawVersions = await bot.versions()
|
||||
const versions = expandAndSortSemVers(rawVersions)
|
||||
const allowedVersions = rawVersions.filter(
|
||||
(v) => lte(v, PH_ALLOWED_POCKETBASE_SEMVER()) && prerelease(v) === null,
|
||||
)
|
||||
const versions = expandAndSortSemVers(allowedVersions)
|
||||
const cjs = `module.exports = ${stringify(versions, null, 2)}`
|
||||
|
||||
{
|
||||
|
||||
@ -78,6 +78,7 @@ if (_IS_DEV) {
|
||||
}
|
||||
|
||||
export const SETTINGS = {
|
||||
PH_ALLOWED_POCKETBASE_SEMVER: mkString(`0.22.21`),
|
||||
PH_PLUGINS: mkCsvString([]),
|
||||
|
||||
PH_HOME: mkPath(_PH_HOME, { create: true }),
|
||||
@ -162,7 +163,10 @@ export const RegisterEnvSettingsService = () => {
|
||||
}
|
||||
|
||||
/** Accessors */
|
||||
|
||||
export const PH_PLUGINS = () => settings().PH_PLUGINS
|
||||
export const PH_ALLOWED_POCKETBASE_SEMVER = () =>
|
||||
settings().PH_ALLOWED_POCKETBASE_SEMVER
|
||||
|
||||
export const PH_HOME = (...paths: string[]) =>
|
||||
join(settings().PH_HOME, ...paths)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user