#!/usr/bin/env bash # Gacha Focus - pull history link finder (Linux, games run through Steam/Proton). # # What it does, and nothing else: # 1. looks for the game in your Steam libraries (Steam's own games and # games added to Steam as non-Steam games, through their Proton prefix) # and in ~/Games; # 2. copies the game's newest web cache (webCaches//Cache/ # Cache_Data/data_2) and looks for the history link the game saved when # you opened the history screen; # 3. checks the link with the game's own history API (one small page); # 4. sends it to the Gacha Focus page that is waiting for it (with the # one-time code from that page), or copies it / prints it. # It never changes a file of the game, needs no root and keeps nothing. The # link only reads your pull history and expires in about a day. Each step # shows for at least two seconds (an animation, nothing else happens then), # and once done the script closes its terminal after 15 seconds. # # Usage (the page builds this line for you): # curl -fsSL https://gachafocus.com.br/ferramentas/historico.sh | bash -s -- genshin pt CODE set -u base='https://gachafocus.com.br' game="${1:-genshin}" lang="${2:-pt}" code="${3:-}" pt=1; [ "$lang" = "en" ] && pt=0 t() { if [ "$pt" = 1 ]; then printf '%s' "$1"; else printf '%s' "$2"; fi; } case "$game" in honkai-star-rail) name='Honkai: Star Rail'; data='StarRail_Data' api='https://public-operation-hkrpg-sg.hoyoverse.com/common/gacha_record/api/getGachaLog' kind='gacha_type=11'; biz='hkrpg_global'; screen="$(t 'Salto > Registro' 'Warp > Records')" ;; zenless-zone-zero) name='Zenless Zone Zero'; data='ZenlessZoneZero_Data' api='https://public-operation-nap-sg.hoyoverse.com/common/gacha_record/api/getGachaLog' kind='real_gacha_type=2'; biz='nap_global'; screen="$(t 'Procurar Sinal > Historico' 'Signal Search > History')" ;; *) game='genshin'; name='Genshin Impact'; data='GenshinImpact_Data' api='https://public-operation-hk4e-sg.hoyoverse.com/gacha_info/api/getGachaLog' kind='gacha_type=301'; biz='hk4e_global'; screen="$(t 'Oracao > Historico' 'Wish > History')" ;; esac # --- the screen: our name, who we are, then each step under it -------------- # (the owner's ASCII art, colored in 24-bit: whole in a window of 120+ # columns, two of every three columns in one of 80+, none in a narrower one, # where it would break every line) art=( $'\e[38;2;0;240;255m \e[38;2;50;194;253m█\e[38;2;51;193;253m▄\e[38;2;53;191;252m█\e[38;2;54;190;252m▀ \e[38;2;88;159;251m▄\e[38;2;43;75;120m░\e[38;2;91;156;251m█\e[38;2;93;155;251m█\e[38;2;94;153;251m▄\e[38;2;78;125;205m▓\e[38;2;97;151;250m▄\e[38;2;98;149;250m▄\e[0m' $'\e[38;2;0;240;255m \e[38;2;3;237;255m▄\e[38;2;4;236;255m▄\e[38;2;5;192;209m▓\e[38;2;7;233;255m▄\e[38;2;9;232;255m█\e[38;2;10;231;255m█\e[38;2;11;229;254m█\e[38;2;13;228;254m█\e[38;2;14;227;254m█ \e[38;2;20;222;254m█\e[38;2;18;181;208m▓\e[38;2;11;105;122m░\e[38;2;24;218;254m▀\e[38;2;26;216;254m█\e[38;2;27;215;254m▄\e[38;2;28;214;254m▄ \e[38;2;36;207;253m▄\e[38;2;37;206;253m▄\e[38;2;38;205;253m█\e[38;2;40;203;253m█\e[38;2;41;202;253m▄\e[38;2;35;164;207m▓\e[38;2;44;199;253m▄\e[38;2;46;198;253m▄ \e[38;2;50;194;253m█\e[38;2;51;193;253m█\e[38;2;53;191;252m█\e[38;2;54;190;252m█\e[38;2;46;155;207m▓\e[38;2;57;187;252m▄\e[38;2;58;186;252m▄\e[38;2;60;185;252m▄\e[38;2;61;184;252m▄ \e[38;2;68;177;252m█\e[38;2;57;144;206m▓\e[38;2;34;84;121m░\e[38;2;73;173;252m▀\e[38;2;74;172;251m█\e[38;2;75;170;251m▄\e[38;2;77;169;251m▄ \e[38;2;87;160;251m▐\e[38;2;88;159;251m█\e[38;2;90;157;251m█\e[38;2;91;156;251m▀ \e[38;2;95;152;250m▀\e[38;2;97;151;250m█\e[38;2;98;149;250m█\e[38;2;100;148;250m█ \e[38;2;105;143;250m▄\e[38;2;107;141;250m▄\e[38;2;108;140;250m█\e[38;2;110;139;250m█\e[38;2;111;138;250m▄\e[38;2;92;112;205m▓\e[38;2;114;135;250m▄\e[38;2;115;134;250m▄ \e[38;2;122;127;249m▄\e[38;2;124;126;249m▄\e[38;2;125;124;249m█\e[38;2;127;123;249m█\e[38;2;128;122;249m▄\e[38;2;106;99;204m▓\e[38;2;131;119;249m▄\e[38;2;132;118;249m▄ \e[38;2;138;113;248m▄\e[38;2;140;111;248m▄\e[38;2;141;110;248m▄ \e[38;2;148;103;248m▄\e[38;2;149;102;248m▄ \e[38;2;157;96;248m▄\e[38;2;158;94;247m▄\e[38;2;159;93;247m█\e[38;2;161;92;247m▄\e[38;2;133;74;203m▓\e[38;2;164;89;247m▄\e[38;2;165;88;247m▄\e[0m' $'\e[38;2;0;240;255m \e[38;2;1;239;255m█\e[38;2;3;237;255m█\e[38;2;4;236;255m█\e[38;2;6;235;255m▀ \e[38;2;5;110;122m░\e[38;2;13;228;254m█\e[38;2;14;227;254m▀ \e[38;2;23;219;254m▄\e[38;2;24;218;254m▄\e[38;2;26;216;254m█\e[38;2;22;176;208m▓\e[38;2;28;214;254m▌\e[38;2;30;212;254m▄ \e[38;2;28;171;208m▓\e[38;2;36;207;253m█\e[38;2;37;206;253m▀\e[38;2;38;205;253m▀ \e[38;2;43;201;253m▀\e[38;2;44;199;253m█\e[38;2;37;162;207m▓\e[38;2;47;197;253m█ \e[38;2;50;194;253m█\e[38;2;42;158;207m▓\e[38;2;25;92;121m░ \e[38;2;58;186;252m▀\e[38;2;60;185;252m█\e[38;2;61;184;252m█\e[38;2;51;149;207m▓ \e[38;2;71;174;252m▄\e[38;2;73;173;252m▄\e[38;2;74;172;251m█\e[38;2;62;140;206m▓\e[38;2;77;169;251m▌\e[38;2;78;168;251m▄ \e[38;2;56;102;161m▒\e[38;2;88;159;251m█\e[38;2;43;75;120m░\e[38;2;91;156;251m▌ \e[38;2;97;151;250m▐\e[38;2;81;122;205m▓\e[38;2;48;71;120m░\e[38;2;101;147;250m▌ \e[38;2;85;118;205m▓\e[38;2;105;143;250m█\e[38;2;107;141;250m▀\e[38;2;108;140;250m▀ \e[38;2;111;138;250m▀\e[38;2;112;136;250m▀\e[38;2;114;135;250m█\e[38;2;95;110;205m▓\e[38;2;117;132;249m█ \e[38;2;99;105;204m▓\e[38;2;122;127;249m█\e[38;2;124;126;249m▀\e[38;2;125;124;249m▀ \e[38;2;130;120;249m▀\e[38;2;131;119;249m█\e[38;2;109;97;204m▓\e[38;2;134;117;249m█ \e[38;2;87;73;159m▒\e[38;2;113;92;204m▓\e[38;2;140;111;248m█\e[38;2;141;110;248m▀ \e[38;2;147;105;248m▄\e[38;2;71;50;119m░\e[38;2;123;84;203m▓\e[38;2;151;101;248m█ \e[38;2;155;97;248m█\e[38;2;157;96;248m█\e[38;2;158;94;247m▀\e[38;2;159;93;247m▀ \e[38;2;162;90;247m▀\e[38;2;164;89;247m█\e[38;2;135;72;203m▓\e[38;2;80;41;119m░\e[38;2;168;85;247m▌\e[0m' $'\e[38;2;0;240;255m▐\e[38;2;1;115;122m░\e[38;2;2;195;209m▓\e[38;2;4;236;255m▌ \e[38;2;11;229;254m▐\e[38;2;11;187;209m▓\e[38;2;14;227;254m▌\e[38;2;16;226;254m▌ \e[38;2;19;223;254m▄\e[38;2;20;222;254m█\e[38;2;21;220;254m▀\e[38;2;23;219;254m▀ \e[38;2;26;216;254m▀\e[38;2;27;215;254m█\e[38;2;23;175;208m▓\e[38;2;14;102;122m░\e[38;2;31;211;254m▌\e[38;2;33;210;253m▐\e[38;2;34;208;253m█\e[38;2;36;207;253m▌\e[38;2;37;206;253m▌ \e[38;2;44;199;253m▐\e[38;2;46;198;253m▀\e[38;2;23;94;121m░\e[38;2;48;195;253m▌\e[38;2;50;194;253m█\e[38;2;42;158;207m▓\e[38;2;53;191;252m▌ \e[38;2;60;185;252m▐\e[38;2;61;184;252m█\e[38;2;63;182;252m▌\e[38;2;64;181;252m▌ \e[38;2;67;178;252m▄\e[38;2;68;177;252m█\e[38;2;70;176;252m▀\e[38;2;71;174;252m▀ \e[38;2;74;172;251m▀\e[38;2;75;170;251m█\e[38;2;63;139;206m▓\e[38;2;38;81;121m░\e[38;2;80;166;251m▌ \e[38;2;87;160;251m▐\e[38;2;72;130;206m▓\e[38;2;90;157;251m█\e[38;2;91;156;251m█\e[38;2;59;99;160m▒\e[38;2;45;74;120m░\e[38;2;46;73;120m░ \e[38;2;98;149;250m▀\e[38;2;100;148;250m▀ \e[38;2;103;145;250m▐\e[38;2;104;144;250m█\e[38;2;105;143;250m▌\e[38;2;107;141;250m▌ \e[38;2;114;135;250m▐\e[38;2;95;110;205m▓\e[38;2;56;63;120m░\e[38;2;118;131;249m▌\e[38;2;120;130;249m▐\e[38;2;121;128;249m█\e[38;2;122;127;249m▌\e[38;2;124;126;249m▌ \e[38;2;131;119;249m▐\e[38;2;132;118;249m▀\e[38;2;64;56;119m░\e[38;2;135;115;249m▌\e[38;2;137;114;248m█\e[38;2;138;113;248m█\e[38;2;140;111;248m▌\e[38;2;141;110;248m▌ \e[38;2;70;50;119m░\e[38;2;148;103;248m▐\e[38;2;123;84;203m▓\e[38;2;72;48;119m░\e[38;2;152;99;248m▌\e[38;2;154;98;248m▄\e[38;2;155;97;248m█\e[38;2;128;78;203m▓\e[38;2;158;94;247m▄ \e[38;2;165;88;247m▀\e[38;2;167;86;247m▀\e[0m' $'\e[38;2;0;240;255m▐\e[38;2;1;239;255m▐\e[38;2;2;195;209m▓\e[38;2;4;236;255m▌ \e[38;2;5;111;122m░\e[38;2;9;188;209m▓\e[38;2;13;228;254m▀\e[38;2;7;109;122m░\e[38;2;16;226;254m▌\e[38;2;17;224;254m▐\e[38;2;19;223;254m█\e[38;2;20;222;254m▌ \e[38;2;27;215;254m▐\e[38;2;28;214;254m█\e[38;2;30;212;254m▌\e[38;2;31;211;254m▀\e[38;2;33;210;253m█\e[38;2;28;171;208m▓\e[38;2;17;99;122m░\e[38;2;18;99;122m░ \e[38;2;41;159;207m▓\e[38;2;51;193;253m▀\e[38;2;25;92;121m░\e[38;2;26;91;121m░ \e[38;2;60;185;252m▐\e[38;2;50;150;207m▓\e[38;2;63;182;252m█\e[38;2;64;181;252m▌\e[38;2;65;180;252m▐\e[38;2;67;178;252m█\e[38;2;68;177;252m▌ \e[38;2;75;170;251m▐\e[38;2;77;169;251m█\e[38;2;78;168;251m▌\e[38;2;80;166;251m▀ \e[38;2;42;77;120m░\e[38;2;88;159;251m▀\e[38;2;43;75;120m░\e[38;2;91;156;251m▀ \e[38;2;103;145;250m█\e[38;2;85;118;205m▓\e[38;2;51;69;120m░\e[38;2;51;68;120m░ \e[38;2;114;135;250m▐\e[38;2;95;110;205m▓\e[38;2;75;85;160m▒\e[38;2;118;131;249m▌\e[38;2;120;130;249m█\e[38;2;99;105;204m▓\e[38;2;59;61;120m░\e[38;2;59;60;120m░ \e[38;2;66;55;119m░\e[38;2;113;92;204m▓\e[38;2;67;53;119m░ \e[38;2;145;106;248m▐\e[38;2;94;67;159m▒\e[38;2;95;66;159m▒\e[38;2;123;84;203m▓\e[38;2;97;64;159m▒\e[38;2;152;99;248m▌\e[38;2;154;98;248m▀\e[38;2;155;97;248m▀\e[38;2;128;78;203m▓\e[38;2;130;77;203m▓\e[38;2;131;76;203m▓\e[38;2;103;59;158m▒\e[38;2;78;43;119m░\e[38;2;105;57;158m▒\e[38;2;165;88;247m▄\e[38;2;167;86;247m▄\e[0m' $'\e[38;2;0;240;255m▐\e[38;2;1;239;255m█\e[38;2;3;237;255m▀\e[38;2;4;236;255m▌ \e[38;2;10;231;255m▐\e[38;2;11;229;254m▄\e[38;2;13;228;254m█\e[38;2;14;227;254m█ \e[38;2;17;224;254m▐\e[38;2;19;223;254m▀\e[38;2;20;222;254m▄\e[38;2;21;220;254m▌ \e[38;2;27;215;254m█\e[38;2;28;214;254m▀\e[38;2;25;174;208m▓\e[38;2;31;211;254m▀\e[38;2;33;210;253m▐\e[38;2;34;208;253m▀\e[38;2;36;207;253m▀\e[38;2;37;206;253m▌ \e[38;2;44;199;253m█\e[38;2;37;162;207m▓\e[38;2;23;94;121m░\e[38;2;48;195;253m▌\e[38;2;50;194;253m▄\e[38;2;25;93;121m░\e[38;2;25;92;121m░\e[38;2;54;190;252m▌ \e[38;2;60;185;252m▐\e[38;2;61;184;252m▀\e[38;2;63;182;252m█\e[38;2;64;181;252m▌\e[38;2;65;180;252m▐\e[38;2;67;178;252m▀\e[38;2;68;177;252m▄\e[38;2;70;176;252m▌ \e[38;2;75;170;251m█\e[38;2;77;169;251m▀\e[38;2;64;138;206m▓\e[38;2;80;166;251m▀ \e[38;2;56;102;161m▒\e[38;2;88;159;251m█\e[38;2;57;101;160m▒ \e[38;2;103;145;250m▐\e[38;2;104;144;250m▀\e[38;2;105;143;250m▀\e[38;2;107;141;250m▌ \e[38;2;54;65;120m░\e[38;2;73;86;160m▒\e[38;2;95;110;205m▓\e[38;2;117;132;249m█ \e[38;2;120;130;249m▐\e[38;2;121;128;249m▀\e[38;2;122;127;249m▀\e[38;2;124;126;249m▌ \e[38;2;131;119;249m█\e[38;2;109;97;204m▓\e[38;2;64;56;119m░\e[38;2;135;115;249m▌\e[38;2;137;114;248m█\e[38;2;138;113;248m▀\e[38;2;140;111;248m█ \e[38;2;145;106;248m█\e[38;2;70;50;119m░\e[38;2;95;66;159m▒\e[38;2;123;84;203m▓\e[38;2;151;101;248m█\e[38;2;152;99;248m▌ \e[38;2;155;97;248m▄\e[38;2;157;96;248m▄\e[38;2;158;94;247m▄ \e[38;2;164;89;247m▀\e[38;2;79;42;119m░\e[38;2;80;41;119m░\e[38;2;168;85;247m▌\e[0m' $'\e[38;2;0;240;255m▀\e[38;2;1;115;122m░\e[38;2;3;237;255m▄\e[38;2;4;236;255m█\e[38;2;6;235;255m▄\e[38;2;7;233;255m▄\e[38;2;4;111;122m░\e[38;2;5;111;122m░\e[38;2;11;229;254m█\e[38;2;13;228;254m█\e[38;2;14;227;254m█ \e[38;2;19;223;254m▀\e[38;2;10;106;122m░░\e[38;2;23;219;254m▄\e[38;2;24;218;254m▄\e[38;2;26;216;254m█\e[38;2;13;103;122m░\e[38;2;14;103;122m░\e[38;2;30;212;254m▀ \e[38;2;34;208;253m█\e[38;2;17;99;122m░\e[38;2;18;99;122m░\e[38;2;38;205;253m▄\e[38;2;40;203;253m▄\e[38;2;41;202;253m▄\e[38;2;43;201;253m█\e[38;2;44;199;253m▀\e[38;2;46;198;253m█\e[38;2;47;197;253m▀ \e[38;2;50;194;253m▀\e[38;2;51;193;253m▄\e[38;2;53;191;252m▌\e[38;2;54;190;252m▀ \e[38;2;60;185;252m█\e[38;2;61;184;252m▄\e[38;2;51;149;207m▓ \e[38;2;67;178;252m▀\e[38;2;33;85;121m░\e[38;2;33;84;121m░\e[38;2;71;174;252m▄\e[38;2;73;173;252m▄\e[38;2;74;172;251m█\e[38;2;36;82;121m░\e[38;2;37;81;121m░\e[38;2;78;168;251m▀ \e[38;2;42;77;120m░\e[38;2;88;159;251m▄\e[38;2;90;157;251m█ \e[38;2;104;144;250m█\e[38;2;51;69;120m░\e[38;2;51;68;120m░\e[38;2;108;140;250m▄\e[38;2;110;139;250m▄\e[38;2;111;138;250m█\e[38;2;112;136;250m█\e[38;2;55;65;120m░\e[38;2;115;134;250m▀ \e[38;2;121;128;249m█\e[38;2;59;61;120m░\e[38;2;59;60;120m░\e[38;2;125;124;249m▄\e[38;2;127;123;249m▄\e[38;2;128;122;249m▄\e[38;2;130;120;249m█\e[38;2;131;119;249m▀\e[38;2;132;118;249m█\e[38;2;134;117;249m▀ \e[38;2;137;114;248m▐\e[38;2;138;113;248m▀\e[38;2;67;53;119m░\e[38;2;68;53;119m░\e[38;2;142;109;248m▄\e[38;2;144;107;248m█\e[38;2;145;106;248m█\e[38;2;147;105;248m▀\e[38;2;71;50;119m░\e[38;2;149;102;248m█\e[38;2;151;101;248m▀ \e[38;2;154;98;248m▀\e[38;2;155;97;248m█\e[38;2;75;46;119m░\e[38;2;76;45;119m░\e[38;2;159;93;247m█\e[38;2;161;92;247m▄\e[38;2;162;90;247m▄\e[38;2;164;89;247m█\e[38;2;79;42;119m░\e[38;2;167;86;247m▌\e[38;2;168;85;247m█\e[0m' $'\e[38;2;0;240;255m \e[38;2;3;237;255m▀\e[38;2;4;194;209m▓\e[38;2;6;235;255m▐\e[38;2;7;233;255m▀\e[38;2;9;232;255m▀ \e[38;2;11;229;254m█\e[38;2;13;228;254m▀\e[38;2;14;227;254m█ \e[38;2;21;220;254m▀\e[38;2;23;219;254m▀\e[38;2;24;218;254m▌\e[38;2;21;177;208m▓\e[38;2;27;215;254m▀ \e[38;2;36;207;253m▀\e[38;2;37;206;253m▀\e[38;2;18;98;122m░\e[38;2;33;167;208m▓\e[38;2;41;202;253m▐\e[38;2;43;201;253m▀ \e[38;2;27;90;121m░\e[38;2;28;89;121m░\e[38;2;60;185;252m▀\e[38;2;61;184;252m▀ \e[38;2;70;176;252m▀\e[38;2;71;174;252m▀\e[38;2;73;173;252m▌\e[38;2;61;141;206m▓\e[38;2;75;170;251m▀ \e[38;2;105;143;250m▀\e[38;2;107;141;250m▀\e[38;2;52;67;120m░\e[38;2;90;114;205m▓\e[38;2;111;138;250m▐\e[38;2;112;136;250m▀ \e[38;2;122;127;249m▀\e[38;2;124;126;249m▀\e[38;2;60;60;120m░\e[38;2;104;101;204m▓\e[38;2;128;122;249m▐\e[38;2;130;120;249m▀ \e[38;2;138;113;248m▀\e[38;2;140;111;248m█\e[38;2;141;110;248m█\e[38;2;68;52;119m░\e[38;2;144;107;248m▐\e[38;2;93;68;159m▒\e[38;2;147;105;248m▀\e[38;2;148;103;248m▀ \e[38;2;157;96;248m▀\e[38;2;158;94;247m▀\e[38;2;131;76;203m▓\e[38;2;161;92;247m█\e[38;2;162;90;247m█\e[38;2;164;89;247m▀\e[38;2;165;88;247m▄\e[38;2;167;86;247m▀\e[0m' $'\e[38;2;0;240;255m \e[38;2;7;233;255m▄ \e[38;2;10;231;255m▄\e[38;2;11;229;254m█\e[38;2;13;228;254m▀\e[38;2;14;227;254m█\e[0m' $'\e[38;2;0;240;255m \e[38;2;4;236;255m▀\e[38;2;6;235;255m▀ \e[38;2;9;232;255m▀\e[38;2;10;231;255m▀\e[38;2;11;229;254m▀\e[38;2;13;228;254m▀\e[0m' ) art_small=( $'\e[38;2;0;240;255m \e[38;2;50;194;253m█\e[38;2;51;193;253m▄\e[38;2;54;190;252m▀ \e[38;2;88;159;251m▄\e[38;2;43;75;120m░\e[38;2;93;155;251m█\e[38;2;94;153;251m▄\e[38;2;97;151;250m▄\e[38;2;98;149;250m▄\e[0m' $'\e[38;2;0;240;255m \e[38;2;3;237;255m▄\e[38;2;4;236;255m▄\e[38;2;7;233;255m▄\e[38;2;9;232;255m█\e[38;2;11;229;254m█\e[38;2;13;228;254m█ \e[38;2;20;222;254m█\e[38;2;18;181;208m▓\e[38;2;24;218;254m▀\e[38;2;26;216;254m█\e[38;2;28;214;254m▄ \e[38;2;37;206;253m▄\e[38;2;38;205;253m█\e[38;2;41;202;253m▄\e[38;2;35;164;207m▓\e[38;2;46;198;253m▄ \e[38;2;50;194;253m█\e[38;2;51;193;253m█\e[38;2;54;190;252m█\e[38;2;46;155;207m▓\e[38;2;58;186;252m▄\e[38;2;60;185;252m▄ \e[38;2;68;177;252m█\e[38;2;34;84;121m░\e[38;2;73;173;252m▀\e[38;2;75;170;251m▄\e[38;2;77;169;251m▄ \e[38;2;88;159;251m█\e[38;2;90;157;251m█ \e[38;2;97;151;250m█\e[38;2;98;149;250m█ \e[38;2;105;143;250m▄\e[38;2;107;141;250m▄\e[38;2;110;139;250m█\e[38;2;111;138;250m▄\e[38;2;114;135;250m▄\e[38;2;115;134;250m▄ \e[38;2;122;127;249m▄\e[38;2;124;126;249m▄\e[38;2;127;123;249m█\e[38;2;128;122;249m▄\e[38;2;131;119;249m▄\e[38;2;132;118;249m▄ \e[38;2;140;111;248m▄\e[38;2;141;110;248m▄ \e[38;2;148;103;248m▄\e[38;2;149;102;248m▄ \e[38;2;157;96;248m▄\e[38;2;158;94;247m▄\e[38;2;161;92;247m▄\e[38;2;133;74;203m▓\e[38;2;165;88;247m▄\e[0m' $'\e[38;2;0;240;255m \e[38;2;3;237;255m█\e[38;2;4;236;255m█ \e[38;2;5;110;122m░\e[38;2;13;228;254m█ \e[38;2;24;218;254m▄\e[38;2;26;216;254m█\e[38;2;28;214;254m▌\e[38;2;30;212;254m▄ \e[38;2;28;171;208m▓\e[38;2;37;206;253m▀\e[38;2;38;205;253m▀ \e[38;2;43;201;253m▀\e[38;2;37;162;207m▓\e[38;2;47;197;253m█\e[38;2;50;194;253m█\e[38;2;42;158;207m▓ \e[38;2;58;186;252m▀\e[38;2;60;185;252m█\e[38;2;51;149;207m▓ \e[38;2;71;174;252m▄\e[38;2;73;173;252m▄\e[38;2;62;140;206m▓\e[38;2;77;169;251m▌ \e[38;2;88;159;251m█\e[38;2;43;75;120m░ \e[38;2;97;151;250m▐\e[38;2;81;122;205m▓\e[38;2;101;147;250m▌ \e[38;2;105;143;250m█\e[38;2;107;141;250m▀ \e[38;2;111;138;250m▀\e[38;2;114;135;250m█\e[38;2;95;110;205m▓ \e[38;2;122;127;249m█\e[38;2;124;126;249m▀ \e[38;2;131;119;249m█\e[38;2;109;97;204m▓ \e[38;2;87;73;159m▒\e[38;2;140;111;248m█\e[38;2;141;110;248m▀ \e[38;2;71;50;119m░\e[38;2;123;84;203m▓ \e[38;2;157;96;248m█\e[38;2;158;94;247m▀ \e[38;2;162;90;247m▀\e[38;2;135;72;203m▓\e[38;2;80;41;119m░\e[0m' $'\e[38;2;0;240;255m▐\e[38;2;2;195;209m▓\e[38;2;4;236;255m▌ \e[38;2;11;229;254m▐\e[38;2;11;187;209m▓\e[38;2;16;226;254m▌ \e[38;2;20;222;254m█\e[38;2;21;220;254m▀ \e[38;2;26;216;254m▀\e[38;2;23;175;208m▓\e[38;2;14;102;122m░\e[38;2;33;210;253m▐\e[38;2;34;208;253m█\e[38;2;37;206;253m▌ \e[38;2;46;198;253m▀\e[38;2;23;94;121m░\e[38;2;50;194;253m█\e[38;2;42;158;207m▓ \e[38;2;60;185;252m▐\e[38;2;63;182;252m▌\e[38;2;64;181;252m▌\e[38;2;67;178;252m▄\e[38;2;68;177;252m█\e[38;2;71;174;252m▀ \e[38;2;75;170;251m█\e[38;2;63;139;206m▓\e[38;2;80;166;251m▌ \e[38;2;72;130;206m▓\e[38;2;90;157;251m█\e[38;2;59;99;160m▒\e[38;2;45;74;120m░ \e[38;2;98;149;250m▀ \e[38;2;103;145;250m▐\e[38;2;105;143;250m▌\e[38;2;107;141;250m▌ \e[38;2;114;135;250m▐\e[38;2;95;110;205m▓\e[38;2;118;131;249m▌\e[38;2;120;130;249m▐\e[38;2;122;127;249m▌\e[38;2;124;126;249m▌ \e[38;2;131;119;249m▐\e[38;2;132;118;249m▀\e[38;2;135;115;249m▌\e[38;2;137;114;248m█\e[38;2;140;111;248m▌\e[38;2;141;110;248m▌ \e[38;2;148;103;248m▐\e[38;2;123;84;203m▓\e[38;2;152;99;248m▌\e[38;2;154;98;248m▄\e[38;2;128;78;203m▓\e[38;2;158;94;247m▄ \e[38;2;165;88;247m▀\e[38;2;167;86;247m▀\e[0m' $'\e[38;2;0;240;255m▐\e[38;2;2;195;209m▓\e[38;2;4;236;255m▌ \e[38;2;9;188;209m▓\e[38;2;13;228;254m▀\e[38;2;16;226;254m▌\e[38;2;17;224;254m▐\e[38;2;20;222;254m▌ \e[38;2;28;214;254m█\e[38;2;30;212;254m▌\e[38;2;33;210;253m█\e[38;2;28;171;208m▓\e[38;2;18;99;122m░ \e[38;2;41;159;207m▓\e[38;2;51;193;253m▀\e[38;2;26;91;121m░ \e[38;2;60;185;252m▐\e[38;2;63;182;252m█\e[38;2;64;181;252m▌\e[38;2;67;178;252m█\e[38;2;68;177;252m▌ \e[38;2;75;170;251m▐\e[38;2;77;169;251m█\e[38;2;80;166;251m▀ \e[38;2;88;159;251m▀\e[38;2;43;75;120m░ \e[38;2;103;145;250m█\e[38;2;51;69;120m░\e[38;2;51;68;120m░ \e[38;2;114;135;250m▐\e[38;2;95;110;205m▓\e[38;2;118;131;249m▌\e[38;2;120;130;249m█\e[38;2;59;61;120m░\e[38;2;59;60;120m░ \e[38;2;66;55;119m░\e[38;2;67;53;119m░ \e[38;2;145;106;248m▐\e[38;2;95;66;159m▒\e[38;2;123;84;203m▓\e[38;2;152;99;248m▌\e[38;2;154;98;248m▀\e[38;2;128;78;203m▓\e[38;2;130;77;203m▓\e[38;2;103;59;158m▒\e[38;2;78;43;119m░\e[38;2;165;88;247m▄\e[38;2;167;86;247m▄\e[0m' $'\e[38;2;0;240;255m▐\e[38;2;3;237;255m▀\e[38;2;4;236;255m▌ \e[38;2;11;229;254m▄\e[38;2;13;228;254m█ \e[38;2;17;224;254m▐\e[38;2;20;222;254m▄\e[38;2;21;220;254m▌ \e[38;2;28;214;254m▀\e[38;2;25;174;208m▓\e[38;2;33;210;253m▐\e[38;2;34;208;253m▀\e[38;2;37;206;253m▌ \e[38;2;37;162;207m▓\e[38;2;23;94;121m░\e[38;2;50;194;253m▄\e[38;2;25;93;121m░\e[38;2;54;190;252m▌ \e[38;2;60;185;252m▐\e[38;2;63;182;252m█\e[38;2;64;181;252m▌\e[38;2;67;178;252m▀\e[38;2;68;177;252m▄ \e[38;2;75;170;251m█\e[38;2;77;169;251m▀\e[38;2;80;166;251m▀ \e[38;2;88;159;251m█\e[38;2;57;101;160m▒ \e[38;2;103;145;250m▐\e[38;2;105;143;250m▀\e[38;2;107;141;250m▌ \e[38;2;73;86;160m▒\e[38;2;95;110;205m▓ \e[38;2;120;130;249m▐\e[38;2;122;127;249m▀\e[38;2;124;126;249m▌ \e[38;2;131;119;249m█\e[38;2;109;97;204m▓\e[38;2;135;115;249m▌\e[38;2;137;114;248m█\e[38;2;140;111;248m█ \e[38;2;145;106;248m█\e[38;2;95;66;159m▒\e[38;2;123;84;203m▓\e[38;2;152;99;248m▌ \e[38;2;157;96;248m▄\e[38;2;158;94;247m▄ \e[38;2;79;42;119m░\e[38;2;80;41;119m░\e[0m' $'\e[38;2;0;240;255m▀\e[38;2;3;237;255m▄\e[38;2;4;236;255m█\e[38;2;7;233;255m▄\e[38;2;4;111;122m░\e[38;2;11;229;254m█\e[38;2;13;228;254m█ \e[38;2;10;106;122m░░\e[38;2;24;218;254m▄\e[38;2;26;216;254m█\e[38;2;14;103;122m░\e[38;2;30;212;254m▀ \e[38;2;34;208;253m█\e[38;2;18;99;122m░\e[38;2;38;205;253m▄\e[38;2;41;202;253m▄\e[38;2;43;201;253m█\e[38;2;46;198;253m█\e[38;2;47;197;253m▀\e[38;2;50;194;253m▀\e[38;2;51;193;253m▄\e[38;2;54;190;252m▀ \e[38;2;60;185;252m█\e[38;2;51;149;207m▓ \e[38;2;67;178;252m▀\e[38;2;33;85;121m░\e[38;2;71;174;252m▄\e[38;2;73;173;252m▄\e[38;2;36;82;121m░\e[38;2;37;81;121m░ \e[38;2;88;159;251m▄\e[38;2;90;157;251m█ \e[38;2;51;69;120m░\e[38;2;51;68;120m░\e[38;2;110;139;250m▄\e[38;2;111;138;250m█\e[38;2;55;65;120m░\e[38;2;115;134;250m▀ \e[38;2;59;61;120m░\e[38;2;59;60;120m░\e[38;2;127;123;249m▄\e[38;2;128;122;249m▄\e[38;2;131;119;249m▀\e[38;2;132;118;249m█ \e[38;2;137;114;248m▐\e[38;2;67;53;119m░\e[38;2;68;53;119m░\e[38;2;144;107;248m█\e[38;2;145;106;248m█\e[38;2;71;50;119m░\e[38;2;149;102;248m█ \e[38;2;154;98;248m▀\e[38;2;75;46;119m░\e[38;2;76;45;119m░\e[38;2;161;92;247m▄\e[38;2;162;90;247m▄\e[38;2;79;42;119m░\e[38;2;167;86;247m▌\e[0m' $'\e[38;2;0;240;255m \e[38;2;3;237;255m▀\e[38;2;4;194;209m▓\e[38;2;7;233;255m▀\e[38;2;9;232;255m▀\e[38;2;11;229;254m█\e[38;2;13;228;254m▀ \e[38;2;21;220;254m▀\e[38;2;24;218;254m▌\e[38;2;21;177;208m▓ \e[38;2;37;206;253m▀\e[38;2;18;98;122m░\e[38;2;41;202;253m▐\e[38;2;43;201;253m▀ \e[38;2;28;89;121m░\e[38;2;60;185;252m▀ \e[38;2;71;174;252m▀\e[38;2;73;173;252m▌\e[38;2;75;170;251m▀ \e[38;2;105;143;250m▀\e[38;2;107;141;250m▀\e[38;2;90;114;205m▓\e[38;2;111;138;250m▐ \e[38;2;122;127;249m▀\e[38;2;124;126;249m▀\e[38;2;104;101;204m▓\e[38;2;128;122;249m▐ \e[38;2;140;111;248m█\e[38;2;141;110;248m█\e[38;2;144;107;248m▐\e[38;2;93;68;159m▒\e[38;2;148;103;248m▀ \e[38;2;157;96;248m▀\e[38;2;158;94;247m▀\e[38;2;161;92;247m█\e[38;2;162;90;247m█\e[38;2;165;88;247m▄\e[38;2;167;86;247m▀\e[0m' $'\e[38;2;0;240;255m \e[38;2;7;233;255m▄ \e[38;2;11;229;254m█\e[38;2;13;228;254m▀\e[0m' $'\e[38;2;0;240;255m \e[38;2;4;236;255m▀ \e[38;2;9;232;255m▀\e[38;2;11;229;254m▀\e[38;2;13;228;254m▀\e[0m' ) tty=0; [ -t 1 ] && tty=1 cols=$(tput cols 2>/dev/null || echo 0) wide=0 if [ "$tty" = 1 ] && [ "${cols:-0}" -ge 120 ] 2>/dev/null; then wide=1 elif [ "$tty" = 1 ] && [ "${cols:-0}" -ge 80 ] 2>/dev/null; then wide=2; art=("${art_small[@]}") fi pink=$'\033[38;2;255;143;177m'; gold=$'\033[38;2;255;210;122m'; cyan=$'\033[38;2;125;244;255m' green=$'\033[38;2;79;224;166m'; red=$'\033[38;2;255;111;174m'; dim=$'\033[38;2;141;151;172m'; off=$'\033[0m' [ "$tty" = 1 ] || { pink=''; gold=''; cyan=''; green=''; red=''; dim=''; off=''; } width=64; [ "$wide" = 1 ] && width=119 rule="$dim$(printf '%.0s─' $(seq 1 "$width"))$off" work=$(mktemp -d) trap 'rm -rf "$work"; [ "$tty" = 1 ] && printf "\033[?25h"' EXIT printf '\n%s\n' "$rule" printf ' %s%s%s %s%s%s\n' "$gold" "Gacha Focus" "$off" "$dim" "$(t 'historico de banners' 'pull history')" "$off" printf '%s\n\n' "$rule" if [ "$wide" != 0 ]; then for line in "${art[@]}"; do printf '%s\n' "$line"; done printf '\n%s\n' "$rule" fi printf ' %s\n' "$(t 'Banners, eventos e codigos de 13 jogos gacha num lugar so.' 'Banners, events and codes of 13 gacha games in one place.')" printf ' %sgachafocus.com.br%s %s·%s %sDiscord: discord.gg/MsFWXSb63F%s\n%s\n\n' "$cyan" "$off" "$dim" "$off" "$cyan" "$off" "$rule" printf ' %s%s%s\n\n' "$gold" "$(t "O Gacha Focus esta importando o seu historico do $name..." "Gacha Focus is importing your $name history...")" "$off" # A step: a spinner while its work runs (``$!`` when given) and for at least # two seconds, then a check or a cross on the same line. frames=(⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏) spin() { local text="$1" pid="${2:-}" i=0 until=$((SECONDS + 2)) [ "$tty" = 1 ] && printf '\033[?25l' while { [ -n "$pid" ] && kill -0 "$pid" 2>/dev/null; } || [ "$SECONDS" -lt "$until" ]; do if [ "$tty" = 1 ]; then printf '\r %s%s%s %s' "$cyan" "${frames[i % 10]}" "$off" "$text"; fi i=$((i + 1)); sleep 0.1 done [ -n "$pid" ] && wait "$pid" 2>/dev/null [ "$tty" = 1 ] && printf '\r\033[K\033[?25h' } done_step() { printf ' %s✓%s %s\n' "$green" "$off" "$1"; } fail() { printf ' %s✗%s %s\n\n %s%s%s\n\n' "$red" "$off" "$1" "$red" "$2" "$off" exit 1 } # --- 1. where is the game ---------------------------------------------------------- find_game() { local roots=() steam lib root dir for steam in "$HOME/.steam/steam" "$HOME/.steam/debian-installation" "$HOME/.local/share/Steam" \ "$HOME/.var/app/com.valvesoftware.Steam/.local/share/Steam"; do [ -d "$steam/steamapps" ] || continue roots+=("$steam/steamapps") # Other libraries (other disks) listed by Steam. if [ -f "$steam/steamapps/libraryfolders.vdf" ]; then while IFS= read -r lib; do [ -d "$lib/steamapps" ] && roots+=("$lib/steamapps") done < <(sed -n 's/^[[:space:]]*"path"[[:space:]]*"\(.*\)"[[:space:]]*$/\1/p' "$steam/steamapps/libraryfolders.vdf") fi done [ -d "$HOME/Games" ] && roots+=("$HOME/Games") for root in "${roots[@]}"; do # Steam's own install (common/) and the Proton prefixes (compatdata/), where # a game added as a non-Steam game lives (pfx/drive_c/...: 9 levels down). while IFS= read -r -d '' dir; do readlink -f -- "$dir" done < <(find "$root" -maxdepth 9 \( -name shadercache -o -name downloading -o -name temp \) -prune -o -type d -name "$data" -print0 2>/dev/null) done | awk 'NF && !seen[$0]++' > "$work/caches" } looking="$(t "Procurando o $name..." "Looking for $name...")" find_game & spin "$looking" $! # ~/.steam/steam is often a link to another root: each install once. mapfile -t caches < "$work/caches" if [ "${#caches[@]}" -eq 0 ]; then fail "$looking" "$(t "Nao achei o jogo. Se ele nao e da Steam, adicione o $name na Steam como jogo nao Steam (Proton), abra $screen e rode o comando de novo." "Couldn't find the game. If it isn't a Steam game, add $name to Steam as a non-Steam game (Proton), open $screen and run the command again.")" fi done_step "$(t "Achei o $name" "Found $name")" # --- 2. the newest web cache of every install found ------------------------------- read_cache() { local files file files=$(for dir in "${caches[@]}"; do ls -1dt "$dir"/webCaches/*/Cache/Cache_Data/data_2 2>/dev/null | head -n 1 done | xargs -r -d '\n' ls -1t 2>/dev/null) : > "$work/links" while IFS= read -r file; do [ -n "$file" ] || continue cp -- "$file" "$work/cache" 2>/dev/null || continue # The cache keeps addresses glued together, split by "1/0/": cut there # first, then keep each piece that is a history link. tr -d '\000' < "$work/cache" | sed 's#1/0/#\n#g' | grep -aoE 'https://[^[:space:]"<>]+authkey=[^[:space:]"<>]+' | tac >> "$work/links" done <<< "$files" rm -f "$work/cache" } reading="$(t 'Lendo o cache do historico...' 'Reading the history cache...')" read_cache & spin "$reading" $! found=$(awk 'NF && !seen[$0]++' "$work/links" | wc -l) if [ "$found" -eq 0 ]; then fail "$reading" "$(t "Nao achei o historico. Abra $screen no jogo e rode o comando de novo." "No history found. Open $screen in the game and run the command again.")" fi done_step "$(t "Cache lido: $found link(s) de historico" "Cache read: $found history link(s)")" # --- 3. the newest link that still works ------------------------------------------- check_links() { local candidate query answer tried=0 while IFS= read -r candidate; do [ -n "$candidate" ] || continue tried=$((tried + 1)); [ "$tried" -gt 12 ] && break query="${candidate#*\?}"; query="${query%%#*}" query=$(printf '%s' "$query" | tr '&' '\n' | grep -vE '^(gacha_type|real_gacha_type|size|page|end_id|lang|game_biz)=' | paste -sd '&' -) answer=$(curl -fsS --max-time 15 "$api?$query&$kind&size=5&page=1&end_id=0&lang=en-us&game_biz=$biz" 2>/dev/null || true) case "$answer" in *'"retcode":0,'*) printf '%s' "$candidate" > "$work/link"; printf '%s' "$answer" > "$work/answer"; return ;; esac sleep 0.4 done < <(awk 'NF && !seen[$0]++' "$work/links") } checking="$(t 'Conferindo o link com o jogo...' 'Checking the link with the game...')" check_links & spin "$checking" $! link=$(cat "$work/link" 2>/dev/null || true) if [ -z "$link" ]; then fail "$checking" "$(t "O link do cache expirou. Abra $screen no jogo de novo e rode o comando." "The cached link expired. Open $screen in the game again and run the command.")" fi done_step "$(t 'Link conferido com o jogo' 'Link checked with the game')" # What the game answered: the account and its newest pull, for the summary. answer=$(cat "$work/answer") field() { printf '%s' "$answer" | grep -oE "\"$1\":\"[^\"]*\"" | head -n 1 | sed -E "s/^\"$1\":\"(.*)\"$/\1/"; } uid=$(field uid); region=$(field region); last_name=$(field name); last_rank=$(field rank_type); last_time=$(field time) case "$region" in *usa*|*_us) server="$(t 'America' 'America')" ;; *euro*|*_eu) server="$(t 'Europa' 'Europe')" ;; *asia*|*_jp|*_sg) server="$(t 'Asia' 'Asia')" ;; *cht*|*_tw) server='TW/HK/MO' ;; *) server="$region" ;; esac rank_word="$last_rank★"; [ "$game" = 'zenless-zone-zero' ] && { case "$last_rank" in 4) rank_word='S' ;; 3) rank_word='A' ;; *) rank_word='B' ;; esac; } # --- 4. to the waiting page, or to the clipboard ----------------------------------- delivered=0; copied=0 if [ -n "$code" ]; then sending="$(t 'Enviando para a pagina do Gacha Focus...' 'Sending to the Gacha Focus page...')" # JSON strings: backslashes and quotes escaped (a link should have none). json() { printf '%s' "$1" | sed -e 's/\\/\\\\/g' -e 's/"/\\"/g'; } ( body=$(printf '{"code":"%s","link":"%s"}' "$(json "$code")" "$(json "$link")") status=$(curl -sS --max-time 20 -o /dev/null -w '%{http_code}' -H 'Content-Type: application/json' -d "$body" "$base/api/ferramentas/historico/entrega" 2>/dev/null || true) printf '%s' "$status" > "$work/sent" ) & spin "$sending" $! status=$(cat "$work/sent" 2>/dev/null || true) if [ "$status" = 200 ]; then delivered=1; done_step "$(t 'Entregue a pagina' 'Delivered to the page')" elif [ "$status" = 404 ]; then printf ' %s!%s %s\n' "$gold" "$off" "$(t 'O codigo deste comando venceu ou foi trocado: use o link abaixo.' 'This command'"'"'s code expired or was replaced: use the link below.')" elif [ "$status" = 400 ]; then printf ' %s!%s %s\n' "$gold" "$off" "$(t 'A pagina recusou este link (e de outro jogo?).' 'The page refused this link (is it from another game?).')" else printf ' %s!%s %s\n' "$gold" "$off" "$(t 'A pagina nao respondeu.' "The page didn't answer.")" fi fi if [ "$delivered" = 0 ]; then if command -v wl-copy >/dev/null 2>&1 && printf '%s' "$link" | wl-copy 2>/dev/null; then copied=1 elif command -v xclip >/dev/null 2>&1 && printf '%s' "$link" | xclip -selection clipboard 2>/dev/null; then copied=1 elif command -v xsel >/dev/null 2>&1 && printf '%s' "$link" | xsel -b 2>/dev/null; then copied=1 fi [ "$copied" = 1 ] && done_step "$(t 'Link copiado' 'Link copied')" fi # --- what was collected, then the countdown ---------------------------------------- line="$dim$(printf '%.0s─' $(seq 1 52))$off" row() { printf ' %s│%s %s%-12s%s %s\n' "$dim" "$off" "$dim" "$1" "$off" "$2"; } printf '\n %s┌─%s %s%s%s %s\n' "$dim" "$off" "$gold" "$(t 'Coleta' 'Collected')" "$off" "$line" row "$(t 'Jogo' 'Game')" "$name" [ -n "$uid" ] && row 'UID' "$uid${server:+ ($server)}" [ -n "$last_name" ] && row "$(t 'Ultima' 'Latest')" "$last_name · $rank_word · ${last_time:0:16}" row 'Link' "$(t 'valido por cerca de 24 h' 'valid for about 24 h')" if [ "$delivered" = 1 ]; then row "$(t 'Entrega' 'Delivery')" "$green$(t 'pagina do Gacha Focus' 'Gacha Focus page')$off" elif [ "$copied" = 1 ]; then row "$(t 'Entrega' 'Delivery')" "$(t 'copiado: cole no passo 3 da pagina' 'copied: paste it in step 3 of the page')" else row "$(t 'Entrega' 'Delivery')" "$(t 'copie o link abaixo e cole no passo 3' 'copy the link below into step 3')" fi printf ' %s└%s%s\n\n' "$dim" "$(printf '%.0s─' $(seq 1 61))" "$off" [ "$delivered" = 0 ] && [ "$copied" = 0 ] && printf '%s\n\n' "$link" if [ "$delivered" = 1 ]; then printf ' %s%s%s\n\n' "$gold" "$(t 'Pronto! Volte para a pagina: o historico ja esta aparecendo la.' 'Done! Go back to the page: your history is showing up there.')" "$off" fi # Nothing delivered or copied: the link is only on the screen, so the window # waits for Enter instead of closing on its own. if [ "$delivered" = 0 ] && [ "$copied" = 0 ] && [ "$tty" = 1 ] && [ -r /dev/tty ]; then printf ' %s%s%s' "$dim" "$(t 'Copie o link acima e aperte Enter para fechar esta janela.' 'Copy the link above, then press Enter to close this window.')" "$off" read -r _ < /dev/tty || true else for left in $(seq 15 -1 1); do if [ "$tty" = 1 ]; then printf '\r %s%s%s\033[K' "$dim" "$(t "Esta janela fecha em $left s (Ctrl+C mantem aberta)" "This window closes in $left s (Ctrl+C keeps it open)")" "$off" elif [ "$left" = 15 ]; then printf ' %s\n' "$(t 'Este script termina em 15 s.' 'This script ends in 15 s.')" fi sleep 1 done fi [ "$tty" = 1 ] && printf '\r\033[K' # curl | bash runs under the shell of the terminal window: hanging that # shell up closes the window. Only the shell the terminal itself started is # closed (it leads the terminal's session; a login shell shows as "-bash"); # a script or a "bash -c" that ran this one just sees it end. if [ "$tty" = 1 ]; then parent=$(ps -o comm= -p "$PPID" 2>/dev/null | tr -d ' ') parent=${parent#-} leader=$(ps -o sid= -p "$PPID" 2>/dev/null | tr -d ' ') if [ "$leader" = "$PPID" ]; then case "$parent" in bash|zsh|fish|sh|dash|ksh) kill -HUP "$PPID" 2>/dev/null ;; esac fi fi exit 0