Skip to content

Commit 06a9bb7

Browse files
authored
Merge pull request #114 from pdsinterop/feature/nextcloud-25
Fixes for nextcloud 25
2 parents ed06a9e + 1089159 commit 06a9bb7

9 files changed

Lines changed: 52 additions & 46 deletions

File tree

env-vars-server.list

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ ALICE_WEBID=https://server/apps/solid/@alice/profile/card#me
44
COOKIE_TYPE=nextcloud-compatible
55
USERNAME=alice
66
PASSWORD=alice123
7+
PUBSUB_URL=http://pubsub:8080

solid/lib/Controller/PageController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ private function getUserProfile($userId) {
5252
'displayName' => $user->getDisplayName(),
5353
'profileUri' => $this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkToRoute("solid.profile.handleGet", array("userId" => $userId, "path" => "/card"))) . "#me",
5454
'solidNavigation' => array(
55-
"profile" => $this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkToRoute("solid.page.profile", array("userId" => $this->userId))),
55+
"profile" => $this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkToRoute("solid.page.profile", array("userId" => $userId))),
5656
"launcher" => $this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkToRoute("solid.app.appLauncher", array())),
5757
)
5858
);

solid/lib/Controller/ProfileController.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,13 @@ private function getUserProfile($userId) {
274274
$addressBooks = $this->contactsManager->getUserAddressBooks();
275275
$friends = [];
276276
foreach($addressBooks as $k => $v) {
277-
$results = $addressBooks[$k]->search('', ['FN'], ['types' => true]);
278-
foreach($results as $found) {
279-
foreach($found['URL'] as $i => $obj) {
280-
array_push($friends, $obj['value']);
281-
}
277+
$results = $addressBooks[$k]->search('', ['FN'], ['types' => true]);
278+
foreach($results as $found) {
279+
if (isset($found['URL']) && is_array($found['URL'])) {
280+
foreach($found['URL'] as $i => $obj) {
281+
array_push($friends, $obj['value']);
282+
}
283+
}
282284
}
283285
}
284286
if ($user !== null) {

solid/lib/Controller/SolidWebsocketController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ class SolidWebsocketController extends Controller
1414
*/
1515
public function register(): DataResponse
1616
{
17+
// @FIXME: If there is no PUBSUB_URL what should be returned? 404? 500? Yo'mamma? 2023/01/27/BMP
1718
$pubsub = getenv("PUBSUB_URL") ?: "http://pubsub:8080";
19+
1820
return new DataResponse([
1921
"@context" => "https://www.w3.org/ns/solid/notification/v1",
2022
"type" => "WebSocketSubscription2021",

solid/lib/Middleware/SolidCorsMiddleware.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ public function afterController($controller, $methodName, Response $response) {
3434
$response->addHeader('Access-Control-Expose-Headers', $corsExposeHeaders);
3535
$response->addHeader('Accept-Patch', 'text/n3');
3636

37-
$pubsub = getenv("PUBSUB_URL") ?: "http://pubsub:8080";
38-
$response->addHeader('updates-via', $pubsub);
37+
$pubsub = getenv("PUBSUB_URL");
38+
if ($pubsub) {
39+
$response->addHeader('updates-via', $pubsub);
40+
}
3941
$linkHeaders = '</.well-known/solid>; rel="http://www.w3.org/ns/solid#storageDescription"';
4042
$existingHeaders = $response->getHeaders();
4143
if (isset($existingHeaders['Link'])) { // careful - this dictionary key is case sensitive here

solid/lib/Notifications/SolidNotifications.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,18 @@ class SolidNotifications implements SolidNotificationsInterface
99
{
1010
private $notifications;
1111
public function __construct() {
12-
$pubsub = getenv("PUBSUB_URL") ?: "http://pubsub:8080";
13-
$this->notifications = [
14-
new SolidWebhook(),
15-
new SolidPubSub($pubsub)
16-
];
12+
13+
$notifications = [
14+
new SolidWebhook(),
15+
];
16+
17+
$pubsub = getenv('PUBSUB_URL');
18+
19+
if ($pubsub) {
20+
$notifications[] = new SolidPubSub($pubsub);
21+
}
22+
23+
$this->notifications = $notifications;
1724
}
1825

1926
public function send($path, $type) {

solid/templates/applauncher.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,12 @@
33
style('solid', 'style');
44
?>
55

6-
<div id="app">
7-
<div id="app-navigation">
8-
<?php print_unescaped($this->inc('navigation/index')); ?>
9-
</div>
6+
<div id="app-navigation">
7+
<?php print_unescaped($this->inc('navigation/index')); ?>
8+
</div>
109

11-
<div id="app-content">
12-
<div id="app-content-wrapper" class="viewcontainer">
13-
<?php print_unescaped($this->inc('applauncher/index')); ?>
14-
</div>
10+
<div id="app-content">
11+
<div id="app-content-wrapper" class="viewcontainer">
12+
<?php print_unescaped($this->inc('applauncher/index')); ?>
1513
</div>
1614
</div>
17-

solid/templates/profile.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,12 @@
33
style('solid', 'style');
44
?>
55

6-
<div id="app">
7-
<div id="app-navigation">
8-
<?php print_unescaped($this->inc('navigation/index')); ?>
9-
</div>
6+
<div id="app-navigation">
7+
<?php print_unescaped($this->inc('navigation/index')); ?>
8+
</div>
109

11-
<div id="app-content">
12-
<div id="app-content-wrapper">
13-
<?php print_unescaped($this->inc('profile/index')); ?>
14-
</div>
10+
<div id="app-content">
11+
<div id="app-content-wrapper">
12+
<?php print_unescaped($this->inc('profile/index')); ?>
1513
</div>
1614
</div>
17-

solid/templates/sharing.php

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,19 @@
22
script('solid', 'script');
33
style('solid', 'style');
44
?>
5-
<div id="app">
6-
<div id="app-navigation">
7-
<?php print_unescaped($this->inc('navigation/index')); ?>
8-
</div>
9-
<div id="app-content">
10-
<div id="app-content-wrapper">
11-
<main class="solid-container">
12-
<form action="" method="POST">
13-
<h1><?php p($_['clientName']); ?> is requesting your consent to use <?php p($_['serverName']); ?> as an identity provider</h1>
14-
<input type="hidden" name="returnUrl" value="<?php p($_['returnUrl']); ?>">
15-
<button name="approval" value="allow">Allow</button>
16-
<button name="approval" value="deny">Deny</button>
17-
</form>
18-
</main>
19-
</div>
5+
<div id="app-navigation">
6+
<?php print_unescaped($this->inc('navigation/index')); ?>
7+
</div>
8+
<div id="app-content">
9+
<div id="app-content-wrapper">
10+
<main class="solid-container">
11+
<form action="" method="POST">
12+
<h1><?php p($_['clientName']); ?> is requesting your consent to use <?php p($_['serverName']); ?> as an identity provider</h1>
13+
<input type="hidden" name="returnUrl" value="<?php p($_['returnUrl']); ?>">
14+
<button name="approval" value="allow">Allow</button>
15+
<button name="approval" value="deny">Deny</button>
16+
</form>
17+
</main>
2018
</div>
2119
</div>
2220

0 commit comments

Comments
 (0)