Skip to content

Commit

Permalink
feat(player): make fileRoot option required for local files
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `fileRoot` option is required to play local files
  • Loading branch information
larsrickert committed Jun 18, 2022
1 parent 9bceb75 commit a0f1994
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/engines/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ import { isSubPath } from "../utils/fs";
export const fileEngine: PlayerEngine = {
source: "file",
async isResponsible(query, { fileRoot }) {
if (fileRoot && !isSubPath(fileRoot, query)) {
return false;
}
if (!fileRoot || !isSubPath(fileRoot, query)) return false;

// check if query is file path
try {
Expand Down
4 changes: 2 additions & 2 deletions src/types/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ export interface PlayerOptions {
/** Initial player volume for all tracks between 0 and 200. */
initialVolume?: number;
/**
* Path to the folder where local files should be playable from. If set, files outside this directory are refused to play.
* For security reasons, its recommended to set this option when playing local files with the player.
* Path to the folder where local files should be playable from. Must be set if local files should be playable.
* For security reasons files outside this directory are refused to play.
*
* @example
* ```ts
Expand Down

0 comments on commit a0f1994

Please sign in to comment.