initial commit
All checks were successful
Build and publish the docker image / build (push) Successful in 58s

Signed-off-by: ngn <ngn@ngn.tf>
This commit is contained in:
ngn
2025-04-05 09:58:58 +03:00
commit 4df8b90dae
26 changed files with 1530 additions and 0 deletions

12
views/head.html Normal file
View File

@ -0,0 +1,12 @@
{{if .term}}
<title>tren - {{.term}}</title>
{{else}}
<title>tren - tureng.com frontend</title>
{{end}}
<meta name="viewport" content="width=1024">
<meta name="description" content="Privacy respecting frontend for tureng.com">
<meta name="keywords" content="tureng,translate,privacy">
<meta name="color-scheme" content="only dark" />
<link rel="icon" href="data:;base64,=">
<link rel="stylesheet" href="/css/global.css"/>

24
views/index.html Normal file
View File

@ -0,0 +1,24 @@
<html>
<head>
{{template "head" .}}
<link rel="stylesheet" href="/css/index.css">
</head>
<body>
{{template "navbar" .}}
<main>
<div class="about">
<h1><span>tren</span> - tureng.com frontend</h1>
<p>
tureng.com is a popular multilingual dictionary website, however
the website serves non-free and malicious JS code, which is used
for tracking and telemetry
</p>
<p>
this frontend proxies requests to tureng.com while respecting your
privacy and freedom, so you don't have to deal with that
</p>
</div>
{{template "search" .}}
</main>
</body>
</html>

7
views/navbar.html Normal file
View File

@ -0,0 +1,7 @@
<nav>
<a href="/">index</a>
<p>/</p>
<a href="https://git.ngn.tf/ngn/tren">source</a>
<p>/</p>
<a href="https://ngn.tf/donate">donate</a>
</nav>

13
views/search.html Normal file
View File

@ -0,0 +1,13 @@
<form class="search" method="post" action="/translate">
{{if .term}}
<input name="term" type="text" placeholder="Enter a word or a sentence" value="{{.term}}">
{{else}}
<input name="term" type="text" placeholder="Enter a word or a sentence">
{{end}}
<select name="dictionary">
{{range .dictionaries}}
<option value="{{.ShortName}}">{{.Name}}</option>
{{end}}
</select>
<button type="submit">Translate</button>
</form>

17
views/table.html Normal file
View File

@ -0,0 +1,17 @@
<table class="result">
<tr>
{{range .fields}}
<th>{{.}}</th>
{{end}}
</tr>
{{range .entries}}
<tr>
{{range .}}
<td>
{{.Text}}
<i>{{.Detail}}</i>
</td>
{{end}}
</tr>
{{end}}
</table>

27
views/translate.html Normal file
View File

@ -0,0 +1,27 @@
<html>
<head>
{{template "head" .}}
<link rel="stylesheet" href="/css/translation.scss">
</head>
<body>
{{template "navbar" .}}
<main>
{{template "search" .}}
{{if not .suggestions}}
{{if not .fields}}
<h3 class="result">No results :(</h3>
{{end}}
{{end}}
{{if .suggestions}}
<h3 class="result">Did you mean...</h3>
{{range .suggestions}}
<p>{{.}}</p>
{{end}}
{{else}}
{{template "table" .}}
{{end}}
</main>
</body>
</html>