Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated by Cargo
# will have compiled files and executables
/target/

/ui/build/*
.DS_Store
# These are backup files generated by rustfmt
**/*.rs.bk
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#This is a no-op dockerfile for local development. When deploying to devices, Dockerfile.template will be used by balena
FROM alpine

CMD ["sleep","infinity"]
7 changes: 6 additions & 1 deletion Dockerfile.template
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM balenalib/%%BALENA_MACHINE_NAME%%-debian

RUN install_packages dnsmasq wireless-tools
RUN install_packages dnsmasq wireless-tools unzip

WORKDIR /usr/src/app

Expand All @@ -9,5 +9,10 @@ RUN curl -Ls "https://github.com/balena-io/wifi-connect/releases/download/v$VERS
| tar -xvz -C /usr/src/app/

COPY scripts/start.sh .
COPY ui/built.zip .
RUN unzip ./built.zip
RUN rm -rf ui
RUN mv build ui


CMD ["bash", "start.sh"]
58 changes: 29 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
_Minimal fork of balena wifi-connect: we take over the UI and, for now, always go into hotspot mode... the goal is to reintigrate the core functionality_

<h1 align="center"><img width="460" src="https://github.com/balena-io/wifi-connect/raw/master/docs/images/wifi-connect.png" /></h1>

> Easy WiFi setup for Linux devices from your mobile phone or laptop
Expand All @@ -13,17 +15,16 @@ WiFi Connect is a utility for dynamically setting the WiFi configuration on a Li
<sub>an open source :satellite: project by <a href="https://balena.io">balena.io</a></sub>
</div>

***
---

[**Download**][DOWNLOAD] | [**How it works**](#how-it-works) | [**Installation**](#installation) | [**Support**](#support) | [**Roadmap**][MILESTONES]
[**Download**][download] | [**How it works**](#how-it-works) | [**Installation**](#installation) | [**Support**](#support) | [**Roadmap**][milestones]

[DOWNLOAD]: https://github.com/balena-io/wifi-connect/releases/latest
[MILESTONES]: https://github.com/balena-io/wifi-connect/milestones
[download]: https://github.com/balena-io/wifi-connect/releases/latest
[milestones]: https://github.com/balena-io/wifi-connect/milestones

![How it works](./docs/images/how-it-works.png?raw=true)

How it works
------------
## How it works

WiFi Connect interacts with NetworkManager, which should be the active network manager on the device's host OS.

Expand Down Expand Up @@ -53,10 +54,9 @@ For a complete list of command line arguments and environment variables check ou

The full application flow is illustrated in the [state flow diagram](./docs/state-flow-diagram.md).

***
---

Installation
------------
## Installation

WiFi Connect is designed to work on systems like Raspbian or Debian, or run in a docker container on top of balenaOS.

Expand All @@ -71,18 +71,21 @@ Run the following in your terminal, then follow the onscreen instructions:
### balenaOS

WiFi Connect can be integrated with a [balena.io](http://balena.io) application. (New to balena.io? Check out the [Getting Started Guide](https://balena.io/docs/#/pages/installing/gettingStarted.md).) This integration is accomplished through the use of two shared files:

- The [Dockerfile template](./Dockerfile.template) manages dependencies. The example included here has everything necessary for WiFi Connect. Application dependencies need to be added. For help with Dockerfiles, take a look at this [guide](https://balena.io/docs/deployment/dockerfile/).
- The [start script](./scripts/start.sh) should contain the commands that run the application. Adding these commands at the end of the script will ensure that everything kicks off after WiFi is correctly configured.
An example of using WiFi Connect in a Python project can be found [here](https://github.com/balena-io-projects/balena-wifi-connect-example).
- The [start script](./scripts/start.sh) should contain the commands that run the application. Adding these commands at the end of the script will ensure that everything kicks off after WiFi is correctly configured.
An example of using WiFi Connect in a Python project can be found [here](https://github.com/balena-io-projects/balena-wifi-connect-example).

### balenaOS: multicontainer app

To use WiFi Connect on a multicontainer app you need to:

- Set container network mode to host
- Enable DBUS by adding the required label and environment variable (more on [balenaOS dbus](https://www.balena.io/docs/learn/develop/runtime/#dbus-communication-with-host-os))
- Grant the container Network Admin capabilities

Your `docker-compose.yml` file should look like this:

```yaml
version: "2.1"

Expand All @@ -99,44 +102,41 @@ services:
...
```

***
---

Supported boards / dongles
--------------------------
## Supported boards / dongles

WiFi Connect has been successfully tested using the following WiFi dongles:

Dongle | Chip
-------------------------------------------|-------------------
[TP-LINK TL-WN722N](http://bit.ly/1P1MdAG) | Atheros AR9271
[ModMyPi](http://bit.ly/1gY3IHF) | Ralink RT3070
[ThePiHut](http://bit.ly/1LfkCgZ) | Ralink RT5370
| Dongle | Chip |
| ------------------------------------------ | -------------- |
| [TP-LINK TL-WN722N](http://bit.ly/1P1MdAG) | Atheros AR9271 |
| [ModMyPi](http://bit.ly/1gY3IHF) | Ralink RT3070 |
| [ThePiHut](http://bit.ly/1LfkCgZ) | Ralink RT5370 |

It has also been successfully tested with the onboard WiFi on a Raspberry Pi 3.

Given these results, it is probable that most dongles with *Atheros* or *Ralink* chipsets will work.
Given these results, it is probable that most dongles with _Atheros_ or _Ralink_ chipsets will work.

The following dongles are known **not** to work (as the driver is not friendly with access point mode or NetworkManager):

* Official Raspberry Pi dongle (BCM43143 chip)
* Addon NWU276 (Mediatek MT7601 chip)
* Edimax (Realtek RTL8188CUS chip)
- Official Raspberry Pi dongle (BCM43143 chip)
- Addon NWU276 (Mediatek MT7601 chip)
- Edimax (Realtek RTL8188CUS chip)

Dongles with similar chipsets will probably not work.

WiFi Connect is expected to work with all balena.io [supported boards](https://www.balena.io/docs/reference/hardware/devices/) as long as they have the [compatible dongles](https://www.balena.io/docs/reference/hardware/wifi-dongles/).

***
---

Support
-------
## Support

If you're having any problem, please [raise an issue](https://github.com/balena-io/wifi-connect/issues/new) on GitHub or [contact us](https://balena.io/community/), and the balena.io team will be happy to help.

***
---

License
-------
## License

WiFi Connect is free software, and may be redistributed under the terms specified in
the [license](https://github.com/balena-io/wifi-connect/blob/master/LICENSE).
20 changes: 17 additions & 3 deletions scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,27 @@ export DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket
# wget --spider http://google.com 2>&1

# 4. Is there an active WiFi connection?
# iwgetid -r
echo "192.168.42.1 samizdapp.localhost" >> /etc/hosts
echo "192.168.42.1 samizdapp.local" >> /etc/hosts
ETH=$(ip a show eth0 up | grep inet)
iwgetid -r



if [ $? -eq 0 ]; then
printf 'Skipping WiFi Connect\n'
echo 'Have WiFi Connect\n'
if [ -z "$ETH" ]; then
echo "no ethernet, do nothing"
else
echo "have wifi + ethernet, enable hotspot"
printf 'Starting WiFi Connect\n'
./wifi-connect --portal-listening-port 8000
fi
else
printf 'Starting WiFi Connect\n'
./wifi-connect
echo "no wifi, start hotspot"
printf 'Starting WiFi Connect\n'
./wifi-connect --portal-listening-port 8000
fi

# Start your application here.
Expand Down
24 changes: 11 additions & 13 deletions ui/build/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
{
"files": {
"main.js": "/static/js/main.2b22a9e9.chunk.js",
"runtime-main.js": "/static/js/runtime-main.2a78626f.js",
"static/css/2.c38cd9da.chunk.css": "/static/css/2.c38cd9da.chunk.css",
"static/js/2.ef060f46.chunk.js": "/static/js/2.ef060f46.chunk.js",
"index.html": "/index.html",
"precache-manifest.96ed21ec05e3b25e96ee640119b0334b.js": "/precache-manifest.96ed21ec05e3b25e96ee640119b0334b.js",
"service-worker.js": "/service-worker.js",
"static/js/2.ef060f46.chunk.js.LICENSE.txt": "/static/js/2.ef060f46.chunk.js.LICENSE.txt",
"static/media/logo.svg": "/static/media/logo.34c0c94e.svg"
"main.js": "/smz/wifi/static/js/main.b8c90bd6.chunk.js",
"runtime-main.js": "/smz/wifi/static/js/runtime-main.15b16ed2.js",
"static/js/2.de958b6e.chunk.js": "/smz/wifi/static/js/2.de958b6e.chunk.js",
"index.html": "/smz/wifi/index.html",
"precache-manifest.aa991961e7b4bee7b6d5cc3ba810d207.js": "/smz/wifi/precache-manifest.aa991961e7b4bee7b6d5cc3ba810d207.js",
"service-worker.js": "/smz/wifi/service-worker.js",
"static/js/2.de958b6e.chunk.js.LICENSE.txt": "/smz/wifi/static/js/2.de958b6e.chunk.js.LICENSE.txt",
"static/media/logo.svg": "/smz/wifi/static/media/logo.34c0c94e.svg"
},
"entrypoints": [
"static/js/runtime-main.2a78626f.js",
"static/css/2.c38cd9da.chunk.css",
"static/js/2.ef060f46.chunk.js",
"static/js/main.2b22a9e9.chunk.js"
"static/js/runtime-main.15b16ed2.js",
"static/js/2.de958b6e.chunk.js",
"static/js/main.b8c90bd6.chunk.js"
]
}
2 changes: 1 addition & 1 deletion ui/build/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="shortcut icon" href="/static/favicon.png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="/static/manifest.json"/><title>WiFi Connect</title><link href="/static/css/2.c38cd9da.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function t(t){for(var n,i,f=t[0],l=t[1],c=t[2],p=0,s=[];p<f.length;p++)i=f[p],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&s.push(o[i][0]),o[i]=0;for(n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n]);for(a&&a(t);s.length;)s.shift()();return u.push.apply(u,c||[]),r()}function r(){for(var e,t=0;t<u.length;t++){for(var r=u[t],n=!0,f=1;f<r.length;f++){var l=r[f];0!==o[l]&&(n=!1)}n&&(u.splice(t--,1),e=i(i.s=r[0]))}return e}var n={},o={1:0},u=[];function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=e,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/";var f=this["webpackJsonpwifi-connect-ui"]=this["webpackJsonpwifi-connect-ui"]||[],l=f.push.bind(f);f.push=t,f=f.slice();for(var c=0;c<f.length;c++)t(f[c]);var a=l;r()}([])</script><script src="/static/js/2.ef060f46.chunk.js"></script><script src="/static/js/main.2b22a9e9.chunk.js"></script></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="shortcut icon" href="/smz/wifi/static/favicon.png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="/smz/wifi/static/manifest.json"/><title>WiFi Connect</title></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function t(t){for(var n,i,f=t[0],l=t[1],c=t[2],p=0,s=[];p<f.length;p++)i=f[p],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&s.push(o[i][0]),o[i]=0;for(n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n]);for(a&&a(t);s.length;)s.shift()();return u.push.apply(u,c||[]),r()}function r(){for(var e,t=0;t<u.length;t++){for(var r=u[t],n=!0,f=1;f<r.length;f++){var l=r[f];0!==o[l]&&(n=!1)}n&&(u.splice(t--,1),e=i(i.s=r[0]))}return e}var n={},o={1:0},u=[];function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=e,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/smz/wifi/";var f=this["webpackJsonpwifi-connect-ui"]=this["webpackJsonpwifi-connect-ui"]||[],l=f.push.bind(f);f.push=t,f=f.slice();for(var c=0;c<f.length;c++)t(f[c]);var a=l;r()}([])</script><script src="/smz/wifi/static/js/2.de958b6e.chunk.js"></script><script src="/smz/wifi/static/js/main.b8c90bd6.chunk.js"></script></body></html>
30 changes: 0 additions & 30 deletions ui/build/precache-manifest.96ed21ec05e3b25e96ee640119b0334b.js

This file was deleted.

6 changes: 3 additions & 3 deletions ui/build/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");

importScripts(
"/precache-manifest.96ed21ec05e3b25e96ee640119b0334b.js"
"/smz/wifi/precache-manifest.aa991961e7b4bee7b6d5cc3ba810d207.js"
);

self.addEventListener('message', (event) => {
Expand All @@ -33,7 +33,7 @@ workbox.core.clientsClaim();
self.__precacheManifest = [].concat(self.__precacheManifest || []);
workbox.precaching.precacheAndRoute(self.__precacheManifest, {});

workbox.routing.registerNavigationRoute(workbox.precaching.getCacheKeyForURL("/index.html"), {
workbox.routing.registerNavigationRoute(workbox.precaching.getCacheKeyForURL("/smz/wifi/index.html"), {

blacklist: [/^\/_/,/\/[^\/?]+\.[^\/]+$/],
blacklist: [/^\/_/,/\/[^/?]+\.[^/]+$/],
});
1 change: 0 additions & 1 deletion ui/build/static/css/2.c38cd9da.chunk.css

This file was deleted.

2 changes: 0 additions & 2 deletions ui/build/static/js/2.ef060f46.chunk.js

This file was deleted.

81 changes: 0 additions & 81 deletions ui/build/static/js/2.ef060f46.chunk.js.LICENSE.txt

This file was deleted.

Loading