Auto detect server
This commit is contained in:
17
Client/android/.idea/deploymentTargetDropDown.xml
generated
Normal file
17
Client/android/.idea/deploymentTargetDropDown.xml
generated
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="deploymentTargetDropDown">
|
||||||
|
<runningDeviceTargetSelectedWithDropDown>
|
||||||
|
<Target>
|
||||||
|
<type value="RUNNING_DEVICE_TARGET" />
|
||||||
|
<deviceKey>
|
||||||
|
<Key>
|
||||||
|
<type value="SERIAL_NUMBER" />
|
||||||
|
<value value="ZY326S5BLL" />
|
||||||
|
</Key>
|
||||||
|
</deviceKey>
|
||||||
|
</Target>
|
||||||
|
</runningDeviceTargetSelectedWithDropDown>
|
||||||
|
<timeTargetWasSelectedWithDropDown value="2022-02-06T22:33:46.214309800Z" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -13,7 +13,7 @@ dependencies {
|
|||||||
implementation project(':capacitor-haptics')
|
implementation project(':capacitor-haptics')
|
||||||
implementation project(':capacitor-keyboard')
|
implementation project(':capacitor-keyboard')
|
||||||
implementation project(':capacitor-status-bar')
|
implementation project(':capacitor-status-bar')
|
||||||
|
implementation "org.jmdns:jmdns:3.5.5"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="op.ionic.starter">
|
package="op.ionic.starter">
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme"
|
android:theme="@style/AppTheme"
|
||||||
android:usesCleartextTraffic="true">
|
android:usesCleartextTraffic="true"
|
||||||
|
android:requestLegacyExternalStorage="true">
|
||||||
<activity
|
<activity
|
||||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
|
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
|
||||||
android:name="op.ionic.starter.MainActivity"
|
android:name="op.ionic.starter.MainActivity"
|
||||||
@@ -39,4 +41,7 @@
|
|||||||
<!-- Permissions -->
|
<!-- Permissions -->
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|||||||
@@ -2,6 +2,11 @@
|
|||||||
<widget version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
|
<widget version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
|
||||||
<access origin="*" />
|
<access origin="*" />
|
||||||
|
|
||||||
|
<feature name="ARP">
|
||||||
|
<param name="android-package" value="com.arvindr21.ARP"/>
|
||||||
|
<param name="onload" value="true"/>
|
||||||
|
</feature>
|
||||||
|
|
||||||
<feature name="CordovaHttpPlugin">
|
<feature name="CordovaHttpPlugin">
|
||||||
<param name="android-package" value="com.silkimen.cordovahttp.CordovaHttpPlugin"/>
|
<param name="android-package" value="com.silkimen.cordovahttp.CordovaHttpPlugin"/>
|
||||||
</feature>
|
</feature>
|
||||||
@@ -11,10 +16,19 @@
|
|||||||
<param name="onload" value="true"/>
|
<param name="onload" value="true"/>
|
||||||
</feature>
|
</feature>
|
||||||
|
|
||||||
|
<feature name="ZeroConf">
|
||||||
|
<param name="android-package" value="net.becvert.cordova.ZeroConf"/>
|
||||||
|
</feature>
|
||||||
|
|
||||||
<feature name="SQLitePlugin">
|
<feature name="SQLitePlugin">
|
||||||
<param name="android-package" value="io.sqlc.SQLitePlugin"/>
|
<param name="android-package" value="io.sqlc.SQLitePlugin"/>
|
||||||
</feature>
|
</feature>
|
||||||
|
|
||||||
|
<feature name="WakeOnLan">
|
||||||
|
<param name="android-package" value="com.matlipe.WakeOnLan"/>
|
||||||
|
<param name="onload" value="true"/>
|
||||||
|
</feature>
|
||||||
|
|
||||||
<feature name="Device">
|
<feature name="Device">
|
||||||
<param name="android-package" value="org.apache.cordova.device.Device"/>
|
<param name="android-package" value="org.apache.cordova.device.Device"/>
|
||||||
</feature>
|
</feature>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"appId": "op.ionic.starter",
|
"appId": "op.ionic.starter",
|
||||||
"appName": "MyApp",
|
"appName": "GoToBed",
|
||||||
"webDir": "www",
|
"webDir": "www",
|
||||||
"bundledWebRuntime": false,
|
"bundledWebRuntime": false,
|
||||||
"cordova": {
|
"cordova": {
|
||||||
|
|||||||
@@ -6,6 +6,15 @@
|
|||||||
<param name="ios-package" value="CordovaHttpPlugin"/>
|
<param name="ios-package" value="CordovaHttpPlugin"/>
|
||||||
</feature>
|
</feature>
|
||||||
|
|
||||||
|
<feature name="File">
|
||||||
|
<param name="ios-package" value="CDVFile"/>
|
||||||
|
<param name="onload" value="true"/>
|
||||||
|
</feature>
|
||||||
|
|
||||||
|
<feature name="ZeroConf">
|
||||||
|
<param name="ios-package" value="ZeroConf"/>
|
||||||
|
</feature>
|
||||||
|
|
||||||
<feature name="SQLitePlugin">
|
<feature name="SQLitePlugin">
|
||||||
<param name="ios-package" value="SQLitePlugin"/>
|
<param name="ios-package" value="SQLitePlugin"/>
|
||||||
</feature>
|
</feature>
|
||||||
|
|||||||
36867
Client/package-lock.json
generated
Normal file
36867
Client/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -23,6 +23,7 @@
|
|||||||
"@angular/router": "~12.1.1",
|
"@angular/router": "~12.1.1",
|
||||||
"@awesome-cordova-plugins/core": "^5.37.3",
|
"@awesome-cordova-plugins/core": "^5.37.3",
|
||||||
"@awesome-cordova-plugins/http": "^5.37.3",
|
"@awesome-cordova-plugins/http": "^5.37.3",
|
||||||
|
"@awesome-cordova-plugins/zeroconf": "^5.37.3",
|
||||||
"@capacitor/android": "3.3.3",
|
"@capacitor/android": "3.3.3",
|
||||||
"@capacitor/app": "1.0.6",
|
"@capacitor/app": "1.0.6",
|
||||||
"@capacitor/core": "3.3.0",
|
"@capacitor/core": "3.3.0",
|
||||||
@@ -31,6 +32,7 @@
|
|||||||
"@capacitor/keyboard": "1.1.3",
|
"@capacitor/keyboard": "1.1.3",
|
||||||
"@capacitor/status-bar": "1.0.6",
|
"@capacitor/status-bar": "1.0.6",
|
||||||
"@ionic-native/core": "^5.36.0",
|
"@ionic-native/core": "^5.36.0",
|
||||||
|
"@ionic-native/zeroconf": "^5.36.0",
|
||||||
"@ionic/angular": "^5.5.2",
|
"@ionic/angular": "^5.5.2",
|
||||||
"@ionic/storage": "^3.0.6",
|
"@ionic/storage": "^3.0.6",
|
||||||
"@ionic/storage-angular": "^3.0.6",
|
"@ionic/storage-angular": "^3.0.6",
|
||||||
@@ -38,12 +40,15 @@
|
|||||||
"@ngrx/router-store": "^13.0.2",
|
"@ngrx/router-store": "^13.0.2",
|
||||||
"@ngrx/store": "^13.0.2",
|
"@ngrx/store": "^13.0.2",
|
||||||
"cordova-android": "9.1.0",
|
"cordova-android": "9.1.0",
|
||||||
|
"cordova-arp-cache-fetch": "^0.3.2",
|
||||||
"cordova-plugin-advanced-http": "^3.2.2",
|
"cordova-plugin-advanced-http": "^3.2.2",
|
||||||
"cordova-plugin-file": "^6.0.2",
|
"cordova-plugin-file": "^6.0.2",
|
||||||
|
"cordova-plugin-zeroconf": "^1.4.2",
|
||||||
"cordova-sqlite-storage": "^6.0.0",
|
"cordova-sqlite-storage": "^6.0.0",
|
||||||
"eva-icons": "^1.1.3",
|
"eva-icons": "^1.1.3",
|
||||||
"localforage": "^1.10.0",
|
"localforage": "^1.10.0",
|
||||||
"localforage-cordovasqlitedriver": "^1.8.0",
|
"localforage-cordovasqlitedriver": "^1.8.0",
|
||||||
|
"phonegap-wake-on-lan": "file:phonegap-wake-on-lan",
|
||||||
"rxjs": "^6.6.7",
|
"rxjs": "^6.6.7",
|
||||||
"tslib": "^2.2.0",
|
"tslib": "^2.2.0",
|
||||||
"zone.js": "~0.11.4"
|
"zone.js": "~0.11.4"
|
||||||
|
|||||||
26
Client/phonegap-wake-on-lan/README.md
Normal file
26
Client/phonegap-wake-on-lan/README.md
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# PhoneGap Wake On Lan
|
||||||
|
Very basic plugin for sending wake on lan requests from a phonegap app.
|
||||||
|
|
||||||
|
# Installation
|
||||||
|
1. phonegap plugin add https://github.com/lipemat/phonegap-wake-on-lan.git
|
||||||
|
2. Or add `<plugin spec="https://github.com/lipemat/phonegap-wake-on-lan.git" source="git"/>` to your main config.xml
|
||||||
|
|
||||||
|
# Usage in JS
|
||||||
|
~~~~
|
||||||
|
document.addEventListener( 'deviceready', function(){
|
||||||
|
//replace the broadcast ip and mac
|
||||||
|
var BROADCAST = '192.168.1.255';
|
||||||
|
var MAC = '48-2C-6A-1E-59-3D';
|
||||||
|
window.plugins.WakeOnLan.wake( BROADCAST, MAC, function( r ){
|
||||||
|
console.log( r )
|
||||||
|
}, function( r){
|
||||||
|
console.error( r )
|
||||||
|
} );
|
||||||
|
}, false );
|
||||||
|
~~~~
|
||||||
|
|
||||||
|
### That's it! Super straight forward.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Wake On Lan Plugin For Cordova/Phonegap
|
||||||
58
Client/phonegap-wake-on-lan/package.json
Normal file
58
Client/phonegap-wake-on-lan/package.json
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
{
|
||||||
|
"name": "phonegap-wake-on-lan",
|
||||||
|
"version": "8.1.1-dev",
|
||||||
|
"description": "You can use the BarcodeScanner plugin to scan different types of barcodes (using the device's camera) and get the metadata encoded in them for processing within your application.",
|
||||||
|
"cordova": {
|
||||||
|
"id": "phonegap-wake-on-lan",
|
||||||
|
"platforms": [
|
||||||
|
"ios",
|
||||||
|
"android",
|
||||||
|
"windows",
|
||||||
|
"browser"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "local",
|
||||||
|
"url": "C:\\repos\\IonicGoToBed\\go-to-bed\\Client\\plugins\\phonegap-wake-on-lan"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"ecosystem:cordova",
|
||||||
|
"ecosystem:phonegap",
|
||||||
|
"cordova-ios",
|
||||||
|
"cordova-android",
|
||||||
|
"cordova-windows",
|
||||||
|
"cordova-browser",
|
||||||
|
"cordova:plugin"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"cordovaDependencies": {
|
||||||
|
"<7.0.0": {
|
||||||
|
"cordova-android": "<6.3.0"
|
||||||
|
},
|
||||||
|
"7.0.0": {
|
||||||
|
"cordova-android": ">=6.3.0"
|
||||||
|
},
|
||||||
|
"7.1.0": {
|
||||||
|
"cordova-android": ">=6.3.0",
|
||||||
|
"cordova": ">=7.1.0"
|
||||||
|
},
|
||||||
|
"8.0.0": {
|
||||||
|
"cordova-android": ">=6.3.0",
|
||||||
|
"cordova": ">=7.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"author": "Adobe PhoneGap Team",
|
||||||
|
"license": "MIT",
|
||||||
|
"scripts": {
|
||||||
|
"test": "jasmine-node --color spec"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"jasmine-node": "1.14.5",
|
||||||
|
"pluginpub": "^0.0.9"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"nopt": "^4.0.1",
|
||||||
|
"shelljs": "^0.8.3"
|
||||||
|
}
|
||||||
|
}
|
||||||
31
Client/phonegap-wake-on-lan/plugin.xml
Normal file
31
Client/phonegap-wake-on-lan/plugin.xml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
||||||
|
id="com.matlipe.WakeOnLan"
|
||||||
|
version="1.0.2">
|
||||||
|
|
||||||
|
<name>Wake On Lan</name>
|
||||||
|
<description>
|
||||||
|
Send Magic Packets to Wake Up Devices
|
||||||
|
</description>
|
||||||
|
<author>Mat Lipe</author>
|
||||||
|
<license>MIT</license>
|
||||||
|
<keywords>Wake On Lan</keywords>
|
||||||
|
<engines>
|
||||||
|
<engine name="cordova" version=">=3.0.0"/>
|
||||||
|
</engines>
|
||||||
|
|
||||||
|
<js-module src="www/WakeOnLan.js" name="WakeOnLan">
|
||||||
|
<clobbers target="window.plugins.WakeOnLan"/>
|
||||||
|
</js-module>
|
||||||
|
|
||||||
|
<!-- android -->
|
||||||
|
<platform name="android">
|
||||||
|
<config-file target="res/xml/config.xml" parent="/*">
|
||||||
|
<feature name="WakeOnLan">
|
||||||
|
<param name="android-package" value="com.matlipe.WakeOnLan"/>
|
||||||
|
<param name="onload" value="true"/>
|
||||||
|
</feature>
|
||||||
|
</config-file>
|
||||||
|
<source-file src="src/WakeOnLan.java" target-dir="src/com/matlipe/WakeOnLan"/>
|
||||||
|
</platform>
|
||||||
|
</plugin>
|
||||||
89
Client/phonegap-wake-on-lan/src/WakeOnLan.java
Normal file
89
Client/phonegap-wake-on-lan/src/WakeOnLan.java
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
package com.matlipe;
|
||||||
|
|
||||||
|
import org.apache.cordova.CordovaPlugin;
|
||||||
|
import org.apache.cordova.CallbackContext;
|
||||||
|
|
||||||
|
import java.net.DatagramPacket;
|
||||||
|
import java.net.DatagramSocket;
|
||||||
|
import java.net.InetAddress;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
public class WakeOnLan extends CordovaPlugin {
|
||||||
|
|
||||||
|
private static final String WAKE_ACTION = "wake";
|
||||||
|
private static final int PORT = 9;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
|
||||||
|
boolean result = false;
|
||||||
|
if( WAKE_ACTION.equals( action ) ){
|
||||||
|
if( wake( args ) ){
|
||||||
|
callbackContext.success( "Device has been woken up" );
|
||||||
|
result = true;
|
||||||
|
} else {
|
||||||
|
callbackContext.error( "Device did not wake up" );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
callbackContext.error( "Invalid action : " + action + " passed" );
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Boolean wake( JSONArray args ) {
|
||||||
|
Boolean result = false;
|
||||||
|
try{
|
||||||
|
String ipStr = args.getString( 0 );
|
||||||
|
String macStr = args.getString( 1 );
|
||||||
|
|
||||||
|
|
||||||
|
byte[] macBytes = getMacBytes( macStr );
|
||||||
|
byte[] bytes = new byte[ 6 + 16 * macBytes.length ];
|
||||||
|
|
||||||
|
for( int i = 0; i < 6; i++ ){
|
||||||
|
bytes[ i ] = ( byte ) 0xff;
|
||||||
|
}
|
||||||
|
for( int i = 6; i < bytes.length; i += macBytes.length ){
|
||||||
|
System.arraycopy( macBytes, 0, bytes, i, macBytes.length );
|
||||||
|
}
|
||||||
|
|
||||||
|
InetAddress address = InetAddress.getByName( ipStr );
|
||||||
|
DatagramPacket packet = new DatagramPacket( bytes, bytes.length, address, PORT );
|
||||||
|
DatagramSocket socket = new DatagramSocket();
|
||||||
|
socket.send( packet );
|
||||||
|
socket.close();
|
||||||
|
|
||||||
|
System.out.println( "Wake-on-LAN packet sent." );
|
||||||
|
|
||||||
|
result = true;
|
||||||
|
} catch( Exception e ){
|
||||||
|
System.out.println( "WakeOnLan Exception thrown" + e.toString() );
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private byte[] getMacBytes( String macStr ) throws IllegalArgumentException {
|
||||||
|
byte[] bytes = new byte[ 6 ];
|
||||||
|
String[] hex = macStr.split( "(\\:|\\-)" );
|
||||||
|
if( hex.length != 6 ){
|
||||||
|
throw new IllegalArgumentException( "Invalid MAC address." );
|
||||||
|
}
|
||||||
|
try{
|
||||||
|
for( int i = 0; i < 6; i++ ){
|
||||||
|
bytes[ i ] = ( byte ) Integer.parseInt( hex[ i ], 16 );
|
||||||
|
}
|
||||||
|
} catch( NumberFormatException e ){
|
||||||
|
throw new IllegalArgumentException( "Invalid hex digit in MAC address." );
|
||||||
|
}
|
||||||
|
return bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
24
Client/phonegap-wake-on-lan/www/WakeOnLan.js
Normal file
24
Client/phonegap-wake-on-lan/www/WakeOnLan.js
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2011 Simon Yeldon
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
var WakeOnLan = function(){}
|
||||||
|
|
||||||
|
WakeOnLan.prototype.wake = function(mac, ip, success, fail) {
|
||||||
|
return PhoneGap.exec( success, fail, "WakeOnLan", "wake", [mac, ip]);
|
||||||
|
}
|
||||||
|
|
||||||
|
PhoneGap.addConstructor(function() {
|
||||||
|
PhoneGap.addPlugin('wol', new WakeOnLan());
|
||||||
|
});
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { WOLService } from './services/WOL.service';
|
||||||
|
import { SearchHostPage } from './components/searchHost/searchHost.page';
|
||||||
import { ExploreContainerComponent } from './components/explore-container/explore-container.component';
|
import { ExploreContainerComponent } from './components/explore-container/explore-container.component';
|
||||||
import { ServerSettingsComponent } from './components/settings/serverSettings/serverSettings.component';
|
import { ServerSettingsComponent } from './components/settings/serverSettings/serverSettings.component';
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
@@ -26,7 +28,8 @@ const components = [
|
|||||||
MenuPage,
|
MenuPage,
|
||||||
ServerSettingsComponent,
|
ServerSettingsComponent,
|
||||||
SettingsPage,
|
SettingsPage,
|
||||||
ExploreContainerComponent
|
ExploreContainerComponent,
|
||||||
|
SearchHostPage
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
@@ -44,10 +47,10 @@ const components = [
|
|||||||
GotobedStoreModule,
|
GotobedStoreModule,
|
||||||
IonicStorageModule.forRoot({
|
IonicStorageModule.forRoot({
|
||||||
name: 'gotobedStorage',
|
name: 'gotobedStorage',
|
||||||
driverOrder: [CordovaSQLLiteDriver._driver, Drivers.IndexedDB]})
|
driverOrder: [CordovaSQLLiteDriver._driver, Drivers.IndexedDB]}),
|
||||||
],
|
],
|
||||||
providers: [HTTP, { provide: RouteReuseStrategy, useClass: IonicRouteStrategy}],
|
providers: [HTTP, { provide: RouteReuseStrategy, useClass: IonicRouteStrategy}],
|
||||||
bootstrap: [AppComponent],
|
bootstrap: [AppComponent],
|
||||||
exports: [NetworkRequestsService]
|
exports: [NetworkRequestsService, WOLService]
|
||||||
})
|
})
|
||||||
export class AppModule {}
|
export class AppModule {}
|
||||||
|
|||||||
@@ -26,6 +26,19 @@
|
|||||||
</ion-col>
|
</ion-col>
|
||||||
</ion-row>
|
</ion-row>
|
||||||
|
|
||||||
|
<ion-row>
|
||||||
|
<ion-col>
|
||||||
|
<ion-card class="noselect" (click)="wakeUp()">
|
||||||
|
<ion-card-header>
|
||||||
|
<ion-card-title>Turn on</ion-card-title>
|
||||||
|
</ion-card-header>
|
||||||
|
<ion-card-content>
|
||||||
|
<ion-icon name="ice-cream-outline"></ion-icon>
|
||||||
|
</ion-card-content>
|
||||||
|
</ion-card>
|
||||||
|
</ion-col>
|
||||||
|
</ion-row>
|
||||||
|
|
||||||
<ion-row>
|
<ion-row>
|
||||||
<ion-col>
|
<ion-col>
|
||||||
<ion-card class="noselect" (click)="commandAlert('sleep')">
|
<ion-card class="noselect" (click)="commandAlert('sleep')">
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { WOLService } from './../../services/WOL.service';
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { AlertController } from '@ionic/angular';
|
import { AlertController } from '@ionic/angular';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
@@ -20,7 +21,8 @@ export class HomePage implements OnInit{
|
|||||||
constructor(
|
constructor(
|
||||||
public alertController: AlertController,
|
public alertController: AlertController,
|
||||||
private httpCommand: NetworkRequestsService,
|
private httpCommand: NetworkRequestsService,
|
||||||
private store: Store
|
private store: Store,
|
||||||
|
private WOLService: WOLService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@@ -59,4 +61,8 @@ export class HomePage implements OnInit{
|
|||||||
|
|
||||||
await alert.present();
|
await alert.present();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wakeUp(){
|
||||||
|
this.WOLService.wakeUp();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import { SearchHostPageRoutingModule } from './searchHost-routing.module';
|
|||||||
ExploreContainerComponentModule,
|
ExploreContainerComponentModule,
|
||||||
SearchHostPageRoutingModule
|
SearchHostPageRoutingModule
|
||||||
],
|
],
|
||||||
|
exports: [SearchHostPage],
|
||||||
declarations: [SearchHostPage]
|
declarations: [SearchHostPage]
|
||||||
})
|
})
|
||||||
export class SearchHostPageModule {}
|
export class SearchHostPageModule {}
|
||||||
|
|||||||
@@ -5,11 +5,27 @@
|
|||||||
</ion-header>
|
</ion-header>
|
||||||
|
|
||||||
<ion-content [fullscreen]="true">
|
<ion-content [fullscreen]="true">
|
||||||
|
<ion-refresher slot="fixed" (ionRefresh)="refresh($event)">
|
||||||
|
<ion-refresher-content></ion-refresher-content>
|
||||||
|
</ion-refresher>
|
||||||
<ion-header collapse="condense">
|
<ion-header collapse="condense">
|
||||||
<ion-toolbar>
|
<ion-toolbar>
|
||||||
<ion-title size="large">WOL</ion-title>
|
<ion-title size="large">WOL</ion-title>
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
|
<!-- WOL -->
|
||||||
<app-explore-container name="WOL"></app-explore-container>
|
<ion-list>
|
||||||
|
<ion-item *ngIf="netWorkDevices.length == 0">
|
||||||
|
<ion-label>No Devices found</ion-label>
|
||||||
|
</ion-item>
|
||||||
|
<ion-item-sliding *ngFor="let device of netWorkDevices">
|
||||||
|
<ion-item>
|
||||||
|
<ion-label>{{device.ipv4Addresses[0]}}</ion-label>
|
||||||
|
</ion-item>
|
||||||
|
<ion-item-options>
|
||||||
|
<ion-item-option (click)="saveWolDevice(device)">Save</ion-item-option>
|
||||||
|
</ion-item-options>
|
||||||
|
</ion-item-sliding>
|
||||||
|
</ion-list>
|
||||||
|
<!-- wol end -->
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|||||||
@@ -1,8 +1,52 @@
|
|||||||
import { Component } from '@angular/core';
|
import { WolAddressChanged } from './../../store/gotobed.actions';
|
||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { Zeroconf, ZeroconfResult, ZeroconfService } from "@ionic-native/zeroconf";
|
||||||
|
import { Store } from '@ngrx/store';
|
||||||
|
import { ServiceOptions } from 'src/app/gotobed.models';
|
||||||
|
import { MacSettingsChanged } from 'src/app/store/gotobed.actions';
|
||||||
|
import { GotobedState } from 'src/app/store/gotobed.state';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-searchhost',
|
selector: 'app-searchhost',
|
||||||
templateUrl: 'searchHost.page.html',
|
templateUrl: 'searchHost.page.html',
|
||||||
styleUrls: ['searchHost.page.scss']
|
styleUrls: ['searchHost.page.scss']
|
||||||
})
|
})
|
||||||
export class SearchHostPage { }
|
export class SearchHostPage implements OnInit {
|
||||||
|
netWorkDevices: ZeroconfService[] = [];
|
||||||
|
|
||||||
|
constructor(private store: Store<GotobedState>) {}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.scanDevices();
|
||||||
|
}
|
||||||
|
|
||||||
|
scanDevices() {
|
||||||
|
Zeroconf.watchAddressFamily = 'ipv4';
|
||||||
|
Zeroconf.watch("_http._tcp.", "local.").subscribe(result => {
|
||||||
|
console.log("Zeroconf Service Changed:");
|
||||||
|
console.log(result.service);
|
||||||
|
if(result.service.ipv4Addresses.length > 0 && JSON.stringify(this.netWorkDevices).includes(result.service.ipv4Addresses[0]) == false) {
|
||||||
|
this.netWorkDevices.push(result.service);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
saveWolDevice(device: ZeroconfService) {
|
||||||
|
this.store.dispatch(new MacSettingsChanged(device.txtRecord.mac));
|
||||||
|
this.store.dispatch(new WolAddressChanged(this.convertToBroadcast(device.ipv4Addresses[0])));
|
||||||
|
}
|
||||||
|
|
||||||
|
refresh(event) {
|
||||||
|
console.log('Begin async operation');
|
||||||
|
this.scanDevices();
|
||||||
|
setTimeout(() => {
|
||||||
|
console.log('Async operation has ended');
|
||||||
|
event.target.complete();
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
|
|
||||||
|
private convertToBroadcast(ip: string) {
|
||||||
|
let subnetArray = ip.split('.');
|
||||||
|
subnetArray[3] = '255';
|
||||||
|
return subnetArray.join('.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -17,4 +17,15 @@
|
|||||||
<ion-label position="fixed">Port</ion-label>
|
<ion-label position="fixed">Port</ion-label>
|
||||||
<ion-input number placeholder="8080" (ionChange)="onPortChange($event)" [value]="port"></ion-input>
|
<ion-input number placeholder="8080" (ionChange)="onPortChange($event)" [value]="port"></ion-input>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
<ion-list-header>
|
||||||
|
<ion-label> WOL Settings </ion-label>
|
||||||
|
</ion-list-header>
|
||||||
|
<ion-item>
|
||||||
|
<ion-label position="fixed">Mac Address</ion-label>
|
||||||
|
<ion-input placeholder="MM:MM:MM:SS:SS:SS" (ionChange)="onMacAdressChange($event)" [value]="macAddress"></ion-input>
|
||||||
|
</ion-item>
|
||||||
|
<ion-item>
|
||||||
|
<ion-label position="fixed">Wol Address</ion-label>
|
||||||
|
<ion-input placeholder="Ex: 192.168.1.255" (ionChange)="onWolAddressChange($event)" [value]="wolAddress"></ion-input>
|
||||||
|
</ion-item>
|
||||||
</ion-list>
|
</ion-list>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { getAddress, getPort, getProtocol } from './../../../store/gotobed.selectors';
|
import { getAddress, getMacAddress, getPort, getProtocol, getWolAddress } from './../../../store/gotobed.selectors';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { PortSettingsChanged, ProtocolSettingsChanged, SaveAddressSettings } from 'src/app/store/gotobed.actions';
|
import { MacSettingsChanged, PortSettingsChanged, ProtocolSettingsChanged, SaveAddressSettings, WolAddressChanged } from 'src/app/store/gotobed.actions';
|
||||||
import { GotobedState } from 'src/app/store/gotobed.state';
|
import { GotobedState } from 'src/app/store/gotobed.state';
|
||||||
import { InputCustomEvent } from 'src/app/gotobed.models';
|
import { InputCustomEvent } from 'src/app/gotobed.models';
|
||||||
|
|
||||||
@@ -14,6 +14,8 @@ export class ServerSettingsComponent implements OnInit{
|
|||||||
port = null;
|
port = null;
|
||||||
address = '';
|
address = '';
|
||||||
protocol = '';
|
protocol = '';
|
||||||
|
macAddress = '';
|
||||||
|
wolAddress = '';
|
||||||
|
|
||||||
constructor(private store: Store<GotobedState>) { }
|
constructor(private store: Store<GotobedState>) { }
|
||||||
|
|
||||||
@@ -30,6 +32,14 @@ export class ServerSettingsComponent implements OnInit{
|
|||||||
this.store
|
this.store
|
||||||
.select(getProtocol)
|
.select(getProtocol)
|
||||||
.subscribe(protocol => (this.protocol = protocol));
|
.subscribe(protocol => (this.protocol = protocol));
|
||||||
|
|
||||||
|
this.store
|
||||||
|
.select(getMacAddress)
|
||||||
|
.subscribe(macAddress => (this.macAddress = macAddress));
|
||||||
|
|
||||||
|
this.store
|
||||||
|
.select(getWolAddress)
|
||||||
|
.subscribe(wolAddress => (this.wolAddress = wolAddress));
|
||||||
}
|
}
|
||||||
|
|
||||||
onProtocolChange(protocol: InputCustomEvent){
|
onProtocolChange(protocol: InputCustomEvent){
|
||||||
@@ -44,4 +54,12 @@ export class ServerSettingsComponent implements OnInit{
|
|||||||
console.log(port.detail.value);
|
console.log(port.detail.value);
|
||||||
this.store.dispatch(new PortSettingsChanged(port.detail.value));
|
this.store.dispatch(new PortSettingsChanged(port.detail.value));
|
||||||
}
|
}
|
||||||
|
onMacAdressChange(macAddress: InputCustomEvent){
|
||||||
|
console.log(macAddress.detail.value);
|
||||||
|
this.store.dispatch(new MacSettingsChanged(macAddress.detail.value));
|
||||||
|
}
|
||||||
|
onWolAddressChange(wolAddress: InputCustomEvent){
|
||||||
|
console.log(wolAddress.detail.value);
|
||||||
|
this.store.dispatch(new WolAddressChanged(wolAddress.detail.value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ export const addressStorageKey = 'AddressKey';
|
|||||||
export const portStorageKey = 'PortKey';
|
export const portStorageKey = 'PortKey';
|
||||||
export const protocolStorageKey = 'ProtocolKey';
|
export const protocolStorageKey = 'ProtocolKey';
|
||||||
export const commandStorageKey = 'CommandKey';
|
export const commandStorageKey = 'CommandKey';
|
||||||
|
export const macStorageKey = 'MacKey';
|
||||||
|
export const wolStorageKey = 'WolKey';
|
||||||
|
|
||||||
export interface InputChangeEventDetail {
|
export interface InputChangeEventDetail {
|
||||||
value: string | undefined | null;
|
value: string | undefined | null;
|
||||||
@@ -16,3 +17,29 @@ export interface InputCustomEvent extends CustomEvent {
|
|||||||
export interface NetRequest{
|
export interface NetRequest{
|
||||||
command: string;
|
command: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ServiceOptions {
|
||||||
|
name: string;
|
||||||
|
host?: string | undefined;
|
||||||
|
port: number;
|
||||||
|
type: string;
|
||||||
|
subtypes?: string[] | undefined;
|
||||||
|
protocol?: 'udp'|'tcp' | undefined;
|
||||||
|
txt?: { [key: string]: string } | undefined;
|
||||||
|
probe?: boolean | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface LocalZeroconf {
|
||||||
|
domain: string;
|
||||||
|
type: string;
|
||||||
|
name: string;
|
||||||
|
port: number;
|
||||||
|
hostname: string;
|
||||||
|
ipv4Addresses: string[];
|
||||||
|
ipv6Addresses: string[];
|
||||||
|
txtRecord: macAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface macAddress {
|
||||||
|
mac: string;
|
||||||
|
}
|
||||||
34
Client/src/app/services/wol.service.ts
Normal file
34
Client/src/app/services/wol.service.ts
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
import { getWolAddress, getMacAddress } from './../store/gotobed.selectors';
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Store } from '@ngrx/store';
|
||||||
|
|
||||||
|
declare var WakeOnLan: any;
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class WOLService {
|
||||||
|
ipAddress = this.store.select(getWolAddress);
|
||||||
|
macAddress = this.store.select(getMacAddress);
|
||||||
|
|
||||||
|
constructor(private store: Store) {}
|
||||||
|
|
||||||
|
public wakeUp() {
|
||||||
|
WakeOnLan.wake(this.macAddress, this.ipAddress, function(response){
|
||||||
|
console.log(response)
|
||||||
|
}, function(response){
|
||||||
|
console.error(response)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// public start() {
|
||||||
|
// return new Promise((resolve, reject) => {
|
||||||
|
// WakeOnLan.wake(this.ipAddress, this.macAddress, function(response){
|
||||||
|
// console.log(response)
|
||||||
|
// },
|
||||||
|
// function(response){
|
||||||
|
// console.error(response)
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
}
|
||||||
@@ -7,6 +7,8 @@ export enum EGotobedActions {
|
|||||||
protocolSettingsChanged = '[GOTOBED] Protocol settings changed',
|
protocolSettingsChanged = '[GOTOBED] Protocol settings changed',
|
||||||
portSettingsChanged = '[GOTOBED] Port settings changed',
|
portSettingsChanged = '[GOTOBED] Port settings changed',
|
||||||
appInitialized = '[GOTOBED] App initialized',
|
appInitialized = '[GOTOBED] App initialized',
|
||||||
|
macSettingsChanged = '[GOTOBED] Mac settings changed',
|
||||||
|
WolAddressChanged = '[GOTOBED] Wake On Lan address changed',
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SendCommandChanged implements Action {
|
export class SendCommandChanged implements Action {
|
||||||
@@ -24,6 +26,11 @@ export class ProtocolSettingsChanged implements Action {
|
|||||||
constructor(public payload: string) { }
|
constructor(public payload: string) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class MacSettingsChanged implements Action {
|
||||||
|
public readonly type = EGotobedActions.macSettingsChanged;
|
||||||
|
constructor(public payload: string) { }
|
||||||
|
}
|
||||||
|
|
||||||
export class PortSettingsChanged implements Action {
|
export class PortSettingsChanged implements Action {
|
||||||
public readonly type = EGotobedActions.portSettingsChanged;
|
public readonly type = EGotobedActions.portSettingsChanged;
|
||||||
constructor(public payload: string) { }
|
constructor(public payload: string) { }
|
||||||
@@ -34,9 +41,16 @@ export class AppInitialized implements Action {
|
|||||||
constructor(public payload: LoadSettingsState) { }
|
constructor(public payload: LoadSettingsState) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class WolAddressChanged implements Action {
|
||||||
|
public readonly type = EGotobedActions.WolAddressChanged;
|
||||||
|
constructor(public payload: string) { }
|
||||||
|
}
|
||||||
|
|
||||||
export type GotobedActions =
|
export type GotobedActions =
|
||||||
SendCommandChanged |
|
SendCommandChanged |
|
||||||
ProtocolSettingsChanged |
|
ProtocolSettingsChanged |
|
||||||
PortSettingsChanged |
|
PortSettingsChanged |
|
||||||
SaveAddressSettings |
|
SaveAddressSettings |
|
||||||
AppInitialized;
|
AppInitialized |
|
||||||
|
MacSettingsChanged |
|
||||||
|
WolAddressChanged;
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { macStorageKey, wolStorageKey } from './../gotobed.models';
|
||||||
import { portStorageKey } from '../gotobed.models';
|
import { portStorageKey } from '../gotobed.models';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Actions, createEffect, ofType, concatLatestFrom, ROOT_EFFECTS_INIT } from '@ngrx/effects';
|
import { Actions, createEffect, ofType, concatLatestFrom, ROOT_EFFECTS_INIT } from '@ngrx/effects';
|
||||||
@@ -5,7 +6,7 @@ import { Store } from '@ngrx/store';
|
|||||||
import { map, tap, withLatestFrom } from 'rxjs/operators';
|
import { map, tap, withLatestFrom } from 'rxjs/operators';
|
||||||
import { addressStorageKey, protocolStorageKey } from '../gotobed.models';
|
import { addressStorageKey, protocolStorageKey } from '../gotobed.models';
|
||||||
import { StorageService } from '../services/storage.service';
|
import { StorageService } from '../services/storage.service';
|
||||||
import { AppInitialized, EGotobedActions, ProtocolSettingsChanged, SaveAddressSettings } from './gotobed.actions';
|
import { AppInitialized, EGotobedActions, MacSettingsChanged, ProtocolSettingsChanged, SaveAddressSettings, WolAddressChanged } from './gotobed.actions';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class GotobedEffects {
|
export class GotobedEffects {
|
||||||
@@ -49,6 +50,22 @@ export class GotobedEffects {
|
|||||||
})
|
})
|
||||||
), { dispatch: false });
|
), { dispatch: false });
|
||||||
|
|
||||||
|
macAddressSettings$ = createEffect(() => this.actions$.pipe(
|
||||||
|
ofType<MacSettingsChanged>(EGotobedActions.macSettingsChanged),
|
||||||
|
withLatestFrom(this.store),
|
||||||
|
tap(([action]) => {
|
||||||
|
localStorage.setItem(macStorageKey, action.payload);
|
||||||
|
})
|
||||||
|
), { dispatch: false });
|
||||||
|
|
||||||
|
wolAddressSettings$ = createEffect(() => this.actions$.pipe(
|
||||||
|
ofType<WolAddressChanged>(EGotobedActions.WolAddressChanged),
|
||||||
|
withLatestFrom(this.store),
|
||||||
|
tap(([action]) => {
|
||||||
|
localStorage.setItem(wolStorageKey, action.payload);
|
||||||
|
})
|
||||||
|
), { dispatch: false });
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly actions$: Actions,
|
private readonly actions$: Actions,
|
||||||
private readonly store: Store,
|
private readonly store: Store,
|
||||||
|
|||||||
@@ -23,6 +23,16 @@ export function gotobedReducer(state = initialGotoBedState, action: GotobedActio
|
|||||||
...state,
|
...state,
|
||||||
port: action.payload,
|
port: action.payload,
|
||||||
};
|
};
|
||||||
|
case EGotobedActions.macSettingsChanged:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
macAddress: action.payload,
|
||||||
|
};
|
||||||
|
case EGotobedActions.WolAddressChanged:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
wolAddress: action.payload,
|
||||||
|
};
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,3 +25,13 @@ export const getPort = createSelector(
|
|||||||
(state: GotobedState) => state.port
|
(state: GotobedState) => state.port
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const getMacAddress = createSelector(
|
||||||
|
gotobedState,
|
||||||
|
(state: GotobedState) => state.macAddress
|
||||||
|
);
|
||||||
|
|
||||||
|
export const getWolAddress = createSelector(
|
||||||
|
gotobedState,
|
||||||
|
(state: GotobedState) => state.wolAddress
|
||||||
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { macStorageKey, wolStorageKey } from './../gotobed.models';
|
||||||
import { addressStorageKey, portStorageKey, protocolStorageKey } from '../gotobed.models';
|
import { addressStorageKey, portStorageKey, protocolStorageKey } from '../gotobed.models';
|
||||||
|
|
||||||
export const storeName = 'Gotobed';
|
export const storeName = 'Gotobed';
|
||||||
@@ -9,6 +10,8 @@ export interface GotobedState {
|
|||||||
port: string;
|
port: string;
|
||||||
address: string;
|
address: string;
|
||||||
isConnected: boolean;
|
isConnected: boolean;
|
||||||
|
macAddress: string;
|
||||||
|
wolAddress: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const initialGotoBedState: GotobedState = {
|
export const initialGotoBedState: GotobedState = {
|
||||||
@@ -16,8 +19,10 @@ export const initialGotoBedState: GotobedState = {
|
|||||||
isLoading: false,
|
isLoading: false,
|
||||||
protocol: localStorage.getItem(protocolStorageKey) ?? 'http',
|
protocol: localStorage.getItem(protocolStorageKey) ?? 'http',
|
||||||
port: localStorage.getItem(portStorageKey) ?? '3000',
|
port: localStorage.getItem(portStorageKey) ?? '3000',
|
||||||
address: localStorage.getItem(addressStorageKey) ?? 'localhost:8080',
|
address: localStorage.getItem(addressStorageKey) ?? 'localhost',
|
||||||
isConnected: false,
|
isConnected: false,
|
||||||
|
macAddress: localStorage.getItem(macStorageKey) ?? '',
|
||||||
|
wolAddress: localStorage.getItem(wolStorageKey) ?? '',
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface LoadSettingsState {
|
export interface LoadSettingsState {
|
||||||
|
|||||||
11483
Client/yarn.lock
Normal file
11483
Client/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
BIN
Server/dist/GoToBed.exe
vendored
BIN
Server/dist/GoToBed.exe
vendored
Binary file not shown.
2
Server/dist/builder-debug.yml
vendored
2
Server/dist/builder-debug.yml
vendored
@@ -10,4 +10,4 @@ x64:
|
|||||||
- '!.editorconfig'
|
- '!.editorconfig'
|
||||||
nodeModuleFilePatterns: []
|
nodeModuleFilePatterns: []
|
||||||
nsis:
|
nsis:
|
||||||
script: "!include \"C:\\Users\\Ludvi\\AppData\\Roaming\\npm\\node_modules\\electron-builder\\node_modules\\app-builder-lib\\templates\\nsis\\include\\StdUtils.nsh\"\n!addincludedir \"C:\\Users\\Ludvi\\AppData\\Roaming\\npm\\node_modules\\electron-builder\\node_modules\\app-builder-lib\\templates\\nsis\\include\"\n!macro _isUpdated _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"updated\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isUpdated `\"\" isUpdated \"\"`\n\n!macro _isForceRun _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"force-run\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isForceRun `\"\" isForceRun \"\"`\n\n!macro _isKeepShortcuts _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"keep-shortcuts\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isKeepShortcuts `\"\" isKeepShortcuts \"\"`\n\n!macro _isNoDesktopShortcut _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"no-desktop-shortcut\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isNoDesktopShortcut `\"\" isNoDesktopShortcut \"\"`\n\n!macro _isDeleteAppData _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"delete-app-data\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isDeleteAppData `\"\" isDeleteAppData \"\"`\n\n!macro _isForAllUsers _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"allusers\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isForAllUsers `\"\" isForAllUsers \"\"`\n\n!macro _isForCurrentUser _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"currentuser\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isForCurrentUser `\"\" isForCurrentUser \"\"`\n\n!macro addLangs\n !insertmacro MUI_LANGUAGE \"English\"\n !insertmacro MUI_LANGUAGE \"German\"\n !insertmacro MUI_LANGUAGE \"French\"\n !insertmacro MUI_LANGUAGE \"SpanishInternational\"\n !insertmacro MUI_LANGUAGE \"SimpChinese\"\n !insertmacro MUI_LANGUAGE \"TradChinese\"\n !insertmacro MUI_LANGUAGE \"Japanese\"\n !insertmacro MUI_LANGUAGE \"Korean\"\n !insertmacro MUI_LANGUAGE \"Italian\"\n !insertmacro MUI_LANGUAGE \"Dutch\"\n !insertmacro MUI_LANGUAGE \"Danish\"\n !insertmacro MUI_LANGUAGE \"Swedish\"\n !insertmacro MUI_LANGUAGE \"Norwegian\"\n !insertmacro MUI_LANGUAGE \"Finnish\"\n !insertmacro MUI_LANGUAGE \"Russian\"\n !insertmacro MUI_LANGUAGE \"Portuguese\"\n !insertmacro MUI_LANGUAGE \"PortugueseBR\"\n !insertmacro MUI_LANGUAGE \"Polish\"\n !insertmacro MUI_LANGUAGE \"Ukrainian\"\n !insertmacro MUI_LANGUAGE \"Czech\"\n !insertmacro MUI_LANGUAGE \"Slovak\"\n !insertmacro MUI_LANGUAGE \"Hungarian\"\n !insertmacro MUI_LANGUAGE \"Arabic\"\n !insertmacro MUI_LANGUAGE \"Turkish\"\n !insertmacro MUI_LANGUAGE \"Thai\"\n !insertmacro MUI_LANGUAGE \"Vietnamese\"\n!macroend\n\n!addplugindir /x86-unicode \"C:\\Users\\Ludvi\\AppData\\Local\\electron-builder\\Cache\\nsis\\nsis-resources-3.4.1\\plugins\\x86-unicode\"\n!include \"C:\\Users\\Ludvi\\AppData\\Local\\Temp\\t-sumJl9\\0-messages.nsh\"\n\n!include \"common.nsh\"\n!include \"extractAppPackage.nsh\"\n\n# https://github.com/electron-userland/electron-builder/issues/3972#issuecomment-505171582\nCRCCheck off\nWindowIcon Off\nAutoCloseWindow True\nRequestExecutionLevel ${REQUEST_EXECUTION_LEVEL}\n\nSilentInstall silent\n\nFunction .onInit\n !insertmacro check64BitAndSetRegView\nFunctionEnd\n\nSection\n StrCpy $INSTDIR \"$TEMP\\${UNPACK_DIR_NAME}\"\n RMDir /r $INSTDIR\n\tSetOutPath $INSTDIR\n\n\t!ifdef APP_DIR_64\n !ifdef APP_DIR_32\n ${if} ${RunningX64}\n File /r \"${APP_DIR_64}\\*.*\"\n ${else}\n File /r \"${APP_DIR_32}\\*.*\"\n ${endIf}\n !else\n File /r \"${APP_DIR_64}\\*.*\"\n !endif\n !else\n !ifdef APP_DIR_32\n File /r \"${APP_DIR_32}\\*.*\"\n !else\n !insertmacro extractEmbeddedAppPackage\n !endif\n !endif\n\n System::Call 'Kernel32::SetEnvironmentVariable(t, t)i (\"PORTABLE_EXECUTABLE_DIR\", \"$EXEDIR\").r0'\n System::Call 'Kernel32::SetEnvironmentVariable(t, t)i (\"PORTABLE_EXECUTABLE_FILE\", \"$EXEPATH\").r0'\n System::Call 'Kernel32::SetEnvironmentVariable(t, t)i (\"PORTABLE_EXECUTABLE_APP_FILENAME\", \"${APP_FILENAME}\").r0'\n ${StdUtils.GetAllParameters} $R0 0\n\tExecWait \"$INSTDIR\\${APP_EXECUTABLE_FILENAME} $R0\" $0\n SetErrorLevel $0\n\n SetOutPath $PLUGINSDIR\n\tRMDir /r $INSTDIR\nSectionEnd\n"
|
script: "!include \"C:\\Users\\Ludvi\\AppData\\Roaming\\npm\\node_modules\\electron-builder\\node_modules\\app-builder-lib\\templates\\nsis\\include\\StdUtils.nsh\"\n!addincludedir \"C:\\Users\\Ludvi\\AppData\\Roaming\\npm\\node_modules\\electron-builder\\node_modules\\app-builder-lib\\templates\\nsis\\include\"\n!macro _isUpdated _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"updated\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isUpdated `\"\" isUpdated \"\"`\n\n!macro _isForceRun _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"force-run\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isForceRun `\"\" isForceRun \"\"`\n\n!macro _isKeepShortcuts _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"keep-shortcuts\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isKeepShortcuts `\"\" isKeepShortcuts \"\"`\n\n!macro _isNoDesktopShortcut _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"no-desktop-shortcut\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isNoDesktopShortcut `\"\" isNoDesktopShortcut \"\"`\n\n!macro _isDeleteAppData _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"delete-app-data\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isDeleteAppData `\"\" isDeleteAppData \"\"`\n\n!macro _isForAllUsers _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"allusers\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isForAllUsers `\"\" isForAllUsers \"\"`\n\n!macro _isForCurrentUser _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"currentuser\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isForCurrentUser `\"\" isForCurrentUser \"\"`\n\n!macro addLangs\n !insertmacro MUI_LANGUAGE \"English\"\n !insertmacro MUI_LANGUAGE \"German\"\n !insertmacro MUI_LANGUAGE \"French\"\n !insertmacro MUI_LANGUAGE \"SpanishInternational\"\n !insertmacro MUI_LANGUAGE \"SimpChinese\"\n !insertmacro MUI_LANGUAGE \"TradChinese\"\n !insertmacro MUI_LANGUAGE \"Japanese\"\n !insertmacro MUI_LANGUAGE \"Korean\"\n !insertmacro MUI_LANGUAGE \"Italian\"\n !insertmacro MUI_LANGUAGE \"Dutch\"\n !insertmacro MUI_LANGUAGE \"Danish\"\n !insertmacro MUI_LANGUAGE \"Swedish\"\n !insertmacro MUI_LANGUAGE \"Norwegian\"\n !insertmacro MUI_LANGUAGE \"Finnish\"\n !insertmacro MUI_LANGUAGE \"Russian\"\n !insertmacro MUI_LANGUAGE \"Portuguese\"\n !insertmacro MUI_LANGUAGE \"PortugueseBR\"\n !insertmacro MUI_LANGUAGE \"Polish\"\n !insertmacro MUI_LANGUAGE \"Ukrainian\"\n !insertmacro MUI_LANGUAGE \"Czech\"\n !insertmacro MUI_LANGUAGE \"Slovak\"\n !insertmacro MUI_LANGUAGE \"Hungarian\"\n !insertmacro MUI_LANGUAGE \"Arabic\"\n !insertmacro MUI_LANGUAGE \"Turkish\"\n !insertmacro MUI_LANGUAGE \"Thai\"\n !insertmacro MUI_LANGUAGE \"Vietnamese\"\n!macroend\n\n!include \"C:\\Users\\Ludvi\\AppData\\Local\\Temp\\t-uiRPoY\\0-messages.nsh\"\n!addplugindir /x86-unicode \"C:\\Users\\Ludvi\\AppData\\Local\\electron-builder\\Cache\\nsis\\nsis-resources-3.4.1\\plugins\\x86-unicode\"\n\n!include \"common.nsh\"\n!include \"extractAppPackage.nsh\"\n\n# https://github.com/electron-userland/electron-builder/issues/3972#issuecomment-505171582\nCRCCheck off\nWindowIcon Off\nAutoCloseWindow True\nRequestExecutionLevel ${REQUEST_EXECUTION_LEVEL}\n\nSilentInstall silent\n\nFunction .onInit\n !insertmacro check64BitAndSetRegView\nFunctionEnd\n\nSection\n StrCpy $INSTDIR \"$TEMP\\${UNPACK_DIR_NAME}\"\n RMDir /r $INSTDIR\n\tSetOutPath $INSTDIR\n\n\t!ifdef APP_DIR_64\n !ifdef APP_DIR_32\n ${if} ${RunningX64}\n File /r \"${APP_DIR_64}\\*.*\"\n ${else}\n File /r \"${APP_DIR_32}\\*.*\"\n ${endIf}\n !else\n File /r \"${APP_DIR_64}\\*.*\"\n !endif\n !else\n !ifdef APP_DIR_32\n File /r \"${APP_DIR_32}\\*.*\"\n !else\n !insertmacro extractEmbeddedAppPackage\n !endif\n !endif\n\n System::Call 'Kernel32::SetEnvironmentVariable(t, t)i (\"PORTABLE_EXECUTABLE_DIR\", \"$EXEDIR\").r0'\n System::Call 'Kernel32::SetEnvironmentVariable(t, t)i (\"PORTABLE_EXECUTABLE_FILE\", \"$EXEPATH\").r0'\n System::Call 'Kernel32::SetEnvironmentVariable(t, t)i (\"PORTABLE_EXECUTABLE_APP_FILENAME\", \"${APP_FILENAME}\").r0'\n ${StdUtils.GetAllParameters} $R0 0\n\tExecWait \"$INSTDIR\\${APP_EXECUTABLE_FILENAME} $R0\" $0\n SetErrorLevel $0\n\n SetOutPath $PLUGINSDIR\n\tRMDir /r $INSTDIR\nSectionEnd\n"
|
||||||
|
|||||||
@@ -5,12 +5,12 @@ const cors = require('cors');
|
|||||||
const AutoLaunch = require('auto-launch');
|
const AutoLaunch = require('auto-launch');
|
||||||
const server = express();
|
const server = express();
|
||||||
const ip = require('ip');
|
const ip = require('ip');
|
||||||
|
const macaddress = require('macaddress');
|
||||||
const firstRun = require('electron-first-run');
|
const firstRun = require('electron-first-run');
|
||||||
|
const bonjour = require('bonjour')()
|
||||||
const autoLaunch = new AutoLaunch({
|
const autoLaunch = new AutoLaunch({
|
||||||
name: 'GoToBed Server',
|
name: 'GoToBed Server',
|
||||||
path: process.env.PORTABLE_EXECUTABLE_DIR + '/GoToBed.exe',
|
path: process.env.PORTABLE_EXECUTABLE_DIR + '/GoToBed.exe',
|
||||||
|
|
||||||
});
|
});
|
||||||
const paramPort = app.commandLine.getSwitchValue("port") == "" ? "3000" : app.commandLine.getSwitchValue("port");
|
const paramPort = app.commandLine.getSwitchValue("port") == "" ? "3000" : app.commandLine.getSwitchValue("port");
|
||||||
const isFirstRun = firstRun();
|
const isFirstRun = firstRun();
|
||||||
@@ -101,6 +101,10 @@ server.post('/commandbridge', function (req, res) {
|
|||||||
}})
|
}})
|
||||||
|
|
||||||
app.on('ready', async () => {
|
app.on('ready', async () => {
|
||||||
|
macaddress.one().then(function (mac) {
|
||||||
|
bonjour.publish({ name: 'GoToBed-Server', type: 'http', port: paramPort, txt: mac})
|
||||||
|
});
|
||||||
|
|
||||||
if(isFirstRun) {
|
if(isFirstRun) {
|
||||||
const firstSetup = dialog.showMessageBox(null, options);
|
const firstSetup = dialog.showMessageBox(null, options);
|
||||||
console.log(firstSetup);
|
console.log(firstSetup);
|
||||||
|
|||||||
4323
Server/package-lock.json
generated
4323
Server/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -16,11 +16,13 @@
|
|||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"auto-launch": "^5.0.5",
|
"auto-launch": "^5.0.5",
|
||||||
|
"bonjour": "^3.5.0",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"electron-first-run": "^3.0.0",
|
"electron-first-run": "^3.0.0",
|
||||||
"electron-shutdown-command": "^2.0.1",
|
"electron-shutdown-command": "^2.0.1",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"ip": "^1.1.5",
|
"ip": "^1.1.5",
|
||||||
|
"macaddress": "^0.5.2",
|
||||||
"nodemon": "^2.0.14"
|
"nodemon": "^2.0.14"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
11
package-lock.json
generated
Normal file
11
package-lock.json
generated
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"requires": true,
|
||||||
|
"lockfileVersion": 1,
|
||||||
|
"dependencies": {
|
||||||
|
"cordova-arp-cache-fetch": {
|
||||||
|
"version": "0.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/cordova-arp-cache-fetch/-/cordova-arp-cache-fetch-0.3.2.tgz",
|
||||||
|
"integrity": "sha512-8EYOUkIztG794jzY/qDy8AMxwIfpMYwaaffBnDp7HSLeQpXXBR2W5FibRhjoGyHxwopXTUIKoPhrtqTdB8LCKQ=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user