Skip to content

Commit

Permalink
fix: removed references to defunct service: snaptext.live schollz#31
Browse files Browse the repository at this point in the history
  • Loading branch information
adam committed Dec 27, 2022
1 parent baf7c57 commit bd1fca0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ Once you boot the Pi with this image, wait about 10 minutes for the Pi to reform

When the WiFi credentials are entered onto the login form, the Pi will modify its internal `wpa_supplicant` to conform to them so that it will be connected to the net. The Pi will then reboot itself using those WiFi credentials. If the credentials are not correct, then the Pi will reboot back into the AP mode to allow you to re-enter them again.

Once connected, you can recieve a message with the LAN IP for your Pi at https://snaptext.live (the specific URL will be given to you when you enter in the credentials to the form).

_Note:_ The Raspberry Pi is **not** a fast computer. When you see the AP and connect to it, it may take up to a minute for the page at `192.168.4.1` to appear. Also, if you enter the wrong WiFi credentials, it will have to reboot twice to reset the Pi to allow you to enter the credentials again. So try to enter them right the first time!

# How does it work?
Expand Down Expand Up @@ -199,7 +197,6 @@ $ sudo dd bs=4M if=/some/place/turnkey.img of=/dev/mmcblk0 conv=fsync status=pro

# Roadmap

- [x] ~~Add messaging system to send the LAN IP address once online~~ (uses https://github.com/schollz/snaptext)
- [x] ~~Add startup hooks~~ (just edit `startup.sh`)
- [ ] connect immediately to wifi and disable hostapd without rebooting

Expand Down
8 changes: 3 additions & 5 deletions startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def id_generator(size=6, chars=string.ascii_lowercase + string.digits):
@app.route('/')
def main():
piid = open('pi.id', 'r').read().strip()
return render_template('index.html', ssids=getssid(), message="Once connected you'll find IP address @ <a href='https://snaptext.live/{}' target='_blank'>snaptext.live/{}</a>.".format(piid,piid))
return render_template('index.html', ssids=getssid())

# Captive portal when connected with iOS or Android
@app.route('/generate_204')
Expand Down Expand Up @@ -162,7 +162,7 @@ def signin():
f.write(json.dumps({'status':'disconnected'}))
subprocess.Popen(["./disable_ap.sh"])
piid = open('pi.id', 'r').read().strip()
return render_template('index.html', message="Please wait 2 minutes to connect. Then your IP address will show up at <a href='https://snaptext.live/{}'>snaptext.live/{}</a>.".format(piid,piid))
return render_template('index.html', message="Please wait 2 minutes to connect.")

def wificonnected():
result = subprocess.check_output(['iwconfig', 'wlan0'])
Expand Down Expand Up @@ -215,9 +215,7 @@ def wificonnected():
ipaddress = s.getsockname()[0]
s.close()

# alert user on snaptext
r = requests.post("https://snaptext.live",data=json.dumps({"message":"Your Pi is online at {}".format(ipaddress),"to":piid,"from":"Raspberry Pi Turnkey"}))
print(r.json())
# Run the startup script
subprocess.Popen("./startup.sh")
while True:
time.sleep(60000)
Expand Down

0 comments on commit bd1fca0

Please sign in to comment.