-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28858 from owncloud/stable10-untangle
[stable10] Untangle fed sharing inter-app dependencies
- Loading branch information
Showing
19 changed files
with
314 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
/** | ||
* @author Björn Schießle <[email protected]> | ||
* @author Joas Schilling <[email protected]> | ||
* @author Jörn Friedrich Dreyer <[email protected]> | ||
* | ||
* @copyright Copyright (c) 2017, ownCloud GmbH | ||
* @license AGPL-3.0 | ||
|
@@ -23,6 +24,8 @@ | |
$app = new \OCA\FederatedFileSharing\AppInfo\Application('federatedfilesharing'); | ||
|
||
use OCA\FederatedFileSharing\Notifier; | ||
use OCP\Share\Events\AcceptShare; | ||
use OCP\Share\Events\DeclineShare; | ||
|
||
$manager = \OC::$server->getNotificationManager(); | ||
$manager->registerNotifier(function() { | ||
|
@@ -36,3 +39,36 @@ | |
'name' => $l->t('Federated sharing'), | ||
]; | ||
}); | ||
|
||
// add 'Add to your ownCloud' button to public pages | ||
// FIXME the OCA\Files::loadAdditionalScripts event is only fired by the ViewController of the files app ... but we are nowadays using webdav. | ||
// FIXME versions, comments, tags and sharing ui still uses it https://github.com/owncloud/core/search?utf8=%E2%9C%93&q=loadAdditionalScripts&type= | ||
OCP\Util::connectHook('OCP\Share', 'share_link_access', 'OCA\FederatedFileSharing\HookHandler', 'loadPublicJS'); | ||
|
||
// react to accept and decline share events | ||
$eventDispatcher = \OC::$server->getEventDispatcher(); | ||
$eventDispatcher->addListener( | ||
AcceptShare::class, | ||
function(AcceptShare $event) use ($app) { | ||
/** @var \OCA\FederatedFileSharing\Notifications $notifications */ | ||
$notifications = $app->getContainer()->query('OCA\FederatedFileSharing\Notifications'); | ||
$notifications->sendAcceptShare( | ||
$event->getRemote(), | ||
$event->getRemoteId(), | ||
$event->getShareToken() | ||
); | ||
} | ||
); | ||
|
||
$eventDispatcher->addListener( | ||
DeclineShare::class, | ||
function(DeclineShare $event) use ($app) { | ||
/** @var \OCA\FederatedFileSharing\Notifications $notifications */ | ||
$notifications = $app->getContainer()->query('OCA\FederatedFileSharing\Notifications'); | ||
$notifications->sendDeclineShare( | ||
$event->getRemote(), | ||
$event->getRemoteId(), | ||
$event->getShareToken() | ||
); | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
$(document).ready(function() { | ||
$('#header #details').prepend( | ||
'<span id="save">' + | ||
' <button id="save-button">'+t('files_sharing', 'Add to your ownCloud')+'</button>' + | ||
' <form class="save-form hidden" action="#">' + | ||
' <input type="text" id="remote_address" placeholder="example.com/owncloud"/>' + | ||
' <button id="save-button-confirm" class="icon-confirm svg" disabled></button>' + | ||
' </form>' + | ||
'</span>'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
/** | ||
* @author Jörn Friedrich Dreyer <[email protected]> | ||
* | ||
* @copyright Copyright (c) 2017, ownCloud GmbH | ||
* @license AGPL-3.0 | ||
* | ||
* This code is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License, version 3, | ||
* as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License, version 3, | ||
* along with this program. If not, see <http://www.gnu.org/licenses/> | ||
* | ||
*/ | ||
|
||
namespace OCA\FederatedFileSharing; | ||
|
||
/** | ||
* Class HookHandler | ||
* | ||
* handles hooks | ||
* | ||
* @package OCA\FederatedFileSharing | ||
*/ | ||
class HookHandler { | ||
|
||
public static function loadPublicJS () { | ||
\OCP\Util::addScript('federatedfilesharing', 'public'); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
/** | ||
* @author Björn Schießle <[email protected]> | ||
* @author Joas Schilling <[email protected]> | ||
* @author Jörn Friedrich Dreyer <[email protected]> | ||
* @author Lukas Reschke <[email protected]> | ||
* @author Robin Appelman <[email protected]> | ||
* @author Roeland Jago Douma <[email protected]> | ||
|
@@ -26,15 +27,13 @@ | |
|
||
namespace OCA\Files_Sharing\AppInfo; | ||
|
||
use OCA\FederatedFileSharing\DiscoveryManager; | ||
use OCA\Files_Sharing\MountProvider; | ||
use OCP\AppFramework\App; | ||
use OC\AppFramework\Utility\SimpleContainer; | ||
use OCA\Files_Sharing\Controllers\ExternalSharesController; | ||
use OCA\Files_Sharing\Controllers\ShareController; | ||
use OCA\Files_Sharing\Middleware\SharingCheckMiddleware; | ||
use \OCP\IContainer; | ||
use OCA\Files_Sharing\Capabilities; | ||
|
||
class Application extends App { | ||
public function __construct(array $urlParams = []) { | ||
|
@@ -47,7 +46,6 @@ public function __construct(array $urlParams = []) { | |
* Controllers | ||
*/ | ||
$container->registerService('ShareController', function (SimpleContainer $c) use ($server) { | ||
$federatedSharingApp = new \OCA\FederatedFileSharing\AppInfo\Application('federatedfilesharing'); | ||
return new ShareController( | ||
$c->query('AppName'), | ||
$c->query('Request'), | ||
|
@@ -59,8 +57,7 @@ public function __construct(array $urlParams = []) { | |
$server->getShareManager(), | ||
$server->getSession(), | ||
$server->getPreviewManager(), | ||
$server->getRootFolder(), | ||
$federatedSharingApp->getFederatedShareProvider() | ||
$server->getRootFolder() | ||
); | ||
}); | ||
$container->registerService('ExternalSharesController', function (SimpleContainer $c) { | ||
|
@@ -81,17 +78,12 @@ public function __construct(array $urlParams = []) { | |
$container->registerService('ExternalManager', function (SimpleContainer $c) use ($server) { | ||
$user = $server->getUserSession()->getUser(); | ||
$uid = $user ? $user->getUID() : null; | ||
$discoveryManager = new DiscoveryManager( | ||
\OC::$server->getMemCacheFactory(), | ||
\OC::$server->getHTTPClientService() | ||
); | ||
return new \OCA\Files_Sharing\External\Manager( | ||
$server->getDatabaseConnection(), | ||
\OC\Files\Filesystem::getMountManager(), | ||
\OC\Files\Filesystem::getLoader(), | ||
$server->getHTTPHelper(), | ||
$server->getNotificationManager(), | ||
$discoveryManager, | ||
$server->getEventDispatcher(), | ||
$uid | ||
); | ||
}); | ||
|
Oops, something went wrong.