Drew cleanup (#380)

* accordion works

* cleanup

* styling

* more styling

* App show change (#387)

* show page change

* no marketplace

* app show changes

* update marketplace list

* icon

* top left icon

* toolbar

* right size

* out of toolbar

* no service details

* fix skeleton text and server metrics page

* stuck

* add session management

* complete sessions feature

* app show page

* remove unnecessary icons

* add cli to list of possible sessions

* Modal global (#383)

* modal checkpoint

* global modal

* black looks good now

* black looks good now

* not smaller

Co-authored-by: Drew Ansbacher <drew.ansbacher@spiredigital.com>

Co-authored-by: Drew Ansbacher <drew.ansbacher@spiredigital.com>
Co-authored-by: Drew Ansbacher <drew.ansbacher@gmail.com>

Co-authored-by: Drew Ansbacher <drew.ansbacher@spiredigital.com>
Co-authored-by: Matt Hill <matthewonthemoon@gmail.com>
Co-authored-by: Matt Hill <MattDHill@users.noreply.github.com>
This commit is contained in:
Drew Ansbacher
2021-07-29 16:59:03 -04:00
committed by Aiden McClelland
parent 4c294566d7
commit a43ff976a2
71 changed files with 808 additions and 694 deletions

View File

@@ -739,6 +739,26 @@ export module Mock {
},
]
export const Sessions: RR.GetSessionsRes = {
current: 'b7b1a9cef4284f00af9e9dda6e676177',
sessions: {
'9513226517c54ddd8107d6d7b9d8aed7': {
'last-active': '2021-07-14T20:49:17.774Z',
'user-agent': 'AppleWebKit/{WebKit Rev} (KHTML, like Gecko)',
metadata: {
platforms: ['iphone', 'mobileweb', 'mobile', 'ios'],
},
},
'b7b1a9cef4284f00af9e9dda6e676177': {
'last-active': '2021-06-14T20:49:17.774Z',
'user-agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0',
metadata: {
platforms: ['desktop'],
},
},
},
}
export const SshKeys: RR.GetSSHKeysRes = {
'28:d2:7e:78:61:b4:bf:g2:de:24:15:96:4e:d4:15:53': {
alg: 'ed25519',

View File

@@ -16,7 +16,7 @@ export module RR {
// auth
export type LoginReq = { password: string } // auth.login - unauthed
export type LoginReq = { password: string, metadata: SessionMetadata } // auth.login - unauthed
export type loginRes = null
export type LogoutReq = { } // auth.logout
@@ -47,6 +47,17 @@ export module RR {
export type RefreshLanReq = { } // network.lan.refresh
export type RefreshLanRes = null
// sessions
export type GetSessionsReq = { } // sessions.list
export type GetSessionsRes = {
current: string,
sessions: { [hash: string]: Session }
}
export type KillSessionsReq = WithExpire<{ hashes: string[] }> // sessions.kill
export type KillSessionsRes = WithRevision<null>
// marketplace URLs
export type SetEosMarketplaceReq = WithExpire<{ url: string }> // marketplace.eos.set
@@ -253,6 +264,18 @@ export interface Metric {
}
}
export interface Session {
'last-active': string
'user-agent': string
metadata: SessionMetadata
}
export interface SessionMetadata {
platforms: PlatformType[]
}
export type PlatformType = 'cli' | 'ios' | 'ipad' | 'iphone' | 'android' | 'phablet' | 'tablet' | 'cordova' | 'capacitor' | 'electron' | 'pwa' | 'mobile' | 'mobileweb' | 'desktop' | 'hybrid'
export interface DiskInfo {
[id: string]: DiskInfoEntry
}

View File

@@ -32,6 +32,10 @@ export abstract class ApiService implements Source<DataModel>, Http<DataModel> {
abstract logout (params: RR.LogoutReq): Promise<RR.LogoutRes>
abstract getSessions (params: RR.GetSessionsReq): Promise<RR.GetSessionsRes>
abstract killSessions (params: RR.KillSessionsReq): Promise<RR.KillSessionsRes>
// server
protected abstract setShareStatsRaw (params: RR.SetShareStatsReq): Promise<RR.SetShareStatsRes>

View File

@@ -41,6 +41,14 @@ export class LiveApiService extends ApiService {
return this.http.rpcRequest({ method: 'auth.logout', params })
}
async getSessions (params: RR.GetSessionsReq): Promise<RR.GetSessionsRes> {
return this.http.rpcRequest({ method: 'auth.session.list', params })
}
async killSessions (params: RR.KillSessionsReq): Promise<RR.KillSessionsRes> {
return this.http.rpcRequest({ method: 'auth.session.kill', params })
}
// server
async setShareStatsRaw (params: RR.SetShareStatsReq): Promise<RR.SetShareStatsRes> {

View File

@@ -50,6 +50,16 @@ export class MockApiService extends ApiService {
return null
}
async getSessions (params: RR.GetSessionsReq): Promise<RR.GetSessionsRes> {
await pauseFor(2000)
return Mock.Sessions
}
async killSessions (params: RR.KillSessionsReq): Promise<RR.KillSessionsRes> {
await pauseFor(2000)
return null
}
// server
async setShareStatsRaw (params: RR.SetShareStatsReq): Promise<RR.SetShareStatsRes> {

View File

@@ -3,6 +3,7 @@ import { BehaviorSubject, Observable } from 'rxjs'
import { distinctUntilChanged } from 'rxjs/operators'
import { ApiService } from './api/embassy/embassy-api.service'
import { Storage } from '@ionic/storage'
import { getPlatforms, isPlatform } from '@ionic/angular'
export enum AuthState {
UNVERIFIED,
@@ -31,7 +32,10 @@ export class AuthService {
}
async login (password: string): Promise<void> {
await this.embassyApi.login({ password })
await this.embassyApi.login({
password,
metadata: { platforms: getPlatforms() },
})
await this.storage.set(this.LOGGED_IN_KEY, true)
this.authState$.next(AuthState.VERIFIED)
}

View File

@@ -67,6 +67,7 @@ export class ConfigService {
}
launchableURL (pkg: PackageDataEntry): string {
console.log('PKGPKGPKG', pkg)
return this.isTor() ? `http://${torUiAddress(pkg)}` : `https://${lanUiAddress(pkg)}`
}
}
@@ -85,7 +86,7 @@ export function torUiAddress (pkg: PackageDataEntry): string {
const val = interfaces[key]
return val.ui && val['tor-config']
})
return pkg['interface-info'].addresses[id]['tor-address']
return pkg.installed['interface-info'].addresses[id]['tor-address']
}
export function lanUiAddress (pkg: PackageDataEntry): string {
@@ -94,7 +95,7 @@ export function lanUiAddress (pkg: PackageDataEntry): string {
const val = interfaces[key]
return val.ui && val['lan-config']
})
return pkg['interface-info'].addresses[id]['lan-address']
return pkg.installed['interface-info'].addresses[id]['lan-address']
}
export function hasUi (interfaces: { [id: string]: InterfaceDef }): boolean {