mirror of
https://github.com/pockethost/pockethost.git
synced 2025-03-30 15:08:30 +00:00
chore: prevent access to pb_data and pb_migrations while instance may be running
This commit is contained in:
parent
32ce0e7835
commit
1beee3ac10
@ -14,7 +14,12 @@ import { customAlphabet } from 'nanoid'
|
|||||||
import { isAbsolute, join, normalize, resolve, sep } from 'path'
|
import { isAbsolute, join, normalize, resolve, sep } from 'path'
|
||||||
import { PocketbaseClientApi } from '../clientService/PbClient'
|
import { PocketbaseClientApi } from '../clientService/PbClient'
|
||||||
import * as fsAsync from './fs-async'
|
import * as fsAsync from './fs-async'
|
||||||
import { INSTANCE_ROOT_FOLDER_NAMES, isInstanceRootFolder } from './FtpService'
|
import {
|
||||||
|
FolderNames,
|
||||||
|
INSTANCE_ROOT_FOLDER_NAMES,
|
||||||
|
isInstanceRootFolder,
|
||||||
|
MAINTENANCE_ONLY_FOLDER_NAMES,
|
||||||
|
} from './FtpService'
|
||||||
|
|
||||||
const nanoid = customAlphabet(`abcdefghijklmnop`)
|
const nanoid = customAlphabet(`abcdefghijklmnop`)
|
||||||
|
|
||||||
@ -100,6 +105,17 @@ export class PhFs implements FileSystem {
|
|||||||
}
|
}
|
||||||
fsPathParts.push(instance.id)
|
fsPathParts.push(instance.id)
|
||||||
if (rootFolderName) {
|
if (rootFolderName) {
|
||||||
|
dbg({ rootFolderName, instance })
|
||||||
|
if (
|
||||||
|
MAINTENANCE_ONLY_FOLDER_NAMES.includes(
|
||||||
|
rootFolderName as FolderNames
|
||||||
|
) &&
|
||||||
|
!instance.maintenance
|
||||||
|
) {
|
||||||
|
throw new Error(
|
||||||
|
`Instance must be in maintenance mode to access ${rootFolderName}`
|
||||||
|
)
|
||||||
|
}
|
||||||
fsPathParts.push(rootFolderName)
|
fsPathParts.push(rootFolderName)
|
||||||
// Ensure folder exists
|
// Ensure folder exists
|
||||||
const rootFolderFsPath = resolve(
|
const rootFolderFsPath = resolve(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user