Compare commits

..

164 Commits

Author SHA1 Message Date
497abfe83f ???? 2025-03-24 01:22:20 -06:00
c812af90ad Deps 2025-03-24 01:16:24 -06:00
4547bf9f6e CORS 2025-03-24 01:15:32 -06:00
0b85919395 Deps 2025-03-24 00:58:56 -06:00
2267706737 Overhaul of stylegen 2025-03-23 03:23:45 -06:00
cff4c4715e Resume change 2025-03-14 22:30:48 -06:00
8b40a4b1c1 Switched to the OG CLI 2025-03-02 01:00:52 -06:00
0348290959 Fuck 2025-03-01 23:58:32 -06:00
caef568659 :) 2025-03-01 23:57:06 -06:00
817f317b03 Multi arch 2025-02-08 02:17:20 -06:00
355f2c5819 no 2025-02-08 02:06:20 -06:00
997f5dc540 Fix 2025-02-07 20:04:12 -06:00
33339de20a Fixed iA writer using wrong " 2025-01-29 01:44:45 -06:00
ddae816ecd New post 2025-01-29 01:28:52 -06:00
6e6207c381 Added PDSMan 2025-01-26 20:49:52 -06:00
690b902c99 Upload files to "/" 2025-01-26 23:28:10 +00:00
b6b7b58231 Updated HTMX to v2 2025-01-13 23:54:01 -06:00
237b2624b1 HTMX + Deps Updates 2025-01-12 14:47:47 -06:00
4e69bf3b50 BSKY 2025-01-12 04:20:22 -06:00
862ff8e546 Fixed formatting and added description 2025-01-11 23:08:39 -06:00
6e51164403 Oops 2025-01-04 22:23:30 -07:00
103b1219b6 Oops 2025-01-04 22:21:04 -07:00
e4028a7b5f oops 2025-01-04 21:26:57 -07:00
71633734ea README 2025-01-04 21:25:11 -07:00
62791490f6 cleaned up stylegen 2025-01-04 21:10:51 -07:00
f32ba4faf6 Updated papers section 2025-01-03 02:21:58 -07:00
546a49f550 Deps and links 2024-12-25 19:53:32 -07:00
886d6339b7 Removed air 2024-12-21 00:18:29 -07:00
99adb7ca5c new icons 2024-12-19 09:09:09 -06:00
07b5c90832 ignore 2024-12-19 02:26:20 -06:00
86b21853b3 Makefile 2024-12-18 23:55:58 -06:00
97179cfa94 Deps 2024-12-18 18:35:17 -06:00
184d20915f oop 2024-12-11 23:34:49 -07:00
259e0bd3b7 Added masto 2024-12-11 23:29:52 -07:00
ee7f3f849a :) 2024-11-25 22:59:14 -06:00
0386f55e96 Git 2024-11-23 01:32:43 -06:00
b68e1eb0b0 Pls 2024-11-22 14:17:44 -06:00
01c970a376 Docking 2024-11-22 13:39:58 -06:00
614d16c710 Docking 2024-11-22 13:37:17 -06:00
b4d6be6f78 updated workflow 2024-11-20 14:54:33 -06:00
774896fad3 new fly 2024-11-20 14:52:17 -06:00
e9ce42747a Oops again 2024-11-06 13:33:17 -06:00
41e7e50fc9 Oops! 2024-11-06 13:30:06 -06:00
4196714720 Added bluesky 2024-11-06 13:29:32 -06:00
5a58697233 Fixed HTMX import order 2024-11-06 01:31:07 -06:00
07a0816d66 Cleaned up TW binaries 2024-11-03 17:23:23 -06:00
f1be386e8b Region change 2024-11-03 13:59:37 -06:00
5b1a106b39 Removed image dependency 2024-10-31 11:37:31 -06:00
561905aabb Proper pre-loading and deps 2024-10-30 23:50:34 -06:00
24bf04aa7a Pls 2024-10-28 12:01:59 -06:00
8d29cc2b1a Pubs 2024-10-23 15:04:26 -06:00
61c969c9de Deps 2024-10-23 01:25:41 -06:00
abfee7b16d Removed talk with missing files 2024-10-23 01:25:01 -06:00
d173c828fd Added my CMPT 868 lecture 2024-10-23 01:23:59 -06:00
8f451a0177 Added my CMPT 868 lecture 2024-10-23 00:44:50 -06:00
e79fe3d9ac Optimized Dockerfile 2024-10-21 21:20:39 -06:00
bcfedb0436 Removed docker-compose 2024-10-20 22:28:01 -06:00
c709cbea06 Changed posts 2024-10-20 22:16:26 -06:00
e5fd8aa21d Auto suspend 2024-10-20 21:37:04 -06:00
e2e736e500 Swagger docs 2024-10-20 16:16:50 -06:00
3cbd0d1806 Fly fix 2024-10-19 22:24:02 -06:00
dc1f723aa7 Fly 2024-10-16 00:47:57 -06:00
3200f6d817 Nope 2024-09-23 14:28:19 -06:00
f0216d3976 Sublime baybee 2024-09-23 11:37:51 -06:00
0a0ee57171 Updated projects 2024-09-23 00:54:50 -06:00
0bcea4cf4c Wrong version 2024-09-22 16:25:31 -06:00
ce30bfcd9e Cleared up posts & fixed nav 2024-09-22 01:57:31 -06:00
07b1c3a96c Github Repo 2024-09-20 22:24:08 -06:00
23f6aec61a Github Repo 2024-09-20 22:14:47 -06:00
a6852c0163 Github Repo 2024-09-20 22:03:44 -06:00
e063a906d2 Github Repo 2024-09-20 21:58:15 -06:00
93b7b9ed68 Fixed workflow params 2024-09-20 21:29:30 -06:00
b71298a21e Fixed network 2024-09-20 02:01:52 -06:00
53143716ce Fixed network 2024-09-20 02:00:29 -06:00
70a630f359 Fixed network 2024-09-20 01:59:26 -06:00
1c54b63a6a Fixed network 2024-09-20 01:55:30 -06:00
9ed4d594d1 Added back the proxy network 2024-09-20 01:36:26 -06:00
202c3067c8 Fixed workflow 2024-09-20 01:31:33 -06:00
c03d410fdd Fixed workflow 2024-09-20 01:27:36 -06:00
e8a3bd48bf Fixed workflow 2024-09-20 01:25:09 -06:00
65468efadb Fixed workflow 2024-09-20 01:07:03 -06:00
b100ed0b09 DO Build 2024-09-20 01:04:01 -06:00
47364b586f Fixed netwok issue 2024-09-19 23:34:15 -06:00
646cda702a Proxy 2024-09-17 01:08:03 -06:00
6e32ee5573 Proxy 2024-09-17 01:06:46 -06:00
6115237f98 Fixed dependencies 2024-09-17 00:36:27 -06:00
455761e2c3 Fixed dependencies 2024-09-17 00:36:14 -06:00
706265845c Bumped go version 2024-09-14 00:14:06 -06:00
6adbdca01f README Updates 2024-09-14 00:11:23 -06:00
164a659c0f Socials 2024-09-14 00:09:15 -06:00
6053b07c6b no proxy 2024-09-08 23:56:14 -06:00
d05f2eb8a4 SINGLE BINARY BB 2024-09-08 23:44:36 -06:00
2edff6915a Removed S3 2024-09-08 23:42:36 -06:00
c0923aaf2b Swapped Git 2024-09-06 00:13:41 -06:00
5499a76ad3 Bluesky 2024-09-03 00:04:11 -06:00
9a328f8eeb Remove contract link 2024-08-26 12:44:29 -06:00
b85ccffe26 Cleaned up env vars 2024-08-22 15:22:12 -06:00
46f636854e Cleanup 2024-08-21 12:59:22 -06:00
c3e40dc826 README changes part 100000 2024-08-19 22:35:34 -06:00
76f6addc03 README changes 2024-08-19 22:30:56 -06:00
b33cc1a647 README changes 2024-08-19 22:25:56 -06:00
cf0c417c0e README changes 2024-08-19 22:23:37 -06:00
43d29792e6 Cleaned up some of the webhooks stuff 2024-08-19 22:19:57 -06:00
96dff182cd Update home.go 2024-08-10 10:52:19 -06:00
982f59ae4e Update Dockerfile 2024-08-09 09:46:54 -06:00
fdc16cc1aa Re-did homepage styling 2024-08-06 14:37:52 -06:00
631693db70 Update docker-compose.yml 2024-08-05 20:11:50 -06:00
241a793d0e Moved testimonials to S3 2024-08-05 12:40:25 -06:00
7cd6afc46c Update home.html 2024-08-03 13:07:51 -06:00
3b2294e905 removed article 2024-07-18 00:21:43 -06:00
61c3e9fb28 Dependencies! 2024-07-05 09:12:50 -06:00
2076202e3b :| 2024-06-07 15:45:11 -06:00
f357df44b9 :) 2024-06-07 15:43:27 -06:00
c9f12a1b34 Home page does not need hyperscript! 2024-06-04 23:40:56 -06:00
e57121715e Cleaned up a bit 2024-06-04 16:07:13 -06:00
e668d62b57 :D 2024-06-04 15:48:31 -06:00
924906431f Simplified the SSE system! 2024-06-04 15:40:29 -06:00
b1d82ca609 Back to GitHub 2024-06-03 17:22:32 -06:00
a982ade417 Fuck self hosting 2024-06-03 16:34:56 -06:00
0f0057805b Oops 2024-06-03 15:43:28 -06:00
008fccfb82 Docker compose issue 2024-06-03 15:25:03 -06:00
60d4a569a0 Dependency Updates 2024-06-03 15:17:58 -06:00
efb316aacb Remove spotify 2024-06-03 15:16:53 -06:00
7ed6dcbcff Deps 2024-06-02 23:43:22 -06:00
f1ee39d90f Deps 2024-05-25 01:00:45 -06:00
cf136bc9bf Updated stuff I use 2024-05-23 15:46:08 -06:00
a04f883f93 Updated fedi 2024-05-22 23:10:29 -06:00
b2b8708760 Updated git logo and link 2024-05-21 11:53:15 -06:00
881b5f8ee8 Update pages/projects.go 2024-05-15 19:19:32 +00:00
cfd92e196d Update api/webhooks/clerk.go 2024-05-15 19:11:22 +00:00
e27d19552f Deps 2024-05-15 09:15:56 -06:00
29cad5a0b2 Apparently I don't understand docker 2024-05-15 00:48:03 -06:00
dfa6fd0af6 Update with network so it doesn't break on re-deploy 2024-05-15 00:42:35 -06:00
f0c878f67e Fixed git integration 2024-05-15 00:09:47 -06:00
6f4fc38d7c How did this get through???? 2024-05-14 22:50:25 -06:00
cd3a539243 Fixed SSE 2024-05-14 22:03:39 -06:00
6f47a15d29 JK 2024-05-14 21:59:21 -06:00
979a67a329 Again! 2024-05-14 21:47:24 -06:00
a9caa1cb24 FOUND IT HOLY SHIT YES 2024-05-14 20:57:59 -06:00
d30c6c9498 I hate NGINX 2024-05-14 20:46:36 -06:00
78133f6519 This time for sure 2024-05-14 20:41:45 -06:00
fae28be16f ugh 2024-05-14 19:13:04 -06:00
cd56d16ae4 >.< 2024-05-14 19:06:08 -06:00
b5b7ef732f COMPOSE 2024-05-14 00:44:17 -06:00
a4b34d4943 Docker-ify? 2024-05-14 00:00:28 -06:00
44df2533c8 No really... this time for real now. 2024-05-09 14:32:19 -06:00
3374ed3bac OK this time for realzies 2024-05-09 01:28:11 -06:00
bc3a365dea Im real bad at this whole goroutine mutex shit but getting better! 2024-05-08 15:05:12 -06:00
8fed511607 Logging and deps 2024-05-08 14:43:57 -06:00
994a2fabd6 More message fixes 2024-05-08 01:13:39 -06:00
00bb8d776d Re-worked stylegen 2024-05-07 18:03:54 -06:00
7463d1a252 Incoming message handling fix 2024-05-06 01:23:05 -06:00
ec04d36559 docs 2024-05-02 15:03:22 -06:00
cdb51bac86 Fixed edge case where a message is being processed while a client is disconnecting. 2024-05-02 14:55:28 -06:00
595802158e Codeberg time baybeeeee 2024-05-01 15:26:58 -06:00
35b8f01728 Update README.md 2024-05-01 04:28:59 +00:00
2f3ab217bd Deps 2024-04-27 21:55:11 -06:00
768642e363 Whoops! 2024-04-24 16:16:27 -06:00
e7e669107f Fix 2024-04-24 16:13:03 -06:00
31d7438bbd Just kidding here it is! 2024-04-24 16:07:29 -06:00
cf64ab18e8 Article time! 2024-04-24 16:07:06 -06:00
4aa0793f73 Deps 2024-04-24 00:50:25 -06:00
0e1f3fc0a9 Masto change 2024-04-23 23:52:57 -06:00
91020231f8 Updated URL 2024-04-23 22:13:30 -06:00
116 changed files with 3253 additions and 2355 deletions

View File

@ -1,46 +0,0 @@
root = "."
testdata_dir = "testdata"
tmp_dir = "tmp"
[build]
args_bin = ["-ip", "127.0.0.1", "-port", "3000"]
bin = "./tmp/main"
pre_cmd = []
cmd = "go build -o ./tmp/main . & cd lib/stylegen && ./gen.sh"
delay = 1000
exclude_dir = ["assets", "tmp", "vendor", "testdata", "lib/stylegen"]
exclude_file = []
exclude_regex = ["_test.go"]
exclude_unchanged = false
follow_symlink = false
full_bin = ""
include_dir = []
include_ext = ["go", "tpl", "tmpl", "html", "css"]
include_file = []
kill_delay = "0s"
log = "build-errors.log"
poll = false
poll_interval = 0
post_cmd = []
rerun = false
rerun_delay = 500
send_interrupt = false
stop_on_error = false
[color]
app = ""
build = "yellow"
main = "magenta"
runner = "green"
watcher = "cyan"
[log]
main_only = false
time = false
[misc]
clean_on_exit = false
[screen]
clear_on_rebuild = false
keep_scroll = true

View File

@ -3,6 +3,5 @@
**/airbin **/airbin
**/tmp **/tmp
**/*.rdb **/*.rdb
stylegen
fly.toml fly.toml
tailwind.config.*.js tailwind.config.*.js

View File

@ -1,16 +0,0 @@
CLERK_SECRET_KEY=""
CLERK_WEBHOOK_SECRET=""
SMTP_HOST=""
SMTP_PORT=""
SMTP_USERNAME=""
SMTP_PASSWORD=""
STRIPE_SECRET_KEY=""
REDIS_URL=""
BUCKET_NAME=
AWS_REGION=
AWS_ENDPOINT_URL_S3=
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
SPOTIFY_CLIENT_ID=
SPOTIFY_CLIENT_SECRET=
SPOTIFY_REFRESH_TOKEN=

35
.github/workflows/deploy.yml vendored Normal file
View File

@ -0,0 +1,35 @@
name: Docker Deploy
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Container Registry
uses: docker/login-action@v2
with:
registry: ${{ secrets.REPO_HOST }}
username: ${{ github.repository_owner }}
password: ${{ secrets.DEPLOY_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ secrets.REPO_HOST }}/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ github.sha }}
${{ secrets.REPO_HOST }}/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest

4
.gitignore vendored
View File

@ -1,7 +1,9 @@
atri.dad atri.dad
main
.env .env
airbin airbin
tmp/ tmp/
*.rdb *.rdb
.DS_Store .DS_Store
tailwind.config.*.js tailwind.config.js
lib/stylegen/tw

View File

@ -1,8 +0,0 @@
{
"recommendations": [
"golang.go",
"bradlc.vscode-tailwindcss",
"redhat.vscode-yaml",
"a-h.templ"
]
}

44
Dockerfile Normal file
View File

@ -0,0 +1,44 @@
FROM --platform=$BUILDPLATFORM golang:1.24.0-alpine AS builder
WORKDIR /app
# Download dependencies and install required tools
COPY go.mod go.sum ./
RUN go mod download && \
go install github.com/swaggo/swag/cmd/swag@latest
# Copy source code and Makefile
COPY . .
# Install required tools and make scripts executable
RUN apk add --no-cache upx make bash && \
chmod +x /app/lib/stylegen/gen.sh
# Create necessary directories
RUN mkdir -p /app/public/css
# Generate assets and build with optimizations
SHELL ["/bin/bash", "-c"]
# Platform-specific builds
ARG TARGETPLATFORM
RUN cd /app && make generate && \
case "${TARGETPLATFORM}" in \
"linux/amd64") GOARCH=amd64 ;; \
"linux/arm64") GOARCH=arm64 ;; \
*) GOARCH=amd64 ;; \
esac && \
CGO_ENABLED=0 GOOS=linux GOARCH=${GOARCH} go build \
-ldflags='-s -w -extldflags "-static"' \
-tags netgo,osusergo \
-o /go/bin/app
# Final stage
FROM --platform=$TARGETPLATFORM scratch
# Copy static files and assets
COPY --from=builder /app/public/css/styles.css /public/css/styles.css
COPY --from=builder /app/docs /docs
COPY --from=builder /go/bin/app /app
ENTRYPOINT ["/app"]

232
LICENSE Normal file
View File

@ -0,0 +1,232 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for software and other kinds of works.
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and modification follow.
TERMS AND CONDITIONS
0. Definitions.
“This License” refers to version 3 of the GNU General Public License.
“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
A “covered work” means either the unmodified Program or a work based on the Program.
To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
1. Source Code.
The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
7. Additional Terms.
“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
11. Patents.
A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
gpl
Copyright (C) 2025 atridad
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
gpl Copyright (C) 2025 atridad
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/philosophy/why-not-lgpl.html>.

134
Makefile Normal file
View File

@ -0,0 +1,134 @@
# Emoji
CHECK :=
BUILD := 🔨
CLEAN := 🧹
RUN := 🚀
CSS := 🎨
TEST := 🧪
DOCKER := 🐳
WARN := ⚠️
DOCS := 📚
# Variables
BINARY_NAME := atri.dad
DOCKER_IMAGE := atri-dot-dad
GO_FILES := $(wildcard *.go)
CSS_INPUT := lib/stylegen/base.css
CSS_OUTPUT := public/css/styles.css
# Docker detection
DOCKER_ENV := $(shell if [ -f /.dockerenv ]; then echo true; else echo false; fi)
ifeq ($(DOCKER_ENV),true)
BASE_PATH := /app
else
BASE_PATH := $(CURDIR)
endif
.PHONY: all build clean run dev stylegen docker-dev docker-build docker-run test help reset ensure-swag
help:
@echo "Available commands:"
@echo "make clean - Remove build artifacts"
@echo "make reset - Clean and reset the project to initial state"
@echo "make build - Generate CSS, docs, and build Go binary"
@echo "make run - Build and run the binary"
@echo "make dev - Run in development mode"
@echo "make docker-dev - Run development environment in Docker"
@echo "make docker-run - Run production container"
@echo "make test - Run tests"
@echo "make prod - Full production build"
# Check if swag is installed
ensure-swag:
@command -v swag >/dev/null 2>&1 || { \
echo "$(WARN) Swagger CLI (swag) is not installed. Installing..."; \
go install github.com/swaggo/swag/cmd/swag@latest; \
}
reset:
@echo "$(CLEAN) Performing complete project reset..."
@rm -f $(BINARY_NAME)
@rm -f $(CSS_OUTPUT)
@rm -rf public/css/*
@rm -f tailwind.config.js
@rm -rf docs/docs.go docs/swagger.json docs/swagger.yaml
@go clean -cache -testcache -modcache
@rm -rf $(BASE_PATH)/tw # Remove the 'tw' directory
@echo "$(CHECK) Project reset complete"
clean:
@echo "$(CLEAN) Cleaning build artifacts..."
@rm -f $(BINARY_NAME)
@rm -f $(CSS_OUTPUT)
@rm -rf $(BASE_PATH)/lib/stylegen/tw # Remove the 'tw' directory
@echo "$(CHECK) Cleanup complete"
stylegen:
@echo "$(CSS) Generating CSS styles..."
@echo "Current working directory: $$(pwd)"
@echo "Contents of current directory:"
@ls -la
@echo "\nContents of lib/stylegen:"
@ls -la lib/stylegen
@chmod +x $(BASE_PATH)/lib/stylegen/gen.sh
@$(BASE_PATH)/lib/stylegen/gen.sh \
-e "html" \
-d "$(BASE_PATH)/pages/templates" \
-o "$(BASE_PATH)/public/css"
@echo "$(CHECK) CSS generation complete"
swaggergen: ensure-swag
@echo "$(DOCS) Generating Swagger documentation..."
@swag init
@echo "$(CHECK) Swagger docs generated"
# Combined generation target
generate: stylegen swaggergen
build: generate
@echo "$(BUILD) Building binary..."
@go build -o $(BINARY_NAME)
@echo "$(CHECK) Build complete: $(BINARY_NAME)"
test:
@echo "$(TEST) Running tests..."
@go test ./...
@echo "$(CHECK) Tests complete"
dev: generate
@echo "$(RUN) Starting development server..."
@go run main.go
run: build
@echo "$(RUN) Running server..."
@./$(BINARY_NAME)
docker-dev:
@echo "$(DOCKER) Starting development container..."
@docker-compose -f docker-compose.dev.yml up --build
docker-build: generate
@echo "$(DOCKER) Building production Docker image..."
@docker build -t $(DOCKER_IMAGE) .
@echo "$(CHECK) Docker image build complete"
docker-run: docker-build
@echo "$(DOCKER) Running production container..."
@docker-compose up
deps:
@echo "$(BUILD) Installing dependencies..."
@go mod download
@go install github.com/swaggo/swag/cmd/swag@latest
@echo "$(CHECK) Dependencies installed"
fmt:
@echo "$(BUILD) Formatting code..."
@go fmt ./...
@echo "$(CHECK) Code formatting complete"
# Full production build
prod: clean generate build
@echo "$(CHECK) Production build complete"
.DEFAULT_GOAL := help

View File

@ -4,21 +4,18 @@ This is my personal website!
## Stack: ## Stack:
- Backend: Golang + Echo - Backend: Golang + Echo
- Rendering: Golang templates - Rendering: Golang templates
- Style: TailwindCSS + DaisyUI (No JS Needed) - Style: TailwindCSS + DaisyUI
- Content format: Markdown - Content format: Markdown
## Requirements: ## Requirements:
- Golang 1.22.0 - Golang 1.23.1
## Instructions: ## Getting Started
1. Run go get 1. Clone this repository
2. Duplicate the .env.example file and call it .env 2. Copy `.env.example` to `.env`
3. Fill out the .env values 3. Run `go mod download`
4. Run ```go install github.com/cosmtrek/air@latest``` to download Air for live reload 4. Start the server: `go run main.go`
5. Run ```air``` to start the dev server
_Note that on MacOS, you need to right click and open the appropriate tailwind executable before you can run StyleGen. This is a limitation of running unsigned binaries in MacOS. Blame Tim Apple._ ## API Documentation
1. Install swag by running ```go install github.com/swaggo/swag/cmd/swag@latest```
## Tests 2. Visit `/api/swagger/index.html` after starting the server
Without Coverage: `go test atri.dad/lib`
With Coverage: `go test atri.dad/lib -cover`

View File

@ -1,42 +0,0 @@
package api
import (
"net/http"
"os"
"strings"
"github.com/clerkinc/clerk-sdk-go/clerk"
"github.com/labstack/echo/v4"
)
func Authed(c echo.Context) error {
apiKey := os.Getenv("CLERK_SECRET_KEY")
client, err := clerk.NewClient(apiKey)
if err != nil {
// handle error
println(err.Error())
}
// get session token from Authorization header
sessionToken := c.Request().Header.Get("Authorization")
sessionToken = strings.TrimPrefix(sessionToken, "Bearer ")
println(sessionToken)
// verify the session
sessClaims, err := client.VerifyToken(sessionToken)
if err != nil {
println(err.Error())
return c.String(http.StatusUnauthorized, "Unauthorized!")
}
// get the user, and say welcome!
user, err := client.Users().Read(sessClaims.Claims.Subject)
if err != nil {
panic(err)
}
return c.String(http.StatusOK, "Welcome "+*user.FirstName)
}

View File

@ -6,6 +6,14 @@ import (
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
) )
// Ping godoc
// @Summary Ping the server
// @Description Get a pong response
// @Tags ping
// @Accept json
// @Produce json
// @Success 200 {string} string "Pong!"
// @Router /ping [get]
func Ping(c echo.Context) error { func Ping(c echo.Context) error {
return c.String(http.StatusOK, "Pong!") return c.String(http.StatusOK, "Pong!")
} }

View File

@ -6,6 +6,14 @@ import (
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
) )
// PostCopy godoc
// @Summary Get copy icon SVG
// @Description Returns an SVG of a copy icon
// @Tags post
// @Accept json
// @Produce html
// @Success 200 {string} string "SVG content"
// @Router /post/copy [get]
func PostCopy(c echo.Context) error { func PostCopy(c echo.Context) error {
return c.String(http.StatusOK, `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-copy"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`) return c.String(http.StatusOK, `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-copy"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`)
} }

View File

@ -1,5 +1,14 @@
package api package api
// RSSFeedHandler godoc
// @Summary Get RSS feed
// @Description Returns an RSS feed of blog posts
// @Tags rss
// @Accept json
// @Produce xml
// @Success 200 {string} string "RSS feed content"
// @Failure 500 {string} string "Internal Server Error"
// @Router /rss [get]
import ( import (
"io/fs" "io/fs"
"net/http" "net/http"

View File

@ -1,30 +0,0 @@
package api
import (
"net/http"
"os"
"atri.dad/lib"
"github.com/labstack/echo/v4"
)
func NowPlayingHandler(c echo.Context) error {
clientID := os.Getenv("SPOTIFY_CLIENT_ID")
clientSecret := os.Getenv("SPOTIFY_CLIENT_SECRET")
refreshToken := os.Getenv("SPOTIFY_REFRESH_TOKEN")
playing, err := lib.GetCurrentlyPlayingTrack(clientID, clientSecret, refreshToken)
if err != nil {
http.Error(c.Response().Writer, err.Error(), http.StatusInternalServerError)
return err
}
if playing.Item != nil && playing.Playing {
songName := lib.NowPlayingTextFilter(playing.Item.Name)
artistName := lib.NowPlayingTextFilter(playing.Item.Artists[0].Name)
return c.String(http.StatusOK, `<div class="indicator-item badge badge-success"><a _='on mouseover put "🔥 Listening to `+songName+" by "+artistName+` 🔥" into my.textContent on mouseout put "🔥" into my.textContent' href="`+playing.Item.ExternalURLs["spotify"]+`" rel="noreferrer" target="_blank">🔥</a></div>`)
} else {
return c.String(http.StatusOK, "")
}
}

View File

@ -1,19 +1,24 @@
package api package api
import ( import (
"errors"
"fmt" "fmt"
"net/http"
"time"
"atri.dad/lib" "atri.dad/lib"
"atri.dad/lib/pubsub"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
) )
func SSE(c echo.Context, pubSub pubsub.PubSub) error { // SSE godoc
if pubSub == nil { // @Summary Server-Sent Events endpoint
return errors.New("pubSub is nil") // @Description Establishes a Server-Sent Events connection
} // @Tags sse
// @Accept json
// @Produce text/event-stream
// @Param channel query string false "Channel name"
// @Success 200 {string} string "Event stream"
// @Router /sse [get]
func SSE(c echo.Context) error {
channel := c.QueryParam("channel") channel := c.QueryParam("channel")
if channel == "" { if channel == "" {
channel = "default" channel = "default"
@ -22,25 +27,67 @@ func SSE(c echo.Context, pubSub pubsub.PubSub) error {
// Use the request context, which is cancelled when the client disconnects // Use the request context, which is cancelled when the client disconnects
ctx := c.Request().Context() ctx := c.Request().Context()
pubsub, err := pubSub.SubscribeToChannel(channel) // Set headers for SSE
if err != nil { c.Response().Header().Set("Content-Type", "text/event-stream")
return fmt.Errorf("failed to subscribe to channel: %w", err) c.Response().Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
c.Response().Header().Set("Connection", "keep-alive")
c.Response().Header().Set("Pragma", "no-cache")
c.Response().Header().Set("Expires", "0")
c.Response().Header().Set("X-Accel-Buffering", "no")
// Set CORS headers
origin := c.Request().Header.Get("Origin")
if origin == "https://atri.dad" || origin == "http://localhost:3000" {
c.Response().Header().Set("Access-Control-Allow-Origin", origin)
c.Response().Header().Set("Access-Control-Allow-Credentials", "true")
} else {
// Allow any origin as fallback for testing
c.Response().Header().Set("Access-Control-Allow-Origin", "*")
} }
lib.SetSSEHeaders(c) // Set response status
c.Response().WriteHeader(http.StatusOK)
c.Response().Flush()
// Create a client channel and add it to the SSE server // Create a channel to receive messages
client := make(chan string) clientChan := make(chan string)
lib.SSEServer.AddClient(channel, client)
defer lib.SSEServer.RemoveClient(channel, client)
go lib.HandleIncomingMessages(c, pubsub, client) // Add the client to the SSEServer
lib.SSEServer.AddClient(channel, clientChan)
// Clean up when the connection is closed
defer lib.SSEServer.RemoveClient(channel, clientChan)
// Write the initial message
initialMsg := ": connected\n\n"
if _, err := c.Response().Write([]byte(initialMsg)); err != nil {
return err
}
c.Response().Flush()
// Create a ticker for keep-alive messages
ticker := time.NewTicker(15 * time.Second)
defer ticker.Stop()
// Event loop
for { for {
select { select {
case <-ctx.Done(): case <-ctx.Done():
// If the client has disconnected, stop the loop // Client disconnected
return nil return nil
case <-ticker.C:
// Send keep-alive comment
if _, err := c.Response().Write([]byte(": ping\n\n")); err != nil {
return err
}
c.Response().Flush()
case msg := <-clientChan:
// Format the SSE message
data := fmt.Sprintf("data: %s\n\n", msg)
if _, err := c.Response().Write([]byte(data)); err != nil {
return err
}
c.Response().Flush()
} }
} }
} }

View File

@ -1,26 +0,0 @@
package api
import (
"net/http"
"atri.dad/lib"
"github.com/labstack/echo/v4"
)
type PayRequest struct {
SuccessUrl string `json:"successUrl"`
CancelUrl string `json:"cancelUrl"`
PriceId string `json:"priceId"`
}
func Pay(c echo.Context) error {
payReq := new(PayRequest)
if err := c.Bind(payReq); err != nil {
return c.JSON(http.StatusBadRequest, map[string]string{"error": "Invalid request payload"})
}
lib.CreateCheckoutSession(c.Response().Writer, c.Request(), payReq.SuccessUrl, payReq.CancelUrl, payReq.PriceId)
return c.String(http.StatusOK, "Checkout session created")
}

View File

@ -9,6 +9,19 @@ import (
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
) )
// ResizeHandler godoc
// @Summary Resize an image
// @Description Resizes an uploaded image to specified dimensions
// @Tags tools
// @Accept mpfd
// @Produce png
// @Param image formData file true "Image file to resize"
// @Param width formData int true "Target width"
// @Param height formData int true "Target height"
// @Success 200 {file} binary "Resized image"
// @Failure 400 {string} string "Bad request"
// @Failure 500 {string} string "Internal server error"
// @Router /tools/resize [post]
func ResizeHandler(c echo.Context) error { func ResizeHandler(c echo.Context) error {
// Extract file from request // Extract file from request

View File

@ -4,11 +4,21 @@ import (
"net/http" "net/http"
"atri.dad/lib" "atri.dad/lib"
"atri.dad/lib/pubsub"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
) )
func SSEDemoSend(c echo.Context, pubSub pubsub.PubSub) error { // SSEDemoSend godoc
// @Summary Send SSE message
// @Description Sends a message to a specified SSE channel
// @Tags sse,tools
// @Accept json
// @Produce json
// @Param channel query string false "Channel name"
// @Param message query string false "Message to send"
// @Success 200 {object} map[string]string
// @Failure 400 {object} map[string]string
// @Router /tools/sendsse [post]
func SSEDemoSend(c echo.Context) error {
channel := c.QueryParam("channel") channel := c.QueryParam("channel")
if channel == "" { if channel == "" {
channel = "default" channel = "default"
@ -31,7 +41,8 @@ func SSEDemoSend(c echo.Context, pubSub pubsub.PubSub) error {
return c.JSON(http.StatusBadRequest, map[string]string{"error": "message parameter is required"}) return c.JSON(http.StatusBadRequest, map[string]string{"error": "message parameter is required"})
} }
lib.SendSSE(c.Request().Context(), pubSub, "default", message) // Send message
lib.SSEServer.SendSSE(channel, message)
return c.JSON(http.StatusOK, map[string]string{"status": "message sent"}) return c.JSON(http.StatusOK, map[string]string{"status": "message sent"})
} }

View File

@ -1,78 +0,0 @@
package webhooks
import (
"encoding/json"
"io"
"net/http"
"os"
"atri.dad/lib"
"github.com/labstack/echo/v4"
svix "github.com/svix/svix-webhooks/go"
)
// Types
type ClerkEventEmail struct {
EmailAddress string `json:"email_address"`
}
type ClerkEventData struct {
EmailAddresses []ClerkEventEmail `json:"email_addresses,omitempty"`
Id string `json:"id"`
}
type ClerkEvent struct {
Data ClerkEventData
Type string
}
// Event Handlers
func userCreatedHandler(event ClerkEvent) {
welcomeEmail := `
<h1>Thank you for making an atri.dad account!</h1>
<h2>There are a number of apps this account give you access to!</h2>
<br/>
<ul>
<li>Atash Demo: https://atash.atri.dad/</li>
<li>Commodore: https://commodore.atri.dad/</li>
</ul>
`
lib.SendEmail(event.Data.EmailAddresses[0].EmailAddress, "apps@atri.dad", "Atri's Apps", welcomeEmail, "Welcome to Atri's Apps!")
}
// Main Handler/Router
func ClerkWebhookHandler(c echo.Context) error {
secret := os.Getenv("CLERK_WEBHOOK_SECRET")
wh, err := svix.NewWebhook(secret)
if err != nil {
return c.String(http.StatusBadRequest, "Unknown Validation Error")
}
headers := c.Request().Header
payload, err := io.ReadAll(c.Request().Body)
if err != nil {
return c.String(http.StatusBadRequest, "Failed to read request body!")
}
err = wh.Verify(payload, headers)
if err != nil {
return c.String(http.StatusBadRequest, "Cannot validate webhook authenticity!")
}
var parsed ClerkEvent
err = json.Unmarshal(payload, &parsed)
if err != nil {
return c.String(http.StatusBadRequest, "Invalid Json!")
}
switch parsed.Type {
case "user.created":
userCreatedHandler(parsed)
}
return c.String(http.StatusOK, "Success!")
}

View File

@ -1,18 +0,0 @@
---
name: "Thoughts on Cognitive Load and Programming Language Syntax"
date: "February 07 2024"
tags: ["article","thoughts"]
---
Recently, I started to pick up a new language in my spare time: Go. Was it partially influenced by the surge in HTMX popularity and how often Go is used alongside it? Almost certainly. But at some point along this journey, I noticed something: This is _so_ much more fun and _so_ much less draining. This whole post won't be me gushing about how much I love Go as a language, not directly. I started to notice a few things...
# Oh, what fun...
I come from the JavaScript and TypeScript world with frameworks like Remix and Next.js. And the DX (Developer Experience) for these is lovely! For reasons I could not quite pin down, I was having much more fun with Go + HTMX despite the hacks to get close to the same DX. It came down to how darn easily I could pull off things I had previously relied on services for. Need a message queue to run on the edge? Easy, write a wrapper over Redis to use its PubSub. Need real-time updates to the UI? No problem, write a basic Server-Sent Events system with subscriptions and channels. Anything I wanted, I could build. That, and the way concurrency _"just works"_, and I could make anything I wanted happen. This brings a level of satisfaction that is hard to convey in an article.
# What changed?
So this isn't meant to be a post to bash JavaScript, as much as I do have my reservations about the language. That being said, JS makes basic things like concurrency an afterthought. Go's lightweight threads, called goroutines, make it easy to write concurrent programs without worrying about the overhead of heavyweight threads. Even better, Go has channels that provide a simple and effective way of synchronizing communication between goroutines, making it easier to write concurrent programs free from race conditions. Similar concepts are present in Java, Rust (Tokio), C#, etc. Even better, error handling! Now, this is controversial, but forcing errors to be valued and allowing functions to assert that there _may_ be errors is a game changer for writing safer code. All of this amounts to a much lower cognitive load. I am less worried that my code is inefficient, error-prone, etc. I can just _write_.
# What does this mean?
As a field, we can and should investigate and identify key points in programming languages that increase or decrease the mental load or overhead for developers. Imagine if we could identify these points and work to reduce the overhead. This has been on my mind as I reflect on my experience learning Go. I want to dive deeper into the details of what we can do to reduce this overhead and get back to writing good software without unnecessary restrictions.
# Thanks!
Do you have any thoughts on this? Do you want to have a chat about the topic? Feel free to reach out by email at [me@atri.dad](mailto:me@atri.dad). Until next time! 🫡

View File

@ -0,0 +1,18 @@
---
name: "Current List of Favourite Tools"
description: "A periodically updated list of tools I use day-to-day."
date: "January 28 2025"
tags: ["tools","list"]
---
I change what I use _constantly_ in order to find something that feels just right. I wanted to share them here and update them here so when someone asks, I can just point them to this article.
1. Sublime Text - Currently my favourite text editor. Fast, simple, and extensible. Just a joy to use!
2. Sublime Merge - Honestly one of the fastest and best looking git GUIs around! Awesome for visualizing changes when you have larger code changes.
3. Ghostty - A Zig based terminal emulator by one of the founders of Hashicorp. Runs great on MacOS and Linux. No windows for those who are into that.
4. OrbStack - A faster alternative to Docker Desktop that also runs VMs!
5. Bitwarden - An open-source password manager. Easy to self host with Vaultwarden and with the recent updates, it has SSH Agent support!
6. iA Writer - A minimalist Markdown editor. For MacOS and Windows only, but really the MacOS version is the most mature. Awesome for focus.
7. Dataflare - A simple but powerful cross-platform database client. Supports most common databases, including LibSQL which is rare!
8. Bruno - A simple and powerful API client, similar to Postman. An critical tool to debug API endpoints.
I hope you found this helpful! This will be periodically updated to avoid outdated recommendations.

View File

@ -1,78 +0,0 @@
---
name: "Introducing the GOTH Stack"
date: "January 08 2024"
tags: ["article","golang"]
---
# Enter the GOTH Stack!
The GOTH stack is something I've been trying to get to for a while now. It's not a specific repository with a fancy command that can scaffold a project for you. It's more like a set of pillars for building excellent, pleasant, full-stack web applications.
# The first pillar: Go
Go is something I learned to love later on in my career. I was mainly writing JavaScript, building on serverless platforms and growing frustrated at the performance and limitations. Go changed all of that.
What makes Go good?:
- Static types
- Incredibly easy concurrency
- Errors as values
- Incredible runtime and build time performance
- Tiny memory footprint
The tl;dr is that it is challenging to write Go code that is _not_ performant.
# The second pillar: Templates... well... Go templates
Go templates surprised me, to be completely honest. They offer just enough to get me going and perform exceptionally well. Sure, it's not as simple as a basic JSX file in Next.js since you need to make a route handler, but it works pretty well and supports basic control flow. I am interested in looking into alternatives such as TEMPL (which reads much like JSX for Go), but I need to find a real reason to move from the standard library here.
Here is an example of a route handler passing a slice over to a template for rendering:
```go
package pages
import (
"HTML/template"
"github.com/labstack/echo/v4"
"goth.stack/lib"
)
type HomeProps struct {
Socials []lib.IconLink
Tech []lib.IconLink
ContractLink string
ResumeURL string
SupportLink string
}
func Home(c echo.Context) error {
socials := []lib.IconLink{
{
Name: "Email",
Href: "mailto:example@site.com",
Icon: template.HTML(`<svg xmlns="http://www.w3.org/2000/svg" height="32" width="32" viewBox="0 0 512 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2023 Fonticons, Inc.--><path d="M48 64C21.5 64 0 85.5 0 112c0 15.1 7.1 29.3 19.2 38.4L236.8 313.6c11.4 8.5 27 8.5 38.4 0L492.8 150.4c12.1-9.1 19.2-23.3 19.2-38.4c0-26.5-21.5-48-48-48H48zM0 176V384c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V176L294.4 339.2c-22.8 17.1-54 17.1-76.8 0L0 176z"/></svg>`),
},
}
props := HomeProps{
Socials: socials,
Tech: tech,
ContractLink: "mailto:example@site.com",
ResumeURL: "https://srv.goth.stack/Atridad_Lahiji_Resume.pdf",
SupportLink: "https://donate.stripe.com/8wMeVF25c78L0V2288",
}
// Specify the partials used by this page
partials := []string{"header", "navitems"}
// Render the template
return lib.RenderTemplate(c.Response().Writer, "base", partials, props)
}
```
As you can see, it really isn't that bad! It also comes with many of the benefits of Go and the flexibility of components!
# The third pillar: HTMX
So, up to this point, you may have been thinking: "Gee Atri... you can't do anything reactive here". Before HTMX, you would have been right. HTMX offers a more backend-centric developer a way to build complex reactivity to their front end through basic templating languages. It is one file you import in your template, and it enables anything from basic HTML swapping to WebSocket and Server-Sent Event support. It is really, really powerful and worth looking at all together.
With Go managing route handlers and API routes, the template language running the UI, and HTMX governing interactivity on the front end, you can effectively write a fully dynamic full-stack application without writing a line of JavaScript code. It even runs quite a bit faster than some of the JS world's frameworks (Astro, for instance). It is actually what powers this site right now! The fundamentals are essential here and come together for a clean and enjoyable developer experience. I encourage everyone in the JS world to give it a shot! Perhaps it is not your thing, and that's okay! But you might also just fall in love with it!
# Giving It A Shot
I have a [repository](https://github.com/atridadl/goth.stack) as well as a [demo](https://goth-stack.fly.dev/) ready to go with everything you need to start!
# Thanks!
If you found this helpful, please let me know by email at [me@atri.dad](mailto:me@atri.dad). Until next time!

View File

@ -1,28 +0,0 @@
---
name: "Build Scalable Real-time Applications on Fly.io + Remix!"
date: "December 04 2023"
tags: ["remix.js", "fly.io", "article"]
---
# Scalability... what is it?
You often think of vertical scaling for something to scale, adding more resources to whatever issue you encounter (CPU, RAM, etc.). While this is the simplest way to scale an application or service, it can only get you so far. Horizontal scaling involves adding more machines or "nodes" running the same application. These nodes sit behind a load balancer responsible for directing client traffic to the appropriate machine to optimize load. This will work well if the application is meant to do simple CRUD operations for individual users. What if you need collaboration in real time? This complicates things...
# The real-time problem:
Real-time applications require a pub/sub or publish and subscribe model. A client will send a request to the application to perform an operation. Once done, the server will broadcast an event to all subscribing clients to trigger a re-fetch of data. In the case of a multi-node application, you need to use a service outside of your nodes to synchronize messages across all nodes.
# The stack:
For this stack, I chose Remix for its close adherence to web standards and easy support for server-sent events. These web socket connections work one way: from server to client. Next, we must synchronize all Server Sent events across different requests to a single node. For this, Node.js has its own Event Emitter API, which we can use. Now, we can use something like Redis and its Pub/Sub commands for multi-node setups to broadcast across nodes.
This is what it would look like:
![Diagram](https://link.storjshare.io/s/jwmhimh32pura4pyr5h5luou6qla/atridad%2Farticles/scalability.png?wrap=0)
# How does it work?
Once a client connects to a page with real-time enabled, a persistent connection via EventStreams is made. The client would request to make a real-time update. Once the endpoint completes the request, it triggers a Node.js event, which the EventStreams endpoint listens to. Once received, the application sends an event down to the client via a server-sent event while also passing that request on to Redis pub/sub. Every node listens to this Redis event stream, so every node will receive the event and trigger the event using Node.js events, which then start server-sent events.
As you can see, there are many moving parts here, and it can get quite complicated. I have a repo called Atash, which acts as a template to get started. You can check it out [here](https://atash.atri.dad)!
If you found this helpful, please let me know by email at [me@atri.dad](mailto:me@atri.dad). Until next time!

View File

@ -1,18 +0,0 @@
---
name: "Thoughts on AI"
date: "April 09 2024"
tags: ["article","thoughts"]
---
I'm a bit late to the party, but AI has definitely taken off lately. Every product we use now seems to have some sort of AI integration or feature baked in to capture some of the hype. How do I feel about it? Well… thats complicated...
# Memes
If you dig around my GitHub you'll surely stuble upon Himbot, my Discord bot project. This is where I enjoy AI. For memes. I have two commands: "ask" and "pic" which generate text and images respectively. Now, I didn't write some complex algorithm for this. It uses Replicate to access open source models. As it turns out, this makes the bot quite fun. Have an unhinged discord conversation that needs image replies, just throw some no-context nonsense into "/pic" and see what happens! Its amazing! This, however, is where my love of it ends.
# Capitalism
Capitalism ruins all things. Including AI. Now what could be a useful and fun technology is rammed into every product ever at the _expense_ of its users just to check a box for shareholders. Notion? It has AI now. Snapchat? Yup… an AI assistant there too. Wan't to use windows? I hope you aren't planning to ignore Microsoft's new OS level AI Copilot! There is no escape it seems. Even DuckDuckGo and Brave Browser are using it now (although given Brave still clings to the trash that is Web3 I am less surprised there). My point is, there is definitely going to be AI fatigue, if there is not already. Capitalism won't let us forget about this though, since it seems to line the pockets of the ultra-rich anyways. Want to make a game but don't want to pay an artist? Just pay for some compute and generate images with **prompt engineering**! How did that model get the data to learn to do this? No need to worry your little heads over that detail if its making you money! All of this and more is enabled by this technology and encouraged by our economic systems.
# What can we do?
What can we do about this? Is there a hope for us trying to escape AI? Honestly, I am not sure. But I am definitely trying. I have removed copilot from my Windows install, and I refuse to use anything that forces me to use AI. Will I still use it for fun in my discord bot? Absolutely! But being concious about how you use AI is key. With so many of these models trained on the work of skilled creatives, it is _our_ responsibility as consumers of this technology to ensure that we are _always_ paying professionals for their work, and not using their skills for free via a heartless algorithm. Lastly, be causious of products that add AI for seemingly no reason. There is a good chance your data is being used to train it.
# Thanks!
Do you have any thoughts on AI? Do you use it? If so, how? Feel free to reach out by email at [me@atri.dad](mailto:me@atri.dad). Until next time! 🫡

10
content/welcome.md Normal file
View File

@ -0,0 +1,10 @@
---
name: "Welcome!"
description: "Welcome to my website!"
date: "October 20 2024"
tags: ["welcome"]
---
Welcome to my site! This is a place for me to share my thoughts and updates on my projects. I hope you find something interesting here.
Feel free to reach out if you have any questions or comments. I'd love to hear from you! I can be reached by email at [me@atri.dad](mailto:me@atri.dad).

10
docker-compose.dev.yml Normal file
View File

@ -0,0 +1,10 @@
services:
app:
build:
context: .
dockerfile: Dockerfile
image: atridad:latest
command: ["/app"]
pull_policy: build
ports:
- "3000:3000"

6
docker-compose.yml Normal file
View File

@ -0,0 +1,6 @@
services:
app:
image: ${IMAGE}
command: ["/app"]
ports:
- "3000:3000"

222
docs/docs.go Normal file
View File

@ -0,0 +1,222 @@
// Package docs Code generated by swaggo/swag. DO NOT EDIT
package docs
import "github.com/swaggo/swag"
const docTemplate = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"contact": {},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/ping": {
"get": {
"description": "Get a pong response",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"ping"
],
"summary": "Ping the server",
"responses": {
"200": {
"description": "Pong!",
"schema": {
"type": "string"
}
}
}
}
},
"/post/copy": {
"get": {
"description": "Returns an SVG of a copy icon",
"consumes": [
"application/json"
],
"produces": [
"text/html"
],
"tags": [
"post"
],
"summary": "Get copy icon SVG",
"responses": {
"200": {
"description": "SVG content",
"schema": {
"type": "string"
}
}
}
}
},
"/sse": {
"get": {
"description": "Establishes a Server-Sent Events connection",
"consumes": [
"application/json"
],
"produces": [
"text/event-stream"
],
"tags": [
"sse"
],
"summary": "Server-Sent Events endpoint",
"parameters": [
{
"type": "string",
"description": "Channel name",
"name": "channel",
"in": "query"
}
],
"responses": {
"200": {
"description": "Event stream",
"schema": {
"type": "string"
}
}
}
}
},
"/tools/resize": {
"post": {
"description": "Resizes an uploaded image to specified dimensions",
"consumes": [
"multipart/form-data"
],
"produces": [
"image/png"
],
"tags": [
"tools"
],
"summary": "Resize an image",
"parameters": [
{
"type": "file",
"description": "Image file to resize",
"name": "image",
"in": "formData",
"required": true
},
{
"type": "integer",
"description": "Target width",
"name": "width",
"in": "formData",
"required": true
},
{
"type": "integer",
"description": "Target height",
"name": "height",
"in": "formData",
"required": true
}
],
"responses": {
"200": {
"description": "Resized image",
"schema": {
"type": "file"
}
},
"400": {
"description": "Bad request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal server error",
"schema": {
"type": "string"
}
}
}
}
},
"/tools/sendsse": {
"post": {
"description": "Sends a message to a specified SSE channel",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"sse",
"tools"
],
"summary": "Send SSE message",
"parameters": [
{
"type": "string",
"description": "Channel name",
"name": "channel",
"in": "query"
},
{
"type": "string",
"description": "Message to send",
"name": "message",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
}
}
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1.0",
Host: "localhost:3000",
BasePath: "/api",
Schemes: []string{},
Title: "Atri.dad API",
Description: "This is the API for atri.dad",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}

198
docs/swagger.json Normal file
View File

@ -0,0 +1,198 @@
{
"swagger": "2.0",
"info": {
"description": "This is the API for atri.dad",
"title": "Atri.dad API",
"contact": {},
"version": "1.0"
},
"host": "localhost:3000",
"basePath": "/api",
"paths": {
"/ping": {
"get": {
"description": "Get a pong response",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"ping"
],
"summary": "Ping the server",
"responses": {
"200": {
"description": "Pong!",
"schema": {
"type": "string"
}
}
}
}
},
"/post/copy": {
"get": {
"description": "Returns an SVG of a copy icon",
"consumes": [
"application/json"
],
"produces": [
"text/html"
],
"tags": [
"post"
],
"summary": "Get copy icon SVG",
"responses": {
"200": {
"description": "SVG content",
"schema": {
"type": "string"
}
}
}
}
},
"/sse": {
"get": {
"description": "Establishes a Server-Sent Events connection",
"consumes": [
"application/json"
],
"produces": [
"text/event-stream"
],
"tags": [
"sse"
],
"summary": "Server-Sent Events endpoint",
"parameters": [
{
"type": "string",
"description": "Channel name",
"name": "channel",
"in": "query"
}
],
"responses": {
"200": {
"description": "Event stream",
"schema": {
"type": "string"
}
}
}
}
},
"/tools/resize": {
"post": {
"description": "Resizes an uploaded image to specified dimensions",
"consumes": [
"multipart/form-data"
],
"produces": [
"image/png"
],
"tags": [
"tools"
],
"summary": "Resize an image",
"parameters": [
{
"type": "file",
"description": "Image file to resize",
"name": "image",
"in": "formData",
"required": true
},
{
"type": "integer",
"description": "Target width",
"name": "width",
"in": "formData",
"required": true
},
{
"type": "integer",
"description": "Target height",
"name": "height",
"in": "formData",
"required": true
}
],
"responses": {
"200": {
"description": "Resized image",
"schema": {
"type": "file"
}
},
"400": {
"description": "Bad request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal server error",
"schema": {
"type": "string"
}
}
}
}
},
"/tools/sendsse": {
"post": {
"description": "Sends a message to a specified SSE channel",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"sse",
"tools"
],
"summary": "Send SSE message",
"parameters": [
{
"type": "string",
"description": "Channel name",
"name": "channel",
"in": "query"
},
{
"type": "string",
"description": "Message to send",
"name": "message",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
}
}
}

131
docs/swagger.yaml Normal file
View File

@ -0,0 +1,131 @@
basePath: /api
host: localhost:3000
info:
contact: {}
description: This is the API for atri.dad
title: Atri.dad API
version: "1.0"
paths:
/ping:
get:
consumes:
- application/json
description: Get a pong response
produces:
- application/json
responses:
"200":
description: Pong!
schema:
type: string
summary: Ping the server
tags:
- ping
/post/copy:
get:
consumes:
- application/json
description: Returns an SVG of a copy icon
produces:
- text/html
responses:
"200":
description: SVG content
schema:
type: string
summary: Get copy icon SVG
tags:
- post
/sse:
get:
consumes:
- application/json
description: Establishes a Server-Sent Events connection
parameters:
- description: Channel name
in: query
name: channel
type: string
produces:
- text/event-stream
responses:
"200":
description: Event stream
schema:
type: string
summary: Server-Sent Events endpoint
tags:
- sse
/tools/resize:
post:
consumes:
- multipart/form-data
description: Resizes an uploaded image to specified dimensions
parameters:
- description: Image file to resize
in: formData
name: image
required: true
type: file
- description: Target width
in: formData
name: width
required: true
type: integer
- description: Target height
in: formData
name: height
required: true
type: integer
produces:
- image/png
responses:
"200":
description: Resized image
schema:
type: file
"400":
description: Bad request
schema:
type: string
"500":
description: Internal server error
schema:
type: string
summary: Resize an image
tags:
- tools
/tools/sendsse:
post:
consumes:
- application/json
description: Sends a message to a specified SSE channel
parameters:
- description: Channel name
in: query
name: channel
type: string
- description: Message to send
in: query
name: message
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties:
type: string
type: object
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
summary: Send SSE message
tags:
- sse
- tools
swagger: "2.0"

57
go.mod
View File

@ -1,48 +1,47 @@
module atri.dad module atri.dad
go 1.22.0 go 1.24
require ( require (
github.com/alecthomas/chroma/v2 v2.13.0 github.com/alecthomas/chroma/v2 v2.15.0
golang.org/x/oauth2 v0.19.0 github.com/swaggo/echo-swagger v1.4.1
github.com/swaggo/swag v1.16.4
golang.org/x/image v0.25.0
) )
require ( require (
github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/KyleBanks/depth v1.2.1 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/dlclark/regexp2 v1.11.5 // indirect
github.com/dlclark/regexp2 v1.11.0 // indirect github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-jose/go-jose/v3 v3.0.3 // indirect github.com/go-openapi/jsonpointer v0.21.1 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/google/go-cmp v0.6.0 // indirect github.com/go-openapi/spec v0.21.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/go-openapi/swag v0.23.1 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/labstack/gommon v0.4.2 // indirect github.com/labstack/gommon v0.4.2 // indirect
github.com/mailru/easyjson v0.9.0 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/swaggo/files/v2 v2.0.2 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect github.com/valyala/fasttemplate v1.2.2 // indirect
golang.org/x/image v0.15.0 // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
golang.org/x/net v0.24.0 // indirect golang.org/x/net v0.37.0 // indirect
golang.org/x/text v0.14.0 // indirect golang.org/x/text v0.23.0 // indirect
golang.org/x/time v0.5.0 // indirect golang.org/x/time v0.11.0 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect golang.org/x/tools v0.31.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
) )
require ( require (
github.com/aws/aws-sdk-go v1.51.23 github.com/gookit/color v1.5.4
github.com/clerkinc/clerk-sdk-go v1.49.0 github.com/gorilla/feeds v1.2.0
github.com/disintegration/imaging v1.6.2
github.com/fatih/color v1.16.0
github.com/gorilla/feeds v1.1.2
github.com/joho/godotenv v1.5.1 github.com/joho/godotenv v1.5.1
github.com/labstack/echo/v4 v4.12.0 github.com/labstack/echo/v4 v4.13.3
github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-isatty v0.0.20 // indirect
github.com/redis/go-redis/v9 v9.5.1 github.com/yuin/goldmark v1.7.8
github.com/stripe/stripe-go/v76 v76.25.0
github.com/svix/svix-webhooks v1.21.0
github.com/yuin/goldmark v1.7.1
github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc
github.com/zmb3/spotify v1.3.0 golang.org/x/crypto v0.36.0 // indirect
golang.org/x/crypto v0.22.0 // indirect golang.org/x/sys v0.31.0 // indirect
golang.org/x/sys v0.19.0 // indirect
gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v2 v2.4.0
) )

200
go.sum
View File

@ -1,175 +1,103 @@
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
github.com/alecthomas/assert/v2 v2.6.0 h1:o3WJwILtexrEUk3cUVal3oiQY2tfgr/FHWiz/v2n4FU= github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
github.com/alecthomas/assert/v2 v2.6.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k= github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8vS6K3D0=
github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
github.com/alecthomas/chroma/v2 v2.2.0/go.mod h1:vf4zrexSH54oEjJ7EdB65tGNHmH3pGZmVkgTP5RHvAs= github.com/alecthomas/chroma/v2 v2.2.0/go.mod h1:vf4zrexSH54oEjJ7EdB65tGNHmH3pGZmVkgTP5RHvAs=
github.com/alecthomas/chroma/v2 v2.13.0 h1:VP72+99Fb2zEcYM0MeaWJmV+xQvz5v5cxRHd+ooU1lI= github.com/alecthomas/chroma/v2 v2.15.0 h1:LxXTQHFoYrstG2nnV9y2X5O94sOBzf0CIUpSTbpxvMc=
github.com/alecthomas/chroma/v2 v2.13.0/go.mod h1:BUGjjsD+ndS6eX37YgTchSEG+Jg9Jv1GiZs9sqPqztk= github.com/alecthomas/chroma/v2 v2.15.0/go.mod h1:gUhVLrPDXPtp/f+L1jo9xepo9gL4eLwRuGAunSZMkio=
github.com/alecthomas/repr v0.0.0-20220113201626-b1b626ac65ae/go.mod h1:2kn6fqh/zIyPLmm3ugklbEi5hg5wS435eygvNfaDQL8= github.com/alecthomas/repr v0.0.0-20220113201626-b1b626ac65ae/go.mod h1:2kn6fqh/zIyPLmm3ugklbEi5hg5wS435eygvNfaDQL8=
github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc= github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc=
github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
github.com/aws/aws-sdk-go v1.51.21 h1:UrT6JC9R9PkYYXDZBV0qDKTualMr+bfK2eboTknMgbs=
github.com/aws/aws-sdk-go v1.51.21/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk=
github.com/aws/aws-sdk-go v1.51.23 h1:/3TEdsEE/aHmdKGw2NrOp7Sdea76zfffGkTTSXTsDxY=
github.com/aws/aws-sdk-go v1.51.23/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk=
github.com/brianvoe/gofakeit/v6 v6.19.0/go.mod h1:Ow6qC71xtwm79anlwKRlWZW6zVq9D2XHE4QSSMP/rU8=
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/clerkinc/clerk-sdk-go v1.49.0 h1:tJLIAx3qfP2cNQJ/iPq6OF1BSB0NzI3alcOuEueexoA=
github.com/clerkinc/clerk-sdk-go v1.49.0/go.mod h1:pejhMTTDAuw5aBpiHBEOOOHMAsxNfPvKfM5qexFJYlc=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c=
github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4=
github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI= github.com/dlclark/regexp2 v1.11.5 h1:Q/sSnsKerHeCkc/jSTNq1oCm7KiVgUMZRDUoRu0JQZQ=
github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/dlclark/regexp2 v1.11.5/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-jose/go-jose/v3 v3.0.0/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8= github.com/go-openapi/jsonpointer v0.21.1 h1:whnzv/pNXtK2FbX/W9yJfRmE2gsmkfahjMKB0fZvcic=
github.com/go-jose/go-jose/v3 v3.0.3 h1:fFKWeig/irsp7XD2zBxvnmA/XaRWp5V3CBsZXJF7G7k= github.com/go-openapi/jsonpointer v0.21.1/go.mod h1:50I1STOfbY1ycR8jGz8DaMeLCdXiI6aDteEdRNNzpdk=
github.com/go-jose/go-jose/v3 v3.0.3/go.mod h1:5b+7YgP7ZICgJDBdfjZaIt+H/9L9T/YQrVfLAMboGkQ= github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ=
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4=
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/go-openapi/spec v0.21.0 h1:LTVzPc3p/RzRnkQqLRndbAzjY0d0BCL72A6j3CdL9ZY=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/go-openapi/spec v0.21.0/go.mod h1:78u6VdPw81XU44qEWGhtr982gJ5BWg2c0I5XwVMotYk=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/go-openapi/swag v0.23.1 h1:lpsStH0n2ittzTnbaSloVZLuB5+fvSY/+hnagBjSNZU=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/go-openapi/swag v0.23.1/go.mod h1:STZs8TbRvEQQKUA+JZNAm3EWlgaOBGpyFDqQnDHMef0=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/gookit/color v1.5.4 h1:FZmqs7XOyGgCAxmWyPslpiok1k05wmY3SJTytgvYFs0=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/gookit/color v1.5.4/go.mod h1:pZJOeOS8DM43rXbp4AZo1n9zCU2qjpcRko0b6/QJi9w=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/gorilla/feeds v1.2.0 h1:O6pBiXJ5JHhPvqy53NsjKOThq+dNFm8+DFrxBEdzSCc=
github.com/gorilla/feeds v1.1.2 h1:pxzZ5PD3RJdhFH2FsJJ4x6PqMqbgFk1+Vez4XWBW8Iw= github.com/gorilla/feeds v1.2.0/go.mod h1:WMib8uJP3BbY+X8Szd1rA5Pzhdfh+HCCAYT2z7Fza6Y=
github.com/gorilla/feeds v1.1.2/go.mod h1:WMib8uJP3BbY+X8Szd1rA5Pzhdfh+HCCAYT2z7Fza6Y=
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/labstack/echo/v4 v4.11.4 h1:vDZmA+qNeh1pd/cCkEicDMrjtrnMGQ1QFI9gWN1zGq8= github.com/labstack/echo/v4 v4.13.3 h1:pwhpCPrTl5qry5HRdM5FwdXnhXSLSY+WE+YQSeCaafY=
github.com/labstack/echo/v4 v4.11.4/go.mod h1:noh7EvLwqDsmh/X/HWKPUl1AjzJrhyptRyEbQJfxen8= github.com/labstack/echo/v4 v4.13.3/go.mod h1:o90YNEeQWjDozo584l7AwhJMHN0bOC4tAfg+Xox9q5g=
github.com/labstack/echo/v4 v4.12.0 h1:IKpw49IMryVB2p1a4dzwlhP1O2Tf2E0Ir/450lH+kI0=
github.com/labstack/echo/v4 v4.12.0/go.mod h1:UP9Cr2DJXbOK3Kr9ONYzNowSh7HP0aG0ShAyycHSJvM=
github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0= github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0=
github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU= github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/redis/go-redis/v9 v9.5.1 h1:H1X4D3yHPaYrkL5X06Wh6xNVM/pX0Ft4RV0vMGvLBh8=
github.com/redis/go-redis/v9 v9.5.1/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M=
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stripe/stripe-go/v76 v76.25.0 h1:kmDoOTvdQSTQssQzWZQQkgbAR2Q8eXdMWbN/ylNalWA= github.com/swaggo/echo-swagger v1.4.1 h1:Yf0uPaJWp1uRtDloZALyLnvdBeoEL5Kc7DtnjzO/TUk=
github.com/stripe/stripe-go/v76 v76.25.0/go.mod h1:rw1MxjlAKKcZ+3FOXgTHgwiOa2ya6CPq6ykpJ0Q6Po4= github.com/swaggo/echo-swagger v1.4.1/go.mod h1:C8bSi+9yH2FLZsnhqMZLIZddpUxZdBYuNHbtaS1Hljc=
github.com/svix/svix-webhooks v1.21.0 h1:ZxoPU2SJGjmRy1qMaeHY1VdZhTaEkHuh3ruy4CrxW3Y= github.com/swaggo/files/v2 v2.0.2 h1:Bq4tgS/yxLB/3nwOMcul5oLEUKa877Ykgz3CJMVbQKU=
github.com/svix/svix-webhooks v1.21.0/go.mod h1:qGeiECF5WRQElyfF0i2CqUtWk2GQJTgL+EJZ/WRCxok= github.com/swaggo/files/v2 v2.0.2/go.mod h1:TVqetIzZsO9OhHX1Am9sRf9LdrFZqoK49N37KON/jr0=
github.com/swaggo/swag v1.16.4 h1:clWJtd9LStiG3VeijiCfOVODP6VpHtKdQy9ELFG3s1A=
github.com/swaggo/swag v1.16.4/go.mod h1:VBsHJRsDvfYvqoiMKnsdwhNV9LEMHgEDZcyVYX0sxPg=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
github.com/yuin/goldmark v1.4.15/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yuin/goldmark v1.4.15/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yuin/goldmark v1.7.1 h1:3bajkSilaCbjdKVsKdZjZCLBNPL9pYzrCakKaf4U49U= github.com/yuin/goldmark v1.7.8 h1:iERMLn0/QJeHFhxSt3p6PeN9mGnvIKSpG9YYorDMnic=
github.com/yuin/goldmark v1.7.1/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= github.com/yuin/goldmark v1.7.8/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc h1:+IAOyRda+RLrxa1WC7umKOZRsGq4QrFFMYApOeHzQwQ= github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc h1:+IAOyRda+RLrxa1WC7umKOZRsGq4QrFFMYApOeHzQwQ=
github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc/go.mod h1:ovIvrum6DQJA4QsJSovrkC4saKHQVs7TvcaeO8AIl5I= github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc/go.mod h1:ovIvrum6DQJA4QsJSovrkC4saKHQVs7TvcaeO8AIl5I=
github.com/zmb3/spotify v1.3.0 h1:6Z2F1IMx0Hviq/dpf8nFwvKPppFEMXn8yfReSBVi16k= golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
github.com/zmb3/spotify v1.3.0/go.mod h1:GD7AAEMUJVYc2Z7p2a2S0E3/5f/KxM/vOnErNr4j+Tw= golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561 h1:MDc5xs78ZrZr3HMQugiXOAkSZtfTpbJLDr/lwfgO53E=
golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/image v0.25.0 h1:Y6uW6rH1y5y/LK1J8BPWZtr6yZ7hrsy6hFrXjgsc2fQ=
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/image v0.25.0/go.mod h1:tCAmOEGthTtkalusGp1g3xa2gke8J6c2N565dTyl9Rs=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU=
golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c=
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
golang.org/x/image v0.15.0 h1:kOELfmgrmJlw4Cdb7g/QGuB3CvDrXbqEIww/pNtNBm8= golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw=
golang.org/x/image v0.15.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE= golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210520170846-37e1c6afe023/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=
golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.19.0 h1:9+E/EZBCbTLNrbN35fHv/a/d/mOBatymz1zbtQrXpIg=
golang.org/x/oauth2 v0.19.0/go.mod h1:vYi7skDa1x015PmRRYZ7+s1cWyPgrPiSYRe4rnsexc8=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/tools v0.31.0 h1:0EedkvKDbh+qistFTd0Bcwe/YLh4vHwWEkiI0toFIBU=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/tools v0.31.0/go.mod h1:naFTU+Cev749tSJRXJlna0T3WxKvb1kWEx15xA4SdmQ=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@ -2,13 +2,12 @@ package lib
import ( import (
"crypto/tls" "crypto/tls"
"log"
"net/smtp" "net/smtp"
"os" "os"
) )
func SendEmail(to_email string, from_email string, from_name string, html string, subject string) { func SendEmail(to_email string, from_email string, from_name string, html string, subject string) {
log.Println("Starting email sending process") LogInfo.Println("Starting email sending process")
// Set up authentication information. // Set up authentication information.
auth := smtp.PlainAuth( auth := smtp.PlainAuth(
@ -18,7 +17,7 @@ func SendEmail(to_email string, from_email string, from_name string, html string
os.Getenv("SMTP_HOST"), os.Getenv("SMTP_HOST"),
) )
log.Println("Authentication set up") LogSuccess.Println("Authentication set up")
// Connect to the server, authenticate, set the sender and recipient, // Connect to the server, authenticate, set the sender and recipient,
// and send the email all in one step. // and send the email all in one step.
@ -34,69 +33,69 @@ func SendEmail(to_email string, from_email string, from_name string, html string
ServerName: os.Getenv("SMTP_HOST"), ServerName: os.Getenv("SMTP_HOST"),
} }
log.Println("TLS configuration set up") LogSuccess.Println("TLS configuration set up")
c, err := smtp.Dial(os.Getenv("SMTP_HOST") + ":587") c, err := smtp.Dial(os.Getenv("SMTP_HOST") + ":587")
if err != nil { if err != nil {
log.Println("Error dialing SMTP server:", err) LogError.Println("Error dialing SMTP server:", err)
return return
} }
log.Println("Connected to SMTP server") LogSuccess.Println("Connected to SMTP server")
if err = c.StartTLS(tlsconfig); err != nil { if err = c.StartTLS(tlsconfig); err != nil {
log.Println("Error starting TLS:", err) LogError.Println("Error starting TLS:", err)
return return
} }
log.Println("TLS started") LogInfo.Println("TLS started")
if err = c.Auth(auth); err != nil { if err = c.Auth(auth); err != nil {
log.Println("Error authenticating with SMTP server:", err) LogError.Println("Error authenticating with SMTP server:", err)
return return
} }
log.Println("Authenticated with SMTP server") LogSuccess.Println("Authenticated with SMTP server")
if err = c.Mail(from_email); err != nil { if err = c.Mail(from_email); err != nil {
log.Println("Error setting sender address:", err) LogError.Println("Error setting sender address:", err)
return return
} }
log.Println("Sender address set") LogSuccess.Println("Sender address set")
if err = c.Rcpt(to_email); err != nil { if err = c.Rcpt(to_email); err != nil {
log.Println("Error setting recipient address:", err) LogError.Println("Error setting recipient address:", err)
return return
} }
log.Println("Recipient address set") LogSuccess.Println("Recipient address set")
w, err := c.Data() w, err := c.Data()
if err != nil { if err != nil {
log.Println("Error getting write closer:", err) LogError.Println("Error getting write closer:", err)
return return
} }
log.Println("Got write closer") LogSuccess.Println("Got write closer")
_, err = w.Write(msg) _, err = w.Write(msg)
if err != nil { if err != nil {
log.Println("Error writing message:", err) LogError.Println("Error writing message:", err)
return return
} }
log.Println("Message written") LogSuccess.Println("Message written")
err = w.Close() err = w.Close()
if err != nil { if err != nil {
log.Println("Error closing write closer:", err) LogError.Println("Error closing write closer:", err)
return return
} }
log.Println("Write closer closed") LogSuccess.Println("Write closer closed")
c.Quit() c.Quit()
log.Println("Email sent successfully") LogSuccess.Println("Email sent successfully")
} }

33
lib/files.go Normal file
View File

@ -0,0 +1,33 @@
package lib
import (
"os"
"path/filepath"
)
// ListFiles returns a slice of file paths in the given directory
func ListFiles(dir string) ([]string, error) {
var filePaths []string
entries, err := os.ReadDir(dir)
if err != nil {
return nil, err
}
for _, entry := range entries {
if entry.IsDir() {
// Recursively list files in subdirectories
subDir := filepath.Join(dir, entry.Name())
subFiles, err := ListFiles(subDir)
if err != nil {
return nil, err
}
filePaths = append(filePaths, subFiles...)
} else {
// Add file path to the slice
filePath := filepath.Join(dir, entry.Name())
filePaths = append(filePaths, filePath)
}
}
return filePaths, nil
}

View File

@ -2,38 +2,32 @@ package lib
import ( import (
"bytes" "bytes"
"errors" "fmt"
"image" "image"
"image/png" "image/png"
"io"
"mime/multipart" "mime/multipart"
"github.com/disintegration/imaging" "golang.org/x/image/draw"
) )
func ResizeImg(file multipart.File, width int, height int) ([]byte, error) { func ResizeImg(file multipart.File, width int, height int) ([]byte, error) {
// Read file content // Read and decode image
fileContent, err := io.ReadAll(file) img, _, err := image.Decode(file)
if err != nil { if err != nil {
return nil, errors.New("error reading image file") return nil, fmt.Errorf("decode error: %w", err)
} }
// Decode image // Create new RGBA image
img, _, err := image.Decode(bytes.NewReader(fileContent)) dst := image.NewRGBA(image.Rect(0, 0, width, height))
if err != nil {
println(err.Error())
return nil, errors.New("error decoding image")
}
// Resize the image // Resize using high-quality interpolation
resizedImg := imaging.Resize(img, width, height, imaging.Lanczos) draw.CatmullRom.Scale(dst, dst.Bounds(), img, img.Bounds(), draw.Over, nil)
// Encode the resized image as PNG // Encode to PNG
buf := new(bytes.Buffer) buf := new(bytes.Buffer)
if err := png.Encode(buf, resizedImg); err != nil { if err := png.Encode(buf, dst); err != nil {
return nil, errors.New("error encoding image to PNG") return nil, fmt.Errorf("encode error: %w", err)
} }
// Return the resized image as response return buf.Bytes(), nil
return buf.Bytes(), nil
} }

View File

@ -1,27 +1,41 @@
package lib package lib
import "github.com/fatih/color" import (
"github.com/gookit/color"
)
// Error logging // Error logging
var red = color.New(color.FgRed) var LogError = color.Style{
var LogError = red.Add(color.Bold) color.FgRed,
color.OpBold,
}
// Info logging // Info logging
var cyan = color.New(color.FgCyan) var LogInfo = color.Style{
var LogInfo = cyan.Add(color.Bold) color.FgCyan,
color.OpBold,
}
// Success logging // Success logging
var green = color.New(color.FgGreen) var LogSuccess = color.Style{
var LogSuccess = green.Add(color.Bold) color.FgGreen,
color.OpBold,
}
// Warning logging // Warning logging
var yellow = color.New(color.FgYellow) var LogWarning = color.Style{
var LogWarning = yellow.Add(color.Bold) color.FgYellow,
color.OpBold,
}
// Debug logging // Debug logging
var magenta = color.New(color.FgMagenta) var LogDebug = color.Style{
var LogDebug = magenta.Add(color.Bold) color.FgMagenta,
color.OpBold,
}
// Custom logging // Custom logging
var white = color.New(color.FgWhite) var LogCustom = color.Style{
var LogCustom = white.Add(color.Bold) color.FgWhite,
color.OpBold,
}

View File

@ -13,9 +13,10 @@ import (
) )
type FrontMatter struct { type FrontMatter struct {
Name string Name string
Date string Description string
Tags []string Date string
Tags []string
} }
func ExtractFrontMatter(file fs.DirEntry, contentFS fs.FS) (CardLink, error) { func ExtractFrontMatter(file fs.DirEntry, contentFS fs.FS) (CardLink, error) {

View File

@ -1,86 +0,0 @@
package adapters
import (
"context"
"sync"
"atri.dad/lib"
"atri.dad/lib/pubsub"
)
type LocalPubSub struct {
subscribers map[string][]chan pubsub.Message
lock sync.RWMutex
}
type LocalPubSubMessage struct {
messages <-chan pubsub.Message
}
func (ps *LocalPubSub) SubscribeToChannel(channel string) (pubsub.PubSubMessage, error) {
ps.lock.Lock()
defer ps.lock.Unlock()
if ps.subscribers == nil {
ps.subscribers = make(map[string][]chan pubsub.Message)
}
ch := make(chan pubsub.Message, 100)
ps.subscribers[channel] = append(ps.subscribers[channel], ch)
lib.LogInfo.Printf("[PUBSUB/LOCAL] Subscribed to channel %s\n", channel)
return &LocalPubSubMessage{messages: ch}, nil
}
func (ps *LocalPubSub) PublishToChannel(channel string, message string) error {
subscribers, ok := ps.subscribers[channel]
if !ok {
lib.LogWarning.Printf("\n[PUBSUB/LOCAL] No subscribers for channel %s\n", channel)
return nil
}
ps.lock.Lock()
defer ps.lock.Unlock()
lib.LogInfo.Printf("\n[PUBSUB/LOCAL] Publishing message to channel %s: %s\n", channel, message)
for _, ch := range subscribers {
ch <- pubsub.Message{Payload: message}
}
return nil
}
func (ps *LocalPubSub) UnsubscribeFromChannel(channel string, ch <-chan pubsub.Message) {
ps.lock.Lock()
defer ps.lock.Unlock()
subscribers := ps.subscribers[channel]
for i, subscriber := range subscribers {
if subscriber == ch {
// Remove the subscriber from the slice
subscribers = append(subscribers[:i], subscribers[i+1:]...)
break
}
}
if len(subscribers) == 0 {
delete(ps.subscribers, channel)
} else {
ps.subscribers[channel] = subscribers
}
}
func (m *LocalPubSubMessage) ReceiveMessage(ctx context.Context) (*pubsub.Message, error) {
for {
select {
case <-ctx.Done():
// The client has disconnected. Stop trying to send messages.
return nil, ctx.Err()
case msg := <-m.messages:
// A message has been received. Send it to the client.
lib.LogInfo.Printf("\n[PUBSUB/LOCAL] Received message: %s\n", msg.Payload)
return &msg, nil
}
}
}

View File

@ -1,71 +0,0 @@
package adapters
import (
"context"
"os"
"atri.dad/lib"
"atri.dad/lib/pubsub"
"github.com/joho/godotenv"
"github.com/redis/go-redis/v9"
)
var RedisClient *redis.Client
type RedisPubSubMessage struct {
pubsub *redis.PubSub
}
// RedisPubSub is a Redis implementation of the PubSub interface.
type RedisPubSub struct {
Client *redis.Client
}
func NewRedisClient() (*redis.Client, error) {
if RedisClient != nil {
return RedisClient, nil
}
godotenv.Load(".env")
redis_url := os.Getenv("REDIS_URL")
opts, err := redis.ParseURL(redis_url)
if err != nil {
return nil, err
}
lib.LogInfo.Printf("\n[PUBSUB/REDIS]Connecting to Redis at %s\n", opts.Addr)
RedisClient = redis.NewClient(opts)
return RedisClient, nil
}
func (m *RedisPubSubMessage) ReceiveMessage(ctx context.Context) (*pubsub.Message, error) {
msg, err := m.pubsub.ReceiveMessage(ctx)
if err != nil {
return nil, err
}
lib.LogInfo.Printf("\n[PUBSUB/REDIS] Received message: %s\n", msg.Payload)
return &pubsub.Message{Payload: msg.Payload}, nil
}
func (ps *RedisPubSub) SubscribeToChannel(channel string) (pubsub.PubSubMessage, error) {
pubsub := ps.Client.Subscribe(context.Background(), channel)
_, err := pubsub.Receive(context.Background())
if err != nil {
return nil, err
}
lib.LogInfo.Printf("\n[PUBSUB/REDIS] Subscribed to channel %s\n", channel)
return &RedisPubSubMessage{pubsub: pubsub}, nil
}
func (r *RedisPubSub) PublishToChannel(channel string, message string) error {
err := r.Client.Publish(context.Background(), channel, message).Err()
if err != nil {
return err
}
lib.LogInfo.Printf("\n[PUBSUB/REDIS] Publishing message to channel %s: %s\n", channel, message)
return nil
}

View File

@ -1,16 +0,0 @@
package pubsub
import "context"
type Message struct {
Payload string
}
type PubSubMessage interface {
ReceiveMessage(ctx context.Context) (*Message, error)
}
type PubSub interface {
SubscribeToChannel(channel string) (PubSubMessage, error)
PublishToChannel(channel string, message string) error
}

View File

@ -1,52 +0,0 @@
package lib
import (
"fmt"
"os"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
)
func GeneratePublicURL(key string) string {
bucket := os.Getenv("BUCKET_NAME")
if bucket == "" {
fmt.Println("No S3 bucket specified, skipping upload.")
return ""
}
endpoint := os.Getenv("AWS_ENDPOINT_URL_S3")
accessKeyID := os.Getenv("AWS_ACCESS_KEY_ID")
secretAccessKey := os.Getenv("AWS_SECRET_ACCESS_KEY")
region := os.Getenv("AWS_REGION")
sess, err := session.NewSession(&aws.Config{
Region: &region,
Credentials: credentials.NewStaticCredentials(
accessKeyID,
secretAccessKey,
"",
),
Endpoint: aws.String(endpoint),
})
if err != nil {
return ""
}
svc := s3.New(sess)
req, _ := svc.GetObjectRequest(&s3.GetObjectInput{
Bucket: &bucket,
Key: &key,
})
urlStr, err := req.Presign(15 * time.Minute)
if err != nil {
return ""
}
return urlStr
}

View File

@ -1,86 +0,0 @@
package lib
import (
"context"
"os"
"strings"
"sync"
"atri.dad/lib/pubsub"
"github.com/zmb3/spotify"
"golang.org/x/oauth2"
)
var (
spotifyOAuth2Endpoint = oauth2.Endpoint{
TokenURL: "https://accounts.spotify.com/api/token",
AuthURL: "https://accounts.spotify.com/authorize",
}
config *oauth2.Config
once sync.Once
)
func NowPlayingTextFilter(s string) string {
s = strings.Replace(s, "'", "&#39;", -1)
s = strings.Replace(s, "\"", "&quot;", -1)
return s
}
func GetOAuth2Config(clientID string, clientSecret string) *oauth2.Config {
once.Do(func() {
config = &oauth2.Config{
ClientID: clientID,
ClientSecret: clientSecret,
Scopes: []string{spotify.ScopeUserReadCurrentlyPlaying},
Endpoint: spotifyOAuth2Endpoint,
}
})
return config
}
func GetCurrentlyPlayingTrack(clientID string, clientSecret string, refreshToken string) (*spotify.CurrentlyPlaying, error) {
// OAuth2 config
config := GetOAuth2Config(clientID, clientSecret)
// Token source
tokenSource := config.TokenSource(context.Background(), &oauth2.Token{RefreshToken: refreshToken})
// Get new token
newToken, err := tokenSource.Token()
if err != nil {
return nil, err
}
// Create new client
client := spotify.Authenticator{}.NewClient(newToken)
// Get currently playing track
playing, err := client.PlayerCurrentlyPlaying()
if err != nil {
return nil, err
}
return playing, nil
}
func CurrentlyPlayingTrackSSE(ctx context.Context, pubSub pubsub.PubSub) error {
clientID := os.Getenv("SPOTIFY_CLIENT_ID")
clientSecret := os.Getenv("SPOTIFY_CLIENT_SECRET")
refreshToken := os.Getenv("SPOTIFY_REFRESH_TOKEN")
playing, err := GetCurrentlyPlayingTrack(clientID, clientSecret, refreshToken)
if err != nil {
return err
}
if playing.Item != nil && playing.Playing {
songName := NowPlayingTextFilter(playing.Item.Name)
artistName := NowPlayingTextFilter(playing.Item.Artists[0].Name)
return SendSSE(ctx, pubSub, "spotify", `<div class="indicator-item badge badge-success"><a _='on mouseover put "🔥 Listening to `+songName+" by "+artistName+` 🔥" into my.textContent on mouseout put "🔥" into my.textContent' href="`+playing.Item.ExternalURLs["spotify"]+`" rel="noreferrer" target="_blank">🔥</a></div>`)
} else {
SendSSE(ctx, pubSub, "spotify", "")
}
return nil
}

View File

@ -1,15 +1,6 @@
package lib package lib
import ( import "sync"
"context"
"fmt"
"log"
"net/http"
"sync"
"atri.dad/lib/pubsub"
"github.com/labstack/echo/v4"
)
type SSEServerType struct { type SSEServerType struct {
clients map[string]map[chan string]bool clients map[string]map[chan string]bool
@ -17,7 +8,6 @@ type SSEServerType struct {
} }
var SSEServer *SSEServerType var SSEServer *SSEServerType
var mutex = &sync.Mutex{}
func init() { func init() {
SSEServer = &SSEServerType{ SSEServer = &SSEServerType{
@ -39,6 +29,8 @@ func (s *SSEServerType) AddClient(channel string, client chan string) {
s.clients[channel] = make(map[chan string]bool) s.clients[channel] = make(map[chan string]bool)
} }
s.clients[channel][client] = true s.clients[channel][client] = true
LogInfo.Printf("\nClient connected to channel %s\n", channel)
} }
func (s *SSEServerType) RemoveClient(channel string, client chan string) { func (s *SSEServerType) RemoveClient(channel string, client chan string) {
@ -49,6 +41,8 @@ func (s *SSEServerType) RemoveClient(channel string, client chan string) {
if len(s.clients[channel]) == 0 { if len(s.clients[channel]) == 0 {
delete(s.clients, channel) delete(s.clients, channel)
} }
LogInfo.Printf("\nClient disconnected from channel %s\n", channel)
} }
func (s *SSEServerType) ClientCount(channel string) int { func (s *SSEServerType) ClientCount(channel string) int {
@ -58,74 +52,15 @@ func (s *SSEServerType) ClientCount(channel string) int {
return len(s.clients[channel]) return len(s.clients[channel])
} }
func SendSSE(ctx context.Context, messageBroker pubsub.PubSub, channel string, message string) error { func (s *SSEServerType) SendSSE(channel string, message string) {
// Create a channel to receive an error from the goroutine s.mu.Lock()
errCh := make(chan error, 1) defer s.mu.Unlock()
// Use a goroutine to send the message asynchronously
go func() { go func() {
select { for client := range s.clients[channel] {
case <-ctx.Done(): client <- message
// The client has disconnected, so return an error
errCh <- ctx.Err()
default:
err := messageBroker.PublishToChannel(channel, message)
errCh <- err // Send the error to the channel
} }
}() }()
// Wait for the goroutine to finish and check for errors LogDebug.Printf("\nMessage broadcast on channel %s: %s\n", channel, message)
err := <-errCh
if err != nil {
return err
}
return nil
}
func SetSSEHeaders(c echo.Context) {
c.Response().Header().Set(echo.HeaderContentType, "text/event-stream")
c.Response().Header().Set(echo.HeaderConnection, "keep-alive")
c.Response().Header().Set(echo.HeaderCacheControl, "no-cache")
}
func HandleIncomingMessages(c echo.Context, pubsub pubsub.PubSubMessage, client chan string) {
for {
select {
case <-c.Request().Context().Done():
// The client has disconnected. Stop trying to send messages.
return
default:
// The client is still connected. Continue processing messages.
msg, err := pubsub.ReceiveMessage(c.Request().Context())
if err != nil {
log.Printf("Failed to receive message: %v", err)
continue
}
data := fmt.Sprintf("data: %s\n\n", msg.Payload)
mutex.Lock()
_, err = c.Response().Write([]byte(data))
mutex.Unlock()
if err != nil {
log.Printf("Failed to write message: %v", err)
return // Stop processing if an error occurs
}
// Check if the ResponseWriter is nil before trying to flush it
if c.Response().Writer != nil {
// Check if the ResponseWriter implements http.Flusher before calling Flush
flusher, ok := c.Response().Writer.(http.Flusher)
if ok {
flusher.Flush()
} else {
log.Println("Failed to flush: ResponseWriter does not implement http.Flusher")
}
} else {
log.Println("Failed to flush: ResponseWriter is nil")
}
}
}
} }

View File

@ -1,41 +0,0 @@
package lib
import (
"log"
"net/http"
"os"
"github.com/joho/godotenv"
"github.com/stripe/stripe-go/v76"
"github.com/stripe/stripe-go/v76/checkout/session"
)
// init function
func init() {
godotenv.Load(".env")
stripe.Key = os.Getenv("STRIPE_SECRET_KEY")
}
func CreateCheckoutSession(w http.ResponseWriter, r *http.Request, successUrl string, cancelUrl string, priceId string) {
params := &stripe.CheckoutSessionParams{
LineItems: []*stripe.CheckoutSessionLineItemParams{
{
// Provide the exact Price ID (for example, pr_1234) of the product you want to sell
Price: stripe.String(priceId),
Quantity: stripe.Int64(1),
},
},
Mode: stripe.String(string(stripe.CheckoutSessionModePayment)),
SuccessURL: stripe.String(successUrl),
CancelURL: stripe.String(cancelUrl),
AutomaticTax: &stripe.CheckoutSessionAutomaticTaxParams{Enabled: stripe.Bool(true)},
}
s, err := session.New(params)
if err != nil {
log.Printf("session.New: %v", err)
}
http.Redirect(w, r, s.URL, http.StatusSeeOther)
}

29
lib/stylegen/base.css vendored
View File

@ -1,14 +1,29 @@
@tailwind base; @import "tailwindcss";
@tailwind components;
@tailwind utilities;
@layer base { @layer base {
html, html,
container, container,
body { body {
height: 100%; height: 100% !important;
width: 100%; width: 100% !important;
overflow-y: auto; overflow-y: auto !important;
position: fixed; position: fixed !important;
}
main {
margin-left: auto !important;
margin-right: auto !important;
width: 100% !important;
max-width: 100% !important;
text-align: center !important;
}
.container {
margin-left: auto !important;
margin-right: auto !important;
display: flex !important;
flex-direction: column !important;
align-items: center !important;
justify-content: center !important;
} }
} }

View File

@ -1,4 +1,33 @@
#!/bin/sh #!/usr/bin/env bash
# Define the version of the binary to download
VERSION="v4.0.9"
# Parse command-line arguments
while [[ $# -gt 0 ]]; do
case $1 in
-e|--extensions)
EXTENSIONS="$2"
shift; shift
;;
-d|--directory)
DIRECTORY="$2"
shift; shift
;;
-o|--output-dir)
OUTPUT_DIR="$2"
shift; shift
;;
*)
echo "Unknown argument: $1"
exit 1
;;
esac
done
# Get the directory where this script is located
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "Script directory: $SCRIPT_DIR"
OS=$(uname -s) OS=$(uname -s)
ARCH=$(uname -m) ARCH=$(uname -m)
@ -24,7 +53,7 @@ case $ARCH in
"x86_64") "x86_64")
ARCH="x64" ARCH="x64"
;; ;;
"arm64") "arm64"|"aarch64")
ARCH="arm64" ARCH="arm64"
;; ;;
*) *)
@ -32,48 +61,52 @@ case $ARCH in
exit 1 exit 1
;; ;;
esac esac
# Construct the binary file name
BINARY="./tw/${OS}-${ARCH}" echo "Detected OS: $OS"
if [ "$OS" = "windows" ]; then echo "Detected Architecture: $ARCH"
BINARY="${BINARY}.exe"
else # Function to construct the binary download URL based on version, OS, and architecture
# Set execute permissions on the binary get_binary_url() {
chmod +x $BINARY echo "https://github.com/tailwindlabs/tailwindcss/releases/download/$VERSION/tailwindcss-$OS-$ARCH"
}
# Create the 'tw' directory for storing the downloaded binary
TW_DIR="${SCRIPT_DIR}/tw"
mkdir -p "$TW_DIR"
# Set the binary path
BINARY="${TW_DIR}/tailwindcss-${OS}-${ARCH}"
# Check if the binary is already downloaded, otherwise download it
if [ ! -f "$BINARY" ]; then
echo "Binary not found, downloading version $VERSION..."
DOWNLOAD_URL=$(get_binary_url)
if [ -z "$DOWNLOAD_URL" ]; then
echo "No suitable release found for this OS and architecture."
exit 1
fi
# Download the binary
curl -L "$DOWNLOAD_URL" -o "$BINARY"
echo "Downloaded binary to: $BINARY"
fi fi
echo $BINARY # Make the binary executable
chmod +x "$BINARY"
# Infer pages from .html files in the pages directory echo "Using binary: $BINARY"
PAGES=$(ls ../../pages/templates/*.html | xargs -n 1 basename | sed 's/\.[^.]*$//') echo "Extensions: $EXTENSIONS"
echo "Directory: $DIRECTORY"
echo "Output Directory: $OUTPUT_DIR"
# Run the binary for each page # Generate the minified version for production
for PAGE in $PAGES; do echo "Generating minified CSS for production..."
( "$BINARY" -i "${SCRIPT_DIR}/base.css" -o "${OUTPUT_DIR}/styles.css" --minify
# Detect which partials are being used in this page
PARTIALS=$(grep -o -E '{{template "[^"]+' ../../pages/templates/${PAGE}.html | cut -d'"' -f2 | xargs -I{} echo \"../../pages/templates/partials/{}.html\")
# Generate an array of partials and join them with commas # Create empty daisyui.css and themes.css files if they don't exist
PARTIALS_ARRAY=$(echo $PARTIALS | tr ' ' ',') touch "${OUTPUT_DIR}/daisyui.css"
touch "${OUTPUT_DIR}/themes.css"
# Always include the "header" partial and any other partials that are always used echo "All CSS files generated"
PARTIALS_ARRAY=\"../../pages/templates/partials/header.html\",\"../../pages/templates/partials/global.html\",$PARTIALS_ARRAY
# Generate Tailwind config for this page
echo "module.exports = {
content: [\"../../pages/templates/${PAGE}.html\", \"../../pages/templates/layouts/*.html\", $PARTIALS_ARRAY],
theme: {
extend: {},
},
daisyui: {
themes: [\"night\"],
},
plugins: [require('daisyui'), require('@tailwindcss/typography')],
}" > tailwind.config.${PAGE}.js
# Run the binary with the generated config
$BINARY build -i ./base.css -c tailwind.config.${PAGE}.js -o ../../public/css/styles.${PAGE}.css --minify
) &
done
# Wait for all background processes to finish
wait

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2,7 +2,6 @@ package lib
import ( import (
"html/template" "html/template"
"log"
"net/http" "net/http"
"path/filepath" "path/filepath"
"runtime" "runtime"
@ -28,14 +27,14 @@ func RenderTemplate(w http.ResponseWriter, layout string, partials []string, pro
// Parse the templates // Parse the templates
ts, err := template.ParseFS(templatefs.FS, templates...) ts, err := template.ParseFS(templatefs.FS, templates...)
if err != nil { if err != nil {
log.Print(err.Error()) LogError.Print(err.Error())
return err return err
} }
// Execute the layout template // Execute the layout template
err = ts.ExecuteTemplate(w, layout, props) err = ts.ExecuteTemplate(w, layout, props)
if err != nil { if err != nil {
log.Print(err.Error()) LogError.Print(err.Error())
return err return err
} }

BIN
main

Binary file not shown.

79
main.go
View File

@ -1,49 +1,34 @@
package main package main
import ( import (
"context"
"embed" "embed"
"flag" "flag"
"fmt" "fmt"
"log"
"net/http" "net/http"
"time"
"atri.dad/api" "atri.dad/api"
"atri.dad/api/webhooks"
"atri.dad/lib" "atri.dad/lib"
"atri.dad/lib/pubsub"
"atri.dad/lib/pubsub/adapters"
"atri.dad/pages" "atri.dad/pages"
_ "atri.dad/docs"
"github.com/joho/godotenv" "github.com/joho/godotenv"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware" "github.com/labstack/echo/v4/middleware"
echoSwagger "github.com/swaggo/echo-swagger"
) )
//go:embed public/* //go:embed public/*
var PublicFS embed.FS var PublicFS embed.FS
// @title Atri.dad API
// @version 1.0
// @description This is the API for atri.dad
// @host localhost:3000
// @BasePath /api
func main() { func main() {
// Load environment variables // Load environment variables
godotenv.Load(".env") godotenv.Load(".env")
// Initialize Redis client
redisClient, redisError := adapters.NewRedisClient()
// Initialize pubsub
var pubSub pubsub.PubSub
if redisError != nil {
lib.LogWarning.Printf("\n[PUBSUB/INIT] Failed to connect to Redis: %v\n", redisError)
lib.LogWarning.Printf("\n[PUBSUB/INIT] Falling back to LocalPubSub\n")
pubSub = &adapters.LocalPubSub{}
} else {
adapters.RedisClient = redisClient
pubSub = &adapters.RedisPubSub{
Client: adapters.RedisClient,
}
}
// Initialize Echo router // Initialize Echo router
e := echo.New() e := echo.New()
@ -58,6 +43,16 @@ func main() {
})) }))
e.Use(middleware.RateLimiter(middleware.NewRateLimiterMemoryStore(50))) e.Use(middleware.RateLimiter(middleware.NewRateLimiterMemoryStore(50)))
// Add CORS middleware
e.Use(middleware.CORSWithConfig(middleware.CORSConfig{
AllowOrigins: []string{"https://atri.dad", "http://localhost:3000"},
AllowMethods: []string{http.MethodGet, http.MethodPost, http.MethodPut, http.MethodDelete},
AllowHeaders: []string{echo.HeaderOrigin, echo.HeaderContentType, echo.HeaderAccept},
ExposeHeaders: []string{echo.HeaderContentType},
AllowCredentials: true,
MaxAge: 86400,
}))
// Static server // Static server
fs := http.FS(PublicFS) fs := http.FS(PublicFS)
e.GET("/public/*", echo.WrapHandler(http.FileServer(fs))) e.GET("/public/*", echo.WrapHandler(http.FileServer(fs)))
@ -66,9 +61,9 @@ func main() {
e.GET("/", pages.Home) e.GET("/", pages.Home)
e.GET("/projects", pages.Projects) e.GET("/projects", pages.Projects)
e.GET("/talks", pages.Talks) e.GET("/talks", pages.Talks)
e.GET("/testimonials", pages.Testimonials) e.GET("/papers", pages.Papers)
e.GET("/blog", pages.Blog) e.GET("/posts", pages.Posts)
e.GET("/post/:post", pages.Post) e.GET("/posts/:post", pages.Post)
e.GET("/tools", pages.Tools) e.GET("/tools", pages.Tools)
e.GET("/tools/resize", pages.Resize) e.GET("/tools/resize", pages.Resize)
e.GET("/tools/ssedemo", pages.SSEDemo) e.GET("/tools/ssedemo", pages.SSEDemo)
@ -76,44 +71,22 @@ func main() {
// API Routes: // API Routes:
apiGroup := e.Group("/api") apiGroup := e.Group("/api")
apiGroup.GET("/ping", api.Ping) apiGroup.GET("/ping", api.Ping)
apiGroup.GET("/authed/ping", api.Authed)
apiGroup.POST("/pay", api.Pay)
apiGroup.GET("/rss", api.RSSFeedHandler) apiGroup.GET("/rss", api.RSSFeedHandler)
apiGroup.GET("/post/copy", api.PostCopy) apiGroup.GET("/post/copy", api.PostCopy)
// Swagger endpoint
apiGroup.GET("/swagger/*", echoSwagger.WrapHandler)
apiGroup.GET("/sse", func(c echo.Context) error { apiGroup.GET("/sse", func(c echo.Context) error {
return api.SSE(c, pubSub) return api.SSE(c)
}) })
apiGroup.POST("/tools/sendsse", func(c echo.Context) error { apiGroup.POST("/tools/sendsse", func(c echo.Context) error {
return api.SSEDemoSend(c, pubSub) return api.SSEDemoSend(c)
}) })
apiGroup.GET("/spotify/nowplaying", api.NowPlayingHandler)
apiGroup.POST("/tools/resize", api.ResizeHandler) apiGroup.POST("/tools/resize", api.ResizeHandler)
// Webhook Routes:
webhookGroup := e.Group("/webhook")
webhookGroup.POST("/clerk", webhooks.ClerkWebhookHandler)
// Spotify Polling
go func() {
ticker := time.NewTicker(5 * time.Second)
defer ticker.Stop()
for range ticker.C {
// Check if there are any clients connected to the "spotify" channel
if lib.SSEServer.ClientCount("spotify") > 0 {
// Get the currently playing track
err := lib.CurrentlyPlayingTrackSSE(context.Background(), pubSub)
if err != nil {
// Handle error
continue
}
}
}
}()
// Parse command-line arguments for IP and port // Parse command-line arguments for IP and port
ip := flag.String("ip", "", "IP address to bind the server to") ip := flag.String("ip", "", "IP address to bind the server to")
port := flag.String("port", "3000", "Port to bind the server to") port := flag.String("port", "3000", "Port to bind the server to")
@ -125,5 +98,5 @@ func main() {
Handler: e, Handler: e,
} }
e.Logger.Fatal(e.StartServer(s)) e.Logger.Fatal(e.StartServer(s))
log.Println("Server started on port", *port) lib.LogSuccess.Println("Server started on port", *port)
} }

File diff suppressed because one or more lines are too long

32
pages/papers.go Normal file
View File

@ -0,0 +1,32 @@
package pages
import (
"atri.dad/lib"
"github.com/labstack/echo/v4"
)
type PapersProps struct {
Papers []lib.CardLink
}
func Papers(c echo.Context) error {
papers := []lib.CardLink{
{
Name: "Bridging the Gap Between Social Networks and Healthcare",
Description: "An Assessment of the Need for Improved Patient-Patient, Patient-Provider, and Provider-Provider Sharing",
Href: "/public/files/bridging_the_gap_between_social_networks_and_healthcare.pdf",
Tags: []string{"masters", "coursework", "sna"},
Date: "January 03, 2025",
},
}
props := PapersProps{
Papers: papers,
}
// Specify the partials used by this page
partials := []string{"header", "navitems", "cardlinks"}
// Render the template
return lib.RenderTemplate(c.Response().Writer, "base", partials, props)
}

View File

@ -16,10 +16,11 @@ import (
) )
type PostProps struct { type PostProps struct {
Content template.HTML Content template.HTML
Name string Name string
Date string Description string
Tags []string Date string
Tags []string
} }
func Post(c echo.Context) error { func Post(c echo.Context) error {
@ -64,10 +65,11 @@ func Post(c echo.Context) error {
} }
props := PostProps{ props := PostProps{
Content: template.HTML(buf.String()), Content: template.HTML(buf.String()),
Name: frontmatter.Name, Name: frontmatter.Name,
Date: frontmatter.Date, Description: frontmatter.Description,
Tags: frontmatter.Tags, Date: frontmatter.Date,
Tags: frontmatter.Tags,
} }
// Specify the partials used by this page // Specify the partials used by this page

View File

@ -13,16 +13,16 @@ import (
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
) )
type BlogProps struct { type PostsProps struct {
Posts []lib.CardLink Posts []lib.CardLink
} }
func Blog(c echo.Context) error { func Posts(c echo.Context) error {
var posts []lib.CardLink var posts []lib.CardLink
files, err := fs.ReadDir(contentfs.FS, ".") files, err := fs.ReadDir(contentfs.FS, ".")
if err != nil { if err != nil {
log.Println(err) lib.LogError.Println(err)
http.Error(c.Response().Writer, "There was an issue finding posts!", http.StatusInternalServerError) http.Error(c.Response().Writer, "There was an issue finding posts!", http.StatusInternalServerError)
return nil return nil
} }
@ -31,12 +31,12 @@ func Blog(c echo.Context) error {
if !file.IsDir() && strings.HasSuffix(file.Name(), ".md") { if !file.IsDir() && strings.HasSuffix(file.Name(), ".md") {
frontMatter, err := lib.ExtractFrontMatter(file, contentfs.FS) frontMatter, err := lib.ExtractFrontMatter(file, contentfs.FS)
if err != nil { if err != nil {
log.Println(err) lib.LogError.Println(err)
http.Error(c.Response().Writer, "There was an issue rendering the posts!", http.StatusInternalServerError) http.Error(c.Response().Writer, "There was an issue rendering the posts!", http.StatusInternalServerError)
return nil return nil
} }
frontMatter.Href = "post/" + strings.TrimSuffix(file.Name(), ".md") frontMatter.Href = "posts/" + strings.TrimSuffix(file.Name(), ".md")
frontMatter.Internal = true frontMatter.Internal = true
posts = append(posts, frontMatter) posts = append(posts, frontMatter)
@ -59,7 +59,7 @@ func Blog(c echo.Context) error {
return iDate.Before(jDate) return iDate.Before(jDate)
}) })
props := BlogProps{ props := PostsProps{
Posts: posts, Posts: posts,
} }

View File

@ -12,40 +12,34 @@ type ProjectProps struct {
func Projects(c echo.Context) error { func Projects(c echo.Context) error {
projects := []lib.CardLink{ projects := []lib.CardLink{
{ {
Name: "Pollo", Name: "BlueSky PDS Manager",
Description: "A dead-simple real-time voting tool.", Description: "A web-based BlueSky PDS Manager. Manage your invite codes and users with a simple web UI.",
Tags: []string{"react", "remix.js", "product"}, Tags: []string{"astro", "atproto"},
Href: "https://pollo.atri.dad", Href: "https://pdsman.atri.dad",
}, },
{ {
Name: "Atash", Name: "Pollo",
Description: "The 🔥hottest🔥 full-stack Remix template!", Description: "A dead-simple real-time voting tool.",
Tags: []string{"react", "remix.js", "template"}, Tags: []string{"golang", "htmx", "product"},
Href: "https://github.com/atridadl/Atash", Href: "https://git.atri.dad/atridad/pollo",
}, },
{ {
Name: "GOTH Stack", Name: "GOTH Stack",
Description: "🚀 A Web Application Template Powered by HTMX + Go + Tailwind 🚀", Description: "🚀 A Web Application Template Powered by HTMX + Go + Tailwind 🚀",
Tags: []string{"golang", "htmx", "template"}, Tags: []string{"golang", "htmx", "template"},
Href: "https://github.com/atridadl/goth.stack", Href: "https://git.atri.dad/atridad/goth.stack",
}, },
{ {
Name: "Himbot", Name: "Himbot",
Description: "A discord bot written in Go. Loosly named after my username online (HimbothySwaggins).", Description: "A discord bot written in Go. Loosly named after my username online (HimbothySwaggins).",
Tags: []string{"golang", "bot"}, Tags: []string{"golang", "bot"},
Href: "https://github.com/atridadl/HimBot", Href: "https://git.atri.dad/atridad/himbot",
},
{
Name: "Commodore",
Description: "Helpful Nightbot Helpers for Twitch",
Tags: []string{"react", "remix.js", "template"},
Href: "https://commodore.atri.dad",
}, },
{ {
Name: "loadr", Name: "loadr",
Description: "A lightweight REST load testing tool with robust support for different verbs, token auth, and performance reports.", Description: "A lightweight REST load testing tool with robust support for different verbs, token auth, and performance reports.",
Tags: []string{"golang", "cli"}, Tags: []string{"golang", "cli"},
Href: "https://github.com/atridadl/loadr", Href: "https://git.atri.dad/atridad/loadr",
}, },
} }

View File

@ -11,20 +11,20 @@ type TalkProps struct {
func Talks(c echo.Context) error { func Talks(c echo.Context) error {
talks := []lib.CardLink{ talks := []lib.CardLink{
{
Name: "How to ship less JavaScript",
Description: "A talk on building websites while being mindful of the JavaScript we ship. Presented at the Dev Edmonton July 2023 JS/Ruby/Python Meetup",
Href: "https://github.com/atridadl/devedmonton-july-2023",
Tags: []string{"astro", "ssr"},
Date: "July 06, 2023",
},
{ {
Name: "Hypermedia as the engine of application state - an Introduction", Name: "Hypermedia as the engine of application state - an Introduction",
Description: "A talk on building reactive websites using tools like HTMX instead of JSON + JS. Will be presented at the Dev Edmonton Fabruary 2024 JS/Ruby/Python Meetup", Description: "A talk on building reactive websites using tools like HTMX instead of JSON + JS. Will be presented at the Dev Edmonton Fabruary 2024 JS/Ruby/Python Meetup",
Href: lib.GeneratePublicURL("hypermedia_talk_atridad.pdf"), Href: "/public/files/hypermedia_talk_atridad.pdf",
Tags: []string{"golang", "htmx", "ssr"}, Tags: []string{"golang", "htmx", "ssr"},
Date: "February 01, 2024", Date: "February 01, 2024",
}, },
{
Name: "Introduction to Social Network Analysis (SNA)",
Description: "Understanding Relationships in Social Structures",
Href: "/public/files/Understanding_Relationships_in_Social_Structures.pdf",
Tags: []string{"graphs", "social", "lecture"},
Date: "October 08, 2024",
},
} }
props := TalkProps{ props := TalkProps{

View File

@ -1,22 +0,0 @@
{{define "title"}}
Atridad Lahiji // Blog
{{end}}
{{define "headercontent"}}
Atridad Lahiji // Blog
{{end}}
{{define "head"}}
<link rel="stylesheet" href="/public/css/styles.blog.css" />
{{end}}
{{define "main"}}
<section class="flex flex-row flex-wrap gap-2 justify-center align-middle">
{{range .Posts}}
{{template "cardlinks" .}}
{{end}}
</section>
{{end}}
{{define "foot"}}
{{end}}

View File

@ -1,26 +0,0 @@
{{define "title"}}
Atridad Lahiji // [SOMEPAGE]
{{end}}
{{define "headercontent"}}
Atridad Lahiji // [SOMEPAGE]
{{end}}
{{define "head"}}
<link rel="stylesheet" href="/public/css/styles.[SOMEPAGE].css" />
{{end}}
{{define "main"}}
<h1 class="text-4xl font-extrabold text-white sm:text-8xl">
New <span
class="bg-gradient-to-r from-pink-500 to-blue-500 bg-clip-text text-transparent"
>Page</span
>
</h1>
{{end}}
{{define "foot"}}
<script src="/public/js/htmx.base.js"></script>
<script src="/public/js/htmx.sse.js"></script>
<script src="/public/js/hyperscript.js"></script>
{{end}}

View File

@ -2,22 +2,25 @@
Atridad Lahiji // Root Atridad Lahiji // Root
{{end}} {{end}}
{{define "headercontent"}} {{define "description"}}
Researcher, Full-Stack Developer, and IT Professional.
{{end}}
{{define "navcontent"}}
Atridad Lahiji // Root Atridad Lahiji // Root
{{end}} {{end}}
{{define "head"}} {{define "head"}}
<link rel="stylesheet" href="/public/css/styles.home.css" />
{{end}} {{end}}
{{define "main"}} {{define "main"}}
<h1 class="text-4xl font-extrabold text-white sm:text-8xl"> <h1 class="text-4xl font-extrabold text-white sm:text-8xl">
Hi, I&apos;m <span <span class="bg-gradient-to-r from-pink-500 to-blue-500 bg-clip-text text-transparent">{{.Title}}</span>
class="text-transparent bg-clip-text bg-gradient-to-r from-pink-500 via-purple-500 to-blue-500">Atridad</span>
</h1> </h1>
<h2 class="text-2xl font-extrabold tracking-tight text-white sm:text-[2rem]"> <h2 class="text-2xl font-extrabold tracking-tight text-white sm:text-[2rem]">
I&apos;m a full stack developer who builds cool things for the web. {{.Subtitle}}
</h2> </h2>
<span> <span>
@ -47,7 +50,4 @@ Atridad Lahiji // Root
{{end}} {{end}}
{{define "foot"}} {{define "foot"}}
<script src="/public/js/htmx.base.js"></script> {{end}}
<script src="/public/js/htmx.sse.js"></script>
<script src="/public/js/hyperscript.js"></script>
{{end}}

View File

@ -6,16 +6,22 @@
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="/public/favicon.ico" /> <link rel="icon" href="/public/favicon.ico" />
<title>{{template "title" .}}</title> <title>{{template "title" .}}</title>
<meta name="description" content="Just here for the vibes..."> <meta name="description" content="{{template "description" .}}">
<script defer src="https://analytics.atri.dad/script.js" data-website-id="0206740c-245f-402a-b433-125d6d48945a"></script>
<link href="/public/css/daisyui.css" rel="stylesheet" type="text/css" />
<link href="/public/css/themes.css" rel="stylesheet" type="text/css" />
<link href="/public/css/styles.css" rel="stylesheet" type="text/css" />
{{template "head" .}} {{template "head" .}}
</head> </head>
<body class="block h-[100%]"> <body class="block h-[100%]" hx-ext="preload">
{{template "header" .}} {{template "header" .}}
<main class="container flex flex-col items-center justify-center gap-3 sm:gap-6 p-4 text-center mx-auto min-h-[calc(100%-64px)]"> <main class="container flex flex-col items-center justify-center gap-3 sm:gap-6 p-4 text-center min-h-[calc(100%-64px)]">
{{template "main" .}} {{template "main" .}}
</main> </main>
<script src="/public/js/htmx.base.js"></script>
<script src="/public/js/htmx.preload.js"></script>
{{template "foot" .}} {{template "foot" .}}
</body> </body>
</html> </html>

View File

@ -1,58 +1,90 @@
{{define "post"}} {{define "post"}}
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" data-theme="night"> <html lang="en" data-theme="night">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="/public/favicon.ico" />
<title>{{.Name}}</title>
<meta name="description" content="Just here for the vibes...">
{{template "head" .}}
</head>
<body class="block h-[100%]"> <head>
{{template "header" .}} <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="/public/favicon.ico" />
<title>{{template "title" .}}</title>
<meta name="description" content="{{template "description" .}}">
<script defer src="https://analytics.atri.dad/script.js" data-website-id="0206740c-245f-402a-b433-125d6d48945a"></script>
<link href="/public/css/daisyui.css" rel="stylesheet" type="text/css" />
<link href="/public/css/styles.css" rel="stylesheet" type="text/css" />
<link href="/public/css/themes.css" rel="stylesheet" type="text/css" />
<link href="/public/css/markdown.css" rel="stylesheet" type="text/css" />
{{template "head" .}}
</head>
<main class="prose prose-invert mx-auto p-4"> <body class="block h-[100%]">
<article> {{template "header" .}}
<h1 class="title">{{.Name}}</h1>
<div class="flex flex-row flex-wrap gap-4">
{{if .Date}}
<p>
<div class="flex flex-row flex-wrap items-center gap-1 text-md">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-clock-4"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>
{{.Date}}
</div>
</p>
{{end}}
{{if .Tags}} <main class="mx-auto p-4 max-w-3xl">
<div class="flex flex-row flex-wrap text-center items-center justify-center gap-1"> <article>
{{range .Tags}} <h1 class="mx-auto text-2xl sm:text-4xl font-bold tracking-tight text-center mb-4 max-w-[65ch]">{{.Name}}</h1>
<div class="badge badge-accent">#{{.}}</div> <div class="flex flex-row flex-wrap justify-center gap-4 mb-6">
{{end}} {{if .Date}}
</div> <p>
{{end}} <div class="flex flex-row flex-wrap items-center gap-1 text-md">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
<div id="svgContainer" style="display: none;"> stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-check-circle"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><path d="m9 11 3 3L22 4"/></svg> class="lucide lucide-clock-4">
</div> <circle cx="12" cy="12" r="10" />
<polyline points="12 6 12 12 16 14" />
<button id="copyButton" aria-label="Copy Link to Post" hx-get="/api/post/copy" hx-swap="innerHTML" hx-trigger="click delay:3s" _='on click put #svgContainer.innerHTML into me.innerHTML then call navigator.clipboard.writeText(window.location.href)'> </svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-copy"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg> {{.Date}}
</button>
<a href="/blog" class="btn btn-primary btn-outline">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-undo-2"><path d="M9 14 4 9l5-5"/><path d="M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5v0a5.5 5.5 0 0 1-5.5 5.5H11"/></svg>
Back
</a>
</div> </div>
<hr /> </p>
{{template "main" .}} {{end}}
{{if .Tags}}
<div class="flex flex-row flex-wrap text-center items-center justify-center gap-1">
{{range .Tags}}
<div class="badge badge-accent">#{{.}}</div>
{{end}}
</div>
{{end}}
<div id="svgContainer" style="display: none;">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
class="lucide lucide-check-circle">
<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14" />
<path d="m9 11 3 3L22 4" />
</svg>
</div>
<button id="copyButton" aria-label="Copy Link to Post" hx-get="/api/post/copy" hx-swap="innerHTML"
hx-trigger="click delay:3s"
_='on click put #svgContainer.innerHTML into me.innerHTML then call navigator.clipboard.writeText(window.location.href)'>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
class="lucide lucide-copy">
<rect width="14" height="14" x="8" y="8" rx="2" ry="2" />
<path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" />
</svg>
</button>
<a href="/posts" class="btn btn-primary btn-outline" preload="mouseover">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
class="lucide lucide-undo-2">
<path d="M9 14 4 9l5-5" />
<path d="M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5v0a5.5 5.5 0 0 1-5.5 5.5H11" />
</svg>
Back
</a>
</div>
<hr class="my-6 border-t border-white w-full max-w-2xl mx-auto" />
<div class="markdown text-left mx-auto max-w-2xl">
{{template "main" .}}
</div>
</article>
</main>
<script src="/public/js/htmx.base.js"></script>
<script src="/public/js/htmx.preload.js"></script>
{{template "foot" .}}
</body>
</article>
</main>
{{template "foot" .}}
</body>
</html> </html>
{{end}} {{end}}

View File

@ -0,0 +1,37 @@
{{define "title"}}
Atridad Lahiji // Papers
{{end}}
{{define "description"}}
Papers I've Written
{{end}}
{{define "navcontent"}}
Atridad Lahiji // Papers
{{end}}
{{define "head"}}
{{end}}
{{define "main"}}
{{if .Papers}}
<section class="flex flex-row flex-wrap gap-2 justify-center align-middle">
{{range .Papers}}
{{template "cardlinks" .}}
{{end}}
</section>
{{end}}
{{if not .Papers}}
<section class="flex flex-row flex-wrap gap-2 justify-center align-middle">
<h2 class="text-2xl font-extrabold tracking-tight text-white sm:text-[2rem]">
Nothing to see here (yet)!
</h2>
</section>
{{end}}
{{end}}
{{define "foot"}}
{{end}}

View File

@ -1,7 +1,7 @@
{{define "buttonlinks"}} {{define "buttonlinks"}}
{{if eq true .Internal}} {{if eq true .Internal}}
<a class="btn btn-primary btn-outline btn-md lg:btn-lg" href={{.Href}}> <a class="btn btn-primary btn-outline btn-md lg:btn-lg" href={{.Href}} preload="mouseover">
{{.Name}} {{.Name}}
</a> </a>
@ -12,4 +12,4 @@
</a> </a>
{{end}} {{end}}
{{end}} {{end}}

View File

@ -31,7 +31,8 @@
role="button" role="button"
href={{.Href}} href={{.Href}}
aria-label={{.Name}} aria-label={{.Name}}
class="btn btn-circle btn-base-100 text-primary hover:btn-accent hover:text-neutral" class="btn btn-circle btn-base-100 btn-outline"
preload="mouseover"
> >
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-right"><path d="M5 12h14"/><path d="m12 5 7 7-7 7"/></svg> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-right"><path d="M5 12h14"/><path d="m12 5 7 7-7 7"/></svg>
</a> </a>
@ -40,7 +41,7 @@
role="button" role="button"
href={{.Href}} href={{.Href}}
aria-label={{.Name}} aria-label={{.Name}}
class="btn btn-circle btn-base-100 text-primary hover:btn-accent hover:text-neutral" class="btn btn-circle btn-base-100 btn-outline"
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
> >

View File

@ -1,7 +1,7 @@
{{define "header"}} {{define "header"}}
<header class="navbar bg-base-100"> <header class="navbar bg-base-100">
<div class="navbar-start"> <div class="navbar-start">
<a class="btn btn-ghost normal-case text-lg sm:text-xl text-white" href="/">{{template "headercontent".}}</a> <a class="btn btn-ghost normal-case text-lg sm:text-xl text-white" href="/">{{template "navcontent".}}</a>
</div> </div>
<div class="navbar-end z-50"> <div class="navbar-end z-50">
<div class="dropdown dropdown-end"> <div class="dropdown dropdown-end">
@ -10,7 +10,8 @@
</label> </label>
<ul <ul
tabindex="0" tabindex="0"
class="menu menu-compact dropdown-content gap-2 mt-3 p-2 shadow bg-base-100 rounded-box" class="menu menu-sm dropdown-content gap-2 mt-3 p-2 shadow-md bg-base-100 rounded-box"
preload="mouseover"
> >
{{template "navitems" .}} {{template "navitems" .}}
</ul> </ul>

View File

@ -1,18 +1,5 @@
{{define "iconlinks"}} {{define "iconlinks"}}
{{if eq .Name "Spotify"}}
<div class="indicator indicator-top indicator-end">
<div hx-ext="sse" sse-connect="/api/sse?channel=spotify" sse-swap="message">
<span class="link link-hover link-success" hx-get="/api/spotify/nowplaying" hx-trigger="load" hx-swap="self">
</span>
</div>
<a class="fill-white hover:fill-pink-500" href={{.Href}} target="_blank" rel="me" aria-label={{.Name}}>
{{.Icon}}
</a>
</div>
{{else}}
<a class="fill-white hover:fill-pink-500" href={{.Href}} target="_blank" rel="me" aria-label={{.Name}}> <a class="fill-white hover:fill-pink-500" href={{.Href}} target="_blank" rel="me" aria-label={{.Name}}>
{{.Icon}} {{.Icon}}
</a> </a>
{{end}}
{{end}} {{end}}

View File

@ -1,32 +1,20 @@
{{define "navitems"}} {{define "navitems"}}
<li> <li>
<a class="no-underline" href="/"> <a class="no-underline" href="/"> Home </a>
Home
</a>
</li> </li>
<li> <li>
<a class="no-underline" href="/projects"> <a class="no-underline" href="/projects"> Projects </a>
Projects
</a>
</li> </li>
<li> <li>
<a class="no-underline" href="/talks"> <a class="no-underline" href="/papers"> Papers </a>
Talks
</a>
</li> </li>
<li> <li>
<a class="no-underline" href="/testimonials"> <a class="no-underline" href="/talks"> Talks </a>
Testimonials
</a>
</li> </li>
<li> <li>
<a class="no-underline" href="/tools"> <a class="no-underline" href="/posts"> Posts </a>
Tools
</a>
</li> </li>
<li> <li>
<a class="no-underline" href="/blog"> <a class="no-underline" href="/tools"> Tools </a>
Blog
</a>
</li> </li>
{{end}} {{end}}

View File

@ -1,13 +1,16 @@
{{define "title"}} {{define "title"}}
Atridad Lahiji // Post Atridad Lahiji // Post // {{.Name}}
{{end}} {{end}}
{{define "headercontent"}} {{define "description"}}
Atridad Lahiji // Post {{.Description}}
{{end}}
{{define "navcontent"}}
Atridad Lahiji // Post // {{.Name}}
{{end}} {{end}}
{{define "head"}} {{define "head"}}
<link rel="stylesheet" href="/public/css/styles.post.css" />
{{end}} {{end}}
{{define "main"}} {{define "main"}}
@ -15,6 +18,5 @@ Atridad Lahiji // Post
{{end}} {{end}}
{{define "foot"}} {{define "foot"}}
<script src="/public/js/htmx.base.js"></script>
<script src="/public/js/hyperscript.js"></script> <script src="/public/js/hyperscript.js"></script>
{{end}} {{end}}

View File

@ -0,0 +1,37 @@
{{define "title"}}
Atridad Lahiji // Posts
{{end}}
{{define "description"}}
Posts I've Written
{{end}}
{{define "navcontent"}}
Atridad Lahiji // Posts
{{end}}
{{define "head"}}
{{end}}
{{define "main"}}
{{if .Posts}}
<section class="flex flex-row flex-wrap gap-2 justify-center align-middle">
{{range .Posts}}
{{template "cardlinks" .}}
{{end}}
</section>
{{end}}
{{if not .Posts}}
<section class="flex flex-row flex-wrap gap-2 justify-center align-middle">
<h2 class="text-2xl font-extrabold tracking-tight text-white sm:text-[2rem]">
Nothing to see here (yet)!
</h2>
</section>
{{end}}
{{end}}
{{define "foot"}}
{{end}}

View File

@ -2,21 +2,36 @@
Atridad Lahiji // Projects Atridad Lahiji // Projects
{{end}} {{end}}
{{define "headercontent"}} {{define "description"}}
Projects I've Done
{{end}}
{{define "navcontent"}}
Atridad Lahiji // Projects Atridad Lahiji // Projects
{{end}} {{end}}
{{define "head"}} {{define "head"}}
<link rel="stylesheet" href="/public/css/styles.projects.css" />
{{end}} {{end}}
{{define "main"}} {{define "main"}}
{{if .Projects}}
<section class="flex flex-row flex-wrap gap-2 justify-center align-middle"> <section class="flex flex-row flex-wrap gap-2 justify-center align-middle">
{{range .Projects}} {{range .Projects}}
{{template "cardlinks" .}} {{template "cardlinks" .}}
{{end}} {{end}}
</section> </section>
{{end}} {{end}}
{{if not .Projects}}
<section class="flex flex-row flex-wrap gap-2 justify-center align-middle">
<h2 class="text-2xl font-extrabold tracking-tight text-white sm:text-[2rem]">
Nothing to see here (yet)!
</h2>
</section>
{{end}}
{{end}}
{{define "foot"}} {{define "foot"}}
{{end}} {{end}}

View File

@ -2,15 +2,20 @@
Atridad Lahiji // Talks Atridad Lahiji // Talks
{{end}} {{end}}
{{define "headercontent"}} {{define "description"}}
Talks I've Given
{{end}}
{{define "navcontent"}}
Atridad Lahiji // Talks Atridad Lahiji // Talks
{{end}} {{end}}
{{define "head"}} {{define "head"}}
<link rel="stylesheet" href="/public/css/styles.talks.css" />
{{end}} {{end}}
{{define "main"}} {{define "main"}}
{{if .Talks}}
<section class="flex flex-row flex-wrap gap-2 justify-center align-middle"> <section class="flex flex-row flex-wrap gap-2 justify-center align-middle">
{{range .Talks}} {{range .Talks}}
{{template "cardlinks" .}} {{template "cardlinks" .}}
@ -18,5 +23,15 @@ Atridad Lahiji // Talks
</section> </section>
{{end}} {{end}}
{{if not .Talks}}
<section class="flex flex-row flex-wrap gap-2 justify-center align-middle">
<h2 class="text-2xl font-extrabold tracking-tight text-white sm:text-[2rem]">
Nothing to see here (yet)!
</h2>
</section>
{{end}}
{{end}}
{{define "foot"}} {{define "foot"}}
{{end}} {{end}}

View File

@ -1,32 +0,0 @@
{{define "title"}}
Atridad Lahiji // Testimonials
{{end}}
{{define "headercontent"}}
Atridad Lahiji // Testimonials
{{end}}
{{define "head"}}
<link rel="stylesheet" href="/public/css/styles.testimonials.css" />
{{end}}
{{define "main"}}
<h2 class="text-2xl font-extrabold tracking-tight text-white sm:text-[2rem]">
What <a class="link link-secondary"
href="https://steamcommunity.com/app/1230140/reviews/?browsefilter=toprated&snr=1_5_100010_" target="_blank"
rel="noreferrer">People</a> Say About Me
</h2>
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3">
{{range .Images}}
<div>
<img class="object-cover object-center w-full max-w-full rounded-lg" src={{.}} alt="Review of Atri"
loading="lazy" />
</div>
{{end}}
</div>
{{end}}
{{define "foot"}}
{{end}}

View File

@ -2,21 +2,36 @@
Atridad Lahiji // Tools Atridad Lahiji // Tools
{{end}} {{end}}
{{define "headercontent"}} {{define "description"}}
Tools I've Built
{{end}}
{{define "navcontent"}}
Atridad Lahiji // Tools Atridad Lahiji // Tools
{{end}} {{end}}
{{define "head"}} {{define "head"}}
<link rel="stylesheet" href="/public/css/styles.tools.css" />
{{end}} {{end}}
{{define "main"}} {{define "main"}}
{{if .Tools}}
<section class="flex flex-row flex-wrap gap-2 justify-center align-middle"> <section class="flex flex-row flex-wrap gap-2 justify-center align-middle">
{{range .Tools}} {{range .Tools}}
{{template "cardlinks" .}} {{template "cardlinks" .}}
{{end}} {{end}}
</section> </section>
{{end}} {{end}}
{{if not .Tools}}
<section class="flex flex-row flex-wrap gap-2 justify-center align-middle">
<h2 class="text-2xl font-extrabold tracking-tight text-white sm:text-[2rem]">
Nothing to see here (yet)!
</h2>
</section>
{{end}}
{{end}}
{{define "foot"}} {{define "foot"}}
{{end}} {{end}}

View File

@ -2,12 +2,15 @@
Atridad Lahiji // Tools // Resizer Atridad Lahiji // Tools // Resizer
{{end}} {{end}}
{{define "headercontent"}} {{define "description"}}
A tool to re-size images.
{{end}}
{{define "navcontent"}}
Atridad Lahiji // Tools // Resizer Atridad Lahiji // Tools // Resizer
{{end}} {{end}}
{{define "head"}} {{define "head"}}
<link rel="stylesheet" href="/public/css/styles.tools.resize.css" />
{{end}} {{end}}
{{define "main"}} {{define "main"}}
@ -28,4 +31,4 @@ Atridad Lahiji // Tools // Resizer
{{end}} {{end}}
{{define "foot"}} {{define "foot"}}
{{end}} {{end}}

View File

@ -1,20 +1,25 @@
{{define "title"}}Atridad Lahiji // Tools // SSE Demo{{end}} {{define "title"}}
{{define "headercontent"}}
Atridad Lahiji // Tools // SSE Demo Atridad Lahiji // Tools // SSE Demo
{{end}} {{end}}
{{define "navcontent"}}
Atridad Lahiji // Tools // SSE Demo
{{end}}
{{define "description"}}
A demo of my SSE implementation.
{{end}}
{{define "head"}} {{define "head"}}
<link rel="stylesheet" href="/public/css/styles.tools.ssedemo.css" />
{{end}} {{end}}
{{define "main"}} {{define "main"}}
<h2 class="text-2xl font-extrabold tracking-tight text-white sm:text-[2rem]">Server Sent Events Demo</h2> <h2 class="text-2xl font-extrabold tracking-tight text-white sm:text-[2rem]">Server Sent Events Demo</h2>
<p class="text-lg">This page demonstrates the use of the <a href="https://htmx.org/extensions/sse/">HTMX SSE <p class="text-lg">This page demonstrates the use of the <a href="https://htmx.org/extensions/sse/">HTMX SSE
Extention</a> to receive Server Sent Events on the "default" channel.</p> Extension</a> to receive Server Sent Events on the "default" channel.</p>
<p class="text-lg">Any events received on the "default" channel will appear below:</p> <p class="text-lg">Any events received on the "default" channel will appear below:</p>
<div hx-ext="sse" sse-connect="/api/sse" sse-swap="message"> <div id="sse-target" hx-ext="sse" sse-connect="/api/sse" sse-swap="message">
Waiting for SSE Message... Waiting for SSE Message...
</div> </div>
@ -31,6 +36,27 @@ Atridad Lahiji // Tools // SSE Demo
{{end}} {{end}}
{{define "foot"}} {{define "foot"}}
<script src="/public/js/htmx.base.js"></script>
<script src="/public/js/htmx.sse.js"></script> <script src="/public/js/htmx.sse.js"></script>
{{end}} <script>
// Custom EventSource factory with better retry handling
htmx.createEventSource = function(url) {
console.log("Creating EventSource for:", url);
// Create EventSource with credentials
const source = new EventSource(url, { withCredentials: true });
// Log connection state changes
source.onopen = function() {
console.log("SSE connection opened successfully");
document.getElementById('sse-target').innerHTML = "Connected to SSE. Waiting for messages...";
};
source.onerror = function(err) {
console.error("SSE connection error:", err);
document.getElementById('sse-target').innerHTML = "Connection error. Retrying...";
};
return source;
};
</script>
{{end}}

View File

@ -1,34 +0,0 @@
package pages
import (
"atri.dad/lib"
"github.com/labstack/echo/v4"
)
type TestimonialsProps struct {
Images []string
}
func Testimonials(c echo.Context) error {
images := []string{
"/public/img/testimonials/1.png",
"/public/img/testimonials/2.png",
"/public/img/testimonials/3.png",
"/public/img/testimonials/4.png",
"/public/img/testimonials/5.png",
"/public/img/testimonials/6.png",
"/public/img/testimonials/7.png",
"/public/img/testimonials/8.png",
"/public/img/testimonials/9.png",
}
props := TestimonialsProps{
Images: images,
}
// Specify the partials used by this page
partials := []string{"header", "navitems"}
// Render the template
return lib.RenderTemplate(c.Response().Writer, "base", partials, props)
}

View File

@ -21,7 +21,7 @@ func Resize(c echo.Context) error {
{ {
Name: "Hypermedia as the engine of application state - an Introduction", Name: "Hypermedia as the engine of application state - an Introduction",
Description: "A talk on building reactive websites using tools like HTMX instead of JSON + JS. Will be presented at the Dev Edmonton Fabruary 2024 JS/Ruby/Python Meetup", Description: "A talk on building reactive websites using tools like HTMX instead of JSON + JS. Will be presented at the Dev Edmonton Fabruary 2024 JS/Ruby/Python Meetup",
Href: lib.GeneratePublicURL("hypermedia_talk_atridad.pdf"), // Href: lib.GeneratePublicURL("hypermedia_talk_atridad.pdf"),
Tags: []string{"golang", "htmx", "ssr"}, Tags: []string{"golang", "htmx", "ssr"},
Date: "February 01, 2024", Date: "February 01, 2024",
}, },

7
public/css/daisyui.css vendored Normal file

File diff suppressed because one or more lines are too long

180
public/css/markdown.css vendored Normal file
View File

@ -0,0 +1,180 @@
/* Markdown styling */
.markdown {
color: #fff;
line-height: 1.6;
}
/* Headings */
.markdown h1,
.markdown h2,
.markdown h3,
.markdown h4,
.markdown h5,
.markdown h6 {
font-weight: 700;
margin-top: 1.5rem;
margin-bottom: 1rem;
color: #fff;
}
.markdown h1 {
font-size: 1.875rem;
line-height: 2.25rem;
}
.markdown h2 {
font-size: 1.5rem;
line-height: 2rem;
}
.markdown h3 {
font-size: 1.25rem;
line-height: 1.75rem;
}
.markdown h4 {
font-size: 1.125rem;
line-height: 1.75rem;
}
/* Paragraphs */
.markdown p {
margin-top: 1rem;
margin-bottom: 1rem;
}
/* Links */
.markdown a {
color: #60a5fa;
text-decoration: none;
}
.markdown a:hover {
text-decoration: underline;
}
/* Strong/Bold */
.markdown strong,
.markdown b {
font-weight: 700;
color: #fff;
}
/* Code blocks and inline code */
.markdown code {
background-color: rgba(55, 65, 81, 0.5);
border-radius: 0.25rem;
padding: 0.125rem 0.25rem;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: 0.875rem;
}
.markdown pre {
background-color: rgba(55, 65, 81, 0.5);
border-radius: 0.375rem;
padding: 1rem;
margin: 1rem 0;
overflow-x: auto;
}
.markdown pre code {
background-color: transparent;
padding: 0;
font-size: 0.875rem;
color: #f1f5f9;
display: block;
}
/* Lists */
.markdown ul {
list-style-type: disc;
padding-left: 1.5rem;
margin: 1rem 0;
}
.markdown ol {
list-style-type: decimal;
padding-left: 1.5rem;
margin: 1rem 0;
}
.markdown li {
margin: 0.25rem 0;
}
.markdown li > ul,
.markdown li > ol {
margin: 0;
}
/* Blockquotes */
.markdown blockquote {
border-left: 4px solid #60a5fa;
padding-left: 1rem;
margin: 1rem 0;
font-style: italic;
color: #d1d5db;
}
/* Images */
.markdown img {
max-width: 100%;
height: auto;
margin: 1rem auto;
border-radius: 0.375rem;
display: block;
}
/* Horizontal rule */
.markdown hr {
border: 0;
border-top: 1px solid #fff;
margin: 1.5rem 0;
}
/* Tables */
.markdown table {
width: 100%;
border-collapse: collapse;
margin: 1rem 0;
}
.markdown th {
background-color: rgba(55, 65, 81, 0.5);
padding: 0.5rem;
border: 1px solid #4b5563;
text-align: left;
}
.markdown td {
padding: 0.5rem;
border: 1px solid #4b5563;
}
.markdown tr:nth-child(even) {
background-color: rgba(55, 65, 81, 0.3);
}
/* Adjustments for code with line numbers */
.markdown .chroma {
background-color: rgba(55, 65, 81, 0.5);
border-radius: 0.375rem;
}
.markdown .lntable {
width: 100%;
border: none;
}
.markdown .lntd {
padding: 0;
border: none;
}
.markdown .lntd:first-child {
width: 10px;
text-align: right;
padding-right: 10px;
color: #6b7280;
user-select: none;
}

File diff suppressed because one or more lines are too long

2
public/css/styles.css vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1
public/css/themes.css vendored Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More