19 Commits

Author SHA1 Message Date
httpjamesm
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
Solomon
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
httpjamesm
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
httpjamesm
42ad68fe34
refactor: highlight code blocks function 2024-03-09 11:14:39 -05:00
httpjamesm
669187dd4d
refactor: concurrently proxy img tags (#53) 2023-08-21 02:02:12 -04:00
httpjamesm
abfd0cfb6f
feat: SO/SE converter
refactor: rework some author logic
2023-02-20 14:17:24 -05:00
httpjamesm
f1370c29b6
fix: pass down domain to comment for author URLs 2023-02-20 13:54:09 -05:00
httpjamesm
69d96d646d
feat: question tags 2023-02-04 13:40:57 -05:00
httpjamesm
15b843d46b
fix: remove ?url for image proxy 2023-02-02 19:15:55 -05:00
httpjamesm
5f11bcd6a2
feat!: proxy images with JWT auth 2023-02-02 19:05:08 -05:00
httpjamesm
d49c0f2ffd feat: display comment upvotes 2022-12-30 18:11:59 -05:00
httpjamesm
11efaf854d feat: comment text to HTML with sanitization 2022-12-29 13:09:25 -05:00
httpjamesm
3b79efc83c refactor: rely heavier on the templating engine
style: fix comments spacing on mobile
2022-12-29 13:06:14 -05:00
httpjamesm
c0df07abad refactor: use existing PreventSurroundingPre 2022-12-29 12:22:59 -05:00
httpjamesm
10e7c89e96 feat: more escaping, tighter security 2022-12-28 23:56:14 -05:00
httpjamesm
599d23544b feat: unify comments finder, show post comments
style: show post notices in a clean layout
2022-12-28 22:54:13 -05:00
httpjamesm
5bd9ce484f fix: escape code blocks to prevent HTML injection 2022-12-28 22:18:18 -05:00
httpjamesm
96d4f768d9 feat: syntax highlighting for question codeblocks 2022-12-28 19:10:14 -05:00
httpjamesm
631a700c9f feat: highlight code blocks within answers 2022-12-28 18:51:14 -05:00