プロジェクトの名前を「マイ」に変更します

git-svn-id: file:///srv/svn/repo/mai/trunk@56 e410bdd4-646f-c54f-a7ce-fffcc4f439ae
This commit is contained in:
yakumo.izuru 2024-01-19 15:40:12 +00:00
parent 3e6dea4a1d
commit 236003cc7b
17 changed files with 60 additions and 197 deletions

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
/simplytranslate
/mai
*.gz

View File

@ -2,6 +2,6 @@ FROM golang:1.20-alpine
COPY . .
RUN go mod download
RUN go build -o simplytranslate
RUN go build -o mai
EXPOSE 5000
CMD [ "./simplytranslate" ]
CMD [ "./mai" ]

View File

@ -1,13 +1,13 @@
PREFIX ?= /usr/local
build:
go build -v ./cmd/simplytranslate
go build -v ./cmd/mai
clean:
rm -f simplytranslate
rm -f mai
install:
install -Dm0755 simplytranslate ${DESTDIR}${PREFIX}/bin/simplytranslate
mkdir -p ${DESTDIR}${PREFIX}/share/simplytranslate
cp -R static views ${DESTDIR}${PREFIX}/share/simplytranslate
install -Dm0755 mai ${DESTDIR}${PREFIX}/bin/mai
mkdir -p ${DESTDIR}${PREFIX}/share/mai
cp -R static views ${DESTDIR}${PREFIX}/share/mai
uninstall:
rm -f ${DESTDIR}${PREFIX}/bin/simplytranslate
rm -rf ${DESTDIR}${PREFIX}/share/simplytranslate
rm -f ${DESTDIR}${PREFIX}/bin/mai
rm -rf ${DESTDIR}${PREFIX}/share/mai

View File

@ -1,17 +1,17 @@
## SimplyTranslate
## Mai
A privacy friendly frontend to multiple translation engines.
### History
1. SimplyTranslate was founded by [metalune and fattalion](https://codeberg.org/SimpleWeb/SimplyTranslate-Web). It was written in Python.
2. Fattalion created a Go implementation.
3. Both metalune and fattalion retired, and they handed SimplyTranslate over to ManeraKai.
4. [Izuru Yakumo The Violet Hermit](https://geidontei.chaotic.ninja/usr/yakumo_izuru) stole it
4. [Izuru Yakumo The Violet Hermit](https://geidontei.chaotic.ninja/usr/yakumo_izuru) stole it, and renamed it after [Mai](https://en.touhouwiki.net/wiki/Mai) from [Mystic Square](https://en.touhouwiki.net/wiki/Mystic_Square)
### Installation
```shell
% git clone https://git.chaotic.ninja/yakumo.izuru/simplytranslate
% cd simplytranslate
% git clone https://git.chaotic.ninja/yakumo.izuru/mai
% cd mai
% make
# make install
```
@ -27,11 +27,14 @@ location / {
```
### Legal notice
SimplyTranslate does not host any content. All content shown on any SimplyTranslate instances is from [Google Translate](https://translate.google.com) and [Reverso](https://www.reverso.net/).
Mai does not host any content. All content shown on any Mai/Mozhi/SimplyTranslate instances is from [Google Translate](https://translate.google.com) and [Reverso](https://www.reverso.net/).
SimplyTranslate is not affiliated with Google Translate nor Reverso that SimplyTranslate relays.
Mai is not affiliated with Google Translate nor Reverso, which this program relays.
Trademarks belong to their respective owners.
Google Translate is a trademark of [Google LLC](https://www.google.com). Reverso is a trademark of Reverso.
The creators and maintainers of this repository assume no liability for the accuracy and timeliness of any information provided above. Trademark owner information was researched to the best of the author's knowledge at the time of curation and may be outdated or incorrect.
### Other projects
* [Mozhi](https://codeberg.org/aryak/mozhi), also a fork of SimplyTranslate

View File

@ -7,7 +7,7 @@ import (
"time"
"runtime"
"git.chaotic.ninja/yakumo.izuru/simplytranslate/engines"
"marisa.chaotic.ninja/mai/engines"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/template/html/v2"
)

20
cmd/mai/readconf.go Normal file
View File

@ -0,0 +1,20 @@
// Read the INI-style configuration file
package main
import (
"gopkg.in/ini.v1"
)
func readConf(file string) error {
cfg, err := ini.Load(file)
if err != nil {
return err
}
conf.listen = cfg.Section("mai").Key("listen").String()
conf.staticpath = cfg.Section("mai").Key("rootdir").String()
conf.tmplpath = cfg.Section("mai").Key("tmplpath").String()
return nil
}

View File

@ -1,20 +0,0 @@
// Read the INI-style configuration file
package main
import (
"gopkg.in/ini.v1"
)
func readConf(file string) error {
cfg, err := ini.Load(file)
if err != nil {
return err
}
conf.listen = cfg.Section("simplytranslate").Key("listen").String()
conf.staticpath = cfg.Section("simplytranslate").Key("rootdir").String()
conf.tmplpath = cfg.Section("simplytranslate").Key("tmplpath").String()
return nil
}

View File

@ -1,8 +1,8 @@
version: "3.6"
services:
simplytranslate:
container_name: simplytranslate
mai:
container_name: mai
build:
context: .
dockerfile: Dockerfile

View File

@ -1,26 +1,26 @@
#!/bin/sh
# $TheSupernovaDuo$
#
# PROVIDE: simplytranslate
# PROVIDE: mai
# REQUIRE: DAEMON NETWORKING syslog
# KEYWORD: shutdown
. /etc/rc.subr
name="simplytranslate"
rcvar="simplytranslate_enable"
name="mai"
rcvar="mai_enable"
load_rc_config $name
: ${simplytranslate_user:="www"}
: ${simplytranslate_enable:="NO"}
: ${simplytranslate_config="/usr/local/etc/simplytranslate/simplytranslate.ini"}
: ${mai_user:="www"}
: ${mai_enable:="NO"}
: ${mai_config="/usr/local/etc/mai/mai.ini"}
pidfile="/var/run/${name}.pid"
command="/usr/sbin/daemon"
procname="/usr/local/bin/${name}"
simplytranslate_args="-f ${simplytranslate_config}"
command_args="-S -m 3 -s info -l daemon -p ${pidfile} /usr/bin/env ${procname} ${simplytranslate_args}"
mai_args="-f ${mai_config}"
command_args="-S -m 3 -s info -l daemon -p ${pidfile} /usr/bin/env ${procname} ${mai_args}"
run_rc_command "$1"

View File

@ -1,8 +1,8 @@
#!/bin/ksh
# $TheSupernovaDuo$
daemon="/usr/local/bin/simplytranslate"
daemon_flags="-f /usr/local/etc/simplytranslate/simplytranslate.ini"
daemon="/usr/local/bin/mai"
daemon_flags="-f /usr/local/etc/mai/mai.ini"
. /etc/rc.d/rc.subr

2
rc.d/immortal.yml Normal file
View File

@ -0,0 +1,2 @@
cmd: /usr/local/bin/mai -f /usr/local/etc/mai/mai.ini
user: www

View File

@ -1,3 +0,0 @@
favicon.ico, favicon.svg, favicon128x128.png
Created by "joelchrono12" (https://joelchrono12.ml/)
Creative Commons Attribution 4.0 International License (CC BY 4.0)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 50 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -1,7 +1,7 @@
<!doctype html>
<html lang="en">
<head>
<title>SimplyTranslate</title>
<title>Mai</title>
<link rel="shortcut icon" href="/static/favicon.ico">
<meta name="description" content="Experience simple and private translations">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@ -12,7 +12,7 @@
</head>
<body>
<header class="center">
<h1>SimplyTranslate</h1>
<h1>Mai</h1>
</header>
<form action="/?engine={{.Engine}}" method="POST" id="translation-form">
<div class="center">
@ -126,8 +126,10 @@
</form>
<br><br><br><br><br>
<footer class="center">
<a href="https://git.chaotic.ninja/yakumo.izuru/simplytranslate">Source code</a><br>
<p>a <em>Mirage AIB</em> project</p>
<p>
<a href="https://git.chaotic.ninja/yakumo.izuru/mai">Source code</a><br>
a <em>Mirage AIB</em> project | Favicon source is <a href="https://pixiv.net/en/artworks/97787072">ユキマイ</a>
</p>
</footer>
<script src="/static/script.js"></script>
</body>