mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +00:00
strip html from colors from logs (#1604)
This commit is contained in:
@@ -3,7 +3,7 @@ import { ActivatedRoute } from '@angular/router'
|
|||||||
import { getPkgId } from '@start9labs/shared'
|
import { getPkgId } from '@start9labs/shared'
|
||||||
import { ToastController } from '@ionic/angular'
|
import { ToastController } from '@ionic/angular'
|
||||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||||
import { copyToClipboard } from 'src/app/util/web.util'
|
import { copyToClipboard, strip } from 'src/app/util/web.util'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-logs',
|
selector: 'app-logs',
|
||||||
@@ -41,7 +41,7 @@ export class AppLogsPage {
|
|||||||
const logs = document
|
const logs = document
|
||||||
.getElementById('template')
|
.getElementById('template')
|
||||||
?.cloneNode(true) as HTMLElement
|
?.cloneNode(true) as HTMLElement
|
||||||
const formatted = '```' + logs.innerHTML + '```'
|
const formatted = '```' + strip(logs.innerHTML) + '```'
|
||||||
const success = await copyToClipboard(formatted)
|
const success = await copyToClipboard(formatted)
|
||||||
const message = success
|
const message = success
|
||||||
? 'Copied to clipboard!'
|
? 'Copied to clipboard!'
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Component } from '@angular/core'
|
import { Component } from '@angular/core'
|
||||||
import { ToastController } from '@ionic/angular'
|
import { ToastController } from '@ionic/angular'
|
||||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||||
import { copyToClipboard } from 'src/app/util/web.util'
|
import { copyToClipboard, strip } from 'src/app/util/web.util'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'server-logs',
|
selector: 'server-logs',
|
||||||
@@ -17,7 +17,7 @@ export class ServerLogsPage {
|
|||||||
constructor(
|
constructor(
|
||||||
private readonly embassyApi: ApiService,
|
private readonly embassyApi: ApiService,
|
||||||
private readonly toastCtrl: ToastController,
|
private readonly toastCtrl: ToastController,
|
||||||
) { }
|
) {}
|
||||||
|
|
||||||
fetchFetchLogs() {
|
fetchFetchLogs() {
|
||||||
return async (params: {
|
return async (params: {
|
||||||
@@ -37,7 +37,7 @@ export class ServerLogsPage {
|
|||||||
const logs = document
|
const logs = document
|
||||||
.getElementById('template')
|
.getElementById('template')
|
||||||
?.cloneNode(true) as HTMLElement
|
?.cloneNode(true) as HTMLElement
|
||||||
const formatted = '```' + logs.innerHTML + '```'
|
const formatted = '```' + strip(logs.innerHTML) + '```'
|
||||||
const success = await copyToClipboard(formatted)
|
const success = await copyToClipboard(formatted)
|
||||||
const message = success
|
const message = success
|
||||||
? 'Copied to clipboard!'
|
? 'Copied to clipboard!'
|
||||||
|
|||||||
@@ -21,3 +21,8 @@ export async function copyToClipboard(str: string): Promise<boolean> {
|
|||||||
return copy
|
return copy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function strip(html: string) {
|
||||||
|
let doc = new DOMParser().parseFromString(html, 'text/html')
|
||||||
|
return doc.body.textContent || ''
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user