Added server #5

Merged
Myxelium merged 2 commits from Added-server into master 2022-01-02 05:16:10 +00:00
50 changed files with 208 additions and 16420 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -11,10 +11,6 @@
<param name="onload" value="true"/> <param name="onload" value="true"/>
</feature> </feature>
<feature name="Ping">
<param name="android-package" value="com.spartan0nix.plugins.Ping"/>
</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>

15722
Client/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,14 +1,9 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router'; import { RouterModule } from '@angular/router';
import { StoreRouterConnectingModule } from '@ngrx/router-store'; import { StoreRouterConnectingModule } from '@ngrx/router-store';
import { StoreModule } from '@ngrx/store'; import { StoreModule } from '@ngrx/store';
import { gotobedReducer } from './store/gotobed.reducer'; import { gotobedReducer } from './store/gotobed.reducer';
const routes: Routes = [
{
path: '',
loadChildren: () => import('./components/menu/menu.module').then(page => page.MenuPageModule)
}
];
@NgModule({ @NgModule({
imports: [ imports: [
StoreModule.forFeature('Gotobed', gotobedReducer), StoreRouterConnectingModule.forRoot(), StoreModule.forFeature('Gotobed', gotobedReducer), StoreRouterConnectingModule.forRoot(),

View File

@@ -19,5 +19,4 @@ describe('AppComponent', () => {
expect(app).toBeTruthy(); expect(app).toBeTruthy();
}); });
// TODO: add more tests! // TODO: add more tests!
}); });

View File

@@ -1,9 +1,4 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { StorageService } from './services/storage.service';
import { ProtocolStorageKey, PortStorageKey, AddressStorageKey } from './gotobed.models';
import { GotobedState, initialGotoBedState } from './store/gotobed.state';
import { Store } from '@ngrx/store';
import { ProtocolSettingsChanged } from './store/gotobed.actions';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
@@ -12,10 +7,5 @@ import { ProtocolSettingsChanged } from './store/gotobed.actions';
}) })
export class AppComponent { export class AppComponent {
constructor(private storage: StorageService, private _store: Store<GotobedState>) { constructor() { }
//this.storage.initializeStorage();
// this._store.dispatch(new ProtocolSettingsChanged(await this.storage.fetchFromStorage(ProtocolStorageKey).then(protocol => protocol)));
// this.storage.fetchFromStorage(PortStorageKey).then(port => (initialGotoBedState.port = port));
// this.storage.fetchFromStorage(AddressStorageKey).then(address => (initialGotoBedState.address = address));
}
} }

View File

@@ -5,7 +5,6 @@ import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router'; import { RouteReuseStrategy } from '@angular/router';
import { Drivers } from '@ionic/storage'; import { Drivers } from '@ionic/storage';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular'; import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { AppRoutingModule } from './app-routing.module'; import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { MenuPage } from './components/menu/menu.page'; import { MenuPage } from './components/menu/menu.page';
@@ -16,9 +15,9 @@ import { HttpClientModule } from '@angular/common/http';
import { AppStoreModule } from './app-store.module'; import { AppStoreModule } from './app-store.module';
import { EffectsModule } from '@ngrx/effects'; import { EffectsModule } from '@ngrx/effects';
import { GotobedStoreModule } from './store/gotobed.store.module'; import { GotobedStoreModule } from './store/gotobed.store.module';
import { GotobedEffects } from './store/gotoved.effects'; import { GotobedEffects } from './store/gotobed.effects';
import { IonicStorageModule } from '@ionic/storage-angular'; import { IonicStorageModule } from '@ionic/storage-angular';
import * as CordovaSQLLiteDriver from 'localforage-cordovasqlitedriver' import * as CordovaSQLLiteDriver from 'localforage-cordovasqlitedriver';
import { SettingsPage } from './components/settings/settings.page'; import { SettingsPage } from './components/settings/settings.page';
import { HTTP } from '@awesome-cordova-plugins/http/ngx'; import { HTTP } from '@awesome-cordova-plugins/http/ngx';

View File

@@ -1,6 +1,5 @@
#container { #container {
text-align: center; text-align: center;
position: absolute; position: absolute;
left: 0; left: 0;
right: 0; right: 0;

View File

@@ -1,6 +1,5 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular'; import { IonicModule } from '@ionic/angular';
import { ExploreContainerComponent } from './explore-container.component'; import { ExploreContainerComponent } from './explore-container.component';
describe('ExploreContainerComponent', () => { describe('ExploreContainerComponent', () => {

View File

@@ -11,5 +11,4 @@ export class ExploreContainerComponent implements OnInit {
constructor() { } constructor() { }
ngOnInit() {} ngOnInit() {}
} }

View File

@@ -1,9 +1,7 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular'; import { IonicModule } from '@ionic/angular';
import { ExploreContainerComponent } from './explore-container.component'; import { ExploreContainerComponent } from './explore-container.component';
@NgModule({ @NgModule({

View File

@@ -4,7 +4,6 @@ import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
import { HomePage } from './home.page'; import { HomePage } from './home.page';
import { ExploreContainerComponentModule } from '../explore-container/explore-container.module'; import { ExploreContainerComponentModule } from '../explore-container/explore-container.module';
import { HomePageRoutingModule } from './home-routing.module'; import { HomePageRoutingModule } from './home-routing.module';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';

View File

@@ -1,8 +1,6 @@
<ion-header [translucent]="true"> <ion-header [translucent]="true">
<ion-toolbar> <ion-toolbar>
<ion-title> <ion-title>Home</ion-title>
Home
</ion-title>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
@@ -17,7 +15,7 @@
<ion-grid> <ion-grid>
<ion-row> <ion-row>
<ion-col> <ion-col>
<ion-card class="noselect" (click)="presentAlert('shutdown')"> <ion-card class="noselect" (click)="commandAlert('shutdown')">
<ion-card-header> <ion-card-header>
<ion-card-title>Shutdown</ion-card-title> <ion-card-title>Shutdown</ion-card-title>
</ion-card-header> </ion-card-header>
@@ -30,7 +28,7 @@
<ion-row> <ion-row>
<ion-col> <ion-col>
<ion-card class="noselect" (click)="presentAlert('sleep')"> <ion-card class="noselect" (click)="commandAlert('sleep')">
<ion-card-header> <ion-card-header>
<ion-card-title>Sleep</ion-card-title> <ion-card-title>Sleep</ion-card-title>
</ion-card-header> </ion-card-header>
@@ -40,7 +38,7 @@
</ion-card> </ion-card>
</ion-col> </ion-col>
<ion-col> <ion-col>
<ion-card class="noselect" (click)="presentAlert('reboot')"> <ion-card class="noselect" (click)="commandAlert('reboot')">
<ion-card-header> <ion-card-header>
<ion-card-title>Reboot</ion-card-title> <ion-card-title>Reboot</ion-card-title>
</ion-card-header> </ion-card-header>
@@ -52,7 +50,7 @@
</ion-row> </ion-row>
<ion-row> <ion-row>
<ion-col> <ion-col>
<ion-card class="noselect" (click)="presentAlert('logout')"> <ion-card class="noselect" (click)="commandAlert('logout')">
<ion-card-header> <ion-card-header>
<ion-card-title>Logout</ion-card-title> <ion-card-title>Logout</ion-card-title>
</ion-card-header> </ion-card-header>

View File

@@ -1,7 +1,6 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular'; import { IonicModule } from '@ionic/angular';
import { ExploreContainerComponentModule } from '../explore-container/explore-container.module'; import { ExploreContainerComponentModule } from '../explore-container/explore-container.module';
import { HomePage } from './home.page'; import { HomePage } from './home.page';
describe('HomePage', () => { describe('HomePage', () => {

View File

@@ -12,17 +12,16 @@ import { getAddress, getCommandType, getPort, getProtocol } from '../../store/go
}) })
export class HomePage implements OnInit{ export class HomePage implements OnInit{
commandtype$ = this.store.select(getCommandType);
port = null;
address = '';
protocol = '';
constructor( constructor(
public alertController: AlertController, public alertController: AlertController,
private httpCommand: NetworkRequestsService, private httpCommand: NetworkRequestsService,
private store: Store) {} private store: Store
) {}
commandtype$ = this.store.select(getCommandType);
port = null;
address = "";
protocol = "";
ngOnInit() { ngOnInit() {
this.store this.store
@@ -38,27 +37,21 @@ export class HomePage implements OnInit{
.subscribe(protocol => (this.protocol = protocol)); .subscribe(protocol => (this.protocol = protocol));
} }
async presentAlert(commandType) { async commandAlert(commandValue) {
const alert = await this.alertController.create({ const alert = await this.alertController.create({
cssClass: 'my-custom-class', cssClass: 'alert',
header: 'Are you sure?', header: 'Are you sure?',
message: `You are about to send a ${commandType} command to the device.`, message: `You are about to send a ${commandValue} command to the device.`,
buttons: [ buttons: [
{ {
text: 'Cancel', text: 'Cancel',
role: 'cancel', role: 'cancel',
cssClass: 'secondary', cssClass: 'secondary'
handler: (blah) => {
console.log('Confirm Cancel: blah');
this.commandtype$.subscribe(commandType => {
console.log(commandType);
});
}
}, { }, {
text: 'Send', text: 'Send',
handler: () => { handler: () => {
this.store.dispatch(new SendCommandChanged(commandType)); this.store.dispatch(new SendCommandChanged(commandValue));
this.httpCommand.sendCommand(commandType, this.address, this.port, this.protocol); this.httpCommand.sendCommand(commandValue, this.address, this.port, this.protocol);
} }
} }
] ]

View File

@@ -1,5 +1,4 @@
<ion-tabs> <ion-tabs>
<ion-tab-bar slot="bottom"> <ion-tab-bar slot="bottom">
<ion-tab-button tab="home"> <ion-tab-button tab="home">
<ion-icon name="home-sharp"></ion-icon> <ion-icon name="home-sharp"></ion-icon>
@@ -16,5 +15,4 @@
<ion-label>Settings</ion-label> <ion-label>Settings</ion-label>
</ion-tab-button> </ion-tab-button>
</ion-tab-bar> </ion-tab-bar>
</ion-tabs> </ion-tabs>

View File

@@ -7,7 +7,5 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
}) })
export class MenuPage { export class MenuPage {
constructor() {} constructor() {}
} }

View File

@@ -1,11 +1,9 @@
import { IonicModule } from '@ionic/angular'; import { IonicModule } from '@ionic/angular';
import { RouterModule } from '@angular/router';
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
import { SearchHostPage } from './searchHost.page'; import { SearchHostPage } from './searchHost.page';
import { ExploreContainerComponentModule } from '../explore-container/explore-container.module'; import { ExploreContainerComponentModule } from '../explore-container/explore-container.module';
import { SearchHostPageRoutingModule } from './searchHost-routing.module'; import { SearchHostPageRoutingModule } from './searchHost-routing.module';
@NgModule({ @NgModule({

View File

@@ -1,17 +1,15 @@
<ion-header [translucent]="true"> <ion-header [translucent]="true">
<ion-toolbar> <ion-toolbar>
<ion-title> <ion-title>Search Host</ion-title>
Search Host
</ion-title>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content [fullscreen]="true"> <ion-content [fullscreen]="true">
<ion-header collapse="condense"> <ion-header collapse="condense">
<ion-toolbar> <ion-toolbar>
<ion-title size="large">Tab 2</ion-title> <ion-title size="large">WOL</ion-title>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<app-explore-container name="Tab 2 page"></app-explore-container> <app-explore-container name="WOL"></app-explore-container>
</ion-content> </ion-content>

View File

@@ -1,7 +1,6 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular'; import { IonicModule } from '@ionic/angular';
import { ExploreContainerComponentModule } from '../explore-container/explore-container.module'; import { ExploreContainerComponentModule } from '../explore-container/explore-container.module';
import { SearchHostPage } from './searchHost.page'; import { SearchHostPage } from './searchHost.page';
describe('SearchHostPage', () => { describe('SearchHostPage', () => {

View File

@@ -1,29 +1,8 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
@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 { }
constructor() {}
testText = '';
test() {
// console.log("!test")
// // Zeroconf.watchAddressFamily = 'ipv4';
// // Zeroconf.watch('_http._tcp.', 'local.').subscribe(result => {
// // this.testText = JSON.stringify(result.service.ipv4Addresses);
// // console.log(JSON.stringify(result.service.ipv4Addresses))
// // });
// ServiceDiscovery.getNetworkServices('ssdp:all')
// .then(devices => {
// console.log(JSON.stringify(devices))
// this.testText = JSON.stringify(devices)
// })
// .catch(error => console.error(error));
}
}

View File

@@ -1,6 +1,6 @@
<ion-list> <ion-list>
<ion-list-header> <ion-list-header>
<ion-label (click)="test()"> Remote Server Settings </ion-label> <ion-label> Remote Server Settings </ion-label>
</ion-list-header> </ion-list-header>
<ion-item> <ion-item>
<ion-label position="fixed">Protocol</ion-label> <ion-label position="fixed">Protocol</ion-label>

View File

@@ -1,8 +1,4 @@
/* tslint:disable:no-unused-variable */
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { ServerSettingsComponent } from './serverSettings.component'; import { ServerSettingsComponent } from './serverSettings.component';
describe('ServerSettingsComponent', () => { describe('ServerSettingsComponent', () => {

View File

@@ -1,6 +1,5 @@
import { getAddress, getPort, getProtocol } from './../../../store/gotobed.selectors'; import { getAddress, getPort, getProtocol } 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 { PortSettingsChanged, ProtocolSettingsChanged, SaveAddressSettings } from 'src/app/store/gotobed.actions';
import { GotobedState } from 'src/app/store/gotobed.state'; import { GotobedState } from 'src/app/store/gotobed.state';
@@ -12,38 +11,37 @@ import { InputCustomEvent } from 'src/app/gotobed.models';
styleUrls: ['./serverSettings.component.scss'] styleUrls: ['./serverSettings.component.scss']
}) })
export class ServerSettingsComponent implements OnInit{ export class ServerSettingsComponent implements OnInit{
constructor(private _store: Store<GotobedState>) { }
port = null; port = null;
address = ""; address = '';
protocol = ""; protocol = '';
constructor(private store: Store<GotobedState>) { }
ngOnInit() { ngOnInit() {
console.log("#Render server settings"); console.log('#Render server settings');
this._store this.store
.select(getPort) .select(getPort)
.subscribe(port => (this.port = port)); .subscribe(port => (this.port = port));
this._store this.store
.select(getAddress) .select(getAddress)
.subscribe(address => (this.address = address)); .subscribe(address => (this.address = address));
this._store this.store
.select(getProtocol) .select(getProtocol)
.subscribe(protocol => (this.protocol = protocol)); .subscribe(protocol => (this.protocol = protocol));
} }
onProtocolChange(protocol: InputCustomEvent){ onProtocolChange(protocol: InputCustomEvent){
console.log(protocol.detail.value) console.log(protocol.detail.value);
this._store.dispatch(new ProtocolSettingsChanged(protocol.detail.value)); this.store.dispatch(new ProtocolSettingsChanged(protocol.detail.value));
} }
onAddressChange(address: InputCustomEvent){ onAddressChange(address: InputCustomEvent){
console.log(address.detail.value) console.log(address.detail.value);
this._store.dispatch(new SaveAddressSettings(address.detail.value)); this.store.dispatch(new SaveAddressSettings(address.detail.value));
} }
onPortChange(port: InputCustomEvent){ onPortChange(port: InputCustomEvent){
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));
} }
} }

View File

@@ -6,7 +6,6 @@ import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
import { SettingsPage } from './settings.page'; import { SettingsPage } from './settings.page';
import { ExploreContainerComponentModule } from '../explore-container/explore-container.module'; import { ExploreContainerComponentModule } from '../explore-container/explore-container.module';
import { SettingsPageRoutingModule } from './settings-routing.module'; import { SettingsPageRoutingModule } from './settings-routing.module';
@NgModule({ @NgModule({

View File

@@ -1,12 +1,10 @@
<ion-header [translucent]="true"> <ion-header [translucent]="true">
<ion-toolbar> <ion-toolbar>
<ion-title> <ion-title>Settings</ion-title>
Settings
</ion-title>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<<ion-content [fullscreen]="true"> <ion-content [fullscreen]="true">
<ion-header collapse="condense"> <ion-header collapse="condense">
<ion-toolbar> <ion-toolbar>
<ion-title size="large">Settings</ion-title> <ion-title size="large">Settings</ion-title>

View File

@@ -1,7 +1,6 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular'; import { IonicModule } from '@ionic/angular';
import { ExploreContainerComponentModule } from '../explore-container/explore-container.module'; import { ExploreContainerComponentModule } from '../explore-container/explore-container.module';
import { SettingsPage } from './settings.page'; import { SettingsPage } from './settings.page';
describe('SettingsPage', () => { describe('SettingsPage', () => {

View File

@@ -5,8 +5,4 @@ import { Component } from '@angular/core';
templateUrl: 'settings.page.html', templateUrl: 'settings.page.html',
styleUrls: ['settings.page.scss'] styleUrls: ['settings.page.scss']
}) })
export class SettingsPage { export class SettingsPage { }
constructor() {}
}

View File

@@ -1,7 +1,7 @@
export const AddressStorageKey = "AddressKey"; 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 interface InputChangeEventDetail { export interface InputChangeEventDetail {

View File

@@ -8,18 +8,18 @@ import { HttpErrorResponse } from '@angular/common/http';
providedIn: 'root' providedIn: 'root'
}) })
export class NetworkRequestsService { export class NetworkRequestsService {
constructor(private readonly _httpClient: HTTP, public toastController: ToastController) { } constructor(private readonly httpClient: HTTP, public toastController: ToastController) { }
public sendCommand(command: string, address: string, port: number, connectionProtocol?: string,) { public sendCommand(command: string, address: string, port: number, connectionProtocol?: string,) {
const request: NetRequest = { const request: NetRequest = {
command: command, command,
} };
this._httpClient.setDataSerializer('json'); this.httpClient.setDataSerializer('json');
this._httpClient.setServerTrustMode('nocheck'); this.httpClient.setServerTrustMode('nocheck');
this._httpClient.post(encodeURI(`${connectionProtocol ?? 'http'}://${address + ":" + port}/commandbridge`), request, { this.httpClient.post(encodeURI(`${connectionProtocol ?? 'http'}://${address + ':' + port}/commandbridge`), request, {
ContentType: 'text/html;' contentType: 'text/html;'
}).catch(response => { }).catch(response => {
this.showErrorMessage(response); this.showErrorMessage(response);
}); });

View File

@@ -1,19 +1,19 @@
import { Injectable } from "@angular/core"; import { Injectable } from '@angular/core';
import { Storage } from "@ionic/storage-angular"; import { Storage } from '@ionic/storage-angular';
import * as cordovaSQLiteDriver from "localforage-cordovasqlitedriver"; import * as cordovaSQLiteDriver from 'localforage-cordovasqlitedriver';
import { BehaviorSubject, from, of } from "rxjs"; import { BehaviorSubject, from, of } from 'rxjs';
import { filter, switchMap, tap } from "rxjs/operators"; import { filter, switchMap, tap } from 'rxjs/operators';
@Injectable({ @Injectable({
providedIn: "root" providedIn: 'root'
}) })
export class StorageService { export class StorageService {
constructor(private storage: Storage) {
//this.initializeStorage();
}
private isStorageLoaded = new BehaviorSubject(false); private isStorageLoaded = new BehaviorSubject(false);
constructor(private storage: Storage) {
//this.initializeStorage(); TO BE USED ONCE MIGRATING TO NATIVE STORAGE
}
async initializeStorage() { async initializeStorage() {
await this.storage.defineDriver(cordovaSQLiteDriver); await this.storage.defineDriver(cordovaSQLiteDriver);
await this.storage.create(); await this.storage.create();

View File

@@ -2,35 +2,35 @@ import { Action } from '@ngrx/store';
import { LoadSettingsState } from './gotobed.state'; import { LoadSettingsState } from './gotobed.state';
export enum EGotobedActions { export enum EGotobedActions {
SendCommandChanged = '[GOTOBED] Command changed', sendCommandChanged = '[GOTOBED] Command changed',
AddressSettingsChanged = '[GOTOBED] Address settings changed', addressSettingsChanged = '[GOTOBED] Address settings changed',
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',
} }
export class SendCommandChanged implements Action { export class SendCommandChanged implements Action {
public readonly type = EGotobedActions.SendCommandChanged; public readonly type = EGotobedActions.sendCommandChanged;
constructor(public payload: string) { } constructor(public payload: string) { }
} }
export class SaveAddressSettings implements Action { export class SaveAddressSettings implements Action {
public readonly type = EGotobedActions.AddressSettingsChanged; public readonly type = EGotobedActions.addressSettingsChanged;
constructor(public payload: string) { } constructor(public payload: string) { }
} }
export class ProtocolSettingsChanged implements Action { export class ProtocolSettingsChanged implements Action {
public readonly type = EGotobedActions.ProtocolSettingsChanged; public readonly type = EGotobedActions.protocolSettingsChanged;
constructor(public payload: string) { } 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) { }
} }
export class AppInitialized implements Action { export class AppInitialized implements Action {
public readonly type = EGotobedActions.AppInitialized; public readonly type = EGotobedActions.appInitialized;
constructor(public payload: LoadSettingsState) { } constructor(public payload: LoadSettingsState) { }
} }

View File

@@ -0,0 +1,57 @@
import { portStorageKey } from '../gotobed.models';
import { Injectable } from '@angular/core';
import { Actions, createEffect, ofType, concatLatestFrom, ROOT_EFFECTS_INIT } from '@ngrx/effects';
import { Store } from '@ngrx/store';
import { map, tap, withLatestFrom } from 'rxjs/operators';
import { addressStorageKey, protocolStorageKey } from '../gotobed.models';
import { StorageService } from '../services/storage.service';
import { AppInitialized, EGotobedActions, ProtocolSettingsChanged, SaveAddressSettings } from './gotobed.actions';
@Injectable()
export class GotobedEffects {
init$ = createEffect(() =>
this.actions$.pipe(
ofType<AppInitialized>(ROOT_EFFECTS_INIT),
concatLatestFrom(() => this.store),
map(async ([action]) => {
this.storage.initializeStorage();
return action.payload = {
address: localStorage.getItem(addressStorageKey),
port: localStorage.getItem(portStorageKey),
protocol: localStorage.getItem(protocolStorageKey),
};
})
), { dispatch: false }
);
saveAddressSettings$ = createEffect(() => this.actions$.pipe(
ofType<SaveAddressSettings>(EGotobedActions.addressSettingsChanged),
withLatestFrom(this.store),
tap(([action]) => {
localStorage.setItem(addressStorageKey, action.payload);
})
), { dispatch: false });
saveProtocolSettings$ = createEffect(() => this.actions$.pipe(
ofType<ProtocolSettingsChanged>(EGotobedActions.protocolSettingsChanged),
withLatestFrom(this.store),
tap(([action]) => {
localStorage.setItem(protocolStorageKey, action.payload);
})
), { dispatch: false });
savePortSettings$ = createEffect(() => this.actions$.pipe(
ofType<ProtocolSettingsChanged>(EGotobedActions.portSettingsChanged),
withLatestFrom(this.store),
tap(([action]) => {
localStorage.setItem(portStorageKey, action.payload);
})
), { dispatch: false });
constructor(
private readonly actions$: Actions,
private readonly store: Store,
private storage: StorageService
) { }
}

View File

@@ -3,22 +3,22 @@ import { GotobedState, initialGotoBedState } from './gotobed.state';
export function gotobedReducer(state = initialGotoBedState, action: GotobedActions): GotobedState { export function gotobedReducer(state = initialGotoBedState, action: GotobedActions): GotobedState {
switch (action.type) { switch (action.type) {
case EGotobedActions.SendCommandChanged: case EGotobedActions.sendCommandChanged:
return { return {
...state, ...state,
command: action.payload, command: action.payload,
}; };
case EGotobedActions.ProtocolSettingsChanged: case EGotobedActions.protocolSettingsChanged:
return { return {
...state, ...state,
protocol: action.payload, protocol: action.payload,
}; };
case EGotobedActions.AddressSettingsChanged: case EGotobedActions.addressSettingsChanged:
return { return {
...state, ...state,
address: action.payload, address: action.payload,
}; };
case EGotobedActions.PortSettingsChanged: case EGotobedActions.portSettingsChanged:
return { return {
...state, ...state,
port: action.payload, port: action.payload,
@@ -26,4 +26,4 @@ export function gotobedReducer(state = initialGotoBedState, action: GotobedActio
default: default:
return state; return state;
} }
} };

View File

@@ -1,8 +1,7 @@
import { AddressStorageKey, PortStorageKey, ProtocolStorageKey } from "../gotobed.models"; import { addressStorageKey, portStorageKey, protocolStorageKey } from '../gotobed.models';
export const storeName = 'Gotobed'; export const storeName = 'Gotobed';
export interface GotobedState { export interface GotobedState {
command: string; command: string;
isLoading: boolean; isLoading: boolean;
@@ -15,9 +14,9 @@ export interface GotobedState {
export const initialGotoBedState: GotobedState = { export const initialGotoBedState: GotobedState = {
command: '', command: '',
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:8080',
isConnected: false, isConnected: false,
}; };

View File

@@ -2,7 +2,7 @@ import { NgModule } from '@angular/core';
import { EffectsModule } from '@ngrx/effects'; import { EffectsModule } from '@ngrx/effects';
import { StoreModule } from '@ngrx/store'; import { StoreModule } from '@ngrx/store';
import { gotobedReducer } from './gotobed.reducer'; import { gotobedReducer } from './gotobed.reducer';
import { GotobedEffects } from './gotoved.effects'; import { GotobedEffects } from './gotobed.effects';
@NgModule({ @NgModule({
imports: [ imports: [

View File

@@ -1,69 +0,0 @@
import { PortStorageKey } from './../gotobed.models';
import { Injectable } from '@angular/core';
import { Actions, createEffect, ofType, concatLatestFrom, ROOT_EFFECTS_INIT } from '@ngrx/effects';
import { Store } from '@ngrx/store';
import { map, tap, withLatestFrom } from 'rxjs/operators';
import { AddressStorageKey, ProtocolStorageKey } from '../gotobed.models';
import { StorageService } from '../services/storage.service';
import { AppInitialized, EGotobedActions, ProtocolSettingsChanged, SaveAddressSettings, SendCommandChanged } from './gotobed.actions';
@Injectable()
export class GotobedEffects {
init$ = createEffect(() =>
this._actions$.pipe(
ofType<AppInitialized>(ROOT_EFFECTS_INIT),
concatLatestFrom(() => this._store),
map(async ([action]) => {
this.storage.initializeStorage();
console.log("Loading# Srorage")
return action.payload = {
address: localStorage.getItem(AddressStorageKey),
port: localStorage.getItem(PortStorageKey),
protocol: localStorage.getItem(ProtocolStorageKey),
}
})
), { dispatch: false }
);
saveAddressSettings$ = createEffect(() => this._actions$.pipe(
ofType<SaveAddressSettings>(EGotobedActions.AddressSettingsChanged),
withLatestFrom(this._store),
tap(([action, state]) => {
//this.storage.addToStorage(ProtocolStorageKey, action.payload);
localStorage.setItem(AddressStorageKey, action.payload);
})
), { dispatch: false });
logCommand$ = createEffect(() => this._actions$.pipe(
ofType<SendCommandChanged>(EGotobedActions.SendCommandChanged),
withLatestFrom(this._store),
tap(([action, state]) => {
//this.storage.addToStorage(AddressStorageKey, action.payload);
})
), { dispatch: false });
saveProtocolSettings$ = createEffect(() => this._actions$.pipe(
ofType<ProtocolSettingsChanged>(EGotobedActions.ProtocolSettingsChanged),
withLatestFrom(this._store),
tap(([action, state]) => {
//this.storage.addToStorage(ProtocolStorageKey, action.payload);
localStorage.setItem(ProtocolStorageKey, action.payload);
})
), { dispatch: false });
savePortSettings$ = createEffect(() => this._actions$.pipe(
ofType<ProtocolSettingsChanged>(EGotobedActions.PortSettingsChanged),
withLatestFrom(this._store),
tap(([action, state]) => {
//this.storage.addToStorage(PortStorageKey, action.payload);
localStorage.setItem(PortStorageKey, action.payload);
})
), { dispatch: false });
constructor(
private readonly _actions$: Actions,
private readonly _store: Store,
private storage: StorageService
) { }
}

View File

@@ -1,28 +1,10 @@
/*
* App Global CSS
* ----------------------------------------------------------------------------
* Put style rules here that you want to apply globally. These styles are for
* the entire app and not just one component. Additionally, this file can be
* used as an entry point to import other CSS/Sass files to be included in the
* output CSS.
* For more information on global stylesheets, visit the documentation:
* https://ionicframework.com/docs/layout/global-stylesheets
*/
/* Core CSS required for Ionic components to work properly */
@import "~@ionic/angular/css/core.css"; @import "~@ionic/angular/css/core.css";
/* Basic CSS for apps built with Ionic */
@import "~@ionic/angular/css/normalize.css"; @import "~@ionic/angular/css/normalize.css";
@import "~@ionic/angular/css/structure.css"; @import "~@ionic/angular/css/structure.css";
@import "~@ionic/angular/css/typography.css"; @import "~@ionic/angular/css/typography.css";
@import '~@ionic/angular/css/display.css'; @import '~@ionic/angular/css/display.css';
/* Optional CSS utils that can be commented out */
@import "~@ionic/angular/css/padding.css"; @import "~@ionic/angular/css/padding.css";
@import "~@ionic/angular/css/float-elements.css"; @import "~@ionic/angular/css/float-elements.css";
@import "~@ionic/angular/css/text-alignment.css"; @import "~@ionic/angular/css/text-alignment.css";
@import "~@ionic/angular/css/text-transformation.css"; @import "~@ionic/angular/css/text-transformation.css";
@import "~@ionic/angular/css/flex-utils.css"; @import "~@ionic/angular/css/flex-utils.css";
// $nb-enable-css-custom-properties: false; // <-- enable css custom properties

View File

@@ -1,26 +1,19 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head>
<head> <meta charset="utf-8" />
<meta charset="utf-8" /> <title>GOTOBED</title>
<title>GOTOBED</title> <base href="/" />
<meta name="color-scheme" content="dark" />
<base href="/" /> <meta name="viewport" content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="format-detection" content="telephone=no" />
<meta name="color-scheme" content="dark" /> <meta name="msapplication-tap-highlight" content="no" />
<meta name="viewport" content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <link rel="icon" type="image/png" href="assets/icon/favicon.png" />
<meta name="format-detection" content="telephone=no" /> <!-- add to menuscreen for ios -->
<meta name="msapplication-tap-highlight" content="no" /> <meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="icon" type="image/png" href="assets/icon/favicon.png" /> </head>
<body>
<!-- add to menuscreen for ios --> <app-root></app-root>
<meta name="apple-mobile-web-app-capable" content="yes" /> </body>
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
</head>
<body>
<app-root></app-root>
</body>
</html> </html>

View File

@@ -1,6 +1,5 @@
import { enableProdMode } from '@angular/core'; import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module'; import { AppModule } from './app/app.module';
import { environment } from './environments/environment'; import { environment } from './environments/environment';

View File

@@ -1,10 +1,4 @@
// Ionic Variables and Theming. For more info, please see:
// http://ionicframework.com/docs/theming/
/** Ionic CSS Variables **/
:root { :root {
/** primary **/
--ion-color-primary: #3880ff; --ion-color-primary: #3880ff;
--ion-color-primary-rgb: 56, 128, 255; --ion-color-primary-rgb: 56, 128, 255;
--ion-color-primary-contrast: #ffffff; --ion-color-primary-contrast: #ffffff;
@@ -379,396 +373,5 @@
--ion-color-shade: var(--ion-color-academind-shade); --ion-color-shade: var(--ion-color-academind-shade);
--ion-color-tint: var(--ion-color-academind-tint); --ion-color-tint: var(--ion-color-academind-tint);
} }
// }
// // Ionic Variables and Theming. For more info, please see:
// // http://ionicframework.com/docs/theming/
// /** Ionic CSS Variables **/
// :root {
// /** primary **/
// --ion-color-primary: #3880FF;
// --ion-color-primary-rgb: 56, 128, 255;
// --ion-color-primary-contrast: #ffffff;
// --ion-color-primary-contrast-rgb: 255, 255, 255;
// --ion-color-primary-shade: #3171e0;
// --ion-color-primary-tint: #4c8dff;
// /** secondary **/
// --ion-color-secondary: #3dc2ff;
// --ion-color-secondary-rgb: 61, 194, 255;
// --ion-color-secondary-contrast: #ffffff;
// --ion-color-secondary-contrast-rgb: 255, 255, 255;
// --ion-color-secondary-shade: #36abe0;
// --ion-color-secondary-tint: #50c8ff;
// /** tertiary **/
// --ion-color-tertiary: #5260ff;
// --ion-color-tertiary-rgb: 82, 96, 255;
// --ion-color-tertiary-contrast: #ffffff;
// --ion-color-tertiary-contrast-rgb: 255, 255, 255;
// --ion-color-tertiary-shade: #4854e0;
// --ion-color-tertiary-tint: #6370ff;
// /** success **/
// --ion-color-success: #2dd36f;
// --ion-color-success-rgb: 45, 211, 111;
// --ion-color-success-contrast: #ffffff;
// --ion-color-success-contrast-rgb: 255, 255, 255;
// --ion-color-success-shade: #28ba62;
// --ion-color-success-tint: #42d77d;
// /** warning **/
// --ion-color-warning: #ffc409;
// --ion-color-warning-rgb: 255, 196, 9;
// --ion-color-warning-contrast: #000000;
// --ion-color-warning-contrast-rgb: 0, 0, 0;
// --ion-color-warning-shade: #e0ac08;
// --ion-color-warning-tint: #ffca22;
// /** danger **/
// --ion-color-danger: #eb445a;
// --ion-color-danger-rgb: 235, 68, 90;
// --ion-color-danger-contrast: #ffffff;
// --ion-color-danger-contrast-rgb: 255, 255, 255;
// --ion-color-danger-shade: #cf3c4f;
// --ion-color-danger-tint: #ed576b;
// /** dark **/
// --ion-color-dark: #222428;
// --ion-color-dark-rgb: 34, 36, 40;
// --ion-color-dark-contrast: #ffffff;
// --ion-color-dark-contrast-rgb: 255, 255, 255;
// --ion-color-dark-shade: #1e2023;
// --ion-color-dark-tint: #383a3e;
// /** medium **/
// --ion-color-medium: #92949c;
// --ion-color-medium-rgb: 146, 148, 156;
// --ion-color-medium-contrast: #ffffff;
// --ion-color-medium-contrast-rgb: 255, 255, 255;
// --ion-color-medium-shade: #808289;
// --ion-color-medium-tint: #9d9fa6;
// /** light **/
// --ion-color-light: #f4f5f8;
// --ion-color-light-rgb: 244, 245, 248;
// --ion-color-light-contrast: #000000;
// --ion-color-light-contrast-rgb: 0, 0, 0;
// --ion-color-light-shade: #d7d8da;
// --ion-color-light-tint: #f5f6f9;
// }
// @media (prefers-color-scheme: dark) {
// /*
// * Dark Colors
// * -------------------------------------------
// */
// body {
// --ion-color-primary: #afccff;
// --ion-color-primary-rgb: 175, 204, 255;
// --ion-color-primary-contrast: #000000;
// --ion-color-primary-contrast-rgb: 0, 0, 0;
// --ion-color-primary-shade: #9ab4e0;
// --ion-color-primary-tint: #b7d1ff;
// --ion-color-secondary: #50c8ff;
// --ion-color-secondary-rgb: 80,200,255;
// --ion-color-secondary-contrast: #ffffff;
// --ion-color-secondary-contrast-rgb: 255,255,255;
// --ion-color-secondary-shade: #46b0e0;
// --ion-color-secondary-tint: #62ceff;
// --ion-color-tertiary: #6a64ff;
// --ion-color-tertiary-rgb: 106,100,255;
// --ion-color-tertiary-contrast: #ffffff;
// --ion-color-tertiary-contrast-rgb: 255,255,255;
// --ion-color-tertiary-shade: #5d58e0;
// --ion-color-tertiary-tint: #7974ff;
// --ion-color-success: #2fdf75;
// --ion-color-success-rgb: 47,223,117;
// --ion-color-success-contrast: #000000;
// --ion-color-success-contrast-rgb: 0,0,0;
// --ion-color-success-shade: #29c467;
// --ion-color-success-tint: #44e283;
// --ion-color-warning: #ffd534;
// --ion-color-warning-rgb: 255,213,52;
// --ion-color-warning-contrast: #000000;
// --ion-color-warning-contrast-rgb: 0,0,0;
// --ion-color-warning-shade: #e0bb2e;
// --ion-color-warning-tint: #ffd948;
// --ion-color-danger: #ff4961;
// --ion-color-danger-rgb: 255,73,97;
// --ion-color-danger-contrast: #ffffff;
// --ion-color-danger-contrast-rgb: 255,255,255;
// --ion-color-danger-shade: #e04055;
// --ion-color-danger-tint: #ff5b71;
// --ion-color-dark: #f4f5f8;
// --ion-color-dark-rgb: 244,245,248;
// --ion-color-dark-contrast: #000000;
// --ion-color-dark-contrast-rgb: 0,0,0;
// --ion-color-dark-shade: #d7d8da;
// --ion-color-dark-tint: #f5f6f9;
// --ion-color-medium: #989aa2;
// --ion-color-medium-rgb: 152,154,162;
// --ion-color-medium-contrast: #000000;
// --ion-color-medium-contrast-rgb: 0,0,0;
// --ion-color-medium-shade: #86888f;
// --ion-color-medium-tint: #a2a4ab;
// --ion-color-light: #222428;
// --ion-color-light-rgb: 34,36,40;
// --ion-color-light-contrast: #ffffff;
// --ion-color-light-contrast-rgb: 255,255,255;
// --ion-color-light-shade: #1e2023;
// --ion-color-light-tint: #383a3e;
// }
// /*
// * iOS Dark Theme
// * -------------------------------------------
// */
// .ios body {
// --ion-background-color: #1b1b38;
// --ion-background-color-rgb: 0,0,0;
// --ion-text-color: #ffffff;
// --ion-text-color-rgb: 255,255,255;
// --ion-color-step-50: #0d0d0d;
// --ion-color-step-100: #1a1a1a;
// --ion-color-step-150: #262626;
// --ion-color-step-200: #333333;
// --ion-color-step-250: #404040;
// --ion-color-step-300: #4d4d4d;
// --ion-color-step-350: #595959;
// --ion-color-step-400: #666666;
// --ion-color-step-450: #737373;
// --ion-color-step-500: #808080;
// --ion-color-step-550: #8c8c8c;
// --ion-color-step-600: #999999;
// --ion-color-step-650: #a6a6a6;
// --ion-color-step-700: #b3b3b3;
// --ion-color-step-750: #bfbfbf;
// --ion-color-step-800: #cccccc;
// --ion-color-step-850: #d9d9d9;
// --ion-color-step-900: #e6e6e6;
// --ion-color-step-950: #f2f2f2;
// --ion-item-background: #000000;
// --ion-card-background: #1c1c1d;
// }
// .ios ion-modal {
// --ion-background-color: var(--ion-color-step-100);
// --ion-toolbar-background: var(--ion-color-step-150);
// --ion-toolbar-border-color: var(--ion-color-step-250);
// }
// /*
// * Material Design Dark Theme
// * -------------------------------------------
// */
// .md body {
// --ion-background-color: #121212;
// --ion-background-color-rgb: 18,18,18;
// --ion-text-color: #ffffff;
// --ion-text-color-rgb: 255,255,255;
// --ion-border-color: #222222;
// --ion-color-step-50: #1e1e1e;
// --ion-color-step-100: #2a2a2a;
// --ion-color-step-150: #363636;
// --ion-color-step-200: #414141;
// --ion-color-step-250: #4d4d4d;
// --ion-color-step-300: #595959;
// --ion-color-step-350: #656565;
// --ion-color-step-400: #717171;
// --ion-color-step-450: #7d7d7d;
// --ion-color-step-500: #898989;
// --ion-color-step-550: #949494;
// --ion-color-step-600: #a0a0a0;
// --ion-color-step-650: #acacac;
// --ion-color-step-700: #b8b8b8;
// --ion-color-step-750: #c4c4c4;
// --ion-color-step-800: #d0d0d0;
// --ion-color-step-850: #dbdbdb;
// --ion-color-step-900: #e7e7e7;
// --ion-color-step-950: #f3f3f3;
// --ion-item-background: #1e1e1e;
// --ion-toolbar-background: #1f1f1f;
// --ion-tab-bar-background: #1f1f1f;
// --ion-card-background: #1e1e1e;
// }
// }
// body.dark {
// --ion-color-primary: #428cff;
// --ion-color-primary-rgb: 66, 140, 255;
// --ion-color-primary-contrast: #ffffff;
// --ion-color-primary-contrast-rgb: 255, 255, 255;
// --ion-color-primary-shade: #3a7be0;
// --ion-color-primary-tint: #5598ff;
// --ion-color-secondary: #50c8ff;
// --ion-color-secondary-rgb: 80, 200, 255;
// --ion-color-secondary-contrast: #ffffff;
// --ion-color-secondary-contrast-rgb: 255, 255, 255;
// --ion-color-secondary-shade: #46b0e0;
// --ion-color-secondary-tint: #62ceff;
// --ion-color-tertiary: #6a64ff;
// --ion-color-tertiary-rgb: 106, 100, 255;
// --ion-color-tertiary-contrast: #ffffff;
// --ion-color-tertiary-contrast-rgb: 255, 255, 255;
// --ion-color-tertiary-shade: #5d58e0;
// --ion-color-tertiary-tint: #7974ff;
// --ion-color-success: #2fdf75;
// --ion-color-success-rgb: 47, 223, 117;
// --ion-color-success-contrast: #000000;
// --ion-color-success-contrast-rgb: 0, 0, 0;
// --ion-color-success-shade: #29c467;
// --ion-color-success-tint: #44e283;
// --ion-color-warning: #ffd534;
// --ion-color-warning-rgb: 255, 213, 52;
// --ion-color-warning-contrast: #000000;
// --ion-color-warning-contrast-rgb: 0, 0, 0;
// --ion-color-warning-shade: #e0bb2e;
// --ion-color-warning-tint: #ffd948;
// --ion-color-danger: #ff4961;
// --ion-color-danger-rgb: 255, 73, 97;
// --ion-color-danger-contrast: #ffffff;
// --ion-color-danger-contrast-rgb: 255, 255, 255;
// --ion-color-danger-shade: #e04055;
// --ion-color-danger-tint: #ff5b71;
// --ion-color-dark: #f4f5f8;
// --ion-color-dark-rgb: 244, 245, 248;
// --ion-color-dark-contrast: #000000;
// --ion-color-dark-contrast-rgb: 0, 0, 0;
// --ion-color-dark-shade: #d7d8da;
// --ion-color-dark-tint: #f5f6f9;
// --ion-color-medium: #989aa2;
// --ion-color-medium-rgb: 152, 154, 162;
// --ion-color-medium-contrast: #000000;
// --ion-color-medium-contrast-rgb: 0, 0, 0;
// --ion-color-medium-shade: #86888f;
// --ion-color-medium-tint: #a2a4ab;
// --ion-color-light: #222428;
// --ion-color-light-rgb: 34, 36, 40;
// --ion-color-light-contrast: #ffffff;
// --ion-color-light-contrast-rgb: 255, 255, 255;
// --ion-color-light-shade: #1e2023;
// --ion-color-light-tint: #383a3e;
// }
// /*
// * iOS Dark Theme
// * -------------------------------------------
// */
// .ios body.dark {
// --ion-background-color: #000000;
// --ion-background-color-rgb: 0, 0, 0;
// --ion-text-color: #ffffff;
// --ion-text-color-rgb: 255, 255, 255;
// --ion-color-step-50: #0d0d0d;
// --ion-color-step-100: #1a1a1a;
// --ion-color-step-150: #262626;
// --ion-color-step-200: #333333;
// --ion-color-step-250: #404040;
// --ion-color-step-300: #4d4d4d;
// --ion-color-step-350: #595959;
// --ion-color-step-400: #666666;
// --ion-color-step-450: #737373;
// --ion-color-step-500: #808080;
// --ion-color-step-550: #8c8c8c;
// --ion-color-step-600: #999999;
// --ion-color-step-650: #a6a6a6;
// --ion-color-step-700: #b3b3b3;
// --ion-color-step-750: #bfbfbf;
// --ion-color-step-800: #cccccc;
// --ion-color-step-850: #d9d9d9;
// --ion-color-step-900: #e6e6e6;
// --ion-color-step-950: #f2f2f2;
// --ion-item-background: #000000;
// --ion-card-background: #1c1c1d;
// }
// .ios body.dark ion-modal {
// --ion-background-color: var(--ion-color-step-100);
// --ion-toolbar-background: var(--ion-color-step-150);
// --ion-toolbar-border-color: var(--ion-color-step-250);
// --ion-item-background: var(--ion-color-step-150);
// }
// /*
// * Material Design Dark Theme
// * -------------------------------------------
// */
// .md body.dark {
// --ion-background-color: #121212;
// --ion-background-color-rgb: 18, 18, 18;
// --ion-text-color: #ffffff;
// --ion-text-color-rgb: 255, 255, 255;
// --ion-border-color: #222222;
// --ion-color-step-50: #1e1e1e;
// --ion-color-step-100: #2a2a2a;
// --ion-color-step-150: #363636;
// --ion-color-step-200: #414141;
// --ion-color-step-250: #4d4d4d;
// --ion-color-step-300: #595959;
// --ion-color-step-350: #656565;
// --ion-color-step-400: #717171;
// --ion-color-step-450: #7d7d7d;
// --ion-color-step-500: #898989;
// --ion-color-step-550: #949494;
// --ion-color-step-600: #a0a0a0;
// --ion-color-step-650: #acacac;
// --ion-color-step-700: #b8b8b8;
// --ion-color-step-750: #c4c4c4;
// --ion-color-step-800: #d0d0d0;
// --ion-color-step-850: #dbdbdb;
// --ion-color-step-900: #e7e7e7;
// --ion-color-step-950: #f3f3f3;
// --ion-item-background: #1e1e1e;
// --ion-toolbar-background: #1f1f1f;
// --ion-tab-bar-background: #1f1f1f;
// --ion-card-background: #1e1e1e;
// }
@import 'themes'; @import 'themes';

31
Server/.gitignore vendored Normal file
View File

@@ -0,0 +1,31 @@
# Specifies intentionally untracked files to ignore when using Git
# http://git-scm.com/docs/gitignore
*~
*.sw[mnpcod]
.tmp
*.tmp
*.tmp.*
*.sublime-project
*.sublime-workspace
.DS_Store
Thumbs.db
UserInterfaceState.xcuserstate
$RECYCLE.BIN/
*.log
log.txt
npm-debug.log*
/.idea
/.ionic
/.sass-cache
/.sourcemaps
/.versions
/.vscode
/coverage
/dist
/node_modules
/platforms
/plugins
/www

Binary file not shown.

View File

@@ -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!include \"C:\\Users\\Ludvi\\AppData\\Local\\Temp\\t-6b9X7N\\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" 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"

View File

@@ -6,7 +6,7 @@ productName: GoToBed
copyright: Copyright © 2021 copyright: Copyright © 2021
mac: mac:
category: public.app-category.utilities category: public.app-category.utilities
icon: assets/icon.icns icon: buildResources/icon.icns
target: target:
- zip - zip
- dmg - dmg

View File

@@ -1,4 +1,4 @@
const { app, BrowserWindow, dialog } = require('electron') const { app, dialog } = require('electron')
const system = require('electron-shutdown-command'); const system = require('electron-shutdown-command');
const express = require('express') const express = require('express')
const cors = require('cors'); const cors = require('cors');
@@ -9,6 +9,8 @@ const firstRun = require('electron-first-run');
const autoLaunch = new AutoLaunch({ const autoLaunch = new AutoLaunch({
name: 'GoToBed Server', name: 'GoToBed Server',
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();
@@ -27,7 +29,6 @@ server.use(cors({
exposedHeaders: ['Access-Control-Allow-Origin', '*'], exposedHeaders: ['Access-Control-Allow-Origin', '*'],
})) }))
server.post('/commandbridge', function (req, res) { server.post('/commandbridge', function (req, res) {
console.log(req.body.command)
switch (req.body.command) { switch (req.body.command) {
case 'shutdown': case 'shutdown':
console.log('shutting down') console.log('shutting down')

View File

@@ -914,11 +914,6 @@
"extract-zip": "^1.0.3" "extract-zip": "^1.0.3"
} }
}, },
"electron-browser-storage": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/electron-browser-storage/-/electron-browser-storage-1.0.7.tgz",
"integrity": "sha512-/5aNIqo0Y1TS3UWs9EVLfiaY3Dio1xaFn5FRAQFDfjE92ObhClrgxWN3MtO9MDMriCkqcY+hO5F1m7sfK5D5fQ=="
},
"electron-builder": { "electron-builder": {
"version": "21.2.0", "version": "21.2.0",
"resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-21.2.0.tgz", "resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-21.2.0.tgz",