Skip to content

Commit

Permalink
Merge pull request #123 from humhub/119-humhub-instances-in-a-sub-fol…
Browse files Browse the repository at this point in the history
…der-are-not-reconized

Use startUrl instead baseUrl
  • Loading branch information
luke- committed Oct 19, 2023
2 parents f8f89a8 + 5546ff6 commit 951b5e9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions lib/util/opener_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ class OpenerController {
if (uri.pathSegments.isEmpty) {
asyncData = await APIProvider.of(ref).request(Manifest.get(uri.origin));
}
await checkHumHubModuleView(uri);
if(asyncData!.hasError) return;
await checkHumHubModuleView(asyncData!.value!.startUrl);
}

checkHumHubModuleView(Uri uri) async {
checkHumHubModuleView(String url) async {
Response? response;
response = await http.Client().get(Uri.parse(uri.origin)).catchError((err) {
response = await http.Client().get(Uri.parse(url)).catchError((err) {
return Response("Found manifest but not humhub.modules.ui.view tag", 404);
});

Expand Down
2 changes: 1 addition & 1 deletion lib/util/providers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class HumHubNotifier extends ChangeNotifier {

_updateSafeStorage() async {
final jsonString = json.encode(_humHubInstance.toJson());
String lastUrl = _humHubInstance.manifest != null ? _humHubInstance.manifest!.baseUrl : await getLastUrl();
String lastUrl = _humHubInstance.manifest != null ? _humHubInstance.manifest!.startUrl : await getLastUrl();
await _storage.write(key: StorageKeys.humhubInstance, value: jsonString);
await _storage.write(key: StorageKeys.lastInstanceUrl, value: lastUrl);
}
Expand Down

0 comments on commit 951b5e9

Please sign in to comment.