Skip to content

Commit ead2280

Browse files
authored
Continuous Release v1.0.1
Merge pull request #9 from Splines/dev
2 parents b3d84f6 + b38d2f7 commit ead2280

File tree

15 files changed

+562
-308
lines changed

15 files changed

+562
-308
lines changed

.vscode/extensions.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"recommendations": [
3+
"streetsidesoftware.code-spell-checker",
4+
"ms-python.pylint",
5+
"ms-python.black-formatter"
6+
]
7+
}

.vscode/settings.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
//////////////////////////////////////
3+
// Python (linting & formatting)
4+
//////////////////////////////////////
5+
"[python]": {
6+
"editor.defaultFormatter": "ms-python.black-formatter",
7+
"editor.formatOnSave": true
8+
},
9+
"pylint.importStrategy": "fromEnvironment",
10+
//////////////////////////////////////
11+
// Files
12+
//////////////////////////////////////
13+
"files.exclude": {
14+
"**/__pycache__/": true,
15+
},
16+
//////////////////////////////////////
17+
// Editor
18+
//////////////////////////////////////
19+
"editor.tabSize": 4,
20+
"editor.insertSpaces": true,
21+
"editor.detectIndentation": false,
22+
"editor.wordWrap": "wordWrapColumn",
23+
"editor.wordWrapColumn": 100, // toggle via Alt + Z shortcut
24+
"editor.mouseWheelZoom": true,
25+
"editor.rulers": [
26+
{
27+
"column": 80, // soft limit
28+
"color": "#e5e5e5"
29+
},
30+
{
31+
"column": 100, // hard limit
32+
"color": "#c9c9c9"
33+
}
34+
],
35+
//////////////////////////////////////
36+
// Git
37+
//////////////////////////////////////
38+
"git.inputValidation": "warn",
39+
"git.inputValidationSubjectLength": 50,
40+
"git.inputValidationLength": 72,
41+
//////////////////////////////////////
42+
// Spell Checker
43+
//////////////////////////////////////
44+
"cSpell.words": [
45+
"github",
46+
"pylint"
47+
],
48+
}

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2022 Splines
3+
Copyright (c) 2022-2024 Splines
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<h3 align="center">Raspi Captive Portal</h3>
55
<p align="center">A Captive Portal & Access Point setup for use with the Raspberry Pi</p>
6-
<p align="center"><sub>Tested on the Raspberry Pi 4, Raspbian GNU/Linux 11 (bullseye)</sub></p>
6+
<p align="center">Tested on the Raspberry Pi 4, Raspberry Pi OS: Bullseye (11) & Bookworm (12) (64-bit)</p>
77
</p>
88

99

@@ -27,12 +27,15 @@ You probably want to use this repo in one of these ways:
2727

2828
## Setup
2929

30+
> [!tip]
31+
> Raspberry Pi OS Bookworm (12) comes with a new [Network Manager](https://www.raspberrypi.com/documentation/computers/configuration.html#configuring-networking). It might make the configuration easier instead of manually having to setup `dhcp`, `hostapd` etc. (the latter is what we do in this project, but automatically for you). Nevertheless, this project still works on Bookworm 😊
32+
3033
<details>
3134
<summary><strong>Installation</strong></summary>
3235

3336
If you connect to the Raspberry Pi from remote, make sure to do so via Ethernet an NOT via WiFi as the setup script will create its own WiFi network and thus you won't be connected anymore (and maybe even lock yourself out of your Raspi). Python is installed by default on a Raspberry Pi, so clone this repository and execute the script via:
3437

35-
<sub>Note that the script needs to run as sudo user. Make sure that you agree with the commands executed beforehand by looking into the `.sh` scripts in the folder `access-point/`. Setup script was tested with a fresh install of Raspbian GNU/Linux 11 (bullseye) on the Raspberry Pi 4.</sub>
38+
<sub>Note that the script needs to run as sudo user. Make sure that you agree with the commands executed beforehand by looking into the `.sh` scripts in the folder `access-point/`.</sub>
3639

3740
```
3841
git clone https://github.com/Splines/raspi-captive-portal.git
@@ -45,7 +48,7 @@ You probably want to use this repo in one of these ways:
4548
<details>
4649
<summary><strong>Connection</strong></summary>
4750

48-
After the installation, you should be able to connect to the new WiFi network called `Splines Raspi AP` using the password `splines-raspi`. You should be redirected to a static welcome page. If you open a "normal" browser, type in any http URL (http**s** URLs are not working) and you should also get redirected to the static page. The URL is supposed to read `splines.portal`.
51+
After the installation, you should be able to connect to the new WiFi network called `Splines Raspi AP` using the password `splinesraspi`. You should be redirected to a static welcome page. If you open a "normal" browser, type in any http URL (http**s** URLs are not working) and you should also get redirected to the static page. The URL is supposed to read `splines.portal` (but visiting any URL should redirect there). From here on you can build your custom captive portal webpage by customizing the code in the `server` folder of this project.
4952

5053
</details>
5154

@@ -59,7 +62,7 @@ You probably want to use this repo in one of these ways:
5962

6063
- static ip for the raspi: `192.168.4.1/24`
6164
- using `wlan0` as interface
62-
- WiFi: SSID: `Splines Raspi AP`, password: `splines-raspi`, country code: `DE` (change if you are not living in Germany)
65+
- WiFi: SSID: `Splines Raspi AP`, password: `splinesraspi`, country code: `DE` (change if you are not living in Germany)
6366
- Server: port: `3000` (all request on port 80 (http) get redirected to this port), host name: `splines.portal`
6467

6568
</details>
@@ -72,7 +75,7 @@ If this first assistance does not help, feel free to open a new issue.
7275

7376
**I can't connect to the `Splines Raspi AP` WiFi or get thrown out**
7477

75-
Double check that you've entered the correct password: `splines-raspi`. Also, the Raspberry Pi won't provide Internet acceess to you, it will just serve a static HTML page for the game. This is why you might get thrown out of the WiFi network. If this is the case, there is usually an option to "Use this network without Internet access" (or the like). It might also help to disable mobile data.
78+
Double check that you've entered the correct password: `splinesraspi`. Also, the Raspberry Pi won't provide Internet access to you, it will just serve a static HTML page as captive portal. This is why you might get thrown out of the WiFi network. If this is the case, there is usually an option to "Use this network without Internet access" (or the like). It might also help to disable mobile data.
7679

7780
**How can I use a "normal" browser when I have to click "Cancel" in the captive portal?**
7881

@@ -120,13 +123,14 @@ sudo systemctl restart access-point-server
120123

121124
<details>
122125
<summary><strong>Dependencies</strong></summary>
123-
This project was developed and tested on the Raspberry Pi 4, Raspbian GNU/Linux 11 (bullseye). Meanwhile, some setup configs might have changed. Feel free to open a pull request with updated config files.
126+
This project was developed and tested on the Raspberry Pi 4, Raspberry Pi OS: Bullseye (11) & Bookworm (12) (64-bit).
124127

125128
These are the principal dependencies used in this project:
126129

127130
*Captive Portal*
131+
- `dhcpcd`: DHCP server (automatically assign IP addresses to clients)
128132
- `hostapd`: Access Point (AP)
129-
- `dnsmasq`: Provide DHCP server (automatically assign IP addresses to clients) and DNS server (name resolution)
133+
- `dnsmasq`: DNS server (name resolution)
130134
- `netfilter-persistent` & `iptables-persistent`: Save firewall rules and restore them when the Raspberry Pi boots
131135

132136
*Node.js Server*
@@ -137,12 +141,12 @@ sudo systemctl restart access-point-server
137141
<details>
138142
<summary><strong>License</strong></summary>
139143

140-
This program is licensed with the very permissive MIT license, see the [LICENSE file](https://github.com/Splines/raspi-captive-portal/blob/main/LICENSE) for details. As this is only a small project, I don't require you to include the license header in every source file, however you must include it at the root of your project. According to the MIT license you must also include a copyright notice, that is, link back to this project, e.g. in this way:
144+
This program is licensed with the very permissive MIT license, see the [LICENSE file](https://github.com/Splines/raspi-captive-portal/blob/main/LICENSE) for details. As this is only a small project, I don't require you to include the license header in every source file. However, you must include a copyright notice in your project, that is, link back to this project, e.g. in this way:
141145

142-
> [Captive Portal & Access Point setup](https://github.com/Splines/raspi-captive-portal) - Copyright (c) 2022-23 Splines
146+
> [Captive Portal & Access Point setup](https://github.com/Splines/raspi-captive-portal) - Copyright (c) 2022-2024 Splines
143147
144148
Any questions regarding the license? [This FAQ](https://www.tawesoft.co.uk/kb/article/mit-license-faq) might help.
145149

146-
The logo of this project is exempt from the MIT license and you must not use it in any of your work. Icons used in the logo are bought from thenounproject.com ([1](https://thenounproject.com/icon/raspberry-pi-1109535/) and [2](https://thenounproject.com/icon/wifi-170991/)).
150+
The logo of this project is exempt from the MIT license and you must *not* use it in any of your work. Icons used in the logo are bought from thenounproject.com ([1](https://thenounproject.com/icon/raspberry-pi-1109535/) and [2](https://thenounproject.com/icon/wifi-170991/)).
147151

148152
</details>

access-point/access-point-server.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Description=Raspi Access Point Server Service
33
After=network.target
44

55
[Service]
6-
WorkingDirectory=/home/domin/Desktop/dev/new/raspi-captive-portal/server
6+
WorkingDirectory=/this/path/will/be/replaced
77
ExecStart=/usr/bin/npm start
88
Restart=on-failure
99
RestartSec=10

access-point/hostapd.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ auth_algs=1
2424
wpa=2
2525
wpa_key_mgmt=WPA-PSK
2626
rsn_pairwise=CCMP
27-
wpa_passphrase=splines-raspi
27+
wpa_passphrase=splinesraspi

access-point/setup-access-point.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@
55
# https://github.com/TomHumphries/RaspberryPiHotspot
66

77
# --- Install
8-
sudo apt update
8+
sudo apt-get update
9+
# dhcpcd is a DHCP client. It should come pre-installed by default, but that
10+
# was not the case for me when installing the new Bookworm Raspi OS. That's
11+
# why we play it safe and install it here (again).
12+
sudo apt-get install -y dhcpcd
913
# HostAPD access point software and DNS/DHCP via DNSMasq
10-
sudo apt install -y dnsmasq
11-
sudo apt install -y hostapd
14+
sudo apt-get install -y dnsmasq
15+
sudo apt-get install -y hostapd
1216
# Utility to save firewall rules and restoring them when the Pi boots
13-
sudo DEBIAN_FRONTEND=noninteractive apt install -y netfilter-persistent iptables-persistent
17+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y netfilter-persistent iptables-persistent
1418

1519
# Stop services since configuration files are not ready yet
1620
sudo systemctl stop dnsmasq

access-point/setup-server.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
sudo cp ./access-point-server.service /etc/systemd/system
1+
sudo cp ./access-point-server.service /etc/systemd/system/
22
sudo systemctl enable access-point-server
33

44
# Start service immediately

pyproject.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# This is NOT published as PyPI package. We just use this file to declare
2+
# some formatting/linting rules.
3+
4+
[tool.pylint."messages control"]
5+
disable = [
6+
"missing-module-docstring",
7+
"missing-function-docstring",
8+
"missing-class-docstring",
9+
]
10+
11+
[tool.pylint.format]
12+
max-line-length = 100
13+
max-module-lines = 500
14+
15+
[tool.black]
16+
line-length = 100

server/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
},
99
"devDependencies": {
1010
"@types/express": "^4.17.17",
11-
"@types/node": "^18.16.3",
11+
"@types/node": "^20.11.20",
1212
"kill-port": "^2.0.1",
13-
"nodemon": "^2.0.22",
13+
"nodemon": "^3.1.0",
1414
"rimraf": "^5.0.0",
1515
"ts-node": "^10.9.1",
1616
"typescript": "^5.0.4"
@@ -23,4 +23,4 @@
2323
"build-start": "npm run build && npm run start",
2424
"test": "echo \"This has to be implemented by you. You might want to try out 'mocha' \" && exit 1"
2525
}
26-
}
26+
}

0 commit comments

Comments
 (0)