Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/umbreld/source/modules/files/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,8 @@ export default class Files {

// Permanently delete a file or directory
async delete(virtualPath: string) {
virtualPath = normalizePath(virtualPath)

// Check if operation is allowed
const allowedOperations = await this.getAllowedOperations(virtualPath)
if (!allowedOperations.includes('delete')) throw new Error('[operation-not-allowed]')
Expand All @@ -692,7 +694,8 @@ export default class Files {
if (virtualPath.startsWith('/External/')) {
const shares = (await this.#umbreld.store.get('files.shares')) || []
for (const share of shares) {
if (share.path.startsWith(virtualPath)) await this.samba.removeShare(share.path)
if (share.path === virtualPath || share.path.startsWith(`${virtualPath}/`))
await this.samba.removeShare(share.path)
}
}

Expand Down
4 changes: 4 additions & 0 deletions packages/umbreld/source/modules/hardware/raid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,10 @@ export default class Raid {
if (deviceIds.length === 0) throw new Error('At least one device is required')
if (raidType === 'failsafe' && deviceIds.length < 2) throw new Error('Failsafe mode requires at least two devices')

// Don't wipe an existing array. setup() partitions the devices and creates a
// fresh pool, so running it again would destroy the live array.
if ((await this.getStatus()).exists) throw new Error('A RAID array already exists')

const devices = deviceIds.map((id) => `/dev/disk/by-umbrel-id/${id}`)
for (const device of devices) {
if (!(await fse.pathExists(device))) throw new Error(`Device not found: ${device}`)
Expand Down