Initial commit (as a partial copy of md:quality)

This commit is contained in:
Joshua Ramon Enslin 2025-01-20 14:14:44 +01:00
commit 97dd72b9f7
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE
918 changed files with 167509 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
cache

102
compile.php Normal file
View File

@ -0,0 +1,102 @@
<?PHP
/**
* Compiles the static parts of the quality assessment web interface.
*/
declare(strict_types = 1);
require_once __DIR__ . '/provideEnv.php';
# if (!(file_put_contents(__DIR__ . '/static/json/openapi.json', json_encode(QAApiDesc::describeApi())))) {
# throw new Exception("Failed to save OpenAPI description");
# }
/**
* Generates the json for a translation file.
*
* @param string $lang Language.
*
* @return string
*/
function generateTranslationFile(string $lang):string {
$tlLoader = new MDTlLoader("mdConc", $lang);
return MD_STD::json_encode([
'concordance_checker' => $tlLoader->tl('concordance', 'concordance', 'concordance_checker'),
]);
}
/**
* Generate index.htm.
*
* @return string
*/
function generateAppShell():string {
return '<!DOCTYPE HTML>
<html data-allowed-langs="' . htmlspecialchars(implode(',', ALLOWED_LANGS)) . '">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="static/css/qa.css?' . uniqid() . '" />
<link rel="manifest" href="/manifest.webmanifest" />
<meta name="theme-color" content="#aa4400" />
<title>Quality assessment :: museum-digital</title>
<meta name="twitter:title" content="Quality assessment :: museum-digital" />
<meta property="og:title" content="Quality assessment :: museum-digital" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@museumdigital" />
<meta name="description" content="Use museum-digital\'s quality assessment tools for your own data" />
<meta name="author" content="Joshua Ramon Enslin" />
<meta name="dc.creator" content="Joshua Ramon Enslin" />
<meta name="keywords" content="Imports, museum-digital, concordance" />
<link rel="shortcut icon" sizes="128x128" href="/static/img/mdlogo-code.svg" />
<link rel="apple-touch-icon" sizes="192x192" href="/static/img/mdlogo-code-128px.png" />
<meta property="twitter:image" content="/static/img/mdlogo-code.svg" />
<meta property="og:image" content="/static/img/mdlogo-code.svg" />
</head>
<body class="loading">
<script src="/static/js/qa.min.js?' . uniqid() . '" type="text/javascript" async></script>
</body>
</html>';
}
const ALLOWED_LANGS = ['de', 'en', 'uk'];
const SERVED_ROOT = __DIR__ . '/public/';
const SERVED_JSON_ROOT = __DIR__ . '/public/static/json/';
if (!is_dir(SERVED_JSON_ROOT)) {
echo "Will generate JSON root directory (" . SERVED_JSON_ROOT . ")" . PHP_EOL;
MD_STD::mkdir(SERVED_JSON_ROOT);
}
foreach (ALLOWED_LANGS as $lang) {
echo "Will generate JSON list of translations for language: " . $lang . PHP_EOL;
file_put_contents(SERVED_JSON_ROOT . 'tls.' . $lang . '.json', generateTranslationFile($lang));
}
echo "Will generate app shell" . PHP_EOL;
file_put_contents(SERVED_ROOT . 'index.htm', generateAppShell());
echo "Will minify CSS" . PHP_EOL;
exec("minify \\
-o " . escapeshellarg(__DIR__ . '/public/static/css/qa.min.css') . '\\
' . escapeshellarg(__DIR__ . '/public/static/css/editMenu.css') . '\\
' . escapeshellarg(__DIR__ . '/public/static/css/dialogue.css') . '\\
' . escapeshellarg(__DIR__ . '/public/static/css/qa.css'));
echo "Will minify JS" . PHP_EOL;
exec("minify \\
-o " . escapeshellarg(__DIR__ . '/public/static/js/qa.min.js') . '\
' . escapeshellarg(__DIR__ . '/public/static/js/qa.js'));

30
constants.php Normal file
View File

@ -0,0 +1,30 @@
<?PHP
/**
* Contains general constants for the QA interface.
*/
declare(strict_types = 1);
const AUTOLOAD_DIRS = [
__DIR__ . "/src",
__DIR__ . "/dependencies/MD_STD/src",
__DIR__ . "/dependencies/MDImporterConcordanceLists/src",
__DIR__ . "/dependencies/MDImporterConcordanceLists/src/blacklists",
__DIR__ . "/dependencies/MDImporterConcordanceLists/interfaces",
__DIR__ . "/dependencies/MDImporterConcordanceLists/exceptions",
__DIR__ . "/dependencies/MDErrorReporter",
__DIR__ . "/dependencies/MDErrorReporter/exceptions",
__DIR__ . "/dependencies/MDErrorReporter/exceptions/page",
__DIR__ . "/dependencies/MDErrorReporter/exceptions/updates",
__DIR__ . "/dependencies/MDErrorReporter/exceptions/generic",
__DIR__ . "/dependencies/MDTlLoader/src",
__DIR__ . "/dependencies/MDTlLoader/exceptions",
__DIR__ . "/dependencies/MDTlLoader",
__DIR__ . "/dependencies/MDAllowedValueSets/src",
__DIR__ . "/dependencies/MDAllowedValueSets/src/classes",
__DIR__ . "/dependencies/MDAllowedValueSets/src/enums",
];
const TL_FILE_DIRS = [
__DIR__ . "/l10n/translation-concordance/",
__DIR__ . "/dependencies/MDAllowedValueSets/l18n/",
];

1
dependencies/MDAllowedValueSets vendored Submodule

@ -0,0 +1 @@
Subproject commit 1b34e49ff8add2afa7ca521bb92f4b844566be7d

1
dependencies/MDErrorReporter vendored Submodule

@ -0,0 +1 @@
Subproject commit b1d25b494175e79d5f33f7a65a45767195c997f9

@ -0,0 +1 @@
Subproject commit 0adcbd2d5d7df896a99aedbf2f569050d23f69b3

1
dependencies/MDTlLoader vendored Submodule

@ -0,0 +1 @@
Subproject commit 8377f474da7474fb79d7610ddd3c4f90642101cb

1
dependencies/MD_STD vendored Submodule

@ -0,0 +1 @@
Subproject commit 9948ee5d3da9fc072a9ea62341630700794dcd92

104
functions.php Normal file
View File

@ -0,0 +1,104 @@
<?PHP
/**
* This file collects generally, often used functions in the public frontend for museum-digital
*
* @file
* @author Stefan Rohde-Enslin <s.rohde-enslin@museum-digital.de>
* @author Joshua Ramon Enslin <joshua@jrenslin.de>
*/
declare(strict_types = 1);
/**
* Autoloader for museum-digital.org.
*
* @param string $className Name of the class to load.
*
* @return void
*/
function mdConcAutoloader(string $className):void {
// Fallback: Load classes by autoload directories
foreach (AUTOLOAD_DIRS as $classDir) {
if (\file_exists("$classDir/$className.php")) {
include "$classDir/$className.php";
return;
}
}
}
/**
* Own error handler: Set to enforce exit on any error.
*
* @param integer $errno Error number.
* @param string $string Error message.
* @param string $file File in which the error occured.
* @param integer $line Line number.
*
* @return boolean
*/
function mdConcErrorHandler(int $errno, string $string, string $file, int $line):bool {
$getStr = [];
foreach ($_GET as $key => $value) {
if (is_array($value)) $getStr[] = "$key\[\]={$value[0]}";
else $getStr[] = $key . "=" . $value;
}
if (!empty($_SERVER) and !empty($_SERVER['HTTP_HOST'])) {
$errorPage = $_SERVER['PHP_SELF'] . "?" . \implode("&", $getStr);
$errorPageFull = "https://" . $_SERVER["HTTP_HOST"] . $errorPage;
$errorMsg = "*$errno (<a href='https://www.google.de/search?q=php+" . \str_replace(" ", "+", $string) . "'>$string</a>) at $file: line_ $line _";
$errorMsg .= " |-- Error generating page: <a href='$errorPageFull'>$errorPage</a>";
$errorMsg .= " |-- Used RAM / Peak RAM / Allowed: " . MD_STD::human_filesize(\memory_get_usage()) . " / " . MD_STD::human_filesize(\memory_get_peak_usage()) . " / " . ini_get("memory_limit");
if (isset($_SESSION['anmnam'])) $errorMsg .= " |-- User: " . $_SESSION["anmnam"];
if (isset($_SESSION['username'])) $errorMsg .= " (" . $_SESSION["username"] . ")";
$errorMsg = \str_replace(PHP_EOL, " ", $errorMsg);
}
else {
$errorMsg = "*$errno (<a href='https://www.google.de/search?q=php+" . \str_replace(" ", "+", $string) . "'>$string</a>) at $file: line_ $line _";
$errorMsg .= " |-- Used RAM / Peak RAM / Allowed: " . MD_STD::human_filesize(\memory_get_usage()) . " / " . MD_STD::human_filesize(\memory_get_peak_usage()) . " / " . ini_get("memory_limit");
}
$errorMsg = \str_replace(PHP_EOL, " ", $errorMsg);
\error_log($errorMsg);
if ($errno === E_ERROR) exit;
return false;
}
/**
* Exception handler to also be able to handle custom exceptions.
*
* @param Throwable $exception Exception.
*
* @return void
*/
function mdConcExceptionHandler(Throwable $exception):void {
if (ob_get_level() !== 0) {
ob_end_clean();
}
$errorReporter = new MDErrorReporter("md:frontend", "bugs-frontend@museum-digital.de");
# $errorCategory = MDErrorReporter::categorizeError($exception);
if (headers_sent() === false) {
http_response_code(404);
}
if (PHP_SAPI !== 'cli') {
header('Content-type: text/plain');
if ($exception instanceof MDParserIncomplete) {
echo 'Parser incomplete - Encountered a field that is thus far unknown / unhandled' . PHP_EOL;
}
echo $exception->getMessage();
}
$errorReporter->sendErrorReport($exception, "joshua@museum-digital.de");
}

@ -0,0 +1 @@
Subproject commit b3b894c247710d1aa53850020d9f0a193aa989fc

38
phpstan.neon Normal file
View File

@ -0,0 +1,38 @@
parameters:
level: 8
paths:
- conf
- src
- tests
- constants.php
- functions.php
- provideEnv.php
- dependencies/MDQualityAssessment
bootstrapFiles:
- constants.php
scanDirectories:
- dependencies
ergebnis:
classesAllowedToBeExtended:
- mysqli
- mysqli_stmt
- Exception
- MDGenericWriter
- MDGenericObject
- ImporterParserAbstract
- ImporterParserXmlAbstract
- ImporterTestAbstract
- ImporterDataTypesTestAbstract
- ImporterParserCsvAbstract
- ImporterParserTestAbstract
- XML_Parser
- JSONParser
- MDValueSet
- MDMysqliInvalidInput
- MDMysqliExpectedError
- MDgenericInvalidInputsException
- MDExpectedException
includes:
- phpstan-baseline.neon
- dependencies/MD_QA/rules/phpstan-rules.neon
- vendor/spaze/phpstan-disallowed-calls/extension.neon

17
phpunit.xml Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd" backupGlobals="false" beStrictAboutChangesToGlobalState="false" beStrictAboutOutputDuringTests="false" bootstrap="tests/bootstrap.php" cacheResult="false" colors="true" enforceTimeLimit="true" failOnWarning="true" processIsolation="true" stopOnError="true" stopOnFailure="true" stopOnIncomplete="true" stopOnSkipped="true" stopOnRisky="true" stopOnWarning="true" timeoutForSmallTests="1" timeoutForMediumTests="10" timeoutForLargeTests="60" cacheDirectory=".phpunit.cache" backupStaticProperties="false" requireCoverageMetadata="false" beStrictAboutCoverageMetadata="false"
displayDetailsOnIncompleteTests="true"
displayDetailsOnSkippedTests="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerErrors="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerWarnings="true">
<testsuite name="tests">
<directory>tests</directory>
</testsuite>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>

23
provideEnv.php Normal file
View File

@ -0,0 +1,23 @@
<?PHP
/**
* This file sets up the quality accessment interface.
*/
declare(strict_types = 1);
/*
* MYSQL // Wrappers around mysqli functions
*/
require_once __DIR__ . "/constants.php";
require_once __DIR__ . "/functions.php";
// Report all PHP errors
error_reporting(E_ALL);
// Set autoloader
spl_autoload_register("mdConcAutoloader");
// Set exception handler for errors of log level E_USER_NOTICE
// The handler logs the errors to a log file.
set_error_handler("mdConcErrorHandler", E_USER_NOTICE);
set_exception_handler("mdConcExceptionHandler");

53
public/api.php Normal file
View File

@ -0,0 +1,53 @@
<?PHP
/**
* Provides the API.
*/
declare(strict_types = 1);
require_once __DIR__ . '/../provideEnv.php';
$verb = MD_STD_IN::get_http_input_text("verb");
$subject = MD_STD_IN::get_http_input_text("subject");
if (empty($verb) && empty($subject)) {
header('Content-Type: application/json; charset=utf-8');
readfile(__DIR__ . '/../static/json/openapi.json');
return;
}
$availableLangs = MD_STD::scandir(__DIR__ . '/../l10n/musdb/');
$lang = MD_STD_IN::get_http_input_text("lang", "en", $availableLangs);
$parser = MD_STD_IN::get_http_input_text("parser");
$data = trim(filter_input(INPUT_POST, "data"));
if ($verb === 'evaluate' && in_array($subject, ['object', 'minimaldatensatz', 'count_vocabulary_entries_to_be_added'], true)) {
$limitMode = match($subject) {
'object' => QARunnerLimitMode::main,
'minimaldatensatz' => QARunnerLimitMode::minimaldatensatz,
'count_vocabulary_entries_to_be_added' => QARunnerLimitMode::count_new_vocab_entries,
};
$runner = new QARunner($lang, $parser, $data, $limitMode);
header('Content-Type: application/json; charset=utf-8');
echo json_encode([
'results' => match($subject) {
'object' => $runner->evaluateObjects(),
'minimaldatensatz' => $runner->evaluateObjectsForMinimaldatensatz(),
'count_vocabulary_entries_to_be_added' => $runner->countNewlyRequestedVocabularyEntries(),
},
]);
}
else if ($verb === 'convert_to_xml' && in_array($subject, QaConvertToXml::listAvailableOutputFormats(), true)) {
$institution_name = MD_STD_IN::get_http_input_text("institution_name");
$institution_identifier = MD_STD_IN::get_http_input_text("institution_identifier");
$runner = new QARunner($lang, $parser, $data, null); // TODO: Add limit modes per format
header('Content-Type: text/xml; charset=utf-8');
echo $runner->convertToXml($subject, $institution_name, $institution_identifier);
}

35
public/index.htm Normal file
View File

@ -0,0 +1,35 @@
<!DOCTYPE HTML>
<html data-allowed-langs="de,en,uk">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="static/css/qa.css?678a5478c6bb4" />
<link rel="manifest" href="/manifest.webmanifest" />
<meta name="theme-color" content="#aa4400" />
<title>Quality assessment :: museum-digital</title>
<meta name="twitter:title" content="Quality assessment :: museum-digital" />
<meta property="og:title" content="Quality assessment :: museum-digital" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@museumdigital" />
<meta name="description" content="Use museum-digital's quality assessment tools for your own data" />
<meta name="author" content="Joshua Ramon Enslin" />
<meta name="dc.creator" content="Joshua Ramon Enslin" />
<meta name="keywords" content="Imports, museum-digital, concordance" />
<link rel="shortcut icon" sizes="128x128" href="/static/img/mdlogo-code.svg" />
<link rel="apple-touch-icon" sizes="192x192" href="/static/img/mdlogo-code-128px.png" />
<meta property="twitter:image" content="/static/img/mdlogo-code.svg" />
<meta property="og:image" content="/static/img/mdlogo-code.svg" />
</head>
<body class="loading">
<script src="/static/js/qa.min.js?678a5478c6bb5" type="text/javascript" async></script>
</body>
</html>

1
public/static/README.md Normal file
View File

@ -0,0 +1 @@
# Static assets of the public web interface to museum-digital's quality assessment tools

View File

@ -0,0 +1 @@
# CSS files for styling the web interface to museum-digital's quality assessment tools

View File

@ -0,0 +1,46 @@
/* ========
| Reference overlay
|= ======== */
#dialogueArea { display: block; position: fixed; left: 0; top: 0;
width: 100%; height: 100%;
max-width: initial; max-height: initial;
background: rgba(0,0,0,.7); backdrop-filter: blur(3px);
z-index: 10000; }
#dialogue { display: block; position: absolute; left: 50%; top: 50%;
transform: translate(-50%, -50%); min-width: 60vw; min-height: 2em;
max-width: 90vw; max-height: 90vh; overflow-y: auto;
padding: 1.5em 1em;
background: var(--color-bg-normal); border-radius: .3em;
box-shadow: 2px 2px 4px var(--color-fg-less), -2px -2px 4px var(--color-fg-less); }
#dialogue h3 { margin-top: 0; padding-top: 0; text-transform: initial; color: var(--color-fg-less); }
h4 { font-size: 1.05em; }
h5 { font-size: 1.02em; }
h6 { font-size: 1em; }
#dialogue section > div > h5,
#dialogue section > div > h6 { margin: .5em 0; }
#confirmButtons { text-align: right; }
#dialogue .buttonLike { margin: .5em 0 .2em .5em; background: transparent; transition: background .4s, color .4s; }
#dialogue .buttonLike:hover { background: var(--color-borders-dark); color: var(--color-bg-normal); }
#dialogue input[type="text"],
#dialogue textarea { padding: .5em; border-radius: .1em; border: 2px solid var(--color-borders); transition: border .4s; }
#dialogue input[type="text"]:hover,
#dialogue textarea:hover { border-color: var(--color-fg-normal); }
#dialogue button { padding: .6em .8em; font-size: .8em; background: var(--color-bg-normal); border: 1px solid var(--color-borders);
transition: .4s; }
#dialogue button:focus,
#dialogue button:hover { background: var(--color-fg-less); color: var(--color-bg-normal); border-color: var(--color-fg-less); }
#dialogue form > * { display: block; width: 100%; }
#dialogue form label { font-weight: bold; color: var(--color-fg-less); }
#dialogueClose { float: right; display: inline-block; padding: 0 .6em .2em .6em; background: var(--color-bg-raised);
border-radius: 100%; cursor: pointer; transition: .4s; }
#dialogueClose:hover { background: var(--color-fg-less); color: var(--color-bg-normal); }
#dialogue ul { margin-left: 1em; padding-left: 0; transition: .4s; }
#dialogue ul.minimized { height: 20px; background-color: var(--color-accent-normal);
background-size: 20px 20px;
background-image: repeating-linear-gradient(to right, var(--color-fg-normal), var(--color-fg-normal) 1px, var(--color-accent-normal) 1px, var(--color-accent-normal)); }
#dialogue ul.minimized > * { display: none; }

View File

@ -0,0 +1,44 @@
/* ========
| New tooltip
|= ======== */
.newToolTip { position: fixed; display: none !important; min-width: 300px !important; max-width: 600px;
background: var(--color-fg-less) !important; color: var(--color-bg-normal); text-align: left; font-size: .95rem;
border-radius: .2em; box-shadow: 1px 1px 4px var(--color-borders-dark); z-index: 3000; white-space: initial !important; }
#newToolTipMain:before { content: attr(data-title); display: block; padding: .5em 1em; max-width: 598px;
background: var(--color-fg-less); color: var(--color-bg-raised2); font-weight: bold;
box-shadow: 0px 4px 2px -2px var(--color-borders-dark); }
#newToolTipMain > * { padding: .5rem 1rem !important; }
#newToolTipMain > table td { padding: .5rem 1em; vertical-align: top; }
@media screen and (min-width: 768px) {
#newToolTipMain.visible { display: block !important; }
}
#newToolTipMain img { max-width: 200px; max-height: 300px; }
dl#newToolTipMain dt { padding-bottom: 0; font-weight: bold; }
dl#newToolTipMain dd { margin: -1em 0 0 0; padding: 0 0 0 0; }
.newToolTipMain p + .toolTipHierarchy { padding-bottom: 0 !important; }
#newToolTipMain > h5 { padding: 0 1rem !important; margin: -.5rem 0 !important; }
.copyToDialogue { cursor: pointer; }
/* ========
| Animations
|= ======== */
@keyframes pulseBorderSize {
0% { border-width: 1em; }
50% { border-width: 1.2em; }
100% { border-width: 1em; }
}
@keyframes fade-in-and-vanish {
0% { opacity: 0; z-index: 1000; }
5% { opacity: .4; }
15% { opacity: 1; padding: .8em; }
75% { opacity: 1; padding: .8em; }
85% { opacity: .4; transform: translateY(0px);}
99% { opacity: 0; transform: translateY(-30px);}
100% { opacity: 0; z-index: 0; }
}

329
public/static/css/qa.css Normal file
View File

@ -0,0 +1,329 @@
/*
* @import 'editMenu.css';
@import 'dialogue.css';
*/@import 'editMenu.css';
@import 'dialogue.css';
:root {
--color-bg-normal: #FFF;
--color-bg-raised: #EEE;
--color-bg-raised2: #FAFAFA;
--color-fg-normal: #000;
--color-fg-less: #212121;
--color-borders: #D6D6D6;
--color-borders-dark: #646464;
--color-accent-normal: #1976D2;
--color-accent-hover: #0D47A1;
--color-green: #388E3C;
--color-red: #D32F2F;
}
@media (prefers-color-scheme: dark) {
:root {
--color-bg-normal: #000;
--color-bg-raised: #273000;
--color-bg-raised2: #121212;
--color-fg-normal: #FFF;
--color-fg-less: #EEE;
--color-borders: #37474F;
--color-borders-dark: #BDBDBD;
--color-accent-normal: #FFC107;
--color-accent-hover: #FFA000;
--color-green: #81C784;
--color-red: #EF5350;
}
}
/* ==============
| Load fonts
|================ */
@font-face {
font-family: sourceSansPro;
src: local('Source-Sans-Pro'), local('Source Sans Pro'),
url(../fonts/SourceSansPro-Regular.woff2) format('woff2'),
url(../fonts/SourceSansPro-Regular.ttf) format('truetype');
font-display: swap;
}
/* ==============
| General
|================ */
* { box-sizing: border-box; z-index: 1; }
body { margin: 0; background: var(--color-bg-normal); color: var(--color-fg-normal);
font-family: sourceSansPro, Arial, Helvetica, Times; font-size: 1.2em; line-height: 1.5em; }
#contentWrapper { display: grid; grid-template-columns: auto auto; grid-gap: 2em 2em; }
a { text-decoration: none; color: inherit; }
h1 { display: block; width: 100%; text-align: center; margin: 0 auto .8em auto;
padding: 1em 0;
font-size: 2.5em; line-height: 1.2em; }
h1 > * { display: inline-block; vertical-align: middle; color: var(--color-fg-less); }
h1 img { margin-right: .5em; border-radius: .1em; opacity: .7; transition: opacity .4s; }
h1 img:hover { opacity: 1; }
main,
#contentWrapper > section,
#contentWrapper > div,
#contentWrapper > form { grid-row: auto; grid-column: 1 / span 2; display: block; width: 90%; margin: 0 auto 3em auto; }
div#uploader #uploaderMenu { display: block; padding: .5em 0; }
#parserList { display: block; margin: 0 0; padding: 0 0; }
#parserList > li { display: grid; grid-template-columns: 15fr 1fr;
margin: 0 0; padding: 0 0; border-bottom: 1px solid var(--color-borders);
cursor: pointer;
transition: .2s ease-out; }
#parserList > li > :first-child:before { content: " > "; margin-right: .5em; }
#parserList > li > * { display: inline-block; grid-column: auto; grid-row: 1;
margin: 0 0; padding: .3rem 1em; }
#parserList > li:hover { background: var(--color-bg-raised); color: var(--color-accent-hover); }
main p,
section p:not(.threeCol p) { white-space: pre-wrap; }
@media screen and (min-width: 768px) {
#contentWrapper { grid-template-columns: 400px 1fr; }
#contentWrapper > div#uploader { position: relative; min-width: initial; }
#contentWrapper > main { padding-left: 2em; border-left: 1px dashed var(--color-fg-normal); }
div#uploader #uploaderMenu { position: sticky; top: 0; }
#contentWrapper > div#uploader, #contentWrapper > main { grid-column: auto; width: initial; }
#contentWrapper > div#uploader { margin-left: 5vw; }
#contentWrapper > main { margin-right: 5vw; }
}
form > div { margin-bottom: 1em; }
label { display: block; font-weight: bold; margin-bottom: .5em; }
form > h4 { margin-top: 0; }
body > footer { padding: 1em 5% 3em 5%; background: var(--color-fg-normal); color: var(--color-bg-normal); border-top: .1em solid var(--color-borders); }
body > footer > div { display: block; }
body > footer > div a,
body > footer > div span { display: block; font-weight: bold; cursor: pointer;
color: inherit; transition: color .4s; }
body > footer > div a:hover,
body > footer > div span:hover { color: var(--color-accent-hover); }
.invisible { display: none !important; opacity: 0; }
.buttonLike,
select,
button,
textarea,
input { display: block; width: 100%; padding: .5em .5em; border: 2.5px solid var(--color-bg-raised);
background: inherit; color: var(--color-fg-less); font-family: sourceSansPro; font-size: 1em;
border-radius: .2em; transition: border .2s; }
select:hover,
textarea:hover,
input:hover { border-color: #888; }
button { width: 100%; padding: .5em .8em;
border: 1px solid var(--color-fg-normal); font-weight: bold;
border-radius: .1em;
text-transform: uppercase; transition: color .2s, color .2s; }
textarea { line-height: 1.2em; }
button:focus,
button:hover { color: var(--color-accent-hover); border-color: var(--color-accent-hover); }
button.backButton { margin-top: 1.5em; }
button + button { margin-top: .5em; }
aside > h4:first-child { margin-top: 0; }
select:focus,
textarea:focus,
input:focus { border-color: var(--color-accent-hover); box-shadow: none; }
textarea:invalid,
input:invalid { box-shadow: none; }
textarea:invalid:focus,
input:invalid:focus { border-right-width: 1em; }
textarea { min-height: 30vh; }
table { width: 100%; max-height: 60vh; margin: 2em 0; border-collapse: collapse; overflow: auto; }
th { padding: .3em .5em; text-align: left; border-bottom: 2px solid var(--color-fg-less); }
tbody > tr:nth-child(2n + 1) { background: var(--color-bg-raised2); }
td { padding: .3em .5em; border-bottom: 1px solid var(--color-borders); }
#contentWrapper > div.uploader { margin-bottom: 0; }
#contentWrapper > div.uploader > form { border: 1px solid var(--color-bg-raised); padding: 1em 1em; margin-bottom: 0; }
.loading:before,
.loading:after { content: " "; display: block;
position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
height: 64px; width: 64px; margin: 0; padding: 0;
border-radius: 50%;
border: 8px solid var(--color-accent-hover);
border-color: var(--color-accent-hover) transparent transparent transparent;
z-index: 100;
animation: rotating 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite; animation-delay: -0.15s; }
.loading:after { animation-delay: -0.45s; }
@keyframes rotating {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
header { display: block; width: 100%; padding: 0 2em; font-size: 1rem; z-index: 2; }
header#mainHeader { margin-bottom: 2em;
background: var(--color-fg-less); color: var(--color-bg-raised2); display: table; }
header#mainHeader > * { display: table-cell; }
@media screen and (max-width: 768px) {
header#mainHeader > * { min-width: 20%; }
}
header#mainHeader > *:last-child { text-align: right; }
header#mainHeader, header#mainHeader * { z-index: 5; }
header#mainHeader:hover,
header#mainHeader *:hover { z-index: 6; }
header * { z-index: 2; }
header > * { display: inline-block; vertical-align: middle; }
header h2 { font-size: 1.1em; color: inherit; }
main h2, section h2,
#more h3 { text-transform: uppercase;
font-weight: normal; }
header select { background: inherit; font-size: .85rem; border: 0; }
header select option { color: var(--color-fg-normal); }
header nav { color: var(--color-bg-raised2); }
header nav > * { position: relative; display: inline-block; flex: 1; font-size: 1rem; padding: .7em 0; }
header#mainHeader img { display: inline-block; height: 1.9em; margin-right: .5em; vertical-align: middle; filter: invert(1); transition: opacity .4s; }
header#mainHeader h2 { display: inline-block; vertical-align: middle; font-weight: normal; }
header#mainHeader > a:focus > img,
header#mainHeader > a:hover > img { opacity: .7; }
.summary { display: block;
padding: 0 1em;
border: 1px solid var(--color-borders);
border-radius: .1em; }
.accordion { max-height: 0; overflow-y: hidden;
transition: max-height 0.2s ease-out, border 0.2s ease-out; }
.accordion.active { display: block; padding: 1em 0; border-top: 1px dotted var(--color-borders);
border-bottom: 1px dotted var(--color-borders); }
.threeCol { display: grid; grid-template-columns: 1fr; grid-gap: 2em; }
.threeCol > * { max-height: 300px; overflow-y: hidden; padding: 0 1em;
transition: max-height 0.2s ease-out, border 0.2s ease-out;
cursor: pointer; border: 1px solid var(--color-borders); border-bottom-style: dashed; }
.threeCol > .active { border-bottom-style: solid; }
.threeCol > :hover { border-color: var(--color-accent-hover); }
.threeCol a { transition: color .4s; }
.threeCol a:hover { color: var(--color-accent-hover); }
@media screen and (min-width: 1024px) {
.threeCol { display: block; overflow-x: auto; white-space: nowrap; }
.threeCol > * { display: inline-block; margin-right: 5%; width: 30%; white-space: initial; vertical-align: top; }
.threeCol > :last-child { margin-right: 0; }
}
/*
* Accordions
*/
/* Style the buttons that are used to open and close the accordion panel */
.faq_question { position: relative; display: block; width: 100%;
padding: .6rem .8rem .6rem 2.4rem; cursor: pointer;
margin: .2em 0;
border: 1px solid var(--color-borders); border-radius: .2rem;
outline: none; transition: .4s ease-out; }
.faq_question:before { display: inline-block; content: " > ";
position: absolute; left: .8rem; top: 50%; transform: translate(0, -50%);
font-size: 1.6rem;
color: var(--color-accent-normal);
font-weight: bold; }
/* Add a background color to the button if it is clicked on (add the .active class with JS), and when you move the mouse over it (hover) */
.active, .faq_question:hover { background: var(--color-bg-raised2); }
.accordion.faq_answer { padding-left: 18px; padding-right: 18px; white-space: pre-wrap; }
section h2 { margin-top: 2em; }
#more { border-top: 1px solid var(--color-borders); margin-top: 2em;}
.moreTiles { display: block; max-width: 100%; position: relative; }
.moreTiles > a { display: inline-block; border: 1px solid var(--color-borders);
border-radius: .1rem;
font-size: .7em;
transition: border .4s; }
.moreTiles > a:hover,
.moreTiles > a:focus { border-color: var(--color-accent-hover); }
.moreTiles > a img { display: block; width: 400px; height: 225px; border-radius: inherit; }
.moreTiles .moreTilesMeta { position: absolute; bottom: .5em;
max-width: 400px;
padding: .5em; background: rgba(0, 0, 0, .8);
color: #FFF; }
.moreTiles .moreTilesMeta p { margin: 0 0; padding: 0 0; font-weight: bold; }
.moreTilesTitle { font-weight: bold; font-size: 1.15em; transition: color .4s; }
.moreTiles > a:hover .moreTilesTitle,
.moreTiles > a:focus .moreTilesTitle { color: var(--color-accent-hover); }
@media screen and (min-width: 768px) {
header nav > div > div { display: none; position: absolute; right: 0; top: 100%; width: 300px;
background: var(--color-fg-less); text-align: left; }
header nav > div > a { padding: .95em 1em; transition: background .4s, color .4s; }
header nav > div:focus > a,
header nav > div:hover > a { color: var(--color-gray); }
header nav > div > a:focus + div,
header nav > div:hover > div { display: block; animation: fade-in .4s; }
header nav > div > a:focus + div > a,
header nav > div:hover > div > a { display: block; padding: .5em 1em; cursor: pointer;
transition: background .4s, color .4s; }
header nav > div > a:focus + div > a:focus,
header nav > div:hover > div > a:hover { background: var(--color-fg-normal); color: var(--color-bg-normal); }
header { padding: 0 10em; }
}
@media screen and (max-width: 768px) {
body { font-size: 1.08em; }
h1 img { display: none; }
header .branding { padding: .7rem; }
header nav:before { content: " \2630 "; display: inline-block; position: absolute; right: 3rem; top: 0;
padding: .8rem 0; font-size: 1.5em; text-align: right; }
header nav > * { display: none; }
header nav:hover:before { display: none; }
header nav:hover { position: absolute; left: 0; top: 0; display: flex;
width: 100%; min-height: 90vh; padding: 2em 1em .5em 1em; background: var(--color-bg-normal); color: var(--color-fg-normal);
border-bottom: 1px solid var(--color-borders); box-shadow: 2px 2px 4px var(--color-borders);
z-index: 3; animation: fade-in .4s; }
header nav:hover > * { display: block; flex: 1; min-width: 40vw; padding: 1em; font-size: 1em; }
header nav:hover > div a { display: block; padding: .2em 0; }
header { padding: 0 1em; }
}
@media (prefers-color-scheme: dark) {
header#mainHeader,
body > footer,
header nav,
header nav > div > div { background: inherit; color: inherit; }
header#mainHeader { border-bottom: 1px solid var(--color-bg-raised2); }
}
@media screen and (min-width: 1600px) {
#contentWrapper {
max-width: 1400px; margin: 0 auto;
}
}

View File

@ -0,0 +1 @@
#dialogueArea{display:block;position:fixed;left:0;top:0;width:100%;height:100%;max-width:initial;max-height:initial;background:rgba(0,0,0,.7);backdrop-filter:blur(3px);z-index:10000}#dialogue{display:block;position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);min-width:60vw;min-height:2em;max-width:90vw;max-height:90vh;overflow-y:auto;padding:1.5em 1em;background:var(--color-bg-normal);border-radius:.3em;box-shadow:2px 2px 4px var(--color-fg-less),-2px -2px 4px var(--color-fg-less)}#dialogue h3{margin-top:0;padding-top:0;text-transform:initial;color:var(--color-fg-less)}h4{font-size:1.05em}h5{font-size:1.02em}h6{font-size:1em}#dialogue section>div>h5,#dialogue section>div>h6{margin:.5em 0}#confirmButtons{text-align:right}#dialogue .buttonLike{margin:.5em 0 .2em .5em;background:0 0;transition:background .4s,color .4s}#dialogue .buttonLike:hover{background:var(--color-borders-dark);color:var(--color-bg-normal)}#dialogue input[type=text],#dialogue textarea{padding:.5em;border-radius:.1em;border:2px solid var(--color-borders);transition:border .4s}#dialogue input[type=text]:hover,#dialogue textarea:hover{border-color:var(--color-fg-normal)}#dialogue button{padding:.6em .8em;font-size:.8em;background:var(--color-bg-normal);border:1px solid var(--color-borders);transition:.4s}#dialogue button:focus,#dialogue button:hover{background:var(--color-fg-less);color:var(--color-bg-normal);border-color:var(--color-fg-less)}#dialogue form>*{display:block;width:100%}#dialogue form label{font-weight:700;color:var(--color-fg-less)}#dialogueClose{float:right;display:inline-block;padding:0 .6em .2em;background:var(--color-bg-raised);border-radius:100%;cursor:pointer;transition:.4s}#dialogueClose:hover{background:var(--color-fg-less);color:var(--color-bg-normal)}#dialogue ul{margin-left:1em;padding-left:0;transition:.4s}#dialogue ul.minimized{height:20px;background-color:var(--color-accent-normal);background-size:20px 20px;background-image:repeating-linear-gradient(to right,var(--color-fg-normal),var(--color-fg-normal) 1px,var(--color-accent-normal) 1px,var(--color-accent-normal))}#dialogue ul.minimized>*{display:none}

View File

@ -0,0 +1 @@
.newToolTip{position:fixed;display:none!important;min-width:300px!important;max-width:600px;background:var(--color-fg-less)!important;color:var(--color-bg-normal);text-align:left;font-size:.95rem;border-radius:.2em;box-shadow:1px 1px 4px var(--color-borders-dark);z-index:3000;white-space:initial!important}#newToolTipMain:before{content:attr(data-title);display:block;padding:.5em 1em;max-width:598px;background:var(--color-fg-less);color:var(--color-bg-raised2);font-weight:700;box-shadow:0 4px 2px -2px var(--color-borders-dark)}#newToolTipMain>*{padding:.5rem 1rem!important}#newToolTipMain>table td{padding:.5rem 1em;vertical-align:top}@media screen and (min-width:768px){#newToolTipMain.visible{display:block!important}}#newToolTipMain img{max-width:200px;max-height:300px}dl#newToolTipMain dt{padding-bottom:0;font-weight:700}dl#newToolTipMain dd{margin:-1em 0 0;padding:0}.newToolTipMain p+.toolTipHierarchy{padding-bottom:0!important}#newToolTipMain>h5{padding:0 1rem!important;margin:-.5rem 0!important}.copyToDialogue{cursor:pointer}@keyframes pulseBorderSize{0%{border-width:1em}50%{border-width:1.2em}100%{border-width:1em}}@keyframes fade-in-and-vanish{0%{opacity:0;z-index:1000}5%{opacity:.4}15%{opacity:1;padding:.8em}75%{opacity:1;padding:.8em}85%{opacity:.4;transform:translateY(0)}99%{opacity:0;transform:translateY(-30px)}100%{opacity:0;z-index:0}}

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@ -0,0 +1,423 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="1020"
height="1020"
id="svg2985"
version="1.1"
inkscape:version="1.2 (dc2aedaf03, 2022-05-15)"
sodipodi:docname="logo-md-code-black.svg"
inkscape:export-filename="mdlogo-code-512px.png"
inkscape:export-xdpi="48.189999"
inkscape:export-ydpi="48.189999"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<title
id="title42">General logo for museum-digital (black background)</title>
<defs
id="defs2987" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#ffffff"
borderopacity="0.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="0"
inkscape:zoom="0.98994949"
inkscape:cx="375.27167"
inkscape:cy="658.11439"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="3840"
inkscape:window-height="2076"
inkscape:window-x="0"
inkscape:window-y="-33"
inkscape:window-maximized="1"
fit-margin-top="5"
fit-margin-left="5"
fit-margin-right="5"
fit-margin-bottom="5"
showguides="false"
inkscape:showpageshadow="2"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1" />
<metadata
id="metadata2990">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<cc:license
rdf:resource="http://creativecommons.org/licenses/by/4.0/" />
<dc:title>General logo for museum-digital (black background)</dc:title>
<dc:date>2019</dc:date>
<dc:creator>
<cc:Agent>
<dc:title>museum-digital</dc:title>
</cc:Agent>
</dc:creator>
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by/4.0/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Notice" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Attribution" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
</cc:License>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(8,-40.362183)">
<rect
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:8.82220364;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect845"
width="1011.1779"
height="1011.1778"
x="-3.5888982"
y="44.773335"
ry="0" />
<flowRoot
xml:space="preserve"
id="flowRoot3763"
style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;text-align:end;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-opacity:1"
transform="matrix(1.0379746,0,0,1.0379746,-169.56958,-12.773255)"
inkscape:export-xdpi="96.379997"
inkscape:export-ydpi="96.379997"><flowRegion
id="flowRegion3765"
style="font-family:sans-serif;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-opacity:1"><rect
id="rect3767"
width="1008.1323"
height="1000.051"
x="-6.0609155"
y="50.290859"
style="font-family:sans-serif;text-align:end;text-anchor:end;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-opacity:1" /></flowRegion><flowPara
id="flowPara3769"
style="font-size:40px;line-height:1.25;font-family:sans-serif;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-opacity:1"> </flowPara></flowRoot>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-stretch:normal;font-size:12.4557px;line-height:0%;font-family:'Bookman Old Style';-inkscape-font-specification:'Bookman Old Style Semi-Light';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1.03797;stroke-opacity:1"
x="348.29947"
y="659.89093"
id="text3771"
inkscape:export-xdpi="96.379997"
inkscape:export-ydpi="96.379997" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:12.98119068;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect833"
width="79.41317"
height="79.41317"
x="98.490639"
y="742.45844"
rx="0"
ry="0"
inkscape:export-xdpi="96.379997"
inkscape:export-ydpi="96.379997" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:12.98119068;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect833-3"
width="79.413177"
height="79.41317"
x="98.490639"
y="626.96552"
rx="0"
ry="0"
inkscape:export-xdpi="96.379997"
inkscape:export-ydpi="96.379997" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:12.98119068;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect833-6"
width="79.41317"
height="79.41317"
x="98.490639"
y="511.47241"
rx="0"
ry="0"
inkscape:export-xdpi="96.379997"
inkscape:export-ydpi="96.379997" />
<rect
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:10.21611977;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect833-3-7"
width="82.178253"
height="47.530357"
x="97.108063"
y="429.24481"
rx="0"
ry="0"
inkscape:export-xdpi="96.379997"
inkscape:export-ydpi="96.379997" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:12.98119068;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect833-5"
width="79.413162"
height="79.41317"
x="271.73004"
y="742.45844"
rx="0"
ry="0"
inkscape:export-xdpi="96.379997"
inkscape:export-ydpi="96.379997" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:12.98119068;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect833-3-3"
width="79.41317"
height="79.41317"
x="271.73004"
y="626.96552"
rx="0"
ry="0"
inkscape:export-xdpi="96.379997"
inkscape:export-ydpi="96.379997" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:12.98119068;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect833-6-5"
width="79.413162"
height="79.41317"
x="271.73004"
y="511.47241"
rx="0"
ry="0"
inkscape:export-xdpi="96.379997"
inkscape:export-ydpi="96.379997" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:12.98119068;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect833-5-6"
width="79.413162"
height="79.41317"
x="444.96948"
y="742.45844"
rx="0"
ry="0"
inkscape:export-xdpi="96.379997"
inkscape:export-ydpi="96.379997" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:12.98119068;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect833-3-3-2"
width="79.41317"
height="79.41317"
x="444.96948"
y="626.96545"
rx="0"
ry="0"
inkscape:export-xdpi="96.379997"
inkscape:export-ydpi="96.379997" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:12.98119068;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect833-6-5-9"
width="79.413162"
height="79.41317"
x="444.96948"
y="511.47235"
rx="0"
ry="39.706581"
inkscape:export-xdpi="96.379997"
inkscape:export-ydpi="96.379997" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:10.21612072;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect833-6-5-1"
width="47.530357"
height="82.178246"
x="201.05171"
y="510.08987"
rx="0"
ry="0"
inkscape:export-xdpi="96.379997"
inkscape:export-ydpi="96.379997" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:10.21612072;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect833-6-5-1-2"
width="47.530357"
height="82.178246"
x="374.29114"
y="510.08987"
rx="0"
ry="0"
inkscape:export-xdpi="96.379997"
inkscape:export-ydpi="96.379997" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:12.98119068;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect833-6-5-9-7"
width="79.413162"
height="79.41317"
x="595.11035"
y="742.45844"
rx="0"
ry="0"
inkscape:export-xdpi="96.379997"
inkscape:export-ydpi="96.379997" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:12.98119068;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect833-6-5-9-7-0"
width="79.413162"
height="79.41317"
x="710.60327"
y="742.45844"
rx="0"
ry="0"
inkscape:transform-center-x="-9.9165682"
inkscape:transform-center-y="47.832846"
inkscape:export-xdpi="96.379997"
inkscape:export-ydpi="96.379997" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:12.98119068;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect833-6-5-9-7-9"
width="79.413162"
height="79.41317"
x="826.09625"
y="742.45844"
rx="0"
ry="0"
inkscape:export-xdpi="96.379997"
inkscape:export-ydpi="96.379997" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:12.98119068;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect833-6-5-9-7-3"
width="79.413162"
height="79.41317"
x="595.11035"
y="626.96552"
rx="0"
ry="0"
inkscape:export-xdpi="96.379997"
inkscape:export-ydpi="96.379997" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:12.98119068;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect833-6-5-9-7-3-6"
width="79.413162"
height="79.41317"
x="595.11035"
y="511.47241"
rx="0"
ry="39.706581"
inkscape:transform-center-x="-29.166407"
inkscape:transform-center-y="139.41528"
inkscape:export-xdpi="96.379997"
inkscape:export-ydpi="96.379997" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:12.98119068;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect833-6-5-9-7-3-6-0"
width="79.413162"
height="79.41317"
x="710.60327"
y="511.47241"
rx="0"
ry="0"
inkscape:transform-center-x="-29.166375"
inkscape:transform-center-y="139.41528"
inkscape:export-xdpi="96.379997"
inkscape:export-ydpi="96.379997" />
<rect
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:12.98119068;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect833-6-5-9-7-6"
width="79.413162"
height="79.41317"
x="826.09625"
y="626.96552"
rx="0"
ry="0"
inkscape:export-xdpi="96.379997"
inkscape:export-ydpi="96.379997" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:12.98119068;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect833-6-5-9-7-3-2"
width="79.413162"
height="79.41317"
x="826.09625"
y="511.47241"
rx="0"
ry="0"
inkscape:export-xdpi="96.379997"
inkscape:export-ydpi="96.379997" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:12.98119068;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect833-6-5-9-7-3-6-6"
width="79.413162"
height="79.41317"
x="826.09625"
y="395.97949"
rx="0"
ry="0"
inkscape:transform-center-x="-29.166404"
inkscape:transform-center-y="139.4153"
inkscape:export-xdpi="96.379997"
inkscape:export-ydpi="96.379997" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:12.98119068;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect833-6-5-9-7-3-6-6-1"
width="79.413162"
height="79.41317"
x="826.09625"
y="280.48651"
rx="0"
ry="0"
inkscape:transform-center-x="-29.166404"
inkscape:transform-center-y="139.41528"
inkscape:export-xdpi="96.379997"
inkscape:export-ydpi="96.379997" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:9.61340618;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect833-6-5-9-3"
width="41.781116"
height="82.780952"
x="443.28558"
y="509.78845"
rx="0"
ry="0"
inkscape:export-xdpi="96.379997"
inkscape:export-ydpi="96.379997" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:9.61340523;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect833-6-5-9-75"
width="82.780945"
height="41.78112"
x="443.28558"
y="550.78833"
rx="0"
ry="0"
inkscape:export-xdpi="96.379997"
inkscape:export-ydpi="96.379997" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:9.61340523;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect833-6-5-9-7-3-6-3"
width="82.780945"
height="41.78112"
x="593.42645"
y="550.78839"
rx="0"
ry="0"
inkscape:transform-center-x="-30.4033"
inkscape:transform-center-y="73.349637"
inkscape:export-xdpi="96.379997"
inkscape:export-ydpi="96.379997" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:9.61340523;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect833-6-5-9-7-3-6-5"
width="41.781116"
height="82.780952"
x="634.42627"
y="509.78851"
rx="0"
ry="0"
inkscape:transform-center-x="-15.345135"
inkscape:transform-center-y="145.32765"
inkscape:export-xdpi="96.379997"
inkscape:export-ydpi="96.379997" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -0,0 +1 @@
# JS for building the web interface of the quality assessment tools of md

1129
public/static/js/qa.js Normal file

File diff suppressed because it is too large Load Diff

1
public/static/js/qa.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
dist/

View File

@ -0,0 +1,29 @@
[node-production]
maintained node versions
[node-development]
node 20.3.0
[browser-production]
> 1%
last 2 versions
Firefox ESR
not dead
[browser-development]
last 1 chrome version
last 1 firefox version
last 1 safari version
[isomorphic-production]
> 1%
last 2 versions
Firefox ESR
not dead
maintained node versions
[isomorphic-development]
last 1 chrome version
last 1 firefox version
last 1 safari version
node 20.3.0

View File

@ -0,0 +1,25 @@
{
"extends": [
"@commitlint/config-conventional"
],
"rules": {
"header-max-length": [
2,
"always",
69
],
"scope-case": [
2,
"always",
[
"camel-case",
"kebab-case",
"upper-case"
]
],
"subject-case": [
0,
"always"
]
}
}

View File

@ -0,0 +1,8 @@
/.git
/.github
/dev-helpers
/docs
/src
/swagger-ui-dist-package
/test
/node_modules

View File

@ -0,0 +1,10 @@
root = true
[*]
end_of_line = lf
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

View File

@ -0,0 +1,3 @@
dist/
node_modules/
test/e2e-selenium/

View File

@ -0,0 +1,38 @@
parser: "@babel/eslint-parser"
env:
browser: true
node: true
es6: true
jest: true
jest/globals: true
parserOptions:
ecmaFeatures:
jsx: true
extends:
- eslint:recommended
- plugin:react/recommended
plugins:
- react
- import
- jest
settings:
react:
pragma: React
version: '15.0'
rules:
semi: [2, never]
strict: 0
quotes: [2, double, { avoidEscape: true, allowTemplateLiterals: true }]
no-unused-vars: 2
no-multi-spaces: 1
camelcase: 1
no-use-before-define: [2, nofunc]
no-underscore-dangle: 0
no-unused-expressions: 1
comma-dangle: 0
no-console: [2, { allow: [warn, error] }]
react/jsx-no-bind: 1
react/jsx-no-target-blank: 2
react/display-name: 0
import/no-extraneous-dependencies: 2
react/jsx-filename-extension: 2

View File

@ -0,0 +1 @@
docker-run.sh text eol=lf

View File

@ -0,0 +1,73 @@
---
name: Bug report
about: Report an issue you're experiencing
---
<!---
Thanks for filing a bug report! 😄
Before you submit, please read the following:
If you're here to report a security issue, please STOP writing an issue and
contact us at security@swagger.io instead!
Search open/closed issues before submitting!
Issues on GitHub are only related to problems of Swagger-UI itself. We'll try
to offer support here for your use case, but we can't offer help with projects
that use Swagger-UI indirectly, like Springfox or swagger-node.
Likewise, we can't accept bugs in the Swagger/OpenAPI specifications
themselves, or anything that violates the specifications.
-->
### Q&A (please complete the following information)
- OS: [e.g. macOS]
- Browser: [e.g. chrome, safari]
- Version: [e.g. 22]
- Method of installation: [e.g. npm, dist assets]
- Swagger-UI version: [e.g. 3.10.0]
- Swagger/OpenAPI version: [e.g. Swagger 2.0, OpenAPI 3.0]
### Content & configuration
<!--
Provide us with a way to see what you're seeing,
so that we can fix your issue.
-->
Example Swagger/OpenAPI definition:
```yaml
# your YAML here
```
Swagger-UI configuration options:
```js
SwaggerUI({
// your config options here
})
```
```
?yourQueryStringConfig
```
### Describe the bug you're encountering
<!-- A clear and concise description of what the bug is. -->
### To reproduce...
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
### Expected behavior
<!-- A clear and concise description of what you expected to happen. -->
### Screenshots
<!-- If applicable, add screenshots to help explain your problem. -->
### Additional context or thoughts
<!-- Add any other context about the problem here. -->

View File

@ -0,0 +1,42 @@
---
name: Feature request
about: Suggest a new feature or enhancement for this project
---
### Content & configuration
Swagger/OpenAPI definition:
```yaml
# your YAML here
```
Swagger-UI configuration options:
```js
SwaggerUI({
// your config options here
})
```
```
?yourQueryStringConfig
```
### Is your feature request related to a problem?
<!--
Please provide a clear and concise description of what the problem is.
"I'm always frustrated when..."
-->
### Describe the solution you'd like
<!-- A clear and concise description of what you want to happen. -->
### Describe alternatives you've considered
<!--
A clear and concise description of any alternative solutions or features
you've considered.
-->
### Additional context
<!-- Add any other context or screenshots about the feature request here. -->

View File

@ -0,0 +1,46 @@
---
name: Support
about: Ask a question or request help with your implementation.
---
<!--
We can only offer support for Swagger-UI itself.
If you're having a problem with a library that uses Swagger-UI
(for example, Springfox or swagger-node), please open an issue
in that project's repository instead.
-->
### Q&A (please complete the following information)
- OS: [e.g. macOS]
- Browser: [e.g. chrome, safari]
- Version: [e.g. 22]
- Method of installation: [e.g. npm, dist assets]
- Swagger-UI version: [e.g. 3.10.0]
- Swagger/OpenAPI version: [e.g. Swagger 2.0, OpenAPI 3.0]
### Content & configuration
<!-- Provide us with a way to see what you're seeing, so that we can help. -->
Swagger/OpenAPI definition:
```yaml
# your YAML here
```
Swagger-UI configuration options:
```js
SwaggerUI({
// your config options here
})
```
```
?yourQueryStringConfig
```
### Screenshots
<!-- If applicable, add screenshots to help give context to your problem. -->
### How can we help?
<!-- Your question or problem goes here! -->

View File

@ -0,0 +1,35 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
time: "23:00"
commit-message:
prefix: "chore"
include: "scope"
open-pull-requests-limit: 3
ignore:
# node-fetch must be synced manually
- dependency-name: "node-fetch"
- package-ecosystem: "docker"
# Look for a `Dockerfile` in the `root` directory
directory: "/"
# Check for updates once a week
schedule:
interval: "weekly"
time: "23:00"
- package-ecosystem: "github-actions"
target-branch: "master"
directory: "/"
schedule:
interval: "daily"
time: "23:00"
commit-message:
prefix: "chore"
include: "scope"
open-pull-requests-limit: 3

View File

@ -0,0 +1,15 @@
daysUntilLock: 365
skipCreatedBefore: 2017-03-29 # initial release of Swagger UI 3.0.0
exemptLabels: []
lockLabel: "locked-by: lock-bot"
setLockReason: false
only: issues
lockComment: false
# lockComment: |
# Locking due to inactivity.
# This is done to avoid resurrecting old issues and bumping long threads with new, possibly unrelated content.
# If you think you're experiencing something similar to what you've found here: please [open a new issue](https://github.com/swagger-api/swagger-ui/issues/new/choose), follow the template, and reference this issue in your report.
# Thanks!

View File

@ -0,0 +1,55 @@
<!--- Provide a general summary of your changes in the Title above -->
### Description
<!--- Describe your changes in detail -->
### Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->
<!--- Use the magic "Fixes #1234" format, so the issues are -->
<!--- automatically closed when this PR is merged. -->
### How Has This Been Tested?
<!--- Please describe in detail how you manually tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
<!--- see how your change affects other areas of the code, etc. -->
### Screenshots (if appropriate):
## Checklist
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
### My PR contains...
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [ ] No code changes (`src/` is unmodified: changes to documentation, CI, metadata, etc.)
- [ ] Dependency changes (any modification to dependencies in `package.json`)
- [ ] Bug fixes (non-breaking change which fixes an issue)
- [ ] Improvements (misc. changes to existing features)
- [ ] Features (non-breaking change which adds functionality)
### My changes...
- [ ] are breaking changes to a public API (config options, System API, major UI change, etc).
- [ ] are breaking changes to a private API (Redux, component props, utility functions, etc.).
- [ ] are breaking changes to a developer API (npm script behavior changes, new dev system dependencies, etc).
- [ ] are not breaking changes.
### Documentation
- [ ] My changes do not require a change to the project documentation.
- [ ] My changes require a change to the project documentation.
- [ ] If yes to above: I have updated the documentation accordingly.
### Automated tests
- [ ] My changes can not or do not need to be tested.
- [ ] My changes can and should be tested by unit and/or integration tests.
- [ ] If yes to above: I have added tests to cover my changes.
- [ ] If yes to above: I have taken care to cover edge cases in my tests.
- [ ] All new and existing tests passed.

View File

@ -0,0 +1,63 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
schedule:
- cron: '16 04 * * 2'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
config: |
paths-ignore:
- 'dist/'
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"

View File

@ -0,0 +1,40 @@
name: Merge me!
on:
pull_request_target:
branches: [ master, next ]
permissions:
contents: read
jobs:
merge-me:
name: Merge me!
if: github.actor == 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
# This first step will fail if there's no metadata and so the approval
# will not occur.
- name: Dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@v2.1.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
# Here the PR gets approved.
- name: Approve a PR
if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}
# Finally, tell dependabot to merge the PR if all checks are successful
- name: Instruct dependabot to squash & merge
if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
uses: mshick/add-pr-comment@v2
with:
repo-token: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}
allow-repeats: true
message: |
@dependabot squash and merge
env:
GITHUB_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}

View File

@ -0,0 +1,143 @@
# inspired by https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
name: Build & Push SwaggerUI multi platform Docker image
on:
workflow_dispatch:
inputs:
git_ref:
description: Git branch, tag or SHA to checkout.
type: string
required: true
docker_tag:
description: Docker tag associated with the `git_ref`
type: string
required: true
repository_dispatch:
type: [docker_build_push]
env:
REGISTRY_IMAGE: swaggerapi/swagger-ui
jobs:
inputs:
name: Normalize inputs
runs-on: ubuntu-latest
outputs:
git_ref: ${{ steps.workflow_dispatch.outputs.git_ref || steps.repository_dispatch.outputs.git_ref }}
docker_tag: ${{ steps.workflow_dispatch.outputs.docker_tag || steps.repository_dispatch.outputs.docker_tag }}
steps:
- name: Normalize inputs of `workflow_dispatch` event
id: workflow_dispatch
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo "git_ref=${{ inputs.git_ref }}" >> "$GITHUB_OUTPUT"
echo "docker_tag=${{ inputs.docker_tag }}" >> "$GITHUB_OUTPUT"
- name: Normalize inputs of `repository_dispatch` event
id: repository_dispatch
if: ${{ github.event_name == 'repository_dispatch' }}
run: |
echo "git_ref=${{ github.event.client_payload.git_ref }}" >> "$GITHUB_OUTPUT"
echo "docker_tag=${{ github.event.client_payload.docker_tag }}" >> "$GITHUB_OUTPUT"
build:
name: Build & Push SwaggerUI platform specific Docker images
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
# linux/amd64 is already built by Jenkins
- linux/arm/v6
- linux/arm64
- linux/386
- linux/ppc64le
needs:
- inputs
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.inputs.outputs.git_ref }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_SB_USERNAME }}
password: ${{ secrets.DOCKERHUB_SB_PASSWORD }}
- name: Build and push by digest
id: build
uses: docker/build-push-action@v5
with:
context: .
platforms: ${{ matrix.platform }}
provenance: false
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Sanitize platform variable
id: sanitize_platform
run: |
SANITIZED_PLATFORM="${{ matrix.platform }}" # Assuming direct usage for simplicity
SANITIZED_PLATFORM="${SANITIZED_PLATFORM//[^a-zA-Z0-9_-]/}" # Remove special chars
echo "SANITIZED_PLATFORM=${SANITIZED_PLATFORM}" # Echo for debug
echo "::set-output name=sanitized_platform::${SANITIZED_PLATFORM}"
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digest-${{ steps.sanitize_platform.outputs.sanitized_platform }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
merge:
name: Merge platform specific Docker image into multi platform image
runs-on: ubuntu-latest
needs:
- inputs
- build
steps:
- name: Download digests
uses: actions/download-artifact@v4
with:
pattern: digest-*
path: /tmp/digests
merge-multiple: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_SB_USERNAME }}
password: ${{ secrets.DOCKERHUB_SB_PASSWORD }}
- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create -t ${{ env.REGISTRY_IMAGE }}:${{ needs.inputs.outputs.docker_tag }} \
${{ env.REGISTRY_IMAGE }}:${{ needs.inputs.outputs.docker_tag }} \
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ needs.inputs.outputs.docker_tag }}

View File

@ -0,0 +1,23 @@
name: Security scan for docker image
on:
workflow_dispatch:
schedule:
- cron: '30 4 * * *'
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: 'docker.io/swaggerapi/swagger-ui:unstable'
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'

View File

@ -0,0 +1,86 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [ master, next ]
pull_request:
branches: [ master, next ]
env:
CYPRESS_CACHE_FOLDER: cypress/cache
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20
- name: Cache Node Modules and Cypress binary
uses: actions/cache@v4
id: cache-primes
with:
path: |
node_modules
${{ env.CYPRESS_CACHE_FOLDER }}
key: ${{ runner.os }}-node-and-cypress-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
if: steps.cache-primes.outputs.cache-hit != 'true'
run: npm ci
- name: Lint code for errors only
run: npm run lint-errors
- name: Run all tests
run: npm run test:unit
env:
CI: true
- name: Build SwaggerUI
run: npm run build
- name: Test build artifacts
run: npm run test:artifact
e2e-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
containers: ['+(a11y|security|bugs)/**/*cy.js', 'features/**/+(o|d)*.cy.js', 'features/**/m*.cy.js', 'features/**/!(o|d|m)*.cy.js']
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20
- name: Cache Node Modules and Cypress binary
uses: actions/cache@v4
id: cache-primes
with:
path: |
node_modules
${{ env.CYPRESS_CACHE_FOLDER }}
key: ${{ runner.os }}-node-and-cypress-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
if: steps.cache-primes.outputs.cache-hit != 'true'
run: npm ci
- name: Cypress Test
run: npx start-server-and-test cy:start http://localhost:3204 'npm run cy:run -- --spec "test/e2e-cypress/e2e/${{ matrix.containers }}"'

View File

@ -0,0 +1,79 @@
name: Build & Release SwaggerUI-React@next
# single-stage
on:
workflow_dispatch:
branches:
- next
# multi-stage automation
# on:
# workflow_run:
# workflows: ["Release SwaggerUI@next"]
# types:
# - completed
# branches: [next]
defaults:
run:
working-directory: flavors/swagger-ui-react/release
jobs:
release-swagger-ui-react:
name: Release SwaggerUI React
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
ref: next
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Prepare SwaggerUI dist
run: |
cd ../../../
npm ci
npm run build
- name: Install dependencies (to create package manifest)
run: npm ci
- name: MKDIR `dist` working directory
run: mkdir -p ../dist
- name: Copy SwaggerUI dist files to MKDIR
run: |
ls ../dist
cp ../../../dist/swagger-ui-es-bundle-core.js ../dist
cp ../../../dist/swagger-ui-es-bundle-core.js.map ../dist
cp ../../../dist/swagger-ui.css ../dist
cp ../../../dist/swagger-ui.css.map ../dist
- name: Create a releasable package manifest
run: node create-manifest.js > ../dist/package.json
- name: Transpile our top-level React Component
run: |
../../../node_modules/.bin/cross-env BABEL_ENV=commonjs ../../../node_modules/.bin/babel --config-file ../../../babel.config.js ../index.jsx > ../dist/commonjs.js
../../../node_modules/.bin/cross-env BABEL_ENV=es ../../../node_modules/.bin/babel --config-file ../../../babel.config.js ../index.jsx > ../dist/index.js
- name: Copy our README into the dist folder for npm
run: cp ../README.md ../dist
- name: Copy LICENSE & NOTICE into the dist folder for npm
run: |
cp ../../../LICENSE ../dist
cp ../../../NOTICE ../dist
- name: Run the release from the dist folder
run: |
cd ../dist
pwd
npm publish . --tag alpha
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

View File

@ -0,0 +1,73 @@
name: Release SwaggerUI@next
on:
workflow_dispatch:
branches:
- next
jobs:
release-swagger-ui:
name: Release SwaggerUI
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
ref: next
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Determine the next release version
uses: cycjimmy/semantic-release-action@v4
with:
dry_run: true
extra_plugins: |
@semantic-release/git
@semantic-release/exec
env:
GITHUB_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Nothing to release
if: ${{ env.NEXT_RELEASE_VERSION == '' }}
uses: actions/github-script@v7
with:
script: |
core.setFailed('Nothing to release')
- name: Install dependencies
run: npm ci
- name: Prepare release
run: |
npm run build
- name: Semantic Release
id: semantic
uses: cycjimmy/semantic-release-action@v4
with:
dry_run: false
extra_plugins: |
@semantic-release/git
env:
GITHUB_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Release failed
if: steps.semantic.outputs.new_release_published == 'false'
uses: actions/github-script@v7
with:
script: |
core.setFailed('Release failed')
- name: Release published
run: |
echo ${{ steps.semantic.outputs.new_release_version }}
echo ${{ steps.semantic.outputs.new_release_major_version }}
echo ${{ steps.semantic.outputs.new_release_minor_version }}
echo ${{ steps.semantic.outputs.new_release_patch_version }}

View File

@ -0,0 +1,29 @@
node_modules
.idea
.vscode
.deps_check
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
.nyc_output
npm-debug.log*
.eslintcache
*.iml
selenium-debug.log
chromedriver.log
test/e2e/db.json
docs/_book
dev-helpers/examples
# dist
flavors/**/dist/*
/lib
/es
dist/log*
/swagger-ui-*.tgz
# Cypress
test/e2e-cypress/screenshots
test/e2e-cypress/videos

View File

@ -0,0 +1 @@
npx commitlint -e

View File

@ -0,0 +1 @@
npx lint-staged

View File

@ -0,0 +1,3 @@
{
"*.js": "eslint"
}

View File

@ -0,0 +1,15 @@
*
*/
!README.md
!NOTICE
!package.json
!dist/swagger-ui.js
!dist/swagger-ui.js.map
!dist/swagger-ui-bundle.js
!dist/swagger-ui-standalone-preset.js
!dist/swagger-ui-es-bundle.js
!dist/swagger-ui-es-bundle-core.js
!dist/swagger-ui-es-bundle-core.js.map
!dist/swagger-ui.css
!dist/swagger-ui.css.map
!dist/oauth2-redirect.html

View File

@ -0,0 +1 @@
save-prefix="="

View File

@ -0,0 +1 @@
20.3.0

View File

@ -0,0 +1,5 @@
semi: false
trailingComma: es5
endOfLine: lf
requirePragma: true
insertPragma: true

View File

@ -0,0 +1,35 @@
{
"branches": [
{
"name": "master"
},
{
"name": "next",
"channel": "alpha",
"prerelease": "alpha"
}
],
"tagFormat": "v${version}",
"plugins": [
"@semantic-release/commit-analyzer",
[
"@semantic-release/exec",
{
"verifyReleaseCmd": "echo \"NEXT_RELEASE_VERSION=${nextRelease.version}\" >> $GITHUB_ENV"
}
],
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
"@semantic-release/github",
[
"@semantic-release/git",
{
"assets": [
"package.json",
"package-lock.json"
],
"message": "chore(release): cut the ${nextRelease.version} release\n\n${nextRelease.notes}"
}
]
]
}

View File

@ -0,0 +1,30 @@
# Looking for information on environment variables?
# We don't declare them here — take a look at our docs.
# https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/configuration.md
FROM nginx:1.26.0-alpine
RUN apk update && apk add --no-cache "nodejs>=18.20.1-r0 "
LABEL maintainer="char0n"
ENV API_KEY="**None**" \
SWAGGER_JSON="/app/swagger.json" \
PORT="8080" \
PORT_IPV6="" \
BASE_URL="/" \
SWAGGER_JSON_URL="" \
CORS="true" \
EMBEDDING="false"
COPY --chown=nginx:nginx --chmod=0666 ./docker/default.conf.template ./docker/cors.conf ./docker/embedding.conf /etc/nginx/templates/
COPY --chmod=0666 ./dist/* /usr/share/nginx/html/
COPY --chmod=0555 ./docker/docker-entrypoint.d/ /docker-entrypoint.d/
COPY --chmod=0666 ./docker/configurator /usr/share/nginx/configurator
# Simulates running NGINX as a non root; in future we want to use nginxinc/nginx-unprivileged.
# In future we will have separate unpriviledged images tagged as v5.1.2-unprivileged.
RUN chmod 777 /usr/share/nginx/html/ /etc/nginx/conf.d/ /etc/nginx/conf.d/default.conf /var/cache/nginx/ /var/run/
EXPOSE 8080

View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -0,0 +1,2 @@
swagger-ui
Copyright 2020-2021 SmartBear Software Inc.

View File

@ -0,0 +1,99 @@
# <img src="https://raw.githubusercontent.com/swagger-api/swagger.io/wordpress/images/assets/SWU-logo-clr.png" width="300">
[![NPM version](https://badge.fury.io/js/swagger-ui.svg)](http://badge.fury.io/js/swagger-ui)
[![Build Status](https://jenkins.swagger.io/view/OSS%20-%20JavaScript/job/oss-swagger-ui-master/badge/icon?subject=jenkins%20build)](https://jenkins.swagger.io/view/OSS%20-%20JavaScript/job/oss-swagger-ui-master/)
[![npm audit](https://jenkins.swagger.io/buildStatus/icon?job=oss-swagger-ui-security-audit&subject=npm%20audit)](https://jenkins.swagger.io/job/oss-swagger-ui-security-audit/lastBuild/console)
![total GitHub contributors](https://img.shields.io/github/contributors-anon/swagger-api/swagger-ui.svg)
![monthly npm installs](https://img.shields.io/npm/dm/swagger-ui.svg?label=npm%20downloads)
![total docker pulls](https://img.shields.io/docker/pulls/swaggerapi/swagger-ui.svg)
![monthly packagist installs](https://img.shields.io/packagist/dm/swagger-api/swagger-ui.svg?label=packagist%20installs)
![gzip size](https://img.shields.io/bundlephobia/minzip/swagger-ui.svg?label=gzip%20size)
## Introduction
[Swagger UI](https://swagger.io/tools/swagger-ui/) allows anyone — be it your development team or your end consumers — to visualize and interact with the APIs resources without having any of the implementation logic in place. Its automatically generated from your OpenAPI (formerly known as Swagger) Specification, with the visual documentation making it easy for back end implementation and client side consumption.
## General
**👉🏼 Want to score an easy open-source contribution?** Check out our [Good first issue](https://github.com/swagger-api/swagger-ui/issues?q=is%3Aissue+is%3Aopen+label%3A%22Good+first+issue%22) label.
**🕰️ Looking for the older version of Swagger UI?** Refer to the [*2.x* branch](https://github.com/swagger-api/swagger-ui/tree/2.x).
This repository publishes three different NPM modules:
* [swagger-ui](https://www.npmjs.com/package/swagger-ui) is a traditional npm module intended for use in single-page applications that are capable of resolving dependencies (via Webpack, Browserify, etc.).
* [swagger-ui-dist](https://www.npmjs.com/package/swagger-ui-dist) is a dependency-free module that includes everything you need to serve Swagger UI in a server-side project, or a single-page application that can't resolve npm module dependencies.
* [swagger-ui-react](https://www.npmjs.com/package/swagger-ui-react) is Swagger UI packaged as a React component for use in React applications.
We strongly suggest that you use `swagger-ui` instead of `swagger-ui-dist` if you're building a single-page application, since `swagger-ui-dist` is significantly larger.
If you are looking for plain ol' HTML/JS/CSS, [download the latest release](https://github.com/swagger-api/swagger-ui/releases/latest) and copy the contents of the `/dist` folder to your server.
## Compatibility
The OpenAPI Specification has undergone 5 revisions since initial creation in 2010. Compatibility between Swagger UI and the OpenAPI Specification is as follows:
| Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes |
|--------------------|--------------|----------------------------------------|-----------------------------------------------------------------------|
| 5.0.0 | 2023-06-12 | 2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.1.0 | [tag v5.0.0](https://github.com/swagger-api/swagger-ui/tree/v5.0.0) |
| 4.0.0 | 2021-11-03 | 2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3 | [tag v4.0.0](https://github.com/swagger-api/swagger-ui/tree/v4.0.0) |
| 3.18.3 | 2018-08-03 | 2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3 | [tag v3.18.3](https://github.com/swagger-api/swagger-ui/tree/v3.18.3) |
| 3.0.21 | 2017-07-26 | 2.0 | [tag v3.0.21](https://github.com/swagger-api/swagger-ui/tree/v3.0.21) |
| 2.2.10 | 2017-01-04 | 1.1, 1.2, 2.0 | [tag v2.2.10](https://github.com/swagger-api/swagger-ui/tree/v2.2.10) |
| 2.1.5 | 2016-07-20 | 1.1, 1.2, 2.0 | [tag v2.1.5](https://github.com/swagger-api/swagger-ui/tree/v2.1.5) |
| 2.0.24 | 2014-09-12 | 1.1, 1.2 | [tag v2.0.24](https://github.com/swagger-api/swagger-ui/tree/v2.0.24) |
| 1.0.13 | 2013-03-08 | 1.1, 1.2 | [tag v1.0.13](https://github.com/swagger-api/swagger-ui/tree/v1.0.13) |
| 1.0.1 | 2011-10-11 | 1.0, 1.1 | [tag v1.0.1](https://github.com/swagger-api/swagger-ui/tree/v1.0.1) |
## Documentation
#### Usage
- [Installation](https://github.com/swagger-api/swagger-ui/blob/HEAD/docs/usage/installation.md)
- [Configuration](https://github.com/swagger-api/swagger-ui/blob/HEAD/docs/usage/configuration.md)
- [CORS](https://github.com/swagger-api/swagger-ui/blob/HEAD/docs/usage/cors.md)
- [OAuth2](https://github.com/swagger-api/swagger-ui/blob/HEAD/docs/usage/oauth2.md)
- [Deep Linking](https://github.com/swagger-api/swagger-ui/blob/HEAD/docs/usage/deep-linking.md)
- [Limitations](https://github.com/swagger-api/swagger-ui/blob/HEAD/docs/usage/limitations.md)
- [Version detection](https://github.com/swagger-api/swagger-ui/blob/HEAD/docs/usage/version-detection.md)
#### Customization
- [Overview](https://github.com/swagger-api/swagger-ui/blob/HEAD/docs/customization/overview.md)
- [Plugin API](https://github.com/swagger-api/swagger-ui/blob/HEAD/docs/customization/plugin-api.md)
- [Custom layout](https://github.com/swagger-api/swagger-ui/blob/HEAD/docs/customization/custom-layout.md)
#### Development
- [Setting up](https://github.com/swagger-api/swagger-ui/blob/HEAD/docs/development/setting-up.md)
- [Scripts](https://github.com/swagger-api/swagger-ui/blob/HEAD/docs/development/scripts.md)
#### Contributing
- [Contributing](https://github.com/swagger-api/.github/blob/HEAD/CONTRIBUTING.md)
##### Integration Tests
You will need JDK of version 7 or higher as instructed here
https://nightwatchjs.org/guide/getting-started/installation.html#install-selenium-server
Integration tests can be run locally with `npm run e2e` - be sure you aren't running a dev server when testing!
### Browser support
Swagger UI works in the latest versions of Chrome, Safari, Firefox, and Edge.
### Known Issues
To help with the migration, here are the currently known issues with 3.X. This list will update regularly, and will not include features that were not implemented in previous versions.
- Only part of the parameters previously supported are available.
- The JSON Form Editor is not implemented.
- Support for `collectionFormat` is partial.
- l10n (translations) is not implemented.
- Relative path support for external files is not implemented.
## Security contact
Please disclose any security-related issues or vulnerabilities by emailing [security@swagger.io](mailto:security@swagger.io), instead of using the public issue tracker.
## License
SwaggerUI is licensed under [Apache 2.0 license](https://github.com/swagger-api/swagger-ui/blob/master/LICENSE).
SwaggerUI comes with an explicit [NOTICE](https://github.com/swagger-api/swagger-ui/blob/master/NOTICE) file
containing additional legal notices and information.

View File

@ -0,0 +1,23 @@
# Security Policy
If you believe you've found an exploitable security issue in Swagger UI,
**please don't create a public issue**.
## Supported versions
This is the list of versions of `swagger-ui` which are
currently being supported with security updates.
| Version | Supported | Notes |
|---------|--------------------|---------------------------------|
| 5.x | :white_check_mark: | Active LTS |
| 4.x | :x: | End-of-life as of August 2023 |
| 3.x | :x: | End-of-life as of November 2021 |
| 2.x | :x: | End-of-life as of 2017 |
## Reporting a vulnerability
To report a vulnerability please send an email with the details to [security@swagger.io](mailto:security@swagger.io).
We'll acknowledge receipt of your report ASAP, and set expectations on how we plan to handle it.

View File

@ -0,0 +1,140 @@
const browser = {
presets: [
[
"@babel/preset-env",
{
debug: false,
modules: "auto",
useBuiltIns: false,
forceAllTransforms: false,
ignoreBrowserslistConfig: false,
}
],
"@babel/preset-react",
],
plugins: [
[
"@babel/plugin-transform-runtime",
{
corejs: { version: 3, proposals: false },
absoluteRuntime: false,
helpers: true,
regenerator: false,
version: "^7.22.11",
}
],
[
"transform-react-remove-prop-types",
{
additionalLibraries: [
"react-immutable-proptypes"
]
}
],
[
"babel-plugin-module-resolver",
{
alias: {
root: ".",
core: "./src/core",
}
}
]
],
}
module.exports = {
env: {
commonjs: {
presets: [
[
"@babel/preset-env",
{
debug: false,
modules: "commonjs",
loose: true,
useBuiltIns: false,
forceAllTransforms: false,
ignoreBrowserslistConfig: false,
}
],
"@babel/preset-react",
],
plugins: [
[
"@babel/plugin-transform-runtime",
{
corejs: { version: 3, proposals: false },
absoluteRuntime: false,
helpers: true,
regenerator: false,
version: "^7.22.11",
}
],
[
"transform-react-remove-prop-types",
{
additionalLibraries: [
"react-immutable-proptypes"
]
}
],
[
"babel-plugin-module-resolver",
{
alias: {
root: ".",
core: "./src/core",
}
}
]
],
},
esm: {
presets: [
[
"@babel/env",
{
debug: false,
modules: false,
ignoreBrowserslistConfig: false,
useBuiltIns: false,
}
],
"@babel/preset-react"
],
plugins: [
[
"@babel/plugin-transform-runtime",
{
corejs: { version: 3, proposals: false },
absoluteRuntime: false,
helpers: true,
regenerator: false,
version: "^7.22.11",
}
],
[
"transform-react-remove-prop-types",
{
additionalLibraries: [
"react-immutable-proptypes"
]
}
],
[
"babel-plugin-module-resolver",
{
alias: {
root: ".",
core: "./src/core",
}
}
]
]
},
development: browser,
production: browser,
},
}

View File

@ -0,0 +1,40 @@
{
"name": "swagger-api/swagger-ui",
"description": " Swagger UI is a collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.",
"keywords": [
"Swagger",
"OpenAPI",
"specification",
"documentation",
"API",
"UI"
],
"homepage": "http://swagger.io",
"license": "Apache-2.0",
"authors": [
{
"name": "Anna Bodnia",
"email": "anna.bodnia@gmail.com"
},
{
"name": "Buu Nguyen",
"email": "buunguyen@gmail.com"
},
{
"name": "Josh Ponelat",
"email": "jponelat@gmail.com"
},
{
"name": "Kyle Shockey",
"email": "kyleshockey1@gmail.com"
},
{
"name": "Robert Barnwell",
"email": "robert@robertismy.name"
},
{
"name": "Sahar Jafari",
"email": "shr.jafari@gmail.com"
}
]
}

View File

@ -0,0 +1,8 @@
{
"rules": {
"import/no-unresolved": 0,
"import/extensions": 0,
"quotes": ["error", "single"],
"semi": ["error", "always"]
}
}

View File

@ -0,0 +1,9 @@
const path = require('path');
module.exports = {
rootDir: path.join(__dirname, '..', '..'),
testEnvironment: 'jsdom',
testMatch: ['**/test/build-artifacts/**/*.js'],
setupFiles: ['<rootDir>/test/unit/jest-shim.js'],
transformIgnorePatterns: ['/node_modules/(?!(swagger-client|react-syntax-highlighter)/)'],
};

View File

@ -0,0 +1,23 @@
const path = require('path');
module.exports = {
rootDir: path.join(__dirname, '..', '..'),
testEnvironment: 'jest-environment-jsdom',
testMatch: [
'**/test/unit/*.js?(x)',
'**/test/unit/**/*.js?(x)',
],
setupFiles: ['<rootDir>/test/unit/jest-shim.js'],
setupFilesAfterEnv: ['<rootDir>/test/unit/setup.js'],
testPathIgnorePatterns: [
'<rootDir>/node_modules/',
'<rootDir>/test/build-artifacts/',
'<rootDir>/test/unit/jest-shim.js',
'<rootDir>/test/unit/setup.js',
],
moduleNameMapper: {
'^.+\\.svg$': 'jest-transform-stub'
},
transformIgnorePatterns: ['/node_modules/(?!(sinon|react-syntax-highlighter)/)'],
silent: true, // set to `false` to allow console.* calls to be printed
};

View File

@ -0,0 +1,19 @@
const { defineConfig } = require("cypress")
const startOAuthServer = require("./test/e2e-cypress/support/helpers/oauth2-server")
module.exports = defineConfig({
fileServerFolder: "test/e2e-cypress/static",
fixturesFolder: "test/e2e-cypress/fixtures",
screenshotsFolder: "test/e2e-cypress/screenshots",
videosFolder: "test/e2e-cypress/videos",
video: false,
e2e: {
baseUrl: "http://localhost:3230/",
supportFile: "test/e2e-cypress/support/e2e.js",
specPattern: "test/e2e-cypress/e2e/**/*.cy.{js,jsx}",
setupNodeEvents: () => {
startOAuthServer()
},
},
})

View File

@ -0,0 +1,33 @@
/* eslint-disable no-undef */
window.onload = function() {
window["SwaggerUIBundle"] = window["swagger-ui-bundle"]
window["SwaggerUIStandalonePreset"] = window["swagger-ui-standalone-preset"]
// Build a system
const ui = SwaggerUIBundle({
url: "https://petstore.swagger.io/v2/swagger.json",
dom_id: "#swagger-ui",
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
// requestSnippetsEnabled: true,
layout: "StandaloneLayout"
})
window.ui = ui
ui.initOAuth({
clientId: "your-client-id",
clientSecret: "your-client-secret-if-required",
realm: "your-realms",
appName: "your-app-name",
scopeSeparator: " ",
scopes: "openid profile email phone address",
additionalQueryStringParams: {},
useBasicAuthenticationWithAccessCodeGrant: false,
usePkceWithAuthorizationCodeGrant: false
})
}

View File

@ -0,0 +1,21 @@
<!-- HTML for dev server -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Swagger UI</title>
<link rel="stylesheet" type="text/css" href="style.css">
<style>
</style>
</head>
<body>
<div id="swagger-ui"></div>
<script src="dev-helper-initializer.js"></script>
</body>
</html>

View File

@ -0,0 +1,76 @@
<!doctype html>
<html lang="en-US">
<body>
</body>
</html>
<script>
'use strict';
function run () {
var oauth2 = window.opener.swaggerUIRedirectOauth2;
var sentState = oauth2.state;
var redirectUrl = oauth2.redirectUrl;
var isValid, qp, arr;
if (/code|token|error/.test(window.location.hash)) {
qp = window.location.hash.substring(1).replace('?', '&');
} else {
qp = location.search.substring(1);
}
arr = qp.split("&")
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';})
qp = qp ? JSON.parse('{' + arr.join() + '}',
function (key, value) {
return key === "" ? value : decodeURIComponent(value)
}
) : {}
isValid = qp.state === sentState
if ((
oauth2.auth.schema.get("flow") === "accessCode" ||
oauth2.auth.schema.get("flow") === "authorizationCode" ||
oauth2.auth.schema.get("flow") === "authorization_code"
) && !oauth2.auth.code) {
if (!isValid) {
oauth2.errCb({
authId: oauth2.auth.name,
source: "auth",
level: "warning",
message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"
});
}
if (qp.code) {
delete oauth2.state;
oauth2.auth.code = qp.code;
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
} else {
let oauthErrorMsg
if (qp.error) {
oauthErrorMsg = "["+qp.error+"]: " +
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
(qp.error_uri ? "More info: "+qp.error_uri : "");
}
oauth2.errCb({
authId: oauth2.auth.name,
source: "auth",
level: "error",
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server"
});
}
} else {
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
}
window.close();
}
if( document.readyState !== 'loading' ) {
run();
} else {
document.addEventListener('DOMContentLoaded', function () {
run();
});
}
</script>

View File

@ -0,0 +1,19 @@
html
{
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}
*,
*:before,
*:after
{
box-sizing: inherit;
}
body
{
margin:0;
background: #fafafa;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 665 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 628 B

View File

@ -0,0 +1,16 @@
html {
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
body {
margin: 0;
background: #fafafa;
}

View File

@ -0,0 +1,19 @@
<!-- HTML for static distribution bundle build -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Swagger UI</title>
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" />
<link rel="stylesheet" type="text/css" href="index.css" />
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
</head>
<body>
<div id="swagger-ui"></div>
<script src="./swagger-ui-bundle.js" charset="UTF-8"> </script>
<script src="./swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
<script src="./swagger-initializer.js" charset="UTF-8"> </script>
</body>
</html>

View File

@ -0,0 +1,79 @@
<!doctype html>
<html lang="en-US">
<head>
<title>Swagger UI: OAuth2 Redirect</title>
</head>
<body>
<script>
'use strict';
function run () {
var oauth2 = window.opener.swaggerUIRedirectOauth2;
var sentState = oauth2.state;
var redirectUrl = oauth2.redirectUrl;
var isValid, qp, arr;
if (/code|token|error/.test(window.location.hash)) {
qp = window.location.hash.substring(1).replace('?', '&');
} else {
qp = location.search.substring(1);
}
arr = qp.split("&");
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';});
qp = qp ? JSON.parse('{' + arr.join() + '}',
function (key, value) {
return key === "" ? value : decodeURIComponent(value);
}
) : {};
isValid = qp.state === sentState;
if ((
oauth2.auth.schema.get("flow") === "accessCode" ||
oauth2.auth.schema.get("flow") === "authorizationCode" ||
oauth2.auth.schema.get("flow") === "authorization_code"
) && !oauth2.auth.code) {
if (!isValid) {
oauth2.errCb({
authId: oauth2.auth.name,
source: "auth",
level: "warning",
message: "Authorization may be unsafe, passed state was changed in server. The passed state wasn't returned from auth server."
});
}
if (qp.code) {
delete oauth2.state;
oauth2.auth.code = qp.code;
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
} else {
let oauthErrorMsg;
if (qp.error) {
oauthErrorMsg = "["+qp.error+"]: " +
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
(qp.error_uri ? "More info: "+qp.error_uri : "");
}
oauth2.errCb({
authId: oauth2.auth.name,
source: "auth",
level: "error",
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server."
});
}
} else {
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
}
window.close();
}
if (document.readyState !== 'loading') {
run();
} else {
document.addEventListener('DOMContentLoaded', function () {
run();
});
}
</script>
</body>
</html>

View File

@ -0,0 +1,20 @@
window.onload = function() {
//<editor-fold desc="Changeable Configuration Block">
// the following lines will be replaced by docker/configurator, when it runs in a docker-container
window.ui = SwaggerUIBundle({
url: "/api",
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
});
//</editor-fold>
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,13 @@
module.exports.indent = function indent(str, len, fromLine = 0) {
return str
.split("\n")
.map((line, i) => {
if (i + 1 >= fromLine) {
return `${Array(len + 1).join(" ")}${line}`
} else {
return line
}
})
.join("\n")
}

View File

@ -0,0 +1,52 @@
/*
* Replace static code with configured data based on environment-variables.
* This code should be called BEFORE the webserver serve the api-documentation.
*/
const fs = require("fs")
const path = require("path")
const translator = require("./translator")
const oauthBlockBuilder = require("./oauth")
const indent = require("./helpers").indent
const START_MARKER = "//<editor-fold desc=\"Changeable Configuration Block\">"
const END_MARKER = "//</editor-fold>"
const targetPath = path.normalize(process.cwd() + "/" + process.argv[2])
const originalHtmlContent = fs.readFileSync(targetPath, "utf8")
const startMarkerIndex = originalHtmlContent.indexOf(START_MARKER)
const endMarkerIndex = originalHtmlContent.indexOf(END_MARKER)
const beforeStartMarkerContent = originalHtmlContent.slice(0, startMarkerIndex)
const afterEndMarkerContent = originalHtmlContent.slice(
endMarkerIndex + END_MARKER.length
)
if (startMarkerIndex < 0 || endMarkerIndex < 0) {
console.error("ERROR: Swagger UI was unable to inject Docker configuration data!")
console.error("! This can happen when you provide custom HTML/JavaScript to Swagger UI.")
console.error("! ")
console.error(`! In order to solve this, add the "${START_MARKER}"`)
console.error(`! and "${END_MARKER}" markers to your JavaScript.`)
console.error("! See the repository for an example:")
console.error("! https://github.com/swagger-api/swagger-ui/blob/8c946a02e73ef877d73b7635de27924418ba50f3/dist/swagger-initializer.js#L2-L19")
console.error("! ")
console.error("! If you're seeing this message and aren't using custom HTML,")
console.error("! this message may be a bug. Please file an issue:")
console.error("! https://github.com/swagger-api/swagger-ui/issues/new/choose")
process.exit(0)
}
fs.writeFileSync(
targetPath,
`${beforeStartMarkerContent}
${START_MARKER}
window.ui = SwaggerUIBundle({
${indent(translator(process.env, {injectBaseConfig: true}), 8, 2)}
})
${indent(oauthBlockBuilder(process.env), 6, 2)}
${END_MARKER}
${afterEndMarkerContent}`
)

View File

@ -0,0 +1,55 @@
const translator = require("./translator")
const indent = require("./helpers").indent
const oauthBlockSchema = {
OAUTH_CLIENT_ID: {
type: "string",
name: "clientId"
},
OAUTH_CLIENT_SECRET: {
type: "string",
name: "clientSecret",
onFound: () => console.warn("Swagger UI warning: don't use `OAUTH_CLIENT_SECRET` in production!")
},
OAUTH_REALM: {
type: "string",
name: "realm"
},
OAUTH_APP_NAME: {
type: "string",
name: "appName"
},
OAUTH_SCOPE_SEPARATOR: {
type: "string",
name: "scopeSeparator"
},
OAUTH_SCOPES: {
type: "string",
name: "scopes"
},
OAUTH_ADDITIONAL_PARAMS: {
type: "object",
name: "additionalQueryStringParams"
},
OAUTH_USE_BASIC_AUTH: {
type: "boolean",
name: "useBasicAuthenticationWithAccessCodeGrant"
},
OAUTH_USE_PKCE: {
type: "boolean",
name: "usePkceWithAuthorizationCodeGrant"
}
}
module.exports = function oauthBlockBuilder(env) {
const translatorResult = translator(env, { schema: oauthBlockSchema })
if(translatorResult) {
return (
`ui.initOAuth({
${indent(translatorResult, 2)}
})`)
}
return ``
}

Some files were not shown because too many files have changed in this diff Show More