|
31 | 31 | use Pdsinterop\Solid\Controller\Profile\ProfileController; |
32 | 32 | use Pdsinterop\Solid\Controller\RegisterController; |
33 | 33 | use Pdsinterop\Solid\Controller\ResourceController; |
| 34 | +use Pdsinterop\Solid\Controller\StorageController; |
34 | 35 | use Pdsinterop\Solid\Controller\TokenController; |
35 | 36 | use Pdsinterop\Solid\Resources\Server as ResourceServer; |
36 | 37 |
|
|
54 | 55 | $container->add(ServerRequestInterface::class, Request::class); |
55 | 56 | $container->add(ResponseInterface::class, Response::class); |
56 | 57 |
|
| 58 | +/* |
57 | 59 | $adapter = new \League\Flysystem\Adapter\Local(__DIR__ . '/../tests/fixtures'); |
58 | 60 | $filesystem = new \League\Flysystem\Filesystem($adapter); |
59 | 61 | $graph = new \EasyRdf_Graph(); |
60 | 62 | $plugin = new \Pdsinterop\Rdf\Flysystem\Plugin\ReadRdf($graph); |
61 | 63 | $filesystem->addPlugin($plugin); |
| 64 | +*/ |
62 | 65 |
|
63 | | -$container->share(FilesystemInterface::class, function () { |
| 66 | +$container->share(FilesystemInterface::class, function () use ($request) { |
64 | 67 | // @FIXME: Filesystem root and the $adapter should be configurable. |
65 | 68 | // Implement this with `$filesystem = \MJRider\FlysystemFactory\create(getenv('STORAGE_ENDPOINT'));` |
66 | 69 | $filesystemRoot = __DIR__ . '/../tests/fixtures'; |
67 | 70 |
|
68 | 71 | $adapter = new \League\Flysystem\Adapter\Local($filesystemRoot); |
69 | 72 |
|
70 | | - $filesystem = new \League\Flysystem\Filesystem($adapter); |
71 | 73 | $graph = new \EasyRdf_Graph(); |
| 74 | + |
| 75 | + // Create Formats objects |
| 76 | + $formats = new \Pdsinterop\Rdf\Formats(); |
| 77 | + |
| 78 | + $serverUri = "https://server" . $request->getServerParams()["REQUEST_URI"]; // FIXME: doublecheck that this is the correct url; |
| 79 | + |
| 80 | + // Create the RDF Adapter |
| 81 | + $rdfAdapter = new \Pdsinterop\Rdf\Flysystem\Adapter\Rdf( |
| 82 | + $adapter, |
| 83 | + $graph, |
| 84 | + $formats, |
| 85 | + $serverUri |
| 86 | + ); |
| 87 | + |
| 88 | + $filesystem = new \League\Flysystem\Filesystem($rdfAdapter); |
| 89 | + |
| 90 | + $filesystem->addPlugin(new \Pdsinterop\Rdf\Flysystem\Plugin\AsMime($formats)); |
| 91 | + |
72 | 92 | $plugin = new \Pdsinterop\Rdf\Flysystem\Plugin\ReadRdf($graph); |
73 | 93 | $filesystem->addPlugin($plugin); |
74 | 94 |
|
|
104 | 124 | OpenidController::class, |
105 | 125 | ProfileController::class, |
106 | 126 | RegisterController::class, |
| 127 | + StorageController::class, |
107 | 128 | TokenController::class, |
108 | 129 | ]; |
109 | 130 |
|
|
170 | 191 |
|
171 | 192 | array_walk($methods, static function ($method) use (&$group) { |
172 | 193 | $group->map($method, '/', AddSlashToPathController::class); |
| 194 | +// $group->map($method, '//', StorageController::class); |
173 | 195 | $group->map($method, '{path:.*}', ResourceController::class); |
174 | 196 | }); |
175 | 197 | })->setScheme($scheme); |
|
0 commit comments