Annotate

tools/tb2err @ 12705:008a7097fdc5

util.jwt: Provide built-in token expiry support (defaults to 3600s lifetime) To avoid every user of the library needing to add and verify expiry info, this is now handled by util.jwt itself (if not overridden or disabled). Issuing tokens that are valid forever is bad practice and rarely desired, and the default token lifetime is now 3600s (1 hour).
author Matthew Wild <mwild1@gmail.com>
date Mon, 11 Jul 2022 13:28:29 +0100
parent 11191:13e2ac7b5798
child 13063:414952def2d3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11191
13e2ac7b5798 tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff changeset
1 #!/usr/bin/env lua-any
13e2ac7b5798 tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff changeset
2 -- Lua-Versions: 5.3 5.2 5.1
13e2ac7b5798 tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff changeset
3 -- traceback to errors.err for vim -q
13e2ac7b5798 tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff changeset
4 local path_sep = package.config:sub(1,1);
13e2ac7b5798 tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff changeset
5 for line in io.lines() do
13e2ac7b5798 tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff changeset
6 local src, err = line:match("%s*(%S+)(:%d+: .*)")
13e2ac7b5798 tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff changeset
7 if src then
13e2ac7b5798 tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff changeset
8 src = src:gsub("\\", path_sep);
13e2ac7b5798 tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff changeset
9 local cut = src:match("/()core/")
13e2ac7b5798 tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff changeset
10 or src:match("/()net/")
13e2ac7b5798 tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff changeset
11 or src:match("/()util/")
13e2ac7b5798 tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff changeset
12 or src:match("/()modules/")
13e2ac7b5798 tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff changeset
13 or src:match("/()plugins/")
13e2ac7b5798 tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff changeset
14 or src:match("/()prosody[ctl]*$")
13e2ac7b5798 tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff changeset
15 if cut then
13e2ac7b5798 tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff changeset
16 src = src:sub(cut);
13e2ac7b5798 tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff changeset
17 end
13e2ac7b5798 tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff changeset
18 src = src:gsub("^modules/", "plugins/")
13e2ac7b5798 tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff changeset
19 io.write(src, err, "\n");
13e2ac7b5798 tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff changeset
20 end
13e2ac7b5798 tools/tb2err: Formats Lua traceback in errors.err format
Kim Alvefur <zash@zash.se>
parents:
diff changeset
21 end