forked from adphi/occweb
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
abdf1777f5 | |||
317c2483d4 | |||
d0c4cd1488 | |||
5a5ba37b69 |
10
README.md
10
README.md
@ -1,10 +1,16 @@
|
|||||||
# OCCWeb terminal
|
# ⚠️ Deprecated ⚠️ OCCWeb terminal
|
||||||
|
|
||||||
### A web terminal for admins to launch Nextcloud's occ commands
|
### A web terminal for admins to launch Nextcloud's occ commands
|
||||||
|
|
||||||
![occweb](https://git.adphi.net/Adphi/OCCWeb/raw/master/appinfo/screenshot.png)
|
![occweb](https://git.adphi.net/Adphi/OCCWeb/raw/master/appinfo/screenshot.png)
|
||||||
|
|
||||||
|
|
||||||
|
## ⚠️ Deprecated ⚠️
|
||||||
|
As nextcloudd has no native support for asynchronous operations, due to the use of php, this aplication is deprecated, and will no longer support the Nextcloud' future versions (19+). I did not find a way to implemement true support for interactive and long running occ tasks in a web terminal whitout introducing addtional dependencies (through websockets, for example), the lack of true asynchronous occ operations can lead to serious alterations of voluminous instances.
|
||||||
|
[This issue](https://github.com/nextcloud/server/issues/16726) may give some hints on why I decided to not support this application anymore.
|
||||||
|
|
||||||
|
And over all of this , I want to say I really dislike, even dispise the overall Nextloud teams communication, the "we are the best", and other "look, we make so many commits", witout fixing good old issues, moving fast forward, "we make more commits than pydio"! what a good point ! your more than 10x their developpers ! What a 'prouesse' !!!
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
Place this app in **nextcloud/apps/**
|
Place this app in **nextcloud/apps/**
|
||||||
@ -13,7 +19,7 @@ Place this app in **nextcloud/apps/**
|
|||||||
|
|
||||||
- The application is not a real interactive terminal and does not support long running tasks.
|
- The application is not a real interactive terminal and does not support long running tasks.
|
||||||
So if your instance is pretty big, commands like `occ files:scan` will time out and fail.
|
So if your instance is pretty big, commands like `occ files:scan` will time out and fail.
|
||||||
- Do not use `occ maintenance:mode -on`, obvious...
|
- Do not use `occ maintenance:mode --on`, obvious...
|
||||||
|
|
||||||
## TODOs:
|
## TODOs:
|
||||||
See [open issues](https://git.adphi.net/Adphi/OCCWeb/issues)
|
See [open issues](https://git.adphi.net/Adphi/OCCWeb/issues)
|
||||||
|
@ -28,11 +28,7 @@
|
|||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
term.echo('\n' + response).resume();
|
term.echo('\n' + response).resume();
|
||||||
}).fail(function (response, code) {
|
}).fail(function (response, code) {
|
||||||
if (response.status === 403) {
|
term.echo('\n' + response).resume();
|
||||||
term.echo(response.responseJSON.error).resume();
|
|
||||||
} else {
|
|
||||||
term.echo('\n[[;red;]Error]\n' + response).resume();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
@ -21,13 +21,13 @@ class OccController extends Controller
|
|||||||
|
|
||||||
private $application;
|
private $application;
|
||||||
private $output;
|
private $output;
|
||||||
private $blacklist;
|
|
||||||
public function __construct(ILogger $logger, $AppName, IRequest $request, $userId)
|
public function __construct(ILogger $logger, $AppName, IRequest $request, $userId)
|
||||||
{
|
{
|
||||||
parent::__construct($AppName, $request);
|
parent::__construct($AppName, $request);
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
$this->userId = $userId;
|
$this->userId = $userId;
|
||||||
$this->blacklist = array("maintenance:mode on");
|
|
||||||
$this->application = new Application(
|
$this->application = new Application(
|
||||||
OC::$server->getConfig(),
|
OC::$server->getConfig(),
|
||||||
OC::$server->getEventDispatcher(),
|
OC::$server->getEventDispatcher(),
|
||||||
@ -58,9 +58,8 @@ class OccController extends Controller
|
|||||||
$this->application->run($input, $this->output);
|
$this->application->run($input, $this->output);
|
||||||
return $this->output->fetch();
|
return $this->output->fetch();
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $ex) {
|
||||||
exceptionHandler($ex);
|
$this->logger->logException($ex);
|
||||||
} catch (Error $ex) {
|
return "error: " . $ex->getMessage();
|
||||||
exceptionHandler($ex);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,10 +70,6 @@ class OccController extends Controller
|
|||||||
public function cmd($command)
|
public function cmd($command)
|
||||||
{
|
{
|
||||||
$this->logger->debug($command);
|
$this->logger->debug($command);
|
||||||
if (in_array($command, $this->blacklist)) {
|
|
||||||
$this->logger->debug("Command blacklist");
|
|
||||||
return new DataResponse(array("error" => "\n".'\u001b[37;41m \u001b[39;49m'."\n".'\u001b[37;41m Command blacklisted. \u001b[39;49m'."\n".'\u001b[37;41m \u001b[39;49m'."\n\n"), 403);
|
|
||||||
}
|
|
||||||
$input = new StringInput($command);
|
$input = new StringInput($command);
|
||||||
$response = $this->run($input);
|
$response = $this->run($input);
|
||||||
$this->logger->debug($response);
|
$this->logger->debug($response);
|
||||||
@ -91,9 +86,3 @@ class OccController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function exceptionHandler($exception)
|
|
||||||
{
|
|
||||||
echo "An unhandled exception has been thrown:" . PHP_EOL;
|
|
||||||
echo $exception;
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user