mirror of
https://github.com/navidrome/navidrome.git
synced 2026-08-31 07:30:32 +00:00
* implement storage api/hooks * fine. if the error messages are different, just match error * rename storageMount * add independent plugin test * round 2 * .-. * one more copypasta fail * docs(plugins): document the Storage host service The README is the plugin author reference and every other host service has a section there, but Storage had none, so the /storage guest path contract only existed in code. Documents the mount point and its backing directory, the manifest permission, the host function, and the two behaviours an author would otherwise discover the hard way: there is no size limit, and the directory outlives an uninstall. * docs(plugins): correct the library filesystem security notes The README stated in three places that library filesystem access is read-only, which stopped being true when AllowWriteAccess was added: an administrator can grant a plugin write access to libraries. Corrects those and gives the library and storage mounts the same wording for what the sandbox guarantees, since both now go through the same jail. * docs(plugins): describe symlink handling in mounts accurately The security notes claimed paths resolving outside a mount are rejected, which overstates the jail. Only lexical escapes are: '..' and absolute paths. Creating symlinks is denied, but symlinks already present are followed and do reach outside the mount, which is what lets music libraries link folders in from elsewhere. Both behaviours are pinned by tests in the plugins package. --------- Co-authored-by: Deluan Quintão <deluan@navidrome.org>
35 lines
1.0 KiB
Go
35 lines
1.0 KiB
Go
// Code generated by ndpgen. DO NOT EDIT.
|
|
//
|
|
// This file contains mock implementations for non-WASM builds.
|
|
// These mocks allow IDE support, compilation, and unit testing on non-WASM platforms.
|
|
// Plugin authors can use the exported mock instances to set expectations in tests.
|
|
//
|
|
//go:build !wasip1
|
|
|
|
package host
|
|
|
|
import (
|
|
"github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
// mockStorageService is the mock implementation for testing.
|
|
type mockStorageService struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// StorageMock is the auto-instantiated mock instance for testing.
|
|
// Use this to set expectations: host.StorageMock.On("MethodName", args...).Return(values...)
|
|
var StorageMock = &mockStorageService{}
|
|
|
|
// GetStoragePath is the mock method for StorageGetStoragePath.
|
|
func (m *mockStorageService) GetStoragePath() string {
|
|
args := m.Called()
|
|
return args.String(0)
|
|
}
|
|
|
|
// StorageGetStoragePath delegates to the mock instance.
|
|
// GetStoragePath retrieves the persistent storage path, if allowed
|
|
func StorageGetStoragePath() string {
|
|
return StorageMock.GetStoragePath()
|
|
}
|