Last active
December 9, 2024 15:09
-
-
Save incheon-kim/d89e6171b892a7e4e677893626f65e8d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Properties에서 복사한 Argument 값으로 변경해주세요 | |
APPARGS="steam://rungameid/10927840923681292288" | |
# url decode | |
decodeURL(){ | |
printf "$(sed 's#^file://##;s/+/ /g;s/%\(..\)/\\x\1/g;' <<< "$@")\n"; | |
} | |
action="$1" | |
case "$action" in | |
start) | |
echo "Starting POE2..." | |
echo "$2" >> ~/poe2kakao.log; | |
url = $(decodeURL "$2") | |
echo $url >> ~/poe2kakao.log; | |
# Set the delimiter as '|' | |
IFS='|' read -ra parts <<< "$url" | |
token="${parts[3]}" | |
userId="${parts[4]}" | |
wtf="${parts[5]}" | |
if [ ! -z $"token"] then | |
exit 1 | |
fi | |
echo "$APPARGS//--kakao $token $userId" >> ~/poe2kakao.log; | |
steam "$APPARGS//--kakao $token $userId" | |
exit 1; | |
;; | |
esac | |
# Submit Custom URL Scheme | |
DESKTOP_FILE_PATH="$HOME/.local/share/applications/ .desktop" | |
SCRIPT_PATH=$(readlink -f "${BASH_SOURCE[0]}") | |
STRING_TO_APPEND=" | |
[Desktop Entry] | |
Name=POE2_DAUMGAMESTARTER | |
Comment=launcher for POE2 KAKAO | |
Exec=$HOME/poe2/poe2_kakao.sh start %u | |
Terminal=false | |
Type=Application | |
MimeType=x-scheme-handler/daumgamestarter | |
Icon=steam # Replace with an icon path if needed | |
Categories=Game;" | |
if [ ! -f "$DESKTOP_FILE_PATH" ]; then | |
# If the file does not exist, create it and append the string | |
echo "$STRING_TO_APPEND" > "$DESKTOP_FILE_PATH" | |
else | |
# If the file exists, append the string to it | |
echo "$STRING_TO_APPEND" >> "$DESKTOP_FILE_PATH" | |
fi | |
update-desktop-database ~/.local/share/applications | |
echo "URL 등록 완료! 이제 POE2 웹사이트에서 게임을 실행해주세요" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment