Fix bugs, many other changes

Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>

git-svn-id: file:///srv/svn/repo/mai/trunk@67 e410bdd4-646f-c54f-a7ce-fffcc4f439ae
This commit is contained in:
yakumo.izuru
2024-02-07 00:26:14 +00:00
parent 2435673dff
commit b860f0610b
22 changed files with 172 additions and 501 deletions

View File

@@ -7,49 +7,68 @@
<title>API Documentation | Mai</title>
</head>
<body id="body">
<h1 id="header">API Documentation</h1>
<br><hr>
<h2 class="get">[GET] /api/translate</h2>
<h2 class="post">[POST] /api/translate</h2>
<h3>Description</h3>
<p>Translation endpoint, input must be URL-encoded (e.g. multi-byte characters, words separated by space)</p>
<h3>Arguments</h3>
<ul>
<li>engine</li>
<li>from</li>
<li>text</li>
<li>to</li>
</ul>
<h3>Examples</h3>
<p><pre><code>GET /api/translate?engine=google&amp;from=auto&amp;to=en&amp;text="sonrisa"</code></pre></p>
<hr>
<h2 class="get">[GET] /api/source_languages</h2>
<h2 class="get">[GET] /api/target_languages</h2>
<h3>Description</h3>
<p>Get a JSON array of supported source and target languages for a particular engine</p>
<h3>Arguments</h3>
<ul>
<li>engine</li>
</ul>
<h3>Examples</h3>
<p><pre><code>GET /api/source_languages?engine=google</code></pre></p>
<p><pre><code>GET /api/target_languages?engine=google</code></pre></p>
<hr>
<h2 class="get">[GET] /api/tts</h2>
<h3>Description</h3>
<p>Obtain text-to-speech audio files from an engine, provided said engine supports them</p>
<h3>Arguments</h3>
<ul>
<li>engine</li>
<li>lang</li>
<li>text</li>
</ul>
<h3>Examples</h3>
<p><pre><code>GET /api/tts?engine=google&amp;lang=en&amp;text="hi"</code></pre></p>
<hr>
<h2 class="post">[POST] /switchlanguages</h2>
<h3>Description</h3>
<p>Switch between source and target languages, as long as the source language isn't "auto"</p>
<hr>
<h1>API documentation</h1>
<table border="1" align="center">
<tr>
<td>
<h2 class="get">[GET] /api/translate</h2>
<h2 class="post">[POST] /api/translate</h2>
<h3>Description</h3>
<p>Translation endpoint, input must be URL-encoded (e.g. multi-byte characters, words separated by space)</p>
<h3>Arguments</h3>
<ul>
<li>engine</li>
<li>from</li>
<li>text</li>
<li>to</li>
</ul>
</td>
</tr>
<tr>
<td>
<h2 class="get">[GET] /api/source_languages</h2>
<h2 class="get">[GET] /api/target_languages</h2>
<h3>Description</h3>
<p>Get a JSON array of supported source and target languages for a particular engine</p>
<h3>Arguments</h3>
<ul>
<li>engine</li>
</ul>
</td>
</tr>
<tr>
<td>
<h2 class="get">[GET] /api/tts</h2>
<h3>Description</h3>
<p>Obtain text-to-speech audio files from an engine, provided said engine supports them</p>
<h3>Arguments</h3>
<ul>
<li>engine</li>
<li>lang</li>
<li>text</li>
</ul>
</td>
</tr>
<tr>
<td>
<h2 class="get">[GET] /robots.txt</h2>
</td>
</tr>
<tr>
<td>
<h2 class="post">[POST] /switchlanguages</h2>
<h3>Description</h3>
<p>Switch between source and target languages, as long as the source language isn't "auto"</p>
<p>Must only be called inside the form interface</p>
</td>
</tr>
<tr>
<td>
<h2 class="get">[GET] /version</h2>
<h3>Description</h3>
<p>Return the software version as a JSON array</p>
</td>
</tr>
</table>
</body>
</html>

View File

@@ -6,12 +6,27 @@
<meta name="author" content="Izuru Yakumo">
<title>Mai | Documentation</title>
</head>
<body id="body">
<img src="/static/favicon128x128.png" style="text-align: center;">
<h1 id="header">Documentation</h1>
<ul id="nav">
<li><a href="/docs/api">API</a></li>
</ul>
<body>
<table>
<tr><td>
<table border="1" align="left">
<tr>
<td><a href="/docs/api">API</a></td>
</tr>
</table>
</tr></td>
<tr><td>
<table border="1" align="center">
<tr>
<td>
<p>Welcome to Mai's documentation!<p>
<p>See the menu for the available entries</p>
<p>Anything else is covered by the man pages</p>
</td>
</tr>
</table>
</td></tr>
</table>
</body>
</html>

View File

@@ -1,114 +1,22 @@
/*
* Taken from vnpower
*/
* {
box-sizing: border-box; }
body {
top: 0;
margin: 0;
background-color: #1d1f21;
color: white;
font-family: "Open Sans", "Roboto", "Noto Sans", "Noto Sans CJK JP", sans-serif;
line-height: 1.618;
background-color: #f8cfd2;
color: rgb(206, 147, 191);
}
h2.get {
color: orange;
a, a:visited {
color: rgb(206, 147, 191);
}
h2.post {
color: green;
@media screen and (prefers-color-scheme: dark) {
body {
background-color: #700000;
color: #ffffff;
}
a, a:visited {
color: #18c018;
}
}
@media (max-width: 684px) {
body {
font-size: 1rem; } }
@media (max-width: 382px) {
body {
font-size: 1rem; } }
a {
color: #81a2be;
text-decoration-color: #81a2be; }
#header {
width: 100%;
min-width: 320px;
background-color: #282a2e; }
#header img {
width: 280px; }
#header-content {
margin: 0 auto;
width: min-content; }
#nav {
display: flex;
justify-content: center;
background-color: #373b41; }
#footer {
margin-top: 0.5rem;
text-align: center; }
#body {
min-height: 75vh;
max-width: 800px;
margin: 1rem auto;
padding: 0 0.6rem; }
#body h1,
#body h2,
#body h3,
#body h4,
#body h5,
#body h6 {
line-height: 1.1;
font-family: sans-serif;
font-weight: 700;
margin-top: 1rem;
margin-bottom: 1rem;
overflow-wrap: break-word;
word-wrap: break-word;
-ms-word-break: break-all;
word-break: break-word; }
#body h1 {
border-bottom: 1px solid #b5bd68;
display: block; }
#body p {
margin-top: 0px;
margin-bottom: 0.5rem; }
#body li > p {
padding: 0;
margin: 0; }
#body small,
#body sub,
#body sup {
font-size: 75%; }
#body img,
#body video {
height: auto;
max-width: 100%;
margin-top: 0.5rem;
margin-bottom: 0.5rem;
box-shadow: 0px 1px 1px 0px rgba(0, 0, 0, 0.12), 0px 2px 2px 0px rgba(0, 0, 0, 0.12), 0px 4px 4px 0px rgba(0, 0, 0, 0.12), 0px 8px 8px 0px rgba(0, 0, 0, 0.12), 0px 16px 16px 0px rgba(0, 0, 0, 0.12); }
#body pre {
background-color: #373b41;
display: block;
padding: 1em;
overflow-x: auto;
margin-top: 0px;
margin-bottom: 0.5rem; }
#body code, #body kbd, #body samp {
padding: 0 0.5em;
background-color: #373b41;
white-space: pre-wrap; }
#body pre > code {
padding: 0;
background-color: transparent;
white-space: pre;
font-size: 1em; }
table {
border-color: white;
}