From ed41833994c7443b8d7c22deda327b5b20764b13 Mon Sep 17 00:00:00 2001
From: "yakumo.izuru"
Date: Sun, 21 Jan 2024 12:50:53 +0000
Subject: [PATCH] Does verbose mode even work, anyways, releasing V1 now
Signed-off-by: Izuru Yakumo
git-svn-id: file:///srv/svn/repo/mai/trunk@64 e410bdd4-646f-c54f-a7ce-fffcc4f439ae
---
doc.go | 1 +
mai.1 | 1 +
static/docs.css | 114 +++++++++++++++++++++++++++++++++++++++++
static/docs/index.html | 56 ++++++++++++++++++++
4 files changed, 172 insertions(+)
create mode 100644 static/docs.css
create mode 100644 static/docs/index.html
diff --git a/doc.go b/doc.go
index ec57bf0..2c9f4df 100644
--- a/doc.go
+++ b/doc.go
@@ -1,4 +1,5 @@
// Package mai is an usable frontend for popular translation engines
// Originally based on SimplyTranslate, and took inspiration from the following projects:
// Partage, PixivFE, etc.
+// For more information see mai(1) mai.ini(5)
package mai
diff --git a/mai.1 b/mai.1
index 815203e..3a52c82 100644
--- a/mai.1
+++ b/mai.1
@@ -7,6 +7,7 @@
.Sh SYNOPSIS
.Nm
.Op Fl f Ar config-file
+.Op Fl v
.Sh DESCRIPTION
This project has been forked from the remains of the
rewrite of the SimplyTranslate project, which is currently
diff --git a/static/docs.css b/static/docs.css
new file mode 100644
index 0000000..da3e48a
--- /dev/null
+++ b/static/docs.css
@@ -0,0 +1,114 @@
+/*
+ * 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;
+}
+
+h2.get {
+ color: orange;
+}
+
+h2.post {
+ color: green;
+}
+
+@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; }
+
diff --git a/static/docs/index.html b/static/docs/index.html
new file mode 100644
index 0000000..c61ea82
--- /dev/null
+++ b/static/docs/index.html
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+ API Documentation | Mai
+
+
+
+
+ [GET] /api/translate
+ [POST] /api/translate
+ Description
+ Translation endpoint
+ Arguments
+
+ - engine
+ - from
+ - text
+ - to
+
+ Examples
+ GET /api/translate?engine=google&from=auto&to=en&text="sonrisa"
+
+ [GET] /api/source_languages
+ [GET] /api/target_languages
+ Description
+ Get a JSON array of supported source and target languages for a particular engine
+ Arguments
+
+ Examples
+ GET /api/source_languages?engine=google
+ GET /api/target_languages?engine=google
+
+ [GET] /api/tts
+ Description
+ Obtain text-to-speech audio files from an engine, provided said engine supports them
+ Arguments
+
+ Examples
+ GET /api/tts?engine=google&lang=en&text="hi"
+
+ [POST] /switchlanguages
+ Description
+ Switch between source and target languages, as long as the source language isn't "auto"
+
+ Return to Mai
+
+