add copy translation link

This commit is contained in:
Arya 2023-10-05 21:31:23 +05:30
parent 3f7ba6b071
commit fbf74effcd
Signed by: arya
GPG Key ID: 842D12BDA50DF120
2 changed files with 3 additions and 4 deletions

View File

@ -84,8 +84,7 @@ func Serve(port string) {
}) })
api := app.Group("/api") api := app.Group("/api")
api.Get("/translate", pages.HandleTranslate) api.All("/translate", pages.HandleTranslate)
api.Post("/translate", pages.HandleTranslate)
api.Get("/source_languages", pages.HandleSourceLanguages) api.Get("/source_languages", pages.HandleSourceLanguages)
api.Get("/target_languages", pages.HandleTargetLanguages) api.Get("/target_languages", pages.HandleTargetLanguages)
api.Get("/tts", pages.HandleTTS) api.Get("/tts", pages.HandleTTS)
@ -97,8 +96,7 @@ func Serve(port string) {
}) })
api.Get("/swagger/*", swagger.HandlerDefault) // default api.Get("/swagger/*", swagger.HandlerDefault) // default
app.Get("/", pages.HandleIndex) app.All("/", pages.HandleIndex)
app.Post("/", pages.HandleIndex)
app.Get("/about", pages.HandleAbout) app.Get("/about", pages.HandleAbout)
app.Get("/switchlanguages", func(c *fiber.Ctx) error { app.Get("/switchlanguages", func(c *fiber.Ctx) error {
engine := c.Query("engine") engine := c.Query("engine")

View File

@ -95,6 +95,7 @@
<button class="wrap" type="submit"> <button class="wrap" type="submit">
Translate! Translate!
</button> </button>
{{ if and .Engine .From .To .OriginalText }}<p><a href="/?engine={{.Engine}}&from={{.From}}&to={{.To}}&text={{.OriginalText}}">Copy translation link</a></p>{{end}}
</form> </form>
<script> <script>
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0 // @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0