Commit Graph

43 Commits

Author SHA1 Message Date
Alexey Yerin c792f7f570 web: reject any whitespace-only input 2021-05-11 11:32:38 +03:00
Alexey Yerin e1c610caf9 Move writeError to api.go
Web interface now uses error HTML template instead.
2021-05-10 20:10:51 +03:00
Alexey Yerin b67c4398fc web: add a nicer error page 2021-05-10 20:09:50 +03:00
Alexey Yerin 9674e124cd web: set better defaults for translation form 2021-05-10 19:39:17 +03:00
Alexey Yerin 598ca5d15e web: add "Detect language" option 2021-05-10 19:35:37 +03:00
Alexey Yerin f2cea08bea Add description meta tag 2021-05-10 18:12:35 +03:00
Alexey Yerin 4070965c76 Update description 2021-05-10 18:09:47 +03:00
Alexey Yerin 1b10a45e8a web: add placeholder for translation field 2021-05-10 17:11:22 +03:00
Alexey Yerin 56459bf680 web: don't run translation on empty text
This was causing an error when submitting nothing.
2021-05-10 17:01:47 +03:00
Alexey Yerin 77b101f877 Update layout to a more "traditional" form
Instead of using one column layout, it's now switched to two column
layout with source on one side and translation on the other side.

One column layout is still used on smaller screens.
2021-05-10 16:48:35 +03:00
Alexey Yerin ee4749e670 Update example in README
Just making it clear where --{templates,static}-dir should point to
2021-05-01 14:38:06 +03:00
Alexey Yerin 8e73e63a55 Update link formatting in README
Instead of inline links [...](), placeholder links [...][...] are used.
2021-03-15 19:50:45 +03:00
Alexey Yerin 63eb6e45f9 Remove TODO 2021-03-15 19:48:49 +03:00
Alexey Yerin 54be24d1a5 api: use fmt.Fprint/Fprintln
Honestly I didn't know it existed at the time of writing gtranslate :)
2021-03-15 19:46:21 +03:00
Alexey Yerin 3f6bdee18d web, api: terminate request on parse error
When a parser error occurs, the request is not terminated which causes
the HTML page to be dumped after the error message.
2021-03-15 19:42:17 +03:00
Alexey Yerin 1526372946 Add dark theme
It uses prefers-color-scheme CSS @media selector to determine which
theme is used.

Support table: https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme#browser_compatibility
2021-03-15 19:41:41 +03:00
Alexey Yerin 5f5936702d Web UI redesign
* Fixed up max-width
  Instead of using relative metric like 90rem, switched over to
  pixels. This also decreases the section so my browser won't struggle
  as much with it.
* Added proper outline
  Instead of using browser's default, I declare blue-ish outline
  manually.
* Add borders to elements
  Inspired by Sourcehut.
2021-03-15 19:34:37 +03:00
Alexey Yerin d551572725 readme: language selector is done 2021-02-13 21:19:58 +03:00
Kyle Anthony Williams bf49f94426 Use <select> for language selection 2021-02-04 17:27:11 +03:00
Alexey Yerin 10f6067580 Rename template-dir to templates-dir
Plural makes more sense as there are multiple templates.
2021-01-23 00:16:07 +03:00
Alexey Yerin f088cd9d5f readme: only email 2021-01-23 00:14:09 +03:00
Alexey Yerin 1a25d03b13 Update README 2021-01-23 00:13:19 +03:00
Alexey Yerin 4c82aced4b Move request handlers out of main.go 2021-01-22 23:44:50 +03:00
Alexey Yerin 0d438fb5a5 Fix sourcehut handle 2021-01-22 13:20:41 +03:00
Alexey Yerin c1fdbdcf76 Add missing public inbox link 2021-01-22 13:09:16 +03:00
Alexey Yerin fc412afdb6 Add proper Tor setup guide 2021-01-22 13:08:24 +03:00
Alexey Yerin 6feb20c8e8 Mention --proxy in Tor setup 2021-01-22 12:37:27 +03:00
Alexey Yerin 34d65c8d51 Minor updates to README 2021-01-22 12:24:29 +03:00
Alexey Yerin 73eafb0251 Remove --tor option 2021-01-22 12:20:27 +03:00
Alexey Yerin cd948c5660 Add other settings section 2021-01-18 23:34:21 +03:00
Alexey Yerin 9f3f2fbb4a Add -T option to mimic Tor Browser's User-Agent 2021-01-18 23:30:26 +03:00
Alexey Yerin e471749a85 Run go fmt 2021-01-18 23:25:57 +03:00
Alexey Yerin 202aca33bb Move request logic to a different function 2021-01-18 23:25:21 +03:00
Alexey Yerin ef9c46bdbe Pass a struct instead of settings directly 2021-01-18 23:22:20 +03:00
Alexey Yerin fc80e5334b Add --user-agent option 2021-01-18 23:09:19 +03:00
Alexey Yerin 7a297bb0d8 Add --proxy option 2021-01-18 23:02:00 +03:00
Alexey Yerin 1a32c713bc Merge api.go into main.go
It would be really painful to provide variables there
2021-01-18 22:52:33 +03:00
Alexey Yerin 4de54045cc Add TODO 2021-01-18 22:36:30 +03:00
Alexey Yerin abd67a48d5 Add missing ids to inputs 2021-01-18 22:27:05 +03:00
Alexey Yerin 9c754f8fea Refactor CSS, small style updates 2021-01-18 21:59:14 +03:00
Alexey Yerin 03cb53d0a3 Wrap command in installation instructions 2021-01-18 20:05:13 +03:00
Alexey Yerin a4fd4d7055 Add installation instructions 2021-01-17 23:49:27 +03:00
Alexey Yerin 065bd6cfb0 Initial 2021-01-17 23:19:52 +03:00