summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/create-user24
-rwxr-xr-xbin/matrix-commander-login2
2 files changed, 25 insertions, 1 deletions
diff --git a/bin/create-user b/bin/create-user
new file mode 100755
index 0000000..02cb7da
--- /dev/null
+++ b/bin/create-user
@@ -0,0 +1,24 @@
+#!/usr/bin/env php
+
+<?php
+
+$options = getopt("", ["username:", "password:", "server:"]);
+
+foreach (["username", "password", "server"] as $variable) {
+ if (! array_key_exists($variable, $options)) {
+ die("missing $variable");
+ }
+}
+
+file_get_contents("https://$options[server]/_matrix/client/v3/register", false, stream_context_create([
+ "http" => [
+ "header" => ["Content-Type: application/json"],
+ "method" => "POST",
+ "content" => json_encode([
+ "device_id" => "matrix-php-cli",
+ "inhibit_login" => true,
+ "password" => $options["password"],
+ "username" => $options["username"],
+ ]),
+ ]
+]));
diff --git a/bin/matrix-commander-login b/bin/matrix-commander-login
index 42fb81e..350ade3 100755
--- a/bin/matrix-commander-login
+++ b/bin/matrix-commander-login
@@ -3,7 +3,7 @@
matrix-commander --no-ssl \
--credentials .cache/credentials.json \
--store .cache/store \
- --homeserver=http://localhost:8080 \
+ --homeserver=http://localhost \
--user-login=php \
--device=matrix-commander \
--room-default=matrix-commander-room \