Giter Site home page Giter Site logo

oneduo / nova-file-manager Goto Github PK

View Code? Open in Web Editor NEW
127.0 6.0 35.0 60.67 MB

The most advanced File Manager for Laravel Nova, feature rich and robust build.

Home Page: https://oneduo.github.io/nova-file-manager/

License: MIT License

JavaScript 0.52% PHP 54.40% CSS 0.53% Vue 31.63% TypeScript 12.91%
laravel nova file manager

nova-file-manager's Issues

Support File Visibility

The S3 filesystem I'm working with handles assets that should be publicly accessible and then files that should be kept private.

Being able to set file visibility when uploading and then determine whether the url should be signed based off of that would avoid the needless activity of signing public assets.

Another potential way of avoiding this could be to define in the config which disks should have signed urls, allowing the splitting of public and private assets onto separate disks.

Add ability to use `private` disks

Hi currently it's impossible to use private cloud disks.. for instance, this is how it is used with default nova image/file fields:

Image::make('Image', 'image->file')
    ->storeOriginalName('image->filename')
    ->disk('s3-private')
    ->preview(fn (string $file, string $disk) => Storage::disk($disk)->temporaryUrl($file, now()->addMinute()))
    ->thumbnail(fn (string $file, string $disk) => Storage::disk($disk)->temporaryUrl($file, now()->addMinute()))
    ->creationRules('required')
    ->updateRules('nullable'),

Here is a quickly docker-compose snipped to start a "local s3" if this helps develop this feature

  minio:
    image: bitnami/minio:2022
    environment:
      - MINIO_ROOT_USER=admin
      - MINIO_ROOT_PASSWORD=secret-password
      - MINIO_DEFAULT_BUCKETS=development-public:public,development-private:none

Cropper default ratio 16:9 ?

Hello, is there a way to change the default cropper ratio to 16:9 from square ?

Thanks in advance for your response.

Access Controls from Menu Item

Hi there.

Amazing work on the new Access controls features!

I'm wondering if there is any way to utilize the Show/Hide buttons methods right from the Menu Item call?

MenuSection::make('File Manager')->path('/nova-file-manager')

I'm using this primarily as a read-only file browser/download for one of my projects.

Thank you!

Translation is not working

Describe the bug
Error messages in errors.php, messages.php and validation.php not change by locale. But ui.php works.

To Reproduce

  1. Create 3 files above, change message in another language.
  2. F5 the page
  3. Input wrong data
  4. Submit form, and nothing gonna change.

Screenshots
image

Cannot select image from preview modal

If you double-click on an image for a quick preview you cannot "quickly" select it and return back to the resource. You have to close the modal and then select the image.

screenshot

To Reproduce
Steps to reproduce the behavior:

Scenario 1

  1. On a FileManager field click on "Choose Image"
  2. On the tool double-click a random image to open the preview modal.
  3. There is no "select" action to use the image in the field.

Scenario 2

  1. On a FileManager field click on "Choose Image"
  2. On the tool click on the search button and search for an existing image.
  3. The preview modal appears but with no "select" action to use the image.

Expected behavior
A "select" action should be added to the list of actions on top, preferably as last action.

Screenshots
Posted above

Desktop (please complete the following information):

  • OS: MacOS Monterey 13.1
  • Browser Chrome
  • Version 109

Smartphone (please complete the following information):
Not Applicable

Additional context
Not Applicable

Translations doesn't works

Describe the bug
Hello, I tried to translate your package, and despite all my attempts, it was impossible to correctly call the language keys I created. I tried copying them to the lang directory, resources/lang, resources/lang/vendor/nova-file-manager, and none of those tries worked

To Reproduce

Just trying to set up a new translation

Expected behavior

How to correctly install language keys?

Desktop (please complete the following information):

  • OS: Mac OS 12
  • Browser : Brave
  • Version 1.40.113

Thanks for your support

Choose a photo when updating

I do photo editing, when I search by image name and click on it. The results show 2 photos including old and new photos like videos.

0520C096-EE80-410A-BB78-BC7E2975FBEA.MP4

Add ability to define own `Asset` class

Feature Request:

Hi currently the shape of the data that is saved to the database opens up the possibility to store extra metadata alongside the file... for example currently, I have extended it to store filename and a lowres placeholder:

{
   "disk": "s3-public",
   "path": "0Y2UxO2j0D2Vpw1wLQdBbF3BRvyVqQtpJL0p1MCU.jpg",
   "originalFilename": "example.jpg",
   "placeholder": "data:image/webp;base64,UklGRn4AAABXRUJQVlA4IHIAAABQAwCdASoIAAgAAMASJZwAdoApwD8QHsAbA3/gDY2N++/2AAD+/vWZ1LKedF+CYDV45m1/sAxx2/zjQ5b3r7K2knz8wFT/4EMhP81yX/YZ1/0qb/59/MvTi7jLnmj3e4H35/5ExN34RjeDRmcJ+nAAAAA="
}

However, there are a few places where the Asset Class is hardcoded that causes issues:

Like:

https://github.com/BBS-Lab/nova-file-manager/blob/3312dc035a15bf67fc523f6fede58588c2077787/src/FileManager.php#L121-L127

and here:

https://github.com/BBS-Lab/nova-file-manager/blob/3312dc035a15bf67fc523f6fede58588c2077787/src/Casts/Asset.php#L46-L48

it would be great if this asset class could be defined via the config similiar to how it was done with the entities etc...

404 error on File Manager tool

Describe the bug
The tool window does not appear due to error 404

To Reproduce
Steps to reproduce the behavior:

  1. Inastall package
  2. Register the tool in your NovaServiceProvider.php file
  3. Click entry File Manager in navigation

Expected behavior
Tool window should appear

Screenshots
image

PHP v8.0.8
Laravel Nova v 4.19.5

Missing icons and wrong styling of the FileManager field popup

When I installed the plugin and wanted to use the FileManager field, I had missing icons and huge graphics on the popup.

image

To Reproduce
Steps to reproduce the behavior:

  1. Install fresh version
  2. Publish assets
  3. Add FileManager field to a resource
  4. Navigate to the resource and try to add a file via the field.

Expected behavior
Correct graphics/styling

Solution
I have already found the solution, but would be great to include this in the documentation for future users. I had to separately run the php artisan vendor:publish --provider="NovaKit\NovaPackagesTool\LaravelServiceProvider" command to fix the issue.

Several usability issues

Hi guys, thanks for this package it looks super clean, however I found several issues which render it unusable atm:

1 - The file selection modal is not letting me pick more than 1 image

FileManager::make('Images', 'content->images')->mutliple(4),

2 - Having multiple FileManager on the same resource conflicts with each other, for example when selecting a cover, somehow it also changes the Images

FileManager::make('Cover', 'content->cover'),
FileManager::make('Images', 'content->images')->mutliple(4),

3 - Although the UI is pretty nice, the backdrop-filter used to blur the background is super heavy which makes opening the image selection picker very laggy (tried on M1 / iMac 5k Retina), would be good if there was a setting to disable it

4 - Scroll locking issue: #4

5 - When switching the display mode from grid view to list view clicking on any image from the list won't do anything... I was only able to select images from the grid view

6 - Impossible to make a field nullable if set any other rule to it, somehow the field always complains it is required. It works with the default nova File field

FileManager::make('glTF', 'content->gltf')->rules('nullable', 'mimes:json,gltf,glb'),

Installation problem.

Hi,

I have just installed this package following docs. The package was installed with no errors. Registered in Nova Service Provider. Shows in the menu. But does not work, going to url http://127.0.0.1:8000/nova/nova-file-manager gives error: :-( Whoops… Nova experienced an unrecoverable error.

, or:

cURL error 60: SSL certificate problem: unable to get local issuer certificate (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://api.github.com/repos/oneduo/nova-file-manager/releases/latest

Any idea what I did wrong?

Minifying / conversions of uploaded images

Hi there,

Is there a way now (or is it planned to be feature of this plugin) to convert media automatically on upload to .webp / .avif, or maybe to minify images or to create conversions (small / medium thumbnails etc...)

Thanks in advance :)

Please allow us to define custom file actions

On many of my projects I use a custom service which allows me to open local applications, open files in certain applications, launch a browser at a specific url, etc.

For obvious reasons, this only works on my dev.. but that's where I do 100% of my file management anyway so this is perfectly suited to be used with your package.

I'll give you an example of what I'd want to achieve. I'd like to add a custom action so that whenever you highlight a file in your nova-file-manager, there could be a custom new icon added which when clicked would trigger "Open in Finder"

This would call a server function that would receive the file information, including its path, and then that path would be forwarded to a function that would look like this:

function myCustomFileAction($file) {
    (new \App\Services\OsxAppService)->openInApp('Finder', $file->path);
}
<?php

namespace App\Services;

class OsxAppService
{
    public function openInApp($app, $path)
    {
        $command = base_path('bash/openInApp.sh') . " '{$app}' '{$path}' 2>&1";
        exec($command);
    }
}
#!/bin/sh

app=${1}
path=${2}

if [[ ${app} == "photoshop" ]] ; then
    app="Adobe Photoshop CC 2015"
    cmd="tell application \"${app}\" to open file \"${path}\""
    osascript -e "${cmd}"
elif [[ ${app} == "chrome" ]] ; then
    app="Google Chrome"    
    cmd="open -a \"${app}\" \"${path}\""
    eval $cmd
elif [[ ${app} == "iterm" ]] ; then
    app="iTerm"    
    cmd="open -a \"${app}\" \"${path}\""
    eval $cmd
elif [[ ${app} == "code" ]] ; then
    app="Visual Studio Code"
    cmd="tell application \"${app}\" to open \"${path}\""
    osascript -e "${cmd}"
elif [[ ${app} == "finder" ]] || [[ ${app} == "preview" ]]; then
    app="Finder"
    cmd="tell application \"${app}\" to open (\"${path}\" as POSIX file)"
    osascript -e "${cmd}"
fi

cmd="tell application \"${app}\" to set frontmost to true"
osascript -e "${cmd}"

And voila.. super easy.. this works perfectly on Mac.. only on localhost but that's just what I need.

All in all I could see custom file actions being useful in many other scenarios.. but this is the first that comes to mind.

Any chance you could add support for custom file actions pretty please?

Many thanks!! Love your project!

Is search intended to work only in currently opened folder ?

Hi there, I would like to ask if the search functionallity is intended to work only in currently active (opened) directory? Shouldn't it work multilevel like across whole filesystem ? Because if I try to search some file which is nested two or three levels, it wont find it.

Thanks

Nested Menu Item Path Inoperative

I'm getting a 404 with an s3 disk with the path:

MenuItem::make('File Manager')->path('/nova-file-manager/feed-archive')

My workaround is:

MenuItem::link('Feed Archive', '/nova-file-manager?path=%2Ffeed-archive'),

Digital Ocean Spaces

When using Digital Ocean Spaces (which uses the S3 driver) I can upload an initial file or folder, but after that if I try to add another I get an error saying that the selected path already exists. I have triple checked and in each test the folder or file does not exist.

My Digital Ocean disk config is as below:

'digitalocean' => [
'driver' => 's3',
'key' => env('DIGITALOCEAN_SPACES_KEY'),
'secret' => env('DIGITALOCEAN_SPACES_SECRET'),
'endpoint' => env('DIGITALOCEAN_SPACES_ENDPOINT'),
'region' => env('DIGITALOCEAN_SPACES_REGION'),
'bucket' => env('DIGITALOCEAN_SPACES_BUCKET'),
'url' => env('DIGITALOCEAN_SPACES_URL'),
'visibility' => 'public',
'use_path_style_endpoint' => false,
'throw' => false,
],

Screenshots
First upload or folder creation works ok:
image

Second attempt returns error:
image

Screenshot of the spaces view in Digital Ocean to show only one folder present:
image

I'm using Laravel ~9.0, Nova ~4.0 and the file manager package version is ^0.7.3

I'm on MacOS in Google Chrome.

I apologise if this is a configuration error on my part, but I have checked things over and over. Also, because it allows an initial file upload or creation it makes me think that the configuration is probably correct.

Thanks for the fantastic work on this package. Do let me know if I can provide anymore useful info.

Chris

Disk on the fly error

Describe the bug
It returns an error message when try to define a disk on the fly (link)[https://oneduo.github.io/nova-file-manager/access-control.html#on-demand-filesystem].

Message: nova-file-manager::validation.disk.missing

Error lauched by class vendor/oneduo/nova-file-manager/src/Rules/DiskExistsRule.php

To Reproduce
Steps to reproduce the behavior:

  1. Add the field in resource:
 FileManager::make(__('Files'), 'files')->multiple()->filesystem(function (NovaRequest $request) {
                return Storage::build([
                    'driver' => 'local',
                    'root' => storage_path('app/public/myfolder' ),

                ]);
            })
  1. Try to create folder or upload
  2. See error

Expected behavior
Not show error.

Screenshots
imagen

Chunks do not get deleted after successful upload

I noticed the chunks folder inside the storage has grown in size. I realized that every single image uploaded to the system has a .part file stored in this folder. I guess this was meant to be a temporary folder that is used to upload images and then move them to the correct folder. But instead the images stay there.

To Reproduce

  1. Upload one or more images
  2. Check on storage/chunks

Expected behavior
The folder should be empty

Screenshots
Screenshot 2023-02-07 at 11 03 36 AM

Desktop (please complete the following information):

  • OS: Mac OS Monterey 13.2
  • Browser Chrome
  • Version 109

The selection does not work

Hello.
The selection does not work - a check mark does not appear when clicking on the file.

laravel 9.24
nova 4.12.14
nova-file-manager 0.2.4

Browsers
firefox, chrome, opera

Use Filemanager in Nova TinyMCE images upload

Hello there, is there a way to use this filemanager with nova TinyMCE ? I tried to put this inside nova-tinymce.php config file but I am getting 404 error.

'use_lfm' => true, 'lfm_url' => 'nova/nova-filemanager',

thanks in advance. :)

Path not working.

Hi!

With last Nova 4.19 path is not working.

 FileManager::make(__('Photos'), 'photos')->path('/photos'),

Incompatibility with `nova-flexible-content` field

Hi, version 0.5.0 introduced a change in the way it fetches the list of files on the modal window that breaks compatibility with flexible-content-fields package.

Here on this function, it tries to find the FileManager field by instance, but when using it inside a flexible layout it throws a 404 error that prevents the window from opening...

https://github.com/BBS-Lab/nova-file-manager/blob/d499da0d95e03e2e1b6ebc2fc9156dcc251c0de4/src/Http/Requests/BaseRequest.php#L50-L59

Different root for specific user roles

Hey there,
I would like to know how can I set root directory for file manager for different user roles.
For instance, we have admin and employee user role. My folder structure looks like this

public // main root
----users
-------employee
-----------bob // bob's root
-----------frank
-------admin
-----------admin1
-----------admin2
----other
......

I want for instance Bob to be able to see just his folder and everything in that folder. And Admins to see everything from main root

I tried to create on-demand filesystem like this:

image

But it saved media to database with "default" disk which i don't have (I am using public) and path relative to bob's root. I need every image to be saved relative to main root.

Any ideas ?

Thanks in advance.

Breadcrumbs

Hi everyone!

I don't know if this is a bug or I do something wrong, but navigating through FileManager I can see in breadcrumbs only Home - as icon - and latest folder I reached. There is no way to make step back, and breadcrumbs does not give this option as well. E.g. I Have in main public folder 5 subfolders and in some of them I have sub sub folders. If I will navigate into sub sub folder, there is no button to go back to sub folder, and breadcrumbs gives the only option to go Home - public folder.

Bug: field does not work when used outside of a resource

Describe the bug
When I use the field inside a tool (eg. Nova Settings) the modal does not show the images and I have a 404 error in the console.

To Reproduce

  1. In the nova-settings fields I define the following field
FileManager::make('Image', 'home_seo_image'),
  1. Go to settings page
  2. Click on Choose Image

Expected behavior
The modal should display the images. Instead it has a loading indicator because of failed ajax call (404)

Screenshots
The bug is demonstrated on this video:

bug.mp4

Desktop (please complete the following information):

  • OS: MacOS Monterey 13.1
  • Browser Google Chrome
  • Version 109

Additional context
Nothing

Add ability to upload multiple files at once

2 Features here:

1 - Would be nice if we could simply drag the asset straight into the modal window without entering the upload mode
2 - Add the ability to upload multiple assets at once, currently it only allows to upload 1 by 1

Screen.Recording.2022-08-30.at.2.01.03.PM.mp4

Automatically select uploaded images

Problem:
When a user clicks to select an image from a field and uploads a new image, the uploaded image does not get automatically selected and the user has to search for it and select it. On a folder containing a lot of images, the only option is to use the search toolbar since they order alphabetically.

Solution:
When a user upload a single image, the preview modal could open and the user can select it with a single click.
If the user uploads more than one image, ideally all of them should be selected and shown in a modal for confirmation (like the same modal the user sees while uploading them)

Hidden files are still being shown?

Using 0.7.0

In my config file I see that the default is to not show hidden file

'show_hidden_files' => env('NOVA_FILE_MANAGER_SHOW_HIDDEN_FILES', false),

And yet in some folders I am seeing the .DS_Store, shouldn't this file be hidden?

404 div when clicking on FileManager menu

Discussed in #7

Originally posted by ymauron August 9, 2022
Hi,

I really like the idea of this package. I installed it but get a 404 error when clicking on the FileManager menu. Any idea on how to debug this ?

Thanks

Issue when toggling disks

Hi if you are currently in a subfolder then toggle to any other disks where that same folder does not exist it throws an error.

Screen.Recording.2022-09-05.at.12.19.46.PM.mov

Select multiple files

Select multiple photos but no action, I want selected photos to be deleted or put in another folder, do you have any solution?
image
Currently I only see a clear selected button !

Not an issue

Hey! This is Aaron from the Twitch stream yesterday. I took a look at the package and honestly it looks amazing. It seems to be really well architected and I dove into some of the classes and they look super clean. You should be proud of this! I don't use Nova on any projects, but if I do I'll absolutely reach for this, nice job! Have you submitted it to Laravel News?

Search does not function properly

When searching for a filename I get a list of found files like the following image

1

However when I click on an item, nothing happens 🤷‍♂️

If I am on a folder with only a few images (not paginated) then searching and clicking on a result would open the image modal but without a "Select Image" action!

To Reproduce
Steps to reproduce the behavior:

  1. Click on FileManager field: "Choose Image"
  2. Click on "Search"
  3. Search for an item on a folder containing a lot of images (paginated)
  4. Click on a result
  5. See Error

Expected behavior
Ideally, I want to automatically select the image and return back to the resource but I feel it should better open the image modal with all actions (crop,delete, etc.) with a "Select Image" action.

Screenshots
Posted above

Desktop (please complete the following information):

  • OS: Mac OS Monterey 13.1
  • Browser Chrome
  • Version 109

Smartphone (please complete the following information):
Not Applicable

Additional context
Not Applicable

Cannot delete files within folder when the foder starts with a `whitespace`

Describe the bug

Today I faced a weird issue where files could not be deleted/renamed/moved (everything else worked) when the folder they were placed started with a whitespace

To Reproduce
Steps to reproduce the behavior:

  1. Create a folder that begins with a whitespace ExampleFolder
  2. Upload an image to it...
  3. Try to delete the image...
  4. See the error

18a9c9b4de098b51315aabc427853cd

Expected behavior

Folder name should be trimmed when created or the filesystem should not crash if it contains it...

Hook before renaming files and folders

Hello,

I am facing a problem. When user renames a file / folder, I need all paths associated with this file / folder to get changed. Is there any hook or something that could help me resolve this?

Many thanks in advance. :)

Scroll native on close

After closing the file manager window in nova resource associated, the browser's native scroll no longer works

Permissions

First of all, thank you both for developing and maintaining a really great package.

I have a few feature requests around permissions;

  1. Limit / Jail to a directory on a specific storage so that users can navigate down but not out
  2. Set the default view to list
  3. Set a closure to evaluate disabling the New Folder, and Upload Feature
  4. Set a closure to evaluate disabling the Rename, and Delete Folder Feature
  5. Set a closure to evaluate disabling the Rename, and Delete File Feature

Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.