Update!
I did implement the 2fa for myself. A separate adminpanel is needed to generate users and to get the QR-code for the registered user. It was really simple with a few lines of code in the files.gallery index.php. The new code-lines are marked as // === NEW: xxxx ===.
The index.php is based on the standard files.gallery version 0.12.4. That means you won't find the additional features of the user registration from my other project.
You can download the index.php and adminpanel.php here: Download
If you want to test it for yourself:
Login to the filebrowser: Filebrowser filey.gallery
Login to the adminpanel: Adminpanel
Username: admin
Password: admin
Important note: PLEASE DON'T DELETE THE ADMIN USER OR CHANGE NAME/PASSWORD IN THE EXAMPLE ON MY SERVER OR REGENERATE AN OTHER QR-CODE, OTHERWISE OTHERS CAN'T TEST IT BECAUSE OF THE NEW QR-CODE.
You have to scan the QR-code with an authenticator app like Google Authenticator or Duo Mobile or any other authenticator app on your phone to get the 2fa code:

The normal filebrowser login site has now an additional field:

When you download the files and install it on your server the adminpanel ask you to create an admin user. With this it adds the following lines to the config.php from the user:
'2fa_secret' => 'IFFAPY4SAWVJXXCM',
'isadmin' => true,
For a normal user it only adds the line 2fa_secret' => 'IFFAPY4SAWVJXXCM',
After set up the admin user, the QR-code for the admin is shown, which you also need to login to the admin panel.
I hope you like it. Ask me, if you have any questions! 🙂