Compare commits

..

No commits in common. "master" and "v2.0" have entirely different histories.
master ... v2.0

8 changed files with 27 additions and 57 deletions

2
.gitignore vendored
View file

@ -1,6 +1,5 @@
# Compiled Lua sources
luac.out
matrix-send
# luarocks build files
*.src.rock
@ -39,3 +38,4 @@ matrix-send
*.i*86
*.x86_64
*.hex

35
COMPILE
View file

@ -1,35 +0,0 @@
___________________
< Manually building >
-------------------
Since matrix-send uses Lua, an interpreted programming language,
building is not necessary; you could just move matrix-send.lua to
/usr/local/bin and be done with it. However, for additional speed,
the Makefile precompiles it to Lua bytecode using
luac <https://www.lua.org/manual/5.4/luac.html> which is included
in the Lua distribution. To do this yourself, follow these steps:
=> Create the shebang
In order to be run by a shell, the compiled bytecode needs a
shebang at the start. To do this, run this command:
printf '#!/usr/bin/env lua\n' > matrix-send
=> Precompile
Now, let's append the bytecode to the file:
luac -o - matrix-send.lua >> matrix-send
=> Mark as an executable
Finally, mark the file as executable:
chmod +x matrix-send
The file `matrix-send` is now ready to be run by a shell.
# vi: ft=txt

View file

@ -1,4 +1,4 @@
VERSION = 2.1
VERSION = 2.0
PREFIX = /usr/local
MANPREFIX = ${PREFIX}/man
@ -11,10 +11,8 @@ install:
luarocks install luaposix
luarocks install luasocket
luarocks install lua-cjson
printf '#!/usr/bin/env lua\n' > matrix-send
luac -o - matrix-send.lua >> matrix-send
chmod +x matrix-send
cp -f matrix-send ${DESTDIR}${PREFIX}/bin
chmod +x ${DESTDIR}${PREFIX}/bin/matrix-send
mkdir -p ${DESTDIR}${MANPREFIX}/man1
cp -f matrix-send.1 ${DESTDIR}${MANPREFIX}/man1
mkdir -p ${DESTDIR}${MANPREFIX}/man5

View file

@ -24,7 +24,7 @@ Now edit the file ~/.config/matrix-send/config.lua. You will first see the `logi
```lua
-- This is a comment
login = {
server = "matrix.org",
server = "matrix-client.matrix.org", -- matrix.org
username = "user",
password = "password"
}

View file

@ -1,6 +1,6 @@
login = {
-- The Matrix server to use.
server = "matrix.org",
server = "matrix-client.matrix.org", -- matrix.org
-- The user to log in to.
username = "user",

View file

@ -19,22 +19,22 @@
require "luarocks.loader"
getopt = require "posix.unistd".getopt
mkdir = require "posix.sys.stat".mkdir
bname = require "posix.libgen".basename
http = require "socket.http"
cjson = require "cjson"
ltn12 = require "ltn12"
mkdir = require "posix.sys.stat".mkdir
bname = require "posix.libgen".basename
http = require "socket.http"
cjson = require "cjson"
ltn12 = require "ltn12"
version = "2.1"
confdir = string.gsub("~/.config/matrix-send", '~', os.getenv("HOME"), 1)
version = "2.0"
confdir = string.gsub("~/.config/matrix-send", '~', os.getenv("HOME"), 1)
confpath = confdir .. "/config.lua"
confvarv = os.getenv("MATRIXSEND_CONFIG")
hostname = io.input("/etc/hostname"):read("l")
matrix = {}
json = {}
uri = {}
sh = os.execute
json = {}
uri = {}
sh = os.execute
-----------------
--- Functions ---

View file

@ -20,7 +20,7 @@ The following configuration options are available:
.Bl -tag -width 11n
.Bl -tag -width login.server
.It Ic login.server Ar server
The address of the Matrix server being used.
The Client-Server API address of the Matrix server being used.
.It Ic login.username Ar username
The username of the account being used.
.It Ic login.password Ar password
@ -50,11 +50,11 @@ default cache directory
.El
.Sh EXAMPLES
The following example logs into the user 'john' of the server
matrix.org, and the password 'supersecretpassword',
matrix-client.matrix.org, and the password 'supersecretpassword',
and sets the default event type to m.notice.
.Bd -literal -offset indent
login = {
server = "matrix.org",
server = "matrix-client.matrix.org",
username = "john",
password = "supersecretpassword"
}

View file

@ -51,7 +51,7 @@ Let's say your Matrix server is envs.net, your username is john, and your passwo
is supersecretpassword. Your configuration could look like this:
.Bd -literal -offset indent
login = {
server = "envs.net",
server = "matrix.envs.net",
username = "john",
password = "supersecretpassword"
}
@ -59,11 +59,18 @@ login = {
.Pp
It could also look like this:
.Bd -literal -offset indent
login.server = "envs.net"
login.server = "matrix.envs.net"
login.username = "john"
login.password = "supersecretpassword"
.Ed
.Pp
In those examples, we used matrix.envs.net instead of envs.net. This is because
matrix.envs.net is the address in which the Client-Server API is listening on.
You can find this address in Element by entering in your server into the
Homeserver dialogue in the sign-in screen, then hovering
over it once entered. Your server's Client-Server API URL should appear once
you hover over it. If it doesn't appear, you should already have it.
.Pp
More information on configuration options can be found in
.Xr matrix-send-config 5 .
.Pp