Compare commits
11 Commits
6bfb7baa15
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
791c4cc908 | ||
|
|
49854a661d | ||
|
|
3827176093 | ||
|
|
d07eddc502 | ||
|
|
e822a74c60 | ||
|
|
57bbf9f091 | ||
|
|
85eac55045 | ||
|
|
55c43df2a7 | ||
|
|
f9a3f48858 | ||
|
|
947634a27e | ||
|
|
98c3d92c7e |
@@ -1,3 +0,0 @@
|
||||
node_modules
|
||||
.nuxt
|
||||
.output
|
||||
29
.gitea/workflows/docker-build.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
name: Build and Push Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Gitea Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.pihkaal.xyz
|
||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
run: |
|
||||
docker build -t git.pihkaal.xyz/pihkaal/lilou-cat:latest .
|
||||
docker push git.pihkaal.xyz/pihkaal/lilou-cat:latest
|
||||
28
.github/workflows/docker-build.yml
vendored
@@ -1,28 +0,0 @@
|
||||
name: Build and Push Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Log in to DockerHub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
run: |
|
||||
docker build -t pihkaal/lilou-cat:latest .
|
||||
docker push pihkaal/lilou-cat:latest
|
||||
28
.gitignore
vendored
@@ -1,27 +1 @@
|
||||
# Nuxt dev/build outputs
|
||||
.output
|
||||
.data
|
||||
.nuxt
|
||||
.nitro
|
||||
.cache
|
||||
dist
|
||||
|
||||
# Node dependencies
|
||||
node_modules
|
||||
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
|
||||
# Misc
|
||||
.DS_Store
|
||||
.fleet
|
||||
.idea
|
||||
|
||||
# Local env files
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
|
||||
# ESLint
|
||||
.eslintcache
|
||||
lilou
|
||||
|
||||
24
Dockerfile
@@ -1,23 +1,13 @@
|
||||
FROM node:20-slim AS base
|
||||
FROM golang:1.23.2
|
||||
|
||||
ENV PNPM_HOME="/pnpm"
|
||||
ENV PATH="$PNPM_HOME:$PATH"
|
||||
|
||||
RUN corepack enable
|
||||
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
|
||||
FROM base AS prod-deps
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
|
||||
COPY go.mod ./
|
||||
RUN go mod download
|
||||
|
||||
FROM base AS build
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
||||
RUN pnpm run build
|
||||
|
||||
FROM base
|
||||
|
||||
COPY --from=build /app/.output /app/.output
|
||||
COPY *.go ./
|
||||
COPY public ./public
|
||||
RUN go build -o ./server
|
||||
|
||||
EXPOSE 3000
|
||||
CMD ["node", ".output/server/index.mjs"]
|
||||
CMD ["./server"]
|
||||
|
||||
14
app.vue
@@ -1,14 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
useSeoMeta({
|
||||
title: "Lilou Chat",
|
||||
description: "Just ✨ Lilou ✨",
|
||||
themeColor: "#fa86c4",
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="h-screen">
|
||||
<AppBody />
|
||||
<StarshineGlitter />
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,26 +0,0 @@
|
||||
<template>
|
||||
<main
|
||||
class="h-full items-center relative p-5 justify-center flex flex-col space-y-4 bg-[#fa86c4] z-10"
|
||||
>
|
||||
<NuxtRouteAnnouncer />
|
||||
<h1
|
||||
class="text-4xl md:text-5xl lg:text-6xl font-serif text-white dark:text-white"
|
||||
>
|
||||
✨ Lilou ✨
|
||||
</h1>
|
||||
<img
|
||||
class="w-full max-w-[50vh] rotate-90"
|
||||
src="https://lilou.cat/api"
|
||||
alt="Lilou"
|
||||
/>
|
||||
<h1
|
||||
class="text-4xl md:text-5xl lg:text-6xl font-serif text-white dark:text-white"
|
||||
>
|
||||
✨ Lilou ✨
|
||||
</h1>
|
||||
|
||||
<div class="absolute inset-0">
|
||||
<StarshineGlitter />
|
||||
</div>
|
||||
</main>
|
||||
</template>
|
||||
@@ -1,6 +1,7 @@
|
||||
services:
|
||||
lilou-cat:
|
||||
image: pihkaal/lilou-cat:latest
|
||||
server:
|
||||
container_name: lilou-cat
|
||||
image: git.pihkaal.xyz/pihkaal/lilou-cat:latest
|
||||
networks:
|
||||
- web
|
||||
labels:
|
||||
@@ -10,6 +11,7 @@ services:
|
||||
- "traefik.http.services.lilou-cat.loadbalancer.server.port=3000"
|
||||
- "traefik.http.routers.lilou-cat.tls=true"
|
||||
- "traefik.http.routers.lilou-cat.tls.certResolver=myresolver"
|
||||
restart: always
|
||||
|
||||
networks:
|
||||
web:
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
// @ts-check
|
||||
import withNuxt from "./.nuxt/eslint.config.mjs";
|
||||
|
||||
export default withNuxt();
|
||||
77
main.go
Normal file
@@ -0,0 +1,77 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
//go:embed public/index.html
|
||||
var indexSrc string
|
||||
|
||||
const PORT = 3000
|
||||
const IMAGES_DIR = "images"
|
||||
|
||||
var cachedImages []string
|
||||
|
||||
func loadImages() error {
|
||||
imagesDir := fmt.Sprintf("public/%s", IMAGES_DIR)
|
||||
|
||||
entries, err := os.ReadDir(imagesDir)
|
||||
if err != nil {
|
||||
return fmt.Errorf("ERROR: Failed to read public/%s directory: %w", IMAGES_DIR, err)
|
||||
}
|
||||
|
||||
cachedImages = []string{}
|
||||
|
||||
for _, entry := range entries {
|
||||
if !entry.IsDir() && strings.HasSuffix(entry.Name(), ".webp") {
|
||||
cachedImages = append(cachedImages, entry.Name())
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Printf("OK: Loaded %d images\n", len(cachedImages))
|
||||
return nil
|
||||
}
|
||||
|
||||
func getPage(w http.ResponseWriter, r *http.Request) {
|
||||
imageName := cachedImages[rand.Intn(len(cachedImages))]
|
||||
imageURL := fmt.Sprintf("/%s/%s", IMAGES_DIR, imageName)
|
||||
src := strings.Replace(indexSrc, "{{ IMAGE_URL }}", imageURL, 1)
|
||||
|
||||
io.WriteString(w, src)
|
||||
}
|
||||
|
||||
func getFavicon(w http.ResponseWriter, r *http.Request) {
|
||||
http.ServeFile(w, r, "public/favicon.ico")
|
||||
}
|
||||
|
||||
func main() {
|
||||
if err := loadImages(); err != nil {
|
||||
fmt.Printf("ERROR: Error loading images: %s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if len(cachedImages) == 0 {
|
||||
fmt.Printf("ERROR: no images found in public/%s\n", IMAGES_DIR)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
http.HandleFunc("/", getPage)
|
||||
http.HandleFunc("/favicon.ico", getFavicon)
|
||||
http.Handle(fmt.Sprintf("/%s/", IMAGES_DIR), http.StripPrefix(fmt.Sprintf("/%s/", IMAGES_DIR), http.FileServer(http.Dir(fmt.Sprintf("public/%s", IMAGES_DIR)))))
|
||||
|
||||
fmt.Printf("OK: Listening on port %d\n", PORT)
|
||||
err := http.ListenAndServe(fmt.Sprintf(":%d", PORT), nil)
|
||||
if errors.Is(err, http.ErrServerClosed) {
|
||||
fmt.Printf("OK: Server closed\n")
|
||||
} else if err != nil {
|
||||
fmt.Printf("ERROR: error starting server: %s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,8 @@ IMG_SZ=1024
|
||||
|
||||
for file in public/lilou/*.jpg; do
|
||||
hash=$(md5sum "$file" | awk '{print $1}')
|
||||
cwebp "$file" -resize $IMG_SZ $IMG_SZ -o "./public/lilou/${hash}.webp"
|
||||
out="./public/lilou/${hash}.webp"
|
||||
cwebp "$file" -resize $IMG_SZ $IMG_SZ -o "$out"
|
||||
magick "$out" -rotate 90 "$out"
|
||||
rm "$file"
|
||||
done
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
// https://nuxt.com/docs/api/configuration/nuxt-config
|
||||
export default defineNuxtConfig({
|
||||
compatibilityDate: "2024-04-03",
|
||||
devtools: { enabled: true },
|
||||
modules: ["@nuxt/eslint", "@nuxtjs/tailwindcss"],
|
||||
});
|
||||
25
package.json
@@ -1,25 +0,0 @@
|
||||
{
|
||||
"name": "nuxt-app",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "nuxt build",
|
||||
"dev": "nuxt dev",
|
||||
"generate": "nuxt generate",
|
||||
"preview": "nuxt preview",
|
||||
"postinstall": "nuxt prepare",
|
||||
"lint": "eslint . --cache --fix",
|
||||
"format": "pnpx prettier --cache --write ."
|
||||
},
|
||||
"dependencies": {
|
||||
"@nuxt/eslint": "^0.6.0",
|
||||
"@nuxtjs/tailwindcss": "^6.12.2",
|
||||
"nuxt": "^3.13.0",
|
||||
"vue": "latest",
|
||||
"vue-router": "latest"
|
||||
},
|
||||
"packageManager": "pnpm@9.11.0",
|
||||
"devDependencies": {
|
||||
"typescript": "5.5.4"
|
||||
}
|
||||
}
|
||||
11550
pnpm-lock.yaml
generated
|
Before Width: | Height: | Size: 221 KiB After Width: | Height: | Size: 221 KiB |
BIN
public/images/002e29d556302d5858384de23e17ba38.webp
Normal file
|
After Width: | Height: | Size: 71 KiB |
BIN
public/images/044edf7f26a23767a8675901fb8b3046.webp
Normal file
|
After Width: | Height: | Size: 87 KiB |
BIN
public/images/07e311ec1ec115a529a14ce41ae1c10b.webp
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
public/images/0821756bc4bae4cb9919a01aabfd0be2.webp
Normal file
|
After Width: | Height: | Size: 166 KiB |
BIN
public/images/09430d5ffbeef4534bc8c8842fb8adcf.webp
Normal file
|
After Width: | Height: | Size: 95 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
BIN
public/images/0e9ab8ea0e973f31c38352f61e130e89.webp
Normal file
|
After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
BIN
public/images/1792014678d5827950badf3fccbf7120.webp
Normal file
|
After Width: | Height: | Size: 99 KiB |
BIN
public/images/1b798a781625c1d459760dee450c80b5.webp
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
public/images/20bbfa996a79559b50f3529ffba77500.webp
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
public/images/24ffd4b4d2f9bf84e68b2bee5853b582.webp
Normal file
|
After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
BIN
public/images/2cbad5faf546b6db148200a38b7b0fda.webp
Normal file
|
After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
BIN
public/images/3046890b4423306d9daf9159983eb993.webp
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
public/images/328ad7a9ea335cd6cd16bdd9a591a82d.webp
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
public/images/33ac9b0d3e136bb51838df766b9b2604.webp
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
public/images/36baa3a948bd6d6940910a3921915da1.webp
Normal file
|
After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
BIN
public/images/3b8aed92be5f56e5d248b4debe00ec57.webp
Normal file
|
After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
BIN
public/images/4542d90ee99d9067c48527e2434eedfb.webp
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
public/images/467a545b9695232e33816de609b1ab66.webp
Normal file
|
After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
BIN
public/images/485535a2423942c7a650d21442edea0a.webp
Normal file
|
After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
BIN
public/images/4b67419a282f04e49e66ef5cd575272d.webp
Normal file
|
After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
BIN
public/images/4df93962dfc4d27932a0c0d7d6168da9.webp
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
public/images/55557db4fee8cea0770c0a60f80266f3.webp
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
public/images/5bff76ba10b1a87882be33595434f164.webp
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
public/images/64ac3ed82df29cc7cd6045501afc42b4.webp
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
public/images/667a0f811a1457cc1e94ec0638ab81f9.webp
Normal file
|
After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
BIN
public/images/702bbcf8b9357dc5fe83506d09f77662.webp
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
public/images/70b8055685df3cecf8267c1edc8c2f9a.webp
Normal file
|
After Width: | Height: | Size: 185 KiB |
BIN
public/images/725a3eab0c243eee5811f1f06f4dd355.webp
Normal file
|
After Width: | Height: | Size: 25 KiB |
BIN
public/images/72ba6830f131d95f3325246b299f7976.webp
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
public/images/8216920a69350fbbd7083dbdd39d8099.webp
Normal file
|
After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
BIN
public/images/9059598a62c79773fd4dc10249ff2b16.webp
Normal file
|
After Width: | Height: | Size: 62 KiB |
BIN
public/images/97a803c121e9462720d6ef9815af7318.webp
Normal file
|
After Width: | Height: | Size: 25 KiB |
BIN
public/images/97c4be30d60e73d6f4b8e7c2f308e27a.webp
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
public/images/9cf7428258c3cb7b36aa456b674e6cb8.webp
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
public/images/a2f560c300bcfe7dc6685dab8ae82c93.webp
Normal file
|
After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
BIN
public/images/a3ab23d5b4b0733a74f7bccb35ea84fb.webp
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
public/images/a454a38388adeb64c0f200e80a3f8d36.webp
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
public/images/a5022aaf712d0a507dddc7a205786b6d.webp
Normal file
|
After Width: | Height: | Size: 25 KiB |
BIN
public/images/a6e4b08a66d604d4aa8c3ef9b50d80df.webp
Normal file
|
After Width: | Height: | Size: 9.5 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
BIN
public/images/aba00ab171781a211e8edc4fb6649679.webp
Normal file
|
After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
BIN
public/images/b5be61f4c83c35934c0387c580c23c6b.webp
Normal file
|
After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
BIN
public/images/bfa2a5735244b17b5542ef676f267e9a.webp
Normal file
|
After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
BIN
public/images/c8678ed7a73d50fcdc1aa2a3111ad213.webp
Normal file
|
After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
BIN
public/images/d07d978160cb445487d58f534a3660b3.webp
Normal file
|
After Width: | Height: | Size: 60 KiB |
BIN
public/images/d0816a70521e03089c9407951562be16.webp
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
public/images/d3bee103cb0b354255be488bae06200b.webp
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
public/images/d4a0d4e2c4c18a2984a2a3d691c3fe37.webp
Normal file
|
After Width: | Height: | Size: 114 KiB |
BIN
public/images/e3debbf1724b1f2eaaec0f6d3b0abea7.webp
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
public/images/e91a49aaf434208f8bf211da933d7b07.webp
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
public/images/f3fad4b78ee3ab3749aa32fea8dcaa6c.webp
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
public/images/f7818fcb320072eb1d54f439810b3814.webp
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
public/images/f7abfd952b526d501175d636b551d138.webp
Normal file
|
After Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
BIN
public/images/fc65e6bf4ee17b4f096d1cff6f5bc835.webp
Normal file
|
After Width: | Height: | Size: 26 KiB |
155
public/index.html
Normal file
@@ -1 +0,0 @@
|
||||
|
||||