Browse Source

Handle new 12-byte IV format in openbrowser.sh

Travis Burtrum 1 year ago
parent
commit
15dc9ae46b
1 changed files with 6 additions and 2 deletions
  1. 6
    2
      openbrowser.sh

+ 6
- 2
openbrowser.sh View File

@@ -1,12 +1,16 @@
1 1
 #!/bin/bash
2
+#exec firefox "$@"
2 3
 set -e
3 4
 URL=$1
4 5
 BROWSER=xdg-open
6
+BROWSER=firefox
5 7
 AES_GCM="$(dirname $(readlink -f $0))/aesgcm"
6
-if [ ${URL: -97:1} == "#" ]
8
+if [ ${URL: -97:1} == "#" -o ${URL: -89:1} == "#" ]
7 9
 then
8 10
     [ -e "$AES_GCM" ] || gcc "$(dirname $(readlink -f $0))/aesgcm.c" -lcrypto -o "$AES_GCM"
9
-    curl "$URL" | "$AES_GCM" "${URL: -96}" | feh -. -
11
+    iv_key="$(echo "$URL" | sed 's/^.*#//')"
12
+    URL="$(echo "$URL" | sed 's/^aesgcm/https/')"
13
+    curl "$URL" | "$AES_GCM" "$iv_key" | feh -. -
10 14
 elif echo $URL | grep -i '\.pgp$'
11 15
 then
12 16
     curl "$URL" | gpg2 -d | feh -. -

Loading…
Cancel
Save