mirror of
https://github.com/go-gitea/gitea.git
synced 2026-04-21 18:24:58 +08:00
Introduces a frontend external-render framework that runs renderer plugins inside an `iframe` (loaded via `srcdoc` to keep the CSP `sandbox` directive working without origin-related console noise), and migrates the 3D viewer and OpenAPI/Swagger renderers onto it. PDF and asciicast paths are refactored to share the same `data-render-name` mechanism. Adds e2e coverage for 3D, PDF, asciicast and OpenAPI render paths, plus a regression for the `RefTypeNameSubURL` double-escape on non-ASCII branch names. Signed-off-by: silverwind <me@silverwind.io> Co-authored-by: Claude (Opus 4.6) <noreply@anthropic.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
15 lines
755 B
TypeScript
15 lines
755 B
TypeScript
// FIXME: INCORRECT-VITE-MANIFEST-PARSER: it just happens to work for current dependencies
|
|
// If this module depends on another one and that one imports "swagger.css", then {{AssetURI "css/swagger.css"}} won't work
|
|
import '../css/swagger.css';
|
|
import {initSwaggerUI} from './render/swagger.ts';
|
|
|
|
async function initGiteaAPIViewer() {
|
|
const elSwaggerUi = document.querySelector<HTMLElement>('#swagger-ui')!;
|
|
const url = elSwaggerUi.getAttribute('data-source')!;
|
|
const res = await fetch(url); // eslint-disable-line no-restricted-globals
|
|
// HINT: SWAGGER-CSS-IMPORT: this is used in the standalone page which already has the related CSS imported by `<link>`
|
|
await initSwaggerUI(elSwaggerUi, {specText: await res.text()});
|
|
}
|
|
|
|
initGiteaAPIViewer();
|