-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wifi-qr (0.2-2) unstable; urgency=medium . * Improve Summary. (Closes: #989034) * QR Code Scan from File Function Update. . wifi-qr (0.2-1) unstable; urgency=medium . * Shellcheck and close issue #9 . wifi-qr (0.1-1) unstable; urgency=medium . * Initial upload.
- Loading branch information
1 parent
2ee1b18
commit 9332de2
Showing
9 changed files
with
287 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
wifi-qr (0.2-2) unstable; urgency=medium | ||
|
||
* Improve Summary. (Closes: #989034) | ||
* QR Code Scan from File Function Update. | ||
|
||
-- kokoye2007 <[email protected]> Wed, 27 Apr 2022 17:11:19 +0630 | ||
|
||
wifi-qr (0.2-1) unstable; urgency=medium | ||
|
||
* Shellcheck and close issue #9 | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,19 +4,19 @@ Priority: optional | |
Maintainer: kokoye2007 <[email protected]> | ||
Build-Depends: debhelper-compat (= 13) | ||
Rules-Requires-Root: no | ||
Standards-Version: 4.5.0 | ||
Standards-Version: 4.6.0.1 | ||
Homepage: https://github.com/kokoye2007/wifi-qr | ||
Vcs-git: https://github.com/kokoye2007/wifi-qr.git | ||
Vcs-browser: https://github.com/kokoye2007/wifi-qr | ||
Vcs-Git: https://github.com/kokoye2007/wifi-qr.git | ||
Vcs-Browser: https://github.com/kokoye2007/wifi-qr | ||
|
||
Package: wifi-qr | ||
Architecture: all | ||
Depends: ${misc:Depends}, zenity, qrencode, zbar-tools | ||
Description: WiFi Share and Connect with QR | ||
Xiaomi Android phones has started using QR to use WiFi for sharing. | ||
The idea was to get started with Bash, from Android to PC or PC to | ||
Mobile, and use Interface for zenity, QR for zbar and qrencode, | ||
and nmcli from Network-Manager for Network. For security, | ||
you can use WPA, WPA2, WEP, Open and share with the Hidden Network. | ||
QR code does not support LDAP Network and VPN. | ||
Android can easily generate WiFi QR, but iOS isn't quite so sure. | ||
Description: WiFi password share via QR codes | ||
Shares WiFi SSID and password via a QR code. | ||
Generate a QR code of a WiFi network with its password. | ||
Scan QR codes and easily connect to WiFi Networks. | ||
. | ||
For Android, OS version 10 and above is supported. | ||
. | ||
For iOS, the Shortcut app supports generating WiFi QR codes. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,267 @@ | ||
Description: Scan QR Code from File | ||
Wifi-QR is support QR Scan from Cam or QR Scan from File. | ||
. | ||
wifi-qr (0.2-2) unstable; urgency=medium | ||
. | ||
* Improve Summary. (Closes: #989034) | ||
* QR Code Scan from File Function Update. | ||
Author: kokoye2007 <[email protected]> | ||
Bug-Debian: https://bugs.debian.org/989034 | ||
|
||
--- | ||
Forwarded: not-needed | ||
Reviewed-By: [email protected] | ||
Last-Update: 2022-04-27 | ||
|
||
--- wifi-qr-0.2.orig/wifi-qr | ||
+++ wifi-qr-0.2/wifi-qr | ||
@@ -30,8 +30,8 @@ VERSION=0.2 | ||
|
||
#RAW DATA SAMPLE | ||
#"WIFI:S:$SSID;P:$PASSWORD;T:$KEY_TYPE;H:$true;" | ||
-#qrencode -o - -t UTF8 | ||
-#qrencode -l h -s 14 -o | ||
+#qrencode -o - -t UTF8 | ||
+#qrencode -l h -s 14 -o | ||
|
||
#GUI Mainmenu | ||
main_menu() { | ||
@@ -43,6 +43,7 @@ main_menu() { | ||
--width=300 --height=320 \ | ||
--column="Check" --column="Option" \ | ||
TRUE "Scan and connect" \ | ||
+ FALSE "Scan Image and connect" \ | ||
FALSE "Share current WiFi" \ | ||
FALSE "Share saved WiFi" \ | ||
FALSE "See license" \ | ||
@@ -54,9 +55,12 @@ main_menu() { | ||
|
||
elif [[ "$CHOICE" =~ "Share current WiFi" ]]; then | ||
call_current_wifi_gui | ||
- | ||
+ | ||
elif [[ "$CHOICE" =~ "Scan and connect" ]]; then | ||
- call_wifi_scan_gui | ||
+ call_wifi_scan_gui "cam" | ||
+ | ||
+ elif [[ "$CHOICE" =~ "Scan Image and connect" ]]; then | ||
+ call_file_select_and_scan_gui | ||
|
||
elif [[ "$CHOICE" =~ "See license" ]]; then | ||
zenity --text-info --title="WiFi QR Copyright" --filename=/usr/share/doc/wifi-qr/copyright --width=528 --height=780 | ||
@@ -139,7 +143,7 @@ call_wifi_terminal() { | ||
terminal_qr() { | ||
call_wifi_pass | ||
qrencode -o - -t UTF8 "WIFI:S:$WIFIS;P:$KEEY;$PSSK$H;" | ||
- echo | ||
+ echo | ||
} | ||
|
||
current_wifi_ssid() { | ||
@@ -179,26 +183,50 @@ call_wifi_pass() { | ||
echo -e "${RESET}" | ||
} | ||
|
||
-call_wifi_scan() { | ||
- wifiqrdata='' | ||
- # tmp data-matrix holder | ||
- cwd="/tmp/" | ||
- qr_data="$cwd/wifi-qr-scan" | ||
- zbarcam --raw --prescale=320x240 /dev/video0 >$qr_data & | ||
+call_zbar_cam_scan() { | ||
+ qr_data=$1 | ||
+ zbarcam --raw --prescale=320x240 /dev/video0 >"$qr_data" & | ||
|
||
# Last job running in background eg. zbarcam | ||
pid=$! | ||
- | ||
# Sleep loop until $qr_data file has content | ||
+ local i=0 | ||
+ local chars="/-\|" | ||
+ echo -en " Scanning QR Code" "\r" | ||
while [[ ! -s $qr_data ]]; do | ||
- sleep 1 | ||
- pgrep -x zbarcam >/dev/null && echo "Still Scanning" || exit 0 | ||
+ sleep 0.5 | ||
+ pgrep -x zbarcam >/dev/null && echo -en "${chars:$i:1}" "\r" || exit 0 | ||
+ i=$(((i+1)%${#chars})) | ||
# cleanup - add a trap that will remove $qr_data and kill zbarcam | ||
# if any of the signals - SIGHUP SIGINT SIGTERM it received. | ||
trap 'rm -f "$qr_data" ; kill -s 9 "$pid"; exit' SIGHUP SIGINT SIGTERM | ||
done | ||
|
||
kill -s 9 $pid | ||
+ # to supress the kill message | ||
+ # https://stackoverflow.com/a/5722874/11910267 | ||
+ wait $pid 2>/dev/null | ||
+} | ||
+ | ||
+call_zbar_img_scan() { | ||
+ qr_data=$1 | ||
+ img_path=$2 | ||
+ zbarimg --raw "$img_path" >"$qr_data" 2>/dev/null | ||
+} | ||
+ | ||
+call_wifi_scan() { | ||
+ mode=$1 | ||
+ wifiqrdata='' | ||
+ # tmp data-matrix holder | ||
+ cwd="/tmp/" | ||
+ qr_data="$cwd/wifi-qr-scan" | ||
+ | ||
+ if [[ $mode == "cam" ]]; then | ||
+ call_zbar_cam_scan "$qr_data" | ||
+ else | ||
+ call_zbar_img_scan "$qr_data" "$mode" # mode stores the image path | ||
+ fi | ||
+ | ||
wifiqrdata=$(cat $qr_data) | ||
rm -f $qr_data | ||
|
||
@@ -207,7 +235,7 @@ call_wifi_scan() { | ||
## Go Go GUI and CLI Mod | ||
# ssid & key are not always in the same sequence - fix by using a dict and cut identifier for first key | ||
if echo "$wifiqrdata" | grep --quiet "H:true;"; then | ||
- QHIDE=true | ||
+ QHIDE=true | ||
fi | ||
declare -A wifiqrcred | ||
wifiqrcred+=([$(echo "$wifiqrdata" | cut -b 6- | awk -F';' '{print $1}' | cut -d":" -f1)]=$(echo "$wifiqrdata" | cut -b 6- | awk -F';' '{print $1}' | cut -d":" -f2)) | ||
@@ -268,7 +296,7 @@ call_wifi_scan() { | ||
|
||
|
||
call_wifi_scan_terminal() { | ||
- call_wifi_scan | ||
+ call_wifi_scan "$1" | ||
if [[ "$QSSIDO" == "NOWIFI" ]]; then | ||
exit 0 | ||
elif [[ "$QHIDE" == "true" ]]; then | ||
@@ -282,10 +310,10 @@ call_wifi_scan_terminal() { | ||
} | ||
|
||
call_wifi_scan_gui() { | ||
- call_wifi_scan | ||
+ call_wifi_scan "$1" | ||
# Function with QR data | ||
if [[ "$QSSIDO" =~ "ON" ]]; then | ||
- zenity --question --title="Connect to WiFi" --text="Connect to '$QSSID'?" --width=200 --height=120 --icon-name=network-wireless 2>/dev/null | ||
+ zenity --question --title="Connect to WiFi" --text="Connect to '$QSSID'?" --width=200 --height=120 --icon-name=network-wireless 2>/dev/null | ||
connectn=$? | ||
if [ $connectn == 0 ]; then \ | ||
scan_connect | ||
@@ -314,7 +342,11 @@ call_wifi_scan_gui() { | ||
exit | ||
fi | ||
elif [[ "$CHOICE" =~ "Retry submitting another QR Code" ]]; then | ||
- call_wifi_scan_gui | ||
+ if [[ $1 == "cam" ]]; then | ||
+ call_wifi_gui "cam" | ||
+ else | ||
+ call_file_select_and_scan_gui | ||
+ fi | ||
else | ||
exit | ||
fi | ||
@@ -328,6 +360,15 @@ call_wifi_scan_gui() { | ||
fi | ||
} | ||
|
||
+call_file_select_and_scan_gui () { | ||
+ img_path=$(zenity --file-selection) | ||
+ if [ -z "$img_path" ]; then | ||
+ echo "No file selected" | ||
+ exit | ||
+ fi | ||
+ call_wifi_scan_gui "$img_path" | ||
+} | ||
+ | ||
scan_connect() { | ||
nmcli radio wifi on | ||
nmcli dev wifi rescan >/dev/null 2>&1 | ||
@@ -360,11 +401,24 @@ case $1 in | ||
;; | ||
[Ss]) | ||
echo "qr scan" | ||
- call_wifi_scan_terminal | ||
+ call_wifi_scan_terminal "cam" | ||
+ ;; | ||
+[Ff]) | ||
+ if [ -f "$2" ]; then | ||
+ echo "qr scan from file $2" | ||
+ call_wifi_scan_terminal "$2" | ||
+ else | ||
+ echo "File not found" | ||
+ exit | ||
+ fi | ||
+ ;; | ||
+[Pp]) | ||
+ echo "qr scan from file with gui" | ||
+ call_file_select_and_scan_gui | ||
;; | ||
[Qq]) | ||
echo "qr scan with gui" | ||
- call_wifi_scan_gui | ||
+ call_wifi_scan_gui "cam" | ||
;; | ||
[Vv]) | ||
echo -e "${GREEN}==================${RESET}" | ||
@@ -373,10 +427,12 @@ case $1 in | ||
;; | ||
*) | ||
echo -e "\nInvalid input\n | ||
- Please use g for GUI Main Menu | ||
+ Please use g for GUI Main Menu | ||
c for WiFi QR Create GUI | ||
t for WiFi QR Create Terminal | ||
s for QR Scan and Auto Connect WiFi | ||
+ f Terminal [file] for QR Scan and Auto Connect WiFi from file | ||
+ p With GUI [file] for QR Scan and Auto Connect WiFi from file | ||
q for QR Scan and Connect WiFi GUI | ||
v for WiFi-QR Version is $VERSION | ||
" | ||
--- wifi-qr-0.2.orig/wifi-qr.1 | ||
+++ wifi-qr-0.2/wifi-qr.1 | ||
@@ -3,7 +3,7 @@ | ||
wifi-qr \- WiFi Share and Connect with QR | ||
.SH SYNOPSIS | ||
.B wifi-qr | ||
-.RI [ Gg | Cc | Tt | Ss | Qq | Vv ] | ||
+.RI [ Gg | Cc | Tt | Ss | Ff | Pp | Qq | Vv ] | ||
.br | ||
.SH DESCRIPTION | ||
PC to Android Network SSID Password share with QR code. | ||
@@ -29,6 +29,12 @@ wifi-qr option | ||
.B s QR Scan and Auto Connect WiFi | ||
.br | ||
.TP | ||
+.B f Terminal - QR File Scan and Auto Connect WiFi | ||
+.br | ||
+.TP | ||
+.B p With Gui - QR File Scan and Auto Connect WiFi | ||
+.br | ||
+.TP | ||
.B q QR Scan and Connect WiFi GUI | ||
.br | ||
.TP | ||
--- wifi-qr-0.2.orig/wifi-qr.desktop | ||
+++ wifi-qr-0.2/wifi-qr.desktop | ||
@@ -8,13 +8,18 @@ Icon=wifi-qr.svg | ||
Keywords="QR; WiFi; Password; Share;" | ||
Terminal=false | ||
Categories=GNOME;Utility; | ||
-Actions=ScanQR;CreateQR; | ||
+Actions=ScanQR;ScanFileQR;CreateQR; | ||
|
||
[Desktop Action ScanQR] | ||
Name=Scan WiFi QR Code | ||
Exec=sh -c 'wifi-qr q' | ||
Terminal=false | ||
|
||
+[Desktop Action ScanFileQR] | ||
+Name=Scan WiFi QR Code File | ||
+Exec=sh -c 'wifi-qr p' | ||
+Terminal=false | ||
+ | ||
[Desktop Action CreateQR] | ||
Name=Create WiFi QR Code | ||
Exec=sh -c 'wifi-qr c' |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0-2.2-Update |
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
tar-ignore = ".git/*" | ||
extend-diff-ignore = "(^|/)(README\.md|readme\.md|readme)$" |
Empty file.
Empty file.
Empty file.