External storage as default landing page

SExternal storage as default landing page

Nextcloud version : 29.0.1
Operating system and version : Debian 12
Apache or nginx version : Apache 2
PHP version : 8.2

Hello Nextcloud community !

I seach a simple feature but unable to find solid answer.

I need to land user on external stoge after login. User can also use normal DATA folder, and I don’t want to move or replace this DATA folder in any way.

External storage works as expected, but user need to click on it to view content.

I just need to land user on external folder after login. For that I try to edit config.php and add line :

'defaultapp' => 'files_external',
or
'defaultapp' => 'extstoragemounts',

In the first case I have a screen who show “page not found - The page could not be found on the server or you may not be allowed to view it.” and this message display in loop.

In second case “extstoragemounts” nothing happens and user land on files manager.

How to display the content of external files storage at landing page ?

Thanks :slight_smile:

I can’t think of a built-in option to set the default folder upon login, but you can sort of get there by taking advantage of the fact that if someone visits a deeper URL (such as https://domain.com/apps/files/extstoragemounts) it’ll take them to that spot.

Also works if they aren’t logged in. After they log in they get forwarded to that deeper link still.

Are you sure ? If i put ‘defaultapp’ => ‘Photos’, in the config.php the user land in Photos folder. Tested and working.

The correct name of the app is external storage support. But i think it does not work in config.php.

But you can use e.g. the url:

https://cloud.server.tld/index.php/apps/files/extstoragemounts
or better
https://cloud.server.tld/index.php/apps/files/files?dir=/foldername

Tested with URL 'defaultapp' => 'https://domain.tld.fr/index.php/apps/files/extstoragemounts', or 'defaultapp' => 'https://domain.tld/index.php/apps/files/files/326?dir=/PUBLIC', and in both cases it does nothing. The user land on the files manager.

I think that the directive ‘defaultapp’ doesn’t take URLs but only the name of the application.

Not defaultapp in config.php. Use the url directly in the browser. Maybe you can use a url shortener for your users. Works only in browsers not in Nextcloud clients.

Yes. But i think it does not work with the app external storage support.

1 Like

If you add ‘defaultapp’ => ‘photos’ to the config.php, the user will not land in the Photos folder of the Files app. Instead, the user will land in the Photos app, which happens to show the contents of the Photos folder.

As others have mentioned, it is not possible to set a default folder, only a default app.

1 Like

It turns out there is an ancient undocumented config value that can be used…

occ config:app:set --value "/apps/files/extstoragemounts" core defaultpage

Beware: This is a global option[1]

Disclaimer: Since it’s not documented I can’t promise it will be permanently supported, but it’s been in place for >10 years through a number of code changes in that area. I’ll try to get it added to the docs.

[1] It doesn’t look like it would be overly challenging to make this a per-user option, but someone would still need to volunteer to implement the change. The code handling this is here.

3 Likes

Is there also an option in config.php or must someone without occ edit it in lib/private/URLGenerator.php?

Lacking occ the next best option would probably be to directly add it to the database:

Something like:

INSERT INTO oc_appconfig VALUES ('core', 'defaultpage', '/apps/files/extstoragemounts', 4, 0)

Assuming the default dbtableprefix is in use (oc).

This could be done using any db client (e.g. phpmyadmin, mariadb, mysql, etc.)

1 Like

Yes, but external storage is an app. If user run external storage as default app, it may land in the folder opened by external storage app, no ?

No. That seems not to work. It is not a “really” app, it is included in “files”.

Thanks ! It not works with /apps/files/extstoragemounts but it works with /apps/files/?dir=/NAME_OF_THE_EXTERNAL_STORAGE and user land directly in this folder.

for me the correct query in DB is :

INSERT INTO oc_appconfig VALUES ('core', 'defaultpage', '/apps/files/?dir=/PUBLIC', 4, 0

Assuming PUBLIC is the name of the external storage on my server.

Thanks !

2 Likes

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.