Closed marc-farre closed 8 months ago
@marc-farre on which level was the manifest.json
available and what was the start_url prop. set to in it?
@PrimozRatej the bug occurs on all Humhub instances. There are no modifications from the Humhub original source code.
So if you are looking at https://github.com/humhub/humhub/blob/master/themes/HumHub/ico/manifest.json, when the Humhub instance is installed on https://my-humhub.com/sub-folder
, the manifest.json
is in https://my-humhub.com/sub-folder/themes/HumHub/ico/manifest.json
@marc-farre Can you provide a demo in a sub directory?
@luke- Sent you a message in Humhub community with an example
Has the following line been modified?
https://github.com/humhub/humhub/blob/master/.htaccess.dist#L8
I forgot to mention that the problem was initially reported by @ks7585 on https://community.humhub.com/content/perma?id=271668 Then I tried with my Humhub instance as described in "Step to reproduce" and noticed the same problem.
@ArchBlood good point, but even with RewriteBase
well defined, the app doesn't work.
@luke- do you still need a testing Humhub instance or is it OK with @ks7585 one?
@marc-farre ks7585 already provided one, thanks!
App version 1.0.79, still issues with HumHub instance in a subfolder: communtity.for-example.xyz/dashboard -> works for-example.xyz/dashboard -> works for-example.xyz/community/dashboard – doesn’t work
In this case the regular website content (domains root) is shown, not the HumHub instance in the subfolder.
See also: https://community.humhub.com/comment/perma?id=46440
App version 1.0.79, still issues with HumHub instance in a subfolder: communtity.for-example.xyz/dashboard -> works for-example.xyz/dashboard -> works for-example.xyz/community/dashboard – doesn’t work
In this case the regular website content (domains root) is shown, not the HumHub instance in the subfolder.
See also: https://community.humhub.com/comment/perma?id=46440
An alternative method would be creating a static Uri parse()
or simply use String uri
and not use the current method.
Hey @smashm, the manifest for the sub-folder instance does not exist on for-example.xyz/community/manifest.json
but it does exist on for-example.xyz/manifest.json
inside the manifest the start URL is https://for-example.xyz/dashboard
this url now redirects the app to the https://for-example.xyz/user/auth/login
, is this perceived as a correct behavior?
https://github.com/humhub/app/assets/10835179/b552693f-cd71-41d7-8a6c-3f5a993c7f0c
Hey @smashm, could you please approve my registration on for-example.xyz
so I can look into the problem? Thanks! My registration email is primozratej@gmail.com
.
If there is no problem on the issue, I'm closing it for now. We can reopen if needed.
@luke- I think we should reopen this issue as it's not fixed.
I've tested by moving a HumHub instance into a test
subfolder:
If I add a /
or /dashboard
at the end of the URL, this is what I see:
I've also tries adding the test
subfolder here:
And in the .htaccess
file:
@PrimozRatej if you need a testing instance, I can provide you one.
Hey @marc-farre, yes please, I would need a testing instance for debugging.
@PrimozRatej I've installed this instance for you: https://test.cuzy.app/humhub Push Service and Firebase are configured. You can create an account if needed. If you need an FTP access or an admin account, don't hesitate to ask.
Hey @marc-farre, I tried to register the account, but I didn't get redirected from the login page, nor did I receive any registration redirect URL in the email.
Hey @marc-farre, I tried to register the account, but I didn't get redirected from the login page, nor did I receive any registration redirect URL in the email.
Sorry, outgoing email wasn't configured... It's working now!
Sorry, outgoing email wasn't configured... It's working now!
Tnx now it's working.
Maybe the following snippets for the opener_controller.dart
could help slightly;
for (var i = uri.pathSegments.length - 1; i >= 0; i--) {
String urlIn = "${uri.origin}/${uri.pathSegments.getRange(0, i).join('/')}";
asyncData = await APIProvider.of(ref).request(Manifest.get(i != 0 ? urlIn : uri.origin));
if (!asyncData!.hasError) break;
}
if (uri.pathSegments.isEmpty) {
asyncData = await APIProvider.of(ref).request(Manifest.get(uri.origin));
Uri assumeUrl(String url) {
if (url.startsWith("https://") || url.startsWith("http://")) {
// Assume it's a valid URL
return Uri.parse(url);
} else {
// Check if the URL contains a dot (.) and a slash (/)
if (url.contains(".") && url.contains("/")) {
// Assume it's a subdomain
// Add "https://$url" before the url
return Uri.parse("https://$url");
} else {
// Assume it's a subdirectory
// Add "https://$url/" before the url
return Uri.parse("https://$url/");
}
}
I've not ran any tests for this just a suggestion for a possible solution.
In this MR, I altered the approach for locating the manifest.json
file. First, all the potential URLs are generated where we presume the manifest should exist, and subsequently, within a loop, attempt to locate it.
I have included the corresponding tests within /app/test/opener_test.dart
. If you wish to verify the opener procedure for discovering the manifest, utilize the following code snippet, append the URLs relevant to your use case, and proceed to create a PR. Tests are executed during the app build process.
/// TEMPLATE: copy this and change it for your use case
test('Check some HumHum instance URLs', () {
/// [key] represents the opener dialog input string
/// [value] represents the actual manifest.json location
Map<String, String> map = {
"https://test.cuzy.app/humhub": "https://test.cuzy.app/humhub/index.php?r=web%2Fpwa-manifest%2Findex",
"test.cuzy.app/humhub": "https://test.cuzy.app/humhub/index.php?r=web%2Fpwa-manifest%2Findex",
};
testGroupOfURIs(map);
});
@PrimozRatej Thanks!
@marc-farre I've just building v1.0.93 - can you please test against this version?
@PrimozRatej thanks! @luke- it's working well now!
Step to reproduce:
https://my-humhub.com/sub-folder
You get the message "Your Humhub installation does not exist".
Then:
https://my-humhub.com
It works.