2022-01-21 22:03:51 +01:00
|
|
|
{ pkgs }:
|
|
|
|
|
|
|
|
pkgs.writeShellApplication {
|
|
|
|
name = "share";
|
|
|
|
|
|
|
|
runtimeInputs = with pkgs; [ curl coreutils rofi p7zip xclip ];
|
|
|
|
|
|
|
|
text = ''
|
2022-01-24 11:19:36 +01:00
|
|
|
files="$(find "$PWD" -maxdepth 10 -type 'f' -not -path '*/.*' | rofi -dmenu -d 15 -p 'File to share')"
|
2022-01-21 22:03:51 +01:00
|
|
|
password="$(rofi -dmenu -p 'Password for encryption')"
|
|
|
|
zipname="$HOME/Downloads/share-$(date +"%Y-%m-%d").zip"
|
|
|
|
if [[ $password == "" ]]; then
|
|
|
|
args=""
|
|
|
|
else
|
|
|
|
args="-p""$password"""
|
|
|
|
fi
|
|
|
|
7z a "$zipname" "$files" "$args" -mx9 > /dev/null
|
2022-01-24 11:19:36 +01:00
|
|
|
link="$(curl -s -F"file=@$zipname" 0x0.st)"
|
|
|
|
echo "$link"
|
|
|
|
echo "$link" | xclip -sel c
|
2022-01-21 22:03:51 +01:00
|
|
|
rm "$zipname"
|
|
|
|
'';
|
|
|
|
}
|