humhub / fcm-push

Enables your users to receive push notifications from your network.
5 stars 7 forks source link

Add possibility to profile `.well-known` files. #39

Closed luke- closed 5 months ago

luke- commented 5 months ago

We need some "Advanced Settings" option, where the admin can add content for files

These files are required for the mobile app.

PrimozRatej commented 5 months ago

https://docs.flutter.dev/cookbook/navigation/set-up-app-links https://docs.flutter.dev/cookbook/navigation/set-up-universal-links

yurabakhtin commented 5 months ago

@luke- Do you mean this module should be allowed to update the 2 files located in the site root folder .well-known/? Or we should implement a rule compoment like this which will print out a stored content of the files:

'urlManagerRules' => [
    ['class' => 'humhub\modules\fcmPush\components\UrlRule'],
],

Please note currently .htaccess has a restriction:

# prevent httpd from serving dotfiles (.htaccess, .svn, .git, etc.) - except let's encrypt challenge
RedirectMatch 403 ^/?\.(?!well-known/acme-challenge/[\w-]{43}$)

So when I open the file https://site.local/.well-known/assetlinks.json I see only a message "403 Access forbidden!". It can be solved if we will update the rule to RedirectMatch 403 ^/?\.(?!well-known/).

yurabakhtin commented 5 months ago

It can be solved if we will update the rule to RedirectMatch 403 ^/?\.(?!well-known/).

I find the file .htaccess.dist was updated to this 2 years ago here, so no problem, I just had to update my local file .htaccess.

yurabakhtin commented 5 months ago

@luke- PR https://github.com/humhub/fcm-push/pull/40 - I have implemented to store the content directly into the files on a disk. If the files don't exist they will be created automatically on first time when the posted content is not empty.

luke- commented 5 months ago

@yurabakhtin We have to use the solution with URL Rule. This does not work with a clustered setup.

Can you please adjust this?

Perhaps we should also include a check as to whether the file can be retrieved via an HTTP client, for example + a check for PrettyURLs. If one of the two fails, we could display an error.

yurabakhtin commented 5 months ago

We have to use the solution with URL Rule. This does not work with a clustered setup.

Can you please adjust this?

@luke- Fixed in the commit https://github.com/humhub/fcm-push/pull/40/commits/921d0cb279119f93871caae81279e2f3054e2e21. Please note if the requested well-known file already exists on a disk then it will be displayed first, so the file content from module settings is printed out only when the file is delated from a disk.

Perhaps we should also include a check as to whether the file can be retrieved via an HTTP client, for example + a check for PrettyURLs. If one of the two fails, we could display an error.

New string Please enable <a {attrs}>Pretty URLs</a> for proper working of the well-known files.:

warning-pretty-urls

luke- commented 5 months ago

@yurabakhtin Thanks, looks good!