From 7452d01d75270888ff207108898a0602ffc01b70 Mon Sep 17 00:00:00 2001 From: Yvo Brevoort Date: Fri, 4 Oct 2024 10:16:02 +0200 Subject: [PATCH] replace @ with ~ in urls --- solid/appinfo/routes.php | 48 +++++++++---------- solid/lib/Controller/CalendarController.php | 4 +- solid/lib/Controller/ContactsController.php | 4 +- solid/lib/Controller/ProfileController.php | 4 +- .../lib/Controller/SolidWebhookController.php | 12 ++--- solid/lib/Controller/StorageController.php | 4 +- 6 files changed, 38 insertions(+), 38 deletions(-) diff --git a/solid/appinfo/routes.php b/solid/appinfo/routes.php index c996d701..1140a88f 100644 --- a/solid/appinfo/routes.php +++ b/solid/appinfo/routes.php @@ -9,11 +9,11 @@ */ return [ 'routes' => [ - ['name' => 'page#profile', 'url' => '/@{userId}/', 'verb' => 'GET'], + ['name' => 'page#profile', 'url' => '/~{userId}/', 'verb' => 'GET'], ['name' => 'page#approval', 'url' => '/sharing/{clientId}', 'verb' => 'GET'], ['name' => 'page#handleRevoke', 'url' => '/revoke/{clientId}', 'verb' => 'GET'], ['name' => 'page#handleApproval', 'url' => '/sharing/{clientId}', 'verb' => 'POST'], - ['name' => 'page#dataJson', 'url' => '/@{userId}/data.json', 'verb' => 'GET' ], + ['name' => 'page#dataJson', 'url' => '/~{userId}/data.json', 'verb' => 'GET' ], ['name' => 'server#cors', 'url' => '/{path}', 'verb' => 'OPTIONS', 'requirements' => array('path' => '.+') ], ['name' => 'server#authorize', 'url' => '/authorize', 'verb' => 'GET'], @@ -25,31 +25,31 @@ ['name' => 'server#register', 'url' => '/register', 'verb' => 'POST'], ['name' => 'server#registeredClient', 'url' => '/register/{clientId}', 'verb' => 'GET'], - ['name' => 'profile#handleGet', 'url' => '/@{userId}/profile{path}', 'verb' => 'GET', 'requirements' => array('path' => '.+')], - ['name' => 'profile#handlePut', 'url' => '/@{userId}/profile{path}', 'verb' => 'PUT', 'requirements' => array('path' => '.+')], - ['name' => 'profile#handlePatch', 'url' => '/@{userId}/profile{path}', 'verb' => 'PATCH', 'requirements' => array('path' => '.+')], - ['name' => 'profile#handleHead', 'url' => '/@{userId}/profile{path}', 'verb' => 'HEAD', 'requirements' => array('path' => '.+')], + ['name' => 'profile#handleGet', 'url' => '/~{userId}/profile{path}', 'verb' => 'GET', 'requirements' => array('path' => '.+')], + ['name' => 'profile#handlePut', 'url' => '/~{userId}/profile{path}', 'verb' => 'PUT', 'requirements' => array('path' => '.+')], + ['name' => 'profile#handlePatch', 'url' => '/~{userId}/profile{path}', 'verb' => 'PATCH', 'requirements' => array('path' => '.+')], + ['name' => 'profile#handleHead', 'url' => '/~{userId}/profile{path}', 'verb' => 'HEAD', 'requirements' => array('path' => '.+')], - ['name' => 'storage#handleGet', 'url' => '/@{userId}/storage{path}', 'verb' => 'GET', 'requirements' => array('path' => '.+')], - ['name' => 'storage#handlePost', 'url' => '/@{userId}/storage{path}', 'verb' => 'POST', 'requirements' => array('path' => '.+')], - ['name' => 'storage#handlePut', 'url' => '/@{userId}/storage{path}', 'verb' => 'PUT', 'requirements' => array('path' => '.+')], - ['name' => 'storage#handleDelete', 'url' => '/@{userId}/storage{path}', 'verb' => 'DELETE', 'requirements' => array('path' => '.+')], - ['name' => 'storage#handlePatch', 'url' => '/@{userId}/storage{path}', 'verb' => 'PATCH', 'requirements' => array('path' => '.+')], - ['name' => 'storage#handleHead', 'url' => '/@{userId}/storage{path}', 'verb' => 'HEAD', 'requirements' => array('path' => '.+')], + ['name' => 'storage#handleGet', 'url' => '/~{userId}/storage{path}', 'verb' => 'GET', 'requirements' => array('path' => '.+')], + ['name' => 'storage#handlePost', 'url' => '/~{userId}/storage{path}', 'verb' => 'POST', 'requirements' => array('path' => '.+')], + ['name' => 'storage#handlePut', 'url' => '/~{userId}/storage{path}', 'verb' => 'PUT', 'requirements' => array('path' => '.+')], + ['name' => 'storage#handleDelete', 'url' => '/~{userId}/storage{path}', 'verb' => 'DELETE', 'requirements' => array('path' => '.+')], + ['name' => 'storage#handlePatch', 'url' => '/~{userId}/storage{path}', 'verb' => 'PATCH', 'requirements' => array('path' => '.+')], + ['name' => 'storage#handleHead', 'url' => '/~{userId}/storage{path}', 'verb' => 'HEAD', 'requirements' => array('path' => '.+')], - ['name' => 'calendar#handleGet', 'url' => '/@{userId}/calendar{path}', 'verb' => 'GET', 'requirements' => array('path' => '.+')], - ['name' => 'calendar#handlePost', 'url' => '/@{userId}/calendar{path}', 'verb' => 'POST', 'requirements' => array('path' => '.+')], - ['name' => 'calendar#handlePut', 'url' => '/@{userId}/calendar{path}', 'verb' => 'PUT', 'requirements' => array('path' => '.+')], - ['name' => 'calendar#handleDelete', 'url' => '/@{userId}/calendar{path}', 'verb' => 'DELETE', 'requirements' => array('path' => '.+')], - ['name' => 'calendar#handlePatch', 'url' => '/@{userId}/calendar{path}', 'verb' => 'PATCH', 'requirements' => array('path' => '.+')], - ['name' => 'calendar#handleHead', 'url' => '/@{userId}/calendar{path}', 'verb' => 'HEAD', 'requirements' => array('path' => '.+')], + ['name' => 'calendar#handleGet', 'url' => '/~{userId}/calendar{path}', 'verb' => 'GET', 'requirements' => array('path' => '.+')], + ['name' => 'calendar#handlePost', 'url' => '/~{userId}/calendar{path}', 'verb' => 'POST', 'requirements' => array('path' => '.+')], + ['name' => 'calendar#handlePut', 'url' => '/~{userId}/calendar{path}', 'verb' => 'PUT', 'requirements' => array('path' => '.+')], + ['name' => 'calendar#handleDelete', 'url' => '/~{userId}/calendar{path}', 'verb' => 'DELETE', 'requirements' => array('path' => '.+')], + ['name' => 'calendar#handlePatch', 'url' => '/~{userId}/calendar{path}', 'verb' => 'PATCH', 'requirements' => array('path' => '.+')], + ['name' => 'calendar#handleHead', 'url' => '/~{userId}/calendar{path}', 'verb' => 'HEAD', 'requirements' => array('path' => '.+')], - ['name' => 'contacts#handleGet', 'url' => '/@{userId}/contacts{path}', 'verb' => 'GET', 'requirements' => array('path' => '.+')], - ['name' => 'contacts#handlePost', 'url' => '/@{userId}/contacts{path}', 'verb' => 'POST', 'requirements' => array('path' => '.+')], - ['name' => 'contacts#handlePut', 'url' => '/@{userId}/contacts{path}', 'verb' => 'PUT', 'requirements' => array('path' => '.+')], - ['name' => 'contacts#handleDelete', 'url' => '/@{userId}/contacts{path}', 'verb' => 'DELETE', 'requirements' => array('path' => '.+')], - ['name' => 'contacts#handlePatch', 'url' => '/@{userId}/contacts{path}', 'verb' => 'PATCH', 'requirements' => array('path' => '.+')], - ['name' => 'contacts#handleHead', 'url' => '/@{userId}/contacts{path}', 'verb' => 'HEAD', 'requirements' => array('path' => '.+')], + ['name' => 'contacts#handleGet', 'url' => '/~{userId}/contacts{path}', 'verb' => 'GET', 'requirements' => array('path' => '.+')], + ['name' => 'contacts#handlePost', 'url' => '/~{userId}/contacts{path}', 'verb' => 'POST', 'requirements' => array('path' => '.+')], + ['name' => 'contacts#handlePut', 'url' => '/~{userId}/contacts{path}', 'verb' => 'PUT', 'requirements' => array('path' => '.+')], + ['name' => 'contacts#handleDelete', 'url' => '/~{userId}/contacts{path}', 'verb' => 'DELETE', 'requirements' => array('path' => '.+')], + ['name' => 'contacts#handlePatch', 'url' => '/~{userId}/contacts{path}', 'verb' => 'PATCH', 'requirements' => array('path' => '.+')], + ['name' => 'contacts#handleHead', 'url' => '/~{userId}/contacts{path}', 'verb' => 'HEAD', 'requirements' => array('path' => '.+')], ['name' => 'solidWebhook#listWebhooks', 'url' => '/webhook/list', 'verb' => 'GET'], ['name' => 'solidWebhook#register', 'url' => '/webhook/register', 'verb' => 'POST'], diff --git a/solid/lib/Controller/CalendarController.php b/solid/lib/Controller/CalendarController.php index c06bab02..14017af5 100644 --- a/solid/lib/Controller/CalendarController.php +++ b/solid/lib/Controller/CalendarController.php @@ -186,8 +186,8 @@ public function handlePut() { // $userId, $path) { // throw an error about accessing put twice, so we will find out the userId and path from $_SERVER instead; // because we got here, the request uri should look like: - // /index.php/apps/solid/@{userId}/storage{path} - $pathInfo = explode("@", $_SERVER['REQUEST_URI']); + // /index.php/apps/solid/~{userId}/storage{path} + $pathInfo = explode("~", $_SERVER['REQUEST_URI']); $pathInfo = explode("/", $pathInfo[1], 2); $userId = $pathInfo[0]; $path = $pathInfo[1]; diff --git a/solid/lib/Controller/ContactsController.php b/solid/lib/Controller/ContactsController.php index ff07c425..b720da9f 100644 --- a/solid/lib/Controller/ContactsController.php +++ b/solid/lib/Controller/ContactsController.php @@ -187,8 +187,8 @@ public function handlePut() { // $userId, $path) { // throw an error about accessing put twice, so we will find out the userId and path from $_SERVER instead; // because we got here, the request uri should look like: - // /index.php/apps/solid/@{userId}/storage{path} - $pathInfo = explode("@", $_SERVER['REQUEST_URI']); + // /index.php/apps/solid/~{userId}/storage{path} + $pathInfo = explode("~", $_SERVER['REQUEST_URI']); $pathInfo = explode("/", $pathInfo[1], 2); $userId = $pathInfo[0]; $path = $pathInfo[1]; diff --git a/solid/lib/Controller/ProfileController.php b/solid/lib/Controller/ProfileController.php index 67cfc7da..edc0f2c2 100644 --- a/solid/lib/Controller/ProfileController.php +++ b/solid/lib/Controller/ProfileController.php @@ -207,8 +207,8 @@ public function handlePut() { // $userId, $path) { // throw an error about accessing put twice, so we will find out the userId and path from $_SERVER instead; // because we got here, the request uri should look like: - // /index.php/apps/solid/@{userId}/storage{path} - $pathInfo = explode("@", $_SERVER['REQUEST_URI']); + // /index.php/apps/solid/~{userId}/storage{path} + $pathInfo = explode("~", $_SERVER['REQUEST_URI']); $pathInfo = explode("/", $pathInfo[1], 2); $userId = $pathInfo[0]; $path = $pathInfo[1]; diff --git a/solid/lib/Controller/SolidWebhookController.php b/solid/lib/Controller/SolidWebhookController.php index 6a88a81e..f6a1cc66 100644 --- a/solid/lib/Controller/SolidWebhookController.php +++ b/solid/lib/Controller/SolidWebhookController.php @@ -162,13 +162,13 @@ private function initializeStorage($userId) { } private function parseTopic($topic) { - // topic = https://nextcloud.server/solid/@alice/storage/foo/bar + // topic = https://nextcloud.server/solid/~alice/storage/foo/bar $appBaseUrl = $this->getAppBaseUrl(); // https://nextcloud.server/solid/ - $internalUrl = str_replace($appBaseUrl, '', $topic); // @alice/storage/foo/bar + $internalUrl = str_replace($appBaseUrl, '', $topic); // ~alice/storage/foo/bar $pathicles = explode("/", $internalUrl); - $userId = $pathicles[0]; // @alice - $userId = preg_replace("/^@/", "", $userId); // alice - $storageUrl = $this->getStorageUrl($userId); // https://nextcloud.server/solid/@alice/storage/ + $userId = $pathicles[0]; // ~alice + $userId = preg_replace("/^~/", "", $userId); // alice + $storageUrl = $this->getStorageUrl($userId); // https://nextcloud.server/solid/~alice/storage/ $storagePath = str_replace($storageUrl, '/', $topic); // /foo/bar return array( "userId" => $userId, @@ -194,7 +194,7 @@ private function createGetRequest($topic) { } private function checkReadAccess($topic) { - // split out $topic into $userId and $path https://nextcloud.server/solid/@alice/storage/foo/bar + // split out $topic into $userId and $path https://nextcloud.server/solid/~alice/storage/foo/bar // - userId in this case is the pod owner (not the one doing the request). (alice) // - path is the path within the storage pod (/foo/bar) $target = $this->parseTopic($topic); diff --git a/solid/lib/Controller/StorageController.php b/solid/lib/Controller/StorageController.php index 36f68513..dfa9cf48 100644 --- a/solid/lib/Controller/StorageController.php +++ b/solid/lib/Controller/StorageController.php @@ -379,8 +379,8 @@ public function handlePut() { // $userId, $path) { // throw an error about accessing put twice, so we will find out the userId and path from $_SERVER instead; // because we got here, the request uri should look like: - // /index.php/apps/solid/@{userId}/storage{path} - $pathInfo = explode("@", $_SERVER['REQUEST_URI']); + // /index.php/apps/solid/~{userId}/storage{path} + $pathInfo = explode("~", $_SERVER['REQUEST_URI']); $pathInfo = explode("/", $pathInfo[1], 2); $userId = $pathInfo[0]; $path = $pathInfo[1];