๐Ÿ“ฆ fredsa / instant-tty

๐Ÿ“„ term.sh ยท 25 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25#!/bin/bash
#
set -eux

SCRIPTS_DIR=$( dirname $0 )
ROOT_DIR=$( dirname $SCRIPTS_DIR )

plaintext_secret="secret42"

if [ "$#" -ge 2 ]
  then
  if [ "$1" == "--secret" ]
  then
    shift
    plaintext_secret="$1"
    shift
  fi
fi
(
  cd $ROOT_DIR/term
  sed -i -e "s/\(resource.*\)'socket.io'/\1'$plaintext_secret'/" node_modules/tty.js/static/tty.js
  sed -i -e "s/secret42/$plaintext_secret/" index.js
  ./index.js $*
)