Commit Graph

64 Commits

Author SHA1 Message Date
1a7635ccef Add version endpoint (#146) 2024-07-25 10:51:05 -07:00
4c971f3121 Add theme support using environment variable (#145)
* Add theme support using environment variable

* Propagate theme variable to template in options.go

Propagate the `theme` variable from the environment to the template in `src/routes/options.go`

* Retrieve the `theme` variable from the environment using `os.Getenv("THEME")`
* Set the `theme` variable in the `gin.H` map when rendering the `home.html` template


---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/httpjamesm/AnonymousOverflow/pull/145?shareId=6397c9b4-9450-425c-bbbe-019425965d2b).

* Move all theme environment variable logic to a utils function

Move theme environment variable logic to a utils function and update routes to use it.

* Add `GetThemeFromEnv` function in `src/utils/theme.go` to derive the theme from environment variables and default to "auto" if not set.
* Update `src/routes/home.go` to import and use `GetThemeFromEnv` in the `GetHome` function.
* Update `src/routes/options.go` to import and use `GetThemeFromEnv` in the `ChangeOptions` function.
* Update `src/routes/question.go` to import and use `GetThemeFromEnv` in the `ViewQuestion` function.


---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/httpjamesm/AnonymousOverflow/pull/145?shareId=a0dab6f3-027c-4f6e-85fe-60e7675d0e70).

* fix: imports removed by copilot

* fix: override theme in posthome

* style: reduced repetition in themes with common vars
2024-07-25 10:50:06 -07:00
6a2ce509c1 feat: add healthcheck (#141)
* feat: add healtcheck app

Signed-off-by: rare-magma <rare-magma@posteo.eu>

* feat: add healthz endpoint

Signed-off-by: rare-magma <rare-magma@posteo.eu>

* ci: add healthcheck directive to dockerfile

Signed-off-by: rare-magma <rare-magma@posteo.eu>

---------

Signed-off-by: rare-magma <rare-magma@posteo.eu>
2024-07-03 14:40:40 -04:00
e409176642 media query theme (#139)
* feat: use css media query to derive theme

* fix: rename alt for toggle images

* feat: remove no-cache middleware
2024-06-20 00:18:22 -04:00
e278368ab7 fix: set answer ID to data-answerid value (#135) 2024-06-16 14:05:02 -04:00
80b45bf034 Support exchange shortened URLs (#133)
* feat: support shortened exchange urls

* feat: add shortener processing for exchange /a/:id conventions
2024-06-13 02:18:51 -04:00
215f24cd53 fix: scrape answer comments (#128) 2024-06-07 15:50:33 -04:00
23b8ed8899 improvement: use lang-* classes declared in snippet markup (#97)
* improvement: use lang-* classes declared in snippet markup

* fix: don't require snippet lang classes in code blocks

* fix: constrain greedy code block match
2024-03-28 19:59:28 -04:00
94032f4f90 Implement external exchanges (#99)
* Implement external exchanges

* test: translateUrl test cases

* fix: double slash bug in translateUrl

---------

Co-authored-by: httpjamesm <github@httpjames.space>
2024-03-25 13:05:24 -04:00
89126a7377 fix: keep HTML escaped (#96) 2024-03-25 12:47:59 -04:00
4c62f9bc4f feat: allow answerId in shorthand overflow URL (#91) 2024-03-09 12:09:17 -05:00
e82646635e Replace StackOverflow Links (#90)
* feat: replace stackoverflow and exchange links

* fix: replace stackoverflow.com links with path

* feat: run stack overflow link replacer on process

* feat: process HTML on comment text
2024-03-09 12:06:41 -05:00
ff66f41f47 fix: derive currentUrl from actual page path (#89) 2024-03-09 11:28:45 -05:00
42ad68fe34 refactor: highlight code blocks function 2024-03-09 11:14:39 -05:00
634c7f1ad0 docs: comments 2024-03-09 10:52:57 -05:00
4db7b4795b refactor: code-split question function 2024-03-09 10:51:09 -05:00
13418054b4 feat: separate parameter parse and validation func 2024-03-06 17:06:31 -05:00
16828585ac feat: allow stackoverflow.com/q/ in posthome (#66) 2023-09-28 13:54:13 -04:00
991b5b46f4 fix: allow option parsing if only one is present (#60) 2023-09-24 00:59:48 -04:00
669187dd4d refactor: concurrently proxy img tags (#53) 2023-08-21 02:02:12 -04:00
2ef7e05f4b Redirect-short-links (#50)
* feat: redirect shortened URLs

* feat: accept shortened URLs in converter

* fix: tell resty not to follow redirect

* fix: remove log
2023-08-21 02:01:56 -04:00
6b77c5dae4 feat: DISABLE_RATELIMIT env 2023-02-25 12:39:09 -05:00
abfd0cfb6f feat: SO/SE converter
refactor: rework some author logic
2023-02-20 14:17:24 -05:00
63a30ab1cf feat: don't count static toward ratelimit 2023-02-20 13:56:44 -05:00
f1370c29b6 fix: pass down domain to comment for author URLs 2023-02-20 13:54:09 -05:00
d935ce72f6 fix: pass domain to question template 2023-02-20 13:49:54 -05:00
45644a0503 feat: get stackexchange posts
fix: comment author distinguishing
2023-02-16 10:25:24 -05:00
c55b8b6ed5 fix: redeclare correct answer author vars 2023-02-14 20:25:16 -05:00
0968932eff fix: defer close raw response body 2023-02-14 20:16:30 -05:00
64302c9334 refactor: simplify author parsing logic 2023-02-14 20:13:24 -05:00
cc9e549aaf feat: get answer ID and fragment scrolling 2023-02-14 19:55:17 -05:00
69d96d646d feat: question tags 2023-02-04 13:40:57 -05:00
4d8632e26c fix: add no cache to static 2023-02-04 13:14:52 -05:00
eee8ec42c5 feat: hashmap with SO sort values, ssr selection 2023-02-04 13:05:10 -05:00
15b843d46b fix: remove ?url for image proxy 2023-02-02 19:15:55 -05:00
5f11bcd6a2 feat!: proxy images with JWT auth 2023-02-02 19:05:08 -05:00
d49c0f2ffd feat: display comment upvotes 2022-12-30 18:11:59 -05:00
f2b369b2c6 fix: remove length requirement 2022-12-29 14:54:05 -05:00
be9380ba20 fix: allow backwards compatibility with older threads 2022-12-29 14:47:07 -05:00
c46820b6d4 fix: add version, rolling ratelimit 2022-12-29 13:54:37 -05:00
0e9677ec61 feat: success message indicator, better UX for image toggling 2022-12-29 13:52:17 -05:00
4ddc1a2af7 feat: send human-readable error for 429 2022-12-29 13:49:19 -05:00
e476087a3a feat: validate question id and send error messages 2022-12-29 13:45:04 -05:00
e6915ae849 fix: re-add question comments 2022-12-29 13:11:33 -05:00
11efaf854d feat: comment text to HTML with sanitization 2022-12-29 13:09:25 -05:00
3b79efc83c refactor: rely heavier on the templating engine
style: fix comments spacing on mobile
2022-12-29 13:06:14 -05:00
c0df07abad refactor: use existing PreventSurroundingPre 2022-12-29 12:22:59 -05:00
10e7c89e96 feat: more escaping, tighter security 2022-12-28 23:56:14 -05:00
599d23544b feat: unify comments finder, show post comments
style: show post notices in a clean layout
2022-12-28 22:54:13 -05:00
84ba0886cd feat: show answer comments under collapsible 2022-12-28 22:48:02 -05:00