Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,022 changes: 511 additions & 511 deletions ui/dist/bundle.js

Large diffs are not rendered by default.

1,024 changes: 512 additions & 512 deletions ui/dist/index.html

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions ui/src/components/aliases.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { escapeHtml } from '../escape';
import { store } from '../state';
import { api } from '../api';

Expand Down Expand Up @@ -128,7 +129,3 @@ export function renderAliases(): string {
</div>
`;
}

function escapeHtml(str: string): string {
return String(str || '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
}
5 changes: 1 addition & 4 deletions ui/src/components/approvals.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { escapeHtml } from '../escape';
import { AppState } from '../state';

export function renderApprovals(state: AppState): string {
Expand Down Expand Up @@ -213,8 +214,4 @@ export function renderApprovals(state: AppState): string {
`;
}

function escapeHtml(str: string): string {
return String(str || '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
}


11 changes: 1 addition & 10 deletions ui/src/components/audit.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { escapeHtml } from '../escape';
import { store } from '../state';
import { api, AuditEventItem } from '../api';

Expand Down Expand Up @@ -408,13 +409,3 @@ export function renderAudit(): string {
`;
}

function escapeHtml(str: string): string {
if (!str) return '';
return String(str)
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#039;');
}

5 changes: 1 addition & 4 deletions ui/src/components/overview.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { escapeHtml } from '../escape';
import { store } from '../state';

export function renderOverview(): string {
Expand Down Expand Up @@ -278,7 +279,3 @@ export function renderOverview(): string {
</div>
`;
}

function escapeHtml(str: string): string {
return String(str || '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
}
9 changes: 1 addition & 8 deletions ui/src/components/playground.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { escapeHtml } from '../escape';
import { store } from '../state';
import { api } from '../api';

Expand Down Expand Up @@ -747,12 +748,4 @@ function renderBatchModal(state: any): string {
`;
}

function escapeHtml(str: string): string {
return String(str || '')
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;');
}


5 changes: 1 addition & 4 deletions ui/src/components/policy.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { escapeHtml } from '../escape';
import { store } from '../state';
import { api } from '../api';

Expand Down Expand Up @@ -253,7 +254,3 @@ export function renderPolicy(): string {
</div>
`;
}

function escapeHtml(str: string): string {
return String(str || '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
}
5 changes: 1 addition & 4 deletions ui/src/components/profiles.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { escapeHtml } from '../escape';
import { store } from '../state';
import { api } from '../api';

Expand Down Expand Up @@ -118,7 +119,3 @@ export function renderProfiles(): string {
${profilesListHtml}
`;
}

function escapeHtml(str: string): string {
return String(str || '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
}
5 changes: 1 addition & 4 deletions ui/src/components/secrets.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { escapeHtml } from '../escape';
import { store } from '../state';
import { api } from '../api';
import { findTemplateForServer } from '../templates';
Expand Down Expand Up @@ -136,7 +137,3 @@ export function renderSecrets(): string {
</div>
`;
}

function escapeHtml(str: string): string {
return String(str || '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
}
5 changes: 1 addition & 4 deletions ui/src/components/servers.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { escapeHtml } from '../escape';
import { store } from '../state';
import { api } from '../api';
import { findTemplateForServer } from '../templates';
Expand Down Expand Up @@ -332,7 +333,3 @@ function renderClientIntegrations(): string {
</div>
`;
}

function escapeHtml(str: string): string {
return String(str || '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
}
5 changes: 1 addition & 4 deletions ui/src/components/tasks.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { escapeHtml } from '../escape';
import { AppState } from '../state';
import { TaskItem } from '../api';

Expand Down Expand Up @@ -337,7 +338,3 @@ export function renderTasks(state: AppState): string {
</div>
`;
}

function escapeHtml(str: string): string {
return String(str || '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
}
21 changes: 21 additions & 0 deletions ui/src/escape.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Escapes a value for safe interpolation into HTML text or an attribute.

/**
* Escapes a value for safe interpolation into HTML text or an attribute.
*
* Also escapes the single quote, so the value is safe inside the single-quoted
* JavaScript string literals used by inline `on*` handlers.
*
* @param value Any value. Non-strings are coerced; nullish values become an
* empty string.
* @returns The escaped string.
*/
export function escapeHtml(value: unknown): string {
if (value === null || value === undefined) return '';
return String(value)
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#039;');
}
5 changes: 1 addition & 4 deletions ui/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { escapeHtml } from './escape';
import { store } from './state';
import { api } from './api';
import { renderOverview } from './components/overview';
Expand Down Expand Up @@ -2777,10 +2778,6 @@ class WarmplaneApp {
}
}

function escapeHtml(str: string): string {
return String(str || '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
}

const app = new WarmplaneApp();
(window as any).app = app;
window.addEventListener('DOMContentLoaded', () => app.init());
Loading