diff options
-rwxr-xr-x[-rw-r--r--] | Makefile | 1 | ||||
-rwxr-xr-x | appinfo/info.xml | 5 | ||||
-rwxr-xr-x[-rw-r--r--] | appinfo/routes.php | 3 | ||||
-rwxr-xr-x | lib/Controller/PageController.php | 29 | ||||
-rwxr-xr-x[-rw-r--r--] | lib/Migration/OldConfigRepairStep.php | 40 |
5 files changed, 78 insertions, 0 deletions
@@ -34,6 +34,7 @@ appstore: clean --exclude=phpunit*xml \ --exclude=tests \ --exclude=vendor/bin \ + --exclude=node_modules \ $(project_dir) $(sign_dir) @echo "Signing…" $(occ) integrity:sign-app --privateKey=$(cert_dir)/$(app_name).key --certificate=$(cert_dir)/$(app_name).crt --path=$(sign_dir)/$(app_name) diff --git a/appinfo/info.xml b/appinfo/info.xml index 2d996877..41f6a3ec 100755 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -37,4 +37,9 @@ <personal>OCA\Wopi\Settings\Personal</personal> <personal-section>OCA\Wopi\Settings\Section</personal-section> </settings> + <repair-steps> + <post-migration> + <step>OCA\Wopi\Migration\OldConfigRepairStep</step> + </post-migration> + </repair-steps> </info> diff --git a/appinfo/routes.php b/appinfo/routes.php index 0451f7d7..ab68a338 100644..100755 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -64,6 +64,9 @@ return [ ['name' => 'templates#getPreview', 'url' => '/template/preview/{fileId}', 'verb' => 'GET'], ['name' => 'templates#add', 'url' => '/template', 'verb' => 'POST'], ['name' => 'templates#delete', 'url' => '/template/{fileId}', 'verb' => 'DELETE'], + + //backwards compatibility + ['name' => 'page#editor', 'url' => '/editor', 'verb' => 'GET'], ], 'ocs' => [ ['name' => 'OCS#create', 'url' => '/api/v1/document', 'verb' => 'POST'], diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php new file mode 100755 index 00000000..ac4a9058 --- /dev/null +++ b/lib/Controller/PageController.php @@ -0,0 +1,29 @@ +<?php +namespace OCA\Wopi\Controller; + +use OCP\AppFramework\Http\RedirectResponse; +use OCP\IRequest; +use OCP\AppFramework\Controller; +use OCP\IURLGenerator; + +class PageController extends Controller { + + private $userId; + /** @var IURLGenerator */ + private $urlGenerator; + + + public function __construct($AppName, IRequest $request, $UserId, IURLGenerator $urlGenerator){ + parent::__construct($AppName, $request); + $this->userId = $UserId; + $this->urlGenerator=$urlGenerator; + } + + /** + * @NoAdminRequired + * @NoCSRFRequired + */ + public function editor($id) { + return new RedirectResponse($this->urlGenerator->getAbsoluteURL('/')); + } +} diff --git a/lib/Migration/OldConfigRepairStep.php b/lib/Migration/OldConfigRepairStep.php index b3d9bbc7..cb1c319a 100644..100755 --- a/lib/Migration/OldConfigRepairStep.php +++ b/lib/Migration/OldConfigRepairStep.php @@ -1 +1,41 @@ <?php +namespace OCA\Wopi\Migration; + +use OCP\IConfig; +use OCP\Migration\IOutput; +use OCP\Migration\IRepairStep; +use OCP\ILogger; + +class OldConfigRepairStep implements IRepairStep { + + /** @var ILogger */ + protected $logger; + /** + * @var IConfig + */ + private $config; + + public function __construct(ILogger $logger, IConfig $config) { + $this->logger = $logger; + $this->config = $config; + } + + /** + * Returns the step's name + */ + public function getName() { + return 'Move old config'; + } + + /** + * @param IOutput $output + */ + public function run(IOutput $output) { + $serverUrl = $this->config->getAppValue('wopi', 'serverUrl'); + if ($serverUrl !== '') + { + $this->config->setAppValue('wopi', 'wopi_url', $serverUrl); + $this->config->deleteAppValue('wopi', 'serverUrl'); + } + } +}
\ No newline at end of file |