summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2024-04-12 14:41:53 +0200
committerJoas Schilling <coding@schilljs.com>2024-04-12 14:49:09 +0200
commitcc4e29258c824e59fe8116fad391ec07070487dc (patch)
tree117b457ada1f918f15e20fd4ccdc43c81bf73266
parenta2bc199716d73bf5e7b91d40bc6227f57dac1026 (diff)
fix(chat): Remove commands
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--appinfo/info.xml9
-rw-r--r--appinfo/routes.php1
-rw-r--r--appinfo/routes/routesCommandController.php35
-rw-r--r--docs/commands.md99
-rw-r--r--docs/events.md11
-rw-r--r--docs/index.md1
-rw-r--r--docs/occ.md77
-rw-r--r--lib/AppInfo/Application.php7
-rw-r--r--lib/Chat/ChatManager.php4
-rw-r--r--lib/Chat/Command/Executor.php200
-rw-r--r--lib/Chat/Command/Listener.php117
-rw-r--r--lib/Chat/Command/ShellExecutor.php76
-rw-r--r--lib/Chat/Parser/Command.php10
-rw-r--r--lib/Command/Command/Add.php119
-rw-r--r--lib/Command/Command/AddSamples.php130
-rw-r--r--lib/Command/Command/Delete.php65
-rw-r--r--lib/Command/Command/ListCommand.php62
-rw-r--r--lib/Command/Command/TRenderCommand.php56
-rw-r--r--lib/Command/Command/Update.php125
-rw-r--r--lib/Controller/CommandController.php59
-rw-r--r--lib/Events/CommandEvent.php72
-rw-r--r--lib/Flow/Operation.php1
-rw-r--r--lib/Migration/CreateHelpCommand.php68
-rw-r--r--lib/Model/Command.php92
-rw-r--r--lib/Model/CommandMapper.php100
-rw-r--r--lib/Service/CommandService.php240
-rw-r--r--lib/Settings/Admin/AdminSettings.php14
-rw-r--r--mkdocs.yml2
-rw-r--r--sample-commands/calc.sh28
-rw-r--r--sample-commands/hackernews.php75
-rw-r--r--sample-commands/wikipedia.php87
-rw-r--r--src/components/AdminSettings/Commands.vue144
-rw-r--r--src/components/MessagesList/MessagesList.vue2
-rw-r--r--src/store/conversationsStore.js8
-rw-r--r--src/store/conversationsStore.spec.js22
-rw-r--r--src/views/AdminSettings.vue3
-rw-r--r--templates/settings/admin-settings.php8
-rw-r--r--tests/psalm-baseline.xml55
38 files changed, 40 insertions, 2244 deletions
diff --git a/appinfo/info.xml b/appinfo/info.xml
index 803a42acb..952b62fe7 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -73,13 +73,9 @@ And in the works for the [coming versions](https://github.com/nextcloud/spreed/m
<step>OCA\Talk\Migration\FixNamespaceInDatabaseTables</step>
</pre-migration>
<post-migration>
- <step>OCA\Talk\Migration\CreateHelpCommand</step>
<step>OCA\Talk\Migration\ClearResourceAccessCache</step>
<step>OCA\Talk\Migration\CacheUserDisplayNames</step>
</post-migration>
- <install>
- <step>OCA\Talk\Migration\CreateHelpCommand</step>
- </install>
</repair-steps>
<commands>
@@ -89,11 +85,6 @@ And in the works for the [coming versions](https://github.com/nextcloud/spreed/m
<command>OCA\Talk\Command\Bot\State</command>
<command>OCA\Talk\Command\Bot\Setup</command>
<command>OCA\Talk\Command\Bot\Uninstall</command>
- <command>OCA\Talk\Command\Command\Add</command>
- <command>OCA\Talk\Command\Command\AddSamples</command>
- <command>OCA\Talk\Command\Command\Delete</command>
- <command>OCA\Talk\Command\Command\ListCommand</command>
- <command>OCA\Talk\Command\Command\Update</command>
<command>OCA\Talk\Command\Developer\UpdateDocs</command>
<command>OCA\Talk\Command\Monitor\Calls</command>
<command>OCA\Talk\Command\Monitor\HasActiveCalls</command>
diff --git a/appinfo/routes.php b/appinfo/routes.php
index be859e962..3713ff1b2 100644
--- a/appinfo/routes.php
+++ b/appinfo/routes.php
@@ -31,7 +31,6 @@ return array_merge_recursive(
include(__DIR__ . '/routes/routesCallController.php'),
include(__DIR__ . '/routes/routesCertificateController.php'),
include(__DIR__ . '/routes/routesChatController.php'),
- include(__DIR__ . '/routes/routesCommandController.php'),
include(__DIR__ . '/routes/routesFederationController.php'),
include(__DIR__ . '/routes/routesFilesIntegrationController.php'),
include(__DIR__ . '/routes/routesGuestController.php'),
diff --git a/appinfo/routes/routesCommandController.php b/appinfo/routes/routesCommandController.php
deleted file mode 100644
index 834032847..000000000
--- a/appinfo/routes/routesCommandController.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-declare(strict_types=1);
-/**
- * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
- *
- * @author Lukas Reschke <lukas@statuscode.ch>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * 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
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-$requirements = [
- 'apiVersion' => '(v1)',
-];
-
-return [
- 'ocs' => [
- /** @see \OCA\Talk\Controller\CommandController::index() */
- ['name' => 'Command#index', 'url' => '/api/{apiVersion}/command', 'verb' => 'GET', 'requirements' => $requirements],
- ],
-];
diff --git a/docs/commands.md b/docs/commands.md
index 629abb682..9af511510 100644
--- a/docs/commands.md
+++ b/docs/commands.md
@@ -2,101 +2,4 @@
!!! warning
- **Deprecation:** Commands are deprecated in favor of [Bots](bots.md).
-
----
-
-!!! note
-
- For security reasons commands can only be added via the
- command line. `./occ talk:command:add --help` gives you
- a short overview of the required arguments, but they are
- explained here in more depth.
-
----
-
-## "Add command" arguments
-
-| Argument | Allowed chars | Description |
-|------------|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| `cmd` | [a-z0-9] | The keyword the user has to type to run this command (min. 1, max. 64 characters) |
-| `name` | * | The author name of the response that is posted by the command (min. 1, max. 64 characters) |
-| `script` | * | Actual command that is being ran. The script must be executable by the user of your webserver and has to use absolute paths only! See the parameter table below for options. The script is invoked with `--help` as argument on set up, to check if it can be executed correctly. |
-| `response` | 0-2 | Who should see the response: 0 - No one, 1 - User who executed the command, 2 - Everyone |
-| `enabled` | 0-3 | Who can use the command: 0 - No one, 1 - Moderators of the room, 2 - Logged in users, 3 - Everyone |
-
-## Script parameter
-
-| Parameter | Description |
-|---------------|----------------------------------------------------|
-| `{ROOM}` | The token of the room the command was used in |
-| `{USER}` | ID of the user that called the command |
-| `{ARGUMENTS}` | Everything the user write after the actual command |
-
-## Example
-
-### Create `/path/to/calc.sh`
-
-```
- while test $# -gt 0; do
- case "$1" in
- --help)
- echo "/calc - A Nextcloud Talk chat wrapper for gnome-calculator"
- echo " "
- echo "Simple equations: /calc 3 + 4 * 5"
- echo "Complex equations: /calc sin(3) + 3^3 * sqrt(5)"
- exit 0
- ;;
- *)
- break
- ;;
- esac
- done
-
- set -f
- echo "$@ ="
- echo $(gnome-calculator --solve="$@")
-```
-
-Please note, that your command should also understand the argument `--help`.
-It should return a useful description, the first line is also displayed in a list of all commands when the user just types `/help`.
-
-### Register command
-
-
-Make sure to use the absolute path to your script when registering the command:
-
-```
-./occ talk:command:add calculator calculator "/path/to/calc.sh {ARGUMENTS} {ROOM} {USER}" 1 3
-```
-
-### Explanation
-* User input by user `my user id` in the chat of room `index.php/call/4tf349j`:
-
- ```
- /calculator 1 + 2 + 3 + "hello"
- ```
-
-
-* Executed shell command:
-
- ```
- /path/to/calc.sh '1 + 2 + 3 + "hello"' '4tf349j' 'my user id'
- ```
-
-## Aliases
-
-It is also possible to define an alias for a command. This allows e.g. to get the `/help` command also with the german word `/hilfe`.
-
-An alias for the `/calculator` command from above could be created using the following command:
-
-```
-./occ talk:command:add calc calculator "alias:calculator" 1 3
-```
-
-Now `/calculator 1 + 2 + 3` and `/calc 1 + 2 + 3` result in the same message.
-
-
-!!! note
-
- The enabled and response flag of the alias are ignored and the flags of the original command will be used and respected.
+ **Deprecation:** Commands have been removed in favor of [Bots](bots.md).
diff --git a/docs/events.md b/docs/events.md
index ea6bd421e..f71b82fce 100644
--- a/docs/events.md
+++ b/docs/events.md
@@ -156,17 +156,6 @@ listen to the `OCA\Talk\Events\SystemMessagesMultipleSentEvent` event instead.
* Since: 18.0.0
* Since: 19.0.0 - Method `getParent()` was added
-### Deprecated events
-
-These events were not using the typed-event mechanism and are therefore deprecated and will be removed in a future version.
-
-#### Command execution for apps
-
-* Event class: `OCA\Talk\Events\CommandEvent`
-* Event name: `OCA\Talk\Chat\Command\Executor::EVENT_APP_EXECUTE`
-* Since: 8.0.0
-* Deprecated: 17.0.0 - Commands are deprecated, please migrate to bots instead
-
## Other events
### Turn servers get
diff --git a/docs/index.md b/docs/index.md
index 5d046a66e..86c9fa97c 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -17,7 +17,6 @@
* [Call experience](call-experience.md)
* [Occ commands](occ.md)
* [Bots](bot-list.md)
-* [Commands (deprecated)](commands.md)
* [Matterbridge integration](matterbridge.md)
## Developer documentation
diff --git a/docs/occ.md b/docs/occ.md
index 04dacdaf0..f6fe0b066 100644
--- a/docs/occ.md
+++ b/docs/occ.md
@@ -106,83 +106,6 @@ Uninstall a bot from the server
| `--output` | Output format (plain, json or json_pretty, default is plain) | yes | no | no | `'plain'` |
| `--url` | The URL of the bot (required when no ID is given, ignored otherwise) | yes | yes | no | *Required* |
-## talk:command:add
-