mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-01 21:13:09 +00:00
chore: enable strict mode (#1569)
* chore: enable strict mode * refactor: remove sync data access from PatchDbService * launchable even when no LAN url Co-authored-by: Matt Hill <matthewonthemoon@gmail.com>
This commit is contained in:
9
frontend/projects/ui/src/app/util/get-marketplace.ts
Normal file
9
frontend/projects/ui/src/app/util/get-marketplace.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { first } from 'rxjs/operators'
|
||||
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { UIMarketplaceData } from 'src/app/services/patch-db/data-model'
|
||||
|
||||
export function getMarketplace(
|
||||
patch: PatchDbService,
|
||||
): Promise<UIMarketplaceData> {
|
||||
return patch.watch$('ui', 'marketplace').pipe(first()).toPromise()
|
||||
}
|
||||
16
frontend/projects/ui/src/app/util/get-package-data.ts
Normal file
16
frontend/projects/ui/src/app/util/get-package-data.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { first } from 'rxjs/operators'
|
||||
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { PackageDataEntry } from 'src/app/services/patch-db/data-model'
|
||||
|
||||
export function getPackage(
|
||||
patch: PatchDbService,
|
||||
id: string,
|
||||
): Promise<PackageDataEntry> {
|
||||
return patch.watch$('package-data', id).pipe(first()).toPromise()
|
||||
}
|
||||
|
||||
export function getAllPackages(
|
||||
patch: PatchDbService,
|
||||
): Promise<Record<string, PackageDataEntry>> {
|
||||
return patch.watch$('package-data').pipe(first()).toPromise()
|
||||
}
|
||||
7
frontend/projects/ui/src/app/util/get-server-info.ts
Normal file
7
frontend/projects/ui/src/app/util/get-server-info.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { first } from 'rxjs/operators'
|
||||
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { ServerInfo } from 'src/app/services/patch-db/data-model'
|
||||
|
||||
export function getServerInfo(patch: PatchDbService): Promise<ServerInfo> {
|
||||
return patch.watch$('server-info').pipe(first()).toPromise()
|
||||
}
|
||||
@@ -2,24 +2,20 @@ export async function copyToClipboard(str: string): Promise<boolean> {
|
||||
if (window.isSecureContext) {
|
||||
return navigator.clipboard
|
||||
.writeText(str)
|
||||
.then(() => {
|
||||
return true
|
||||
})
|
||||
.catch(err => {
|
||||
return false
|
||||
})
|
||||
} else {
|
||||
const el = document.createElement('textarea')
|
||||
el.value = str
|
||||
el.setAttribute('readonly', '')
|
||||
el.style.position = 'absolute'
|
||||
el.style.left = '-9999px'
|
||||
document.body.appendChild(el)
|
||||
el.select()
|
||||
const copy = document.execCommand('copy')
|
||||
document.body.removeChild(el)
|
||||
return copy
|
||||
.then(() => true)
|
||||
.catch(() => false)
|
||||
}
|
||||
|
||||
const el = document.createElement('textarea')
|
||||
el.value = str
|
||||
el.setAttribute('readonly', '')
|
||||
el.style.position = 'absolute'
|
||||
el.style.left = '-9999px'
|
||||
document.body.appendChild(el)
|
||||
el.select()
|
||||
const copy = document.execCommand('copy')
|
||||
document.body.removeChild(el)
|
||||
return copy
|
||||
}
|
||||
|
||||
export function strip(html: string) {
|
||||
|
||||
Reference in New Issue
Block a user