Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

add passwordless access point #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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 src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {

// defaults
const AP_SSID = process.env.AP_SSID || `WiFi Repeater`;
const AP_PASSWORD = process.env.AP_PASSWORD || 'charlietheunicorn';
const AP_PASSWORD = process.env.AP_PASSWORD || '';
const WIFI_SSID = process.env.WIFI_SSID;
const WIFI_PASSWORD = process.env.WIFI_PASSWORD;

Expand Down
13 changes: 9 additions & 4 deletions src/nm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ export const createAccessPoint = async (device: WirelessNetwork): Promise<any> =
['ssid', ['ay', stringToArrayOfBytes(device.ssid)]],
['mode', ['s', 'ap']],
]],
['802-11-wireless-security', [
['key-mgmt', ['s', 'wpa-psk']],
['psk', ['s', device.password]],
]],
['ipv4', [
['method', ['s', 'shared']],
]],
Expand All @@ -60,6 +56,15 @@ export const createAccessPoint = async (device: WirelessNetwork): Promise<any> =
]],
];

if (device.password) {
connectionParams.push(
['802-11-wireless-security', [
['key-mgmt', ['s', 'wpa-psk']],
['psk', ['s', device.password]],
]]
);
}

const dbusPath = await getPathByIface(device.iface);
const connection = await addConnection(connectionParams);
const result = await activateConnection(connection, dbusPath);
Expand Down