Skip to content

Commit fdbb911

Browse files
committed
Add .xpi support to automtime and autodescribe
1 parent 46aa8ec commit fdbb911

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

autodescribe

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,6 +1424,14 @@ comment_xcf () {
14241424
fi
14251425
}
14261426

1427+
# File type: xpi (Mozilla extension)
1428+
# requires: unzip (Info-ZIP version)
1429+
comment_xpi () {
1430+
# "safe" filename guaranteed not to start with a dash
1431+
sf="$(safefn "$1")"
1432+
COMMENT=$(unzip -p "$sf" manifest.json | jq -r .name)
1433+
}
1434+
14271435
# File type: xpm (X pixmap image)
14281436
# Could extract image size here as well
14291437
comment_xpm () {
@@ -1794,6 +1802,9 @@ for f in "$@" ; do
17941802
*.xhb)
17951803
TYPE=xhb
17961804
;;
1805+
*.xpi)
1806+
TYPE=xpi
1807+
;;
17971808
*.xpm)
17981809
TYPE=xpm
17991810
;;

automtime

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,6 +1098,16 @@ mtime_xcf_exiftool () {
10981098
TIME=$(echo "$RAWTIME" | sed -E -e 's/^([0-9][0-9][0-9][0-9]):([0-9][0-9]):/\1-\2-/' -e 's/([-+][0-9][0-9])(:)?([0-9][0-9])$/ \1\3/')
10991099
}
11001100

1101+
# File type: xpi (Mozilla extension)
1102+
# requires: unzip (Info-ZIP version), openssl
1103+
mtime_xpi () {
1104+
# Decode the signature rather than looking at the file mtimes since the latter
1105+
# seems to always be set to 1980-01-01.
1106+
RAWTIME=$(unzip -p "$f" META-INF/mozilla.rsa | openssl pkcs7 -print_certs -text -inform DER -in - | sed -n 's/^[[:space:]]*Not Before:[[:space:]]*//p' | head -1)
1107+
# $RAWTIME is like Apr 19 22:52:53 2026 GMT
1108+
TIME=$(normalize_time_tz "$RAWTIME")
1109+
}
1110+
11011111
# File type: zip (zip archive)
11021112
# requires: unzip (Info-ZIP version), findutils
11031113
mtime_zip () {
@@ -1530,6 +1540,10 @@ for f in "$@" ; do
15301540
TYPE=xcf
15311541
;;
15321542

1543+
*.xpi)
1544+
TYPE=xpi
1545+
;;
1546+
15331547
*.zpaq)
15341548
TYPE=zpaq
15351549
;;

0 commit comments

Comments
 (0)