MiczFlor / RPi-Jukebox-RFID

A Raspberry Pi jukebox, playing local music, podcasts, web radio and streams triggered by RFID cards, web app or home automation. All plug and play via USB. GPIO scripts available.
http://phoniebox.de
MIT License
1.37k stars 398 forks source link

Add a simple file manager to WebGUI #510

Open Ardios opened 5 years ago

Ardios commented 5 years ago

Hello everyone,

today I will show you how to add a file manager to the WebGUI. There are several ways to include a file Manager, i have chosen iframe.

1.) we need a File Manager PHP Script, i took Tiny File Manager from Github:

You need tinyfilemanager.php and for other languages you also need translation.json.

2.) Edit tinyfilemanager.php Change Line 46 from $root_path = $_SERVER['DOCUMENT_ROOT']; to $root_path = '/home/pi/RPi-Jukebox-RFID/shared'; and Line 50 from $root_url = ''; to $root_url = '/home/pi/RPi-Jukebox-RFID/shared'; and save.

3.) Copy tinyfilemanager.php and translation.json to /home/pi/RPi-Jukebox-RFID/htdocs/

Now we have to decide if we want to include the File Manager in Folders & Files (manageFilesFolders.php) or if we prefer it as a own page (e.g. filemanager.php).

Folders & Files (manageFilesFolders.php):

1.) Edit manageFilesFolders.php in /home/pi/RPi-Jukebox-RFID/htdocs/manageFilesFolders.php and add on Line 400 after:

        <?php
        if ($edition == "plusSpotify") {
        print "
        <legend><i class='mdi mdi-autorenew'></i> ".$lang['manageFilesFoldersRenewDB']."</legend>
        <h4>".$lang['manageFilesFoldersRenewDBinfo']."</h4>
        <a href='".$_SERVER['PHP_SELF']."?scan=true' class='btn btn-success'> ".$lang['manageFilesFoldersLocalScan']."</a>";
        }
        ?>

this:

<fieldset> 
<legend>File Manager</legend>

<div style="text-align:center;">
<iframe height="600" width="100%" src="tinyfilemanager.php" align="middle" frameBorder="0"></iframe>
</div>
</fieldset>

Save and Done.

2.) Finally we have to set the folder permissions for the script, i use:

chmod 777 -R /home/pi/RPi-Jukebox-RFID/shared/

Prefer it as a own page (e.g. filemanager.php):

1.) Edit inc.navigation.php in /home/pi/RPi-Jukebox-RFID/htdocs/inc.navigation.php and add on Line 29 after:

<li><a href="cardRegisterNew.php" class="mainMenu"><i class='mdi mdi-cards-outline'></i> <?php print $lang['globalRegisterCardShort']; ?></a></li>

add this:

<li><a href='filemanager.php' class='mainMenu'><i class='mdi mdi-folder-plus'></i> File Manager</a></li>

2.) I attached a new File filemanager.php only copy to /home/pi/RPi-Jukebox-RFID/htdocs/ i had edited the cardRegisterNew.php for filemanager.php

3.) Finally we have to set the folder permissions for the script, i use:

chmod 777 -R /home/pi/RPi-Jukebox-RFID/shared/

Done.

files.zip The file files.zip contains the edited filemanager.php, inc.navigation.php and manageFilesFolders.php these are directly ready for use

Please excuse my broken English

Ardios

//EDIT// Add Pictures

Folders & Files (manageFilesFolders.php): 2019-03-10 03_07_07-Phoniebox ‎- Microsoft Edge

Prefer it as a own page (e.g. filemanager.php): 2019-03-10 03_09_48-Phoniebox ‎- Microsoft Edge //EDIT END//

MiczFlor commented 5 years ago

Hi @Ardios I like the idea. Personally, I do not use the web UI for file management. It would be great if you could find a solution using a MIT license, like Phoniebox. Would you know one? And if I hack this myself: what tasks need to be covered?

Ardios commented 5 years ago

@MiczFlor

like this?

https://github.com/alexantr/filemanager or https://github.com/jcampbell1/simple-file-manager

ckuetbach commented 5 years ago

Just wanted to mention minio.

It is a single go-application without any dependencies, which has a file server mode.

There is a download for ARM as well. I think it should not be included into phoniebox, because it was made for different purpose. But if one simply wants to have a web filemanager, this could be sufficient.

pi@raspberrypi:~ $ export MINIO_ACCESS_KEY=minio
pi@raspberrypi:~ $ export MINIO_SECRET_KEY=miniostorage
pi@raspberrypi:~ $ ./minio server .

The arm (32 bit) version can be downloaded here: https://dl.min.io/server/minio/release/linux-arm/

There two more arm versions (arm64 and arm6vl).