Compare commits
23 Commits
Added-serv
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
63ba450f9a | ||
| 79cd222cce | |||
|
|
7e63ab5a0f | ||
| 75aeccaa15 | |||
| 4700f0e11d | |||
|
|
41b699adec | ||
| 4bb7282b6b | |||
| 76f2ee4d69 | |||
| 9c06727e8d | |||
|
|
0a7442d908 | ||
| ba0b90304a | |||
|
|
719c60a462 | ||
| bb6b583a61 | |||
| f96e52a124 | |||
| 5af085a0d2 | |||
| e39e1cdd3c | |||
|
|
3140a78f00 | ||
| 6ca84bf4b0 | |||
| 83ef536add | |||
| 695849dec9 | |||
| e463154622 | |||
| a1d6ce2dc0 | |||
| 94ca384199 |
BIN
Binaries/Changed port example.lnk
Normal file
BIN
Binaries/Changed port example.lnk
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1,8 @@
|
||||
# go-to-bed
|
||||
# In order to build this application:
|
||||
You mainly need to install Ionic Capacitor, and NodeJs. Make sure you got Android studio and grandle and Android Emulator set up.
|
||||
|
||||
The application is design with Angular using typescript so make sure you got that, if the package.json doesnt install that for you.
|
||||
|
||||
|
||||
# What is this?
|
||||
This is the client, a phone app for the user to send requests to the server (the pc) he/she wants to control.
|
||||
|
||||
17
Client/android/.idea/deploymentTargetDropDown.xml
generated
17
Client/android/.idea/deploymentTargetDropDown.xml
generated
@@ -1,17 +0,0 @@
|
||||
<?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>
|
||||
1119
Client/package-lock.json
generated
1119
Client/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -33,7 +33,7 @@
|
||||
"@capacitor/status-bar": "1.0.6",
|
||||
"@ionic-native/core": "^5.36.0",
|
||||
"@ionic-native/zeroconf": "^5.36.0",
|
||||
"@ionic/angular": "^5.5.2",
|
||||
"@ionic/angular": "^6.2.3",
|
||||
"@ionic/storage": "^3.0.6",
|
||||
"@ionic/storage-angular": "^3.0.6",
|
||||
"@ngrx/effects": "^13.0.2",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { WOLService } from './services/WOL.service';
|
||||
import { SearchHostPage } from './components/searchHost/searchHost.page';
|
||||
import { SearchHostPage } from './components/search-host/search-host.page';
|
||||
import { ExploreContainerComponent } from './components/explore-container/explore-container.component';
|
||||
import { ServerSettingsComponent } from './components/settings/serverSettings/serverSettings.component';
|
||||
import { NgModule } from '@angular/core';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { HomePage } from '../home/home.page';
|
||||
import { SearchHostPage } from '../searchHost/searchHost.page';
|
||||
import { SearchHostPage } from '../search-host/search-host.page';
|
||||
import { SettingsPage } from '../settings/settings.page';
|
||||
|
||||
const routes: Routes = [
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<ion-tab-button tab="searchHost">
|
||||
<ion-icon name="search-sharp"></ion-icon>
|
||||
<ion-label>WOL</ion-label>
|
||||
<ion-label>Search</ion-label>
|
||||
</ion-tab-button>
|
||||
|
||||
<ion-tab-button tab="settings">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { SearchHostPage } from './searchHost.page';
|
||||
import { SearchHostPage } from './search-host.page';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
@@ -2,9 +2,9 @@ import { IonicModule } from '@ionic/angular';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { SearchHostPage } from './searchHost.page';
|
||||
import { SearchHostPage } from './search-host.page';
|
||||
import { ExploreContainerComponentModule } from '../explore-container/explore-container.module';
|
||||
import { SearchHostPageRoutingModule } from './searchHost-routing.module';
|
||||
import { SearchHostPageRoutingModule } from './search-host-routing.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
45
Client/src/app/components/search-host/search-host.page.html
Normal file
45
Client/src/app/components/search-host/search-host.page.html
Normal file
@@ -0,0 +1,45 @@
|
||||
<ion-header [translucent]="true">
|
||||
<ion-toolbar>
|
||||
<ion-title>Search computer</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content [fullscreen]="true">
|
||||
<ion-refresher slot="fixed" (ionRefresh)="refresh($event)">
|
||||
<ion-refresher-content></ion-refresher-content>
|
||||
</ion-refresher>
|
||||
<ion-header collapse="condense">
|
||||
<ion-toolbar>
|
||||
<ion-title size="large">WOL</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
<!-- WOL -->
|
||||
<ion-list>
|
||||
<ion-item *ngIf="netWorkDevices.length === 0">
|
||||
<ion-label>No devices found</ion-label>
|
||||
</ion-item>
|
||||
<ion-accordion-group>
|
||||
<ion-accordion *ngFor="let device of netWorkDevices">
|
||||
<ion-item slot="header" color="light">
|
||||
<ion-icon name="desktop-outline"></ion-icon>
|
||||
<ion-label>{{ device.ipv4Addresses[0] }}</ion-label>
|
||||
</ion-item>
|
||||
<div slot="content">
|
||||
<ion-item>
|
||||
<ion-label>IP: {{ device.ipv4Addresses[0] }}</ion-label>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-label>PORT: {{ device.port }}</ion-label>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-label>MAC-Address: {{ device.txtRecord.mac }}</ion-label>
|
||||
</ion-item>
|
||||
<ion-button expand="full" (click)="saveWolDevice(device)"
|
||||
>Configure</ion-button
|
||||
>
|
||||
</div>
|
||||
</ion-accordion>
|
||||
</ion-accordion-group>
|
||||
</ion-list>
|
||||
<!-- wol end -->
|
||||
</ion-content>
|
||||
@@ -0,0 +1,3 @@
|
||||
ion-icon {
|
||||
padding-right: 5px;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
import { IonicModule } from '@ionic/angular';
|
||||
import { ExploreContainerComponentModule } from '../explore-container/explore-container.module';
|
||||
import { SearchHostPage } from './searchHost.page';
|
||||
import { SearchHostPage } from './search-host.page';
|
||||
|
||||
describe('SearchHostPage', () => {
|
||||
let component: SearchHostPage;
|
||||
@@ -1,19 +1,22 @@
|
||||
import { WolAddressChanged } from './../../store/gotobed.actions';
|
||||
import { PortSettingsChanged, SaveAddressSettings, WolAddressChanged } from './../../store/gotobed.actions';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Zeroconf, ZeroconfResult, ZeroconfService } from "@ionic-native/zeroconf";
|
||||
import { Zeroconf, 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';
|
||||
import { ToastController } from '@ionic/angular';
|
||||
@Component({
|
||||
selector: 'app-searchhost',
|
||||
templateUrl: 'searchHost.page.html',
|
||||
styleUrls: ['searchHost.page.scss']
|
||||
templateUrl: 'search-host.page.html',
|
||||
styleUrls: ['search-host.page.scss']
|
||||
})
|
||||
export class SearchHostPage implements OnInit {
|
||||
netWorkDevices: ZeroconfService[] = [];
|
||||
|
||||
constructor(private store: Store<GotobedState>) {}
|
||||
constructor(
|
||||
private store: Store<GotobedState>,
|
||||
public toastController: ToastController
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.scanDevices();
|
||||
@@ -31,10 +34,13 @@ export class SearchHostPage implements OnInit {
|
||||
}
|
||||
|
||||
saveWolDevice(device: ZeroconfService) {
|
||||
this.presentToast();
|
||||
this.store.dispatch(new MacSettingsChanged(device.txtRecord.mac));
|
||||
this.store.dispatch(new WolAddressChanged(this.convertToBroadcast(device.ipv4Addresses[0])));
|
||||
this.store.dispatch(new SaveAddressSettings(device.ipv4Addresses[0]));
|
||||
this.store.dispatch(new PortSettingsChanged(device.port.toString()));
|
||||
}
|
||||
|
||||
|
||||
refresh(event) {
|
||||
console.log('Begin async operation');
|
||||
this.scanDevices();
|
||||
@@ -44,6 +50,14 @@ export class SearchHostPage implements OnInit {
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
async presentToast() {
|
||||
const toast = await this.toastController.create({
|
||||
message: 'Your settings have been saved.',
|
||||
duration: 2000,
|
||||
});
|
||||
toast.present();
|
||||
}
|
||||
|
||||
private convertToBroadcast(ip: string) {
|
||||
let subnetArray = ip.split('.');
|
||||
subnetArray[3] = '255';
|
||||
@@ -1,31 +0,0 @@
|
||||
<ion-header [translucent]="true">
|
||||
<ion-toolbar>
|
||||
<ion-title>Search Host</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content [fullscreen]="true">
|
||||
<ion-refresher slot="fixed" (ionRefresh)="refresh($event)">
|
||||
<ion-refresher-content></ion-refresher-content>
|
||||
</ion-refresher>
|
||||
<ion-header collapse="condense">
|
||||
<ion-toolbar>
|
||||
<ion-title size="large">WOL</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
<!-- WOL -->
|
||||
<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>
|
||||
15157
Client/yarn.lock
15157
Client/yarn.lock
File diff suppressed because it is too large
Load Diff
86
README.md
Normal file
86
README.md
Normal file
@@ -0,0 +1,86 @@
|
||||
# What is this?
|
||||
I'm lazy and don't like to get up from bed to turn off my PC so i spent a while creating an application to turn off my pc for me.
|
||||
This application can turn off/on, logout, sleep and restart your pc remotely with a press on a button.
|
||||
|
||||
|
||||
## Build
|
||||
Download the repo and run:
|
||||
|
||||
Client:
|
||||
|
||||
npm i
|
||||
ng serve --open
|
||||
// to build with Ionic and Android Studio
|
||||
ionic capacitor build android
|
||||
|
||||
Links:
|
||||
* [Android studio](https://developer.android.com/studio)
|
||||
* [Grandle](https://gradle.org/install/)
|
||||
* [JDK](https://developer.android.com/studio)
|
||||
* [Setup Enviroment variables to point to JDK and JAVA_SDK](https://cordova.apache.org/docs/en/10.x/guide/platforms/android/#setting-environment-variables)
|
||||
|
||||
Ionic might set up those automatically, I migrated from Cordova so I did it manually...
|
||||
|
||||
Server:
|
||||
|
||||
npm i
|
||||
electron-builder --win portable
|
||||
// npm start will work if you comment out the lines effected by: AutoLaunch
|
||||
|
||||
## What do I need to get this working?
|
||||
You'll need to Install the Client APK file on your Android phone and download and run the "GoToBed" server on your pc so there is a connection between your phone and computer.
|
||||
|
||||
Client: [APK Download (Beta)](https://github.com/Myxelium/go-to-bed/raw/master/Binaries/GoToBed.apk)
|
||||
|
||||
Server: [EXE Download](https://github.com/Myxelium/go-to-bed/raw/master/Binaries/GoToBed.exe)
|
||||
|
||||
### ios devices
|
||||
I haven't built the server or the application on either Mac or Ios devices, but there shouldn't be anything stopping you doing so. Both the server and client is built with Node (Server: Electron, Client: Ionic Capacitor/Cordova).
|
||||
|
||||
### Linux support
|
||||
The server should be able to be built on Linux since it uses NodeJs and Electron. You will need to add some lines to package.json in order to get Electron-builder to work.
|
||||
|
||||
|
||||
## Wakeup On Lan (WOL)
|
||||
|
||||
It's not yet inplemented, since i have to write a Java plugin specifically for that.
|
||||
**This means the application does not support turning on the pc yet.**
|
||||
In the meanwhile can I recommend: [Wake on lan](https://play.google.com/store/apps/details?id=co.uk.mrwebb.wakeonlan)
|
||||
|
||||
## Can I use this outside my own network?
|
||||
You'll need to portforward your router so the App can connect to your Pc.
|
||||
This might help you on the way:
|
||||
* Common router addresses are: [192.168.1.1](http://192.168.1.1), [192.168.0.1](http://192.168.0.1)
|
||||
* Once reached the router login screen you'll need to login.
|
||||
Common User and passwords are either blank or `Admin` / `Administrator`.
|
||||
* Once logged in (This looks different for every router brand), but look for something called `WAN` or `PortForward`
|
||||
* If you find it, click on it and you should be able to add a new entry. Start the server to find out port and your address and enter that, also use http/tcp as protocol.
|
||||
* Now in your app, instead of using the local address of your pc that start with 192.168.XXX.YYY, use your [public address](https://whatismyipaddress.com/) (note: make sure are on your pc when entering the page to avoid the mistake of using your phones own network.) Enter your public IP in GoToBed App's Address field under Settings tab.
|
||||
|
||||
### Server API
|
||||
If you check the server code you might see more functionality than the Client Application currently supports.
|
||||
All the commands can be sent using a post request
|
||||
|
||||
So more functionality will be added later on inside the phone app.
|
||||
|
||||
endpoint: http://localhost/commandbridge
|
||||
{
|
||||
command: "yourcommand"
|
||||
}
|
||||
|
||||
List of commands
|
||||
|
||||
|Command| Description |
|
||||
|--|--|
|
||||
| shutdown | Turns off PC|
|
||||
| reboot | Restarts PC |
|
||||
| logout | Logouts User |
|
||||
| shutdown-options | Shutdown with additional options, such as a timer |
|
||||
| cancel-shutdown | Cancel shutdown, mainly implemented for command above |
|
||||
| sleep | Puts the computer in hibernation mode |
|
||||
| set-autostart | [Toggle] Start the server when windows starts|
|
||||
| unset-autostart | [Toggle] Don't start server when windows starts |
|
||||
| closeServer | Remote turn off GoToBed Server Application |
|
||||
| resetFirstRun | Reset first run message. Window with setup information will show up on next startup. |
|
||||
|
||||
You can call those commands from any application that support it, so if you build something your own, you can integrate it with this.
|
||||
6
Server/package-lock.json
generated
6
Server/package-lock.json
generated
@@ -6216,9 +6216,9 @@
|
||||
}
|
||||
},
|
||||
"minimist": {
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
||||
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
|
||||
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q=="
|
||||
},
|
||||
"mkdirp": {
|
||||
"version": "0.5.5",
|
||||
|
||||
10
package-lock.json
generated
10
package-lock.json
generated
@@ -1,11 +1,3 @@
|
||||
{
|
||||
"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=="
|
||||
}
|
||||
}
|
||||
"lockfileVersion": 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user